Merge pull request #1182 from tom-daubney-arm/backport_key_agreement_buffer_protection

[Backport] Implement safe buffer copying in key agreement