Skip to content

AEAD: EVP_CIPHER_CTX_iv_length is oblivious to EVP_CTRL_AEAD_SET_IVLEN #8330

@jorangreef

Description

@jorangreef

For AEAD ciphers, EVP_CIPHER_CTX_iv_length() does not return the ctx's actual IV length, but the cipher's default IV length:

For example, changing a GCM cipher's IV length from 12 to 4 fails the assertion:

int iv_size = 4;
EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, iv_size, NULL)
assert(EVP_CIPHER_CTX_iv_length(ctx) == iv_size);

Is this a bug? Or should the documentation make this clear?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions