awslabs / aws-crt-cpp

C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++.
Apache License 2.0
73 stars 64 forks source link

fix order of arguments when calling aws_aes_gcm_256_new #618

Closed sbiscigl closed 3 months ago

sbiscigl commented 3 months ago

Description of changes:

A recent change added symmetric ciphers to the crt.

it added the call

aws_aes_gcm_256_new(
  allocator,
  key.has_value() ? &key.value() : nullptr,
  iv.has_value() ? &iv.value() : nullptr,
  tag.has_value() ? &tag.value() : nullptr,
  aad.has_value() ? &aad.value() : nullptr)

whereas in c-cal it is actually defined as

AWS_CAL_API struct aws_symmetric_cipher *aws_aes_gcm_256_new(
    struct aws_allocator *allocator,
    const struct aws_byte_cursor *key,
    const struct aws_byte_cursor *iv,
    const struct aws_byte_cursor *aad,
    const struct aws_byte_cursor *decryption_tag);

so we are passing the wrong values to aad and tag, they are swapped around, this fixes the order.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.