Commit ecd1557f authored by Boris Pismenny's avatar Boris Pismenny Committed by Matt Caswell
Browse files

evp/e_aes: Expose IV



This commit exposes the cipher's IV to applications.

Signed-off-by: default avatarBoris Pismenny <borisp@mellanox.com>

Reviewed-by: default avatarTim Hudson <tjh@openssl.org>
Reviewed-by: default avatarPaul Yang <yang.yang@baishancloud.com>
Reviewed-by: default avatarMatt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5253)
parent 6ba76c4f
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -2866,6 +2866,14 @@ static int aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
        memcpy(ptr, c->buf, arg);
        return 1;

    case EVP_CTRL_GET_IV:
        if (gctx->iv_gen != 1)
            return 0;
        if (gctx->ivlen != arg)
            return 0;
        memcpy(ptr, gctx->iv, arg);
        return 1;

    case EVP_CTRL_GCM_SET_IV_FIXED:
        /* Special case: -1 length restores whole IV */
        if (arg == -1) {
+2 −0
Original line number Diff line number Diff line
@@ -350,6 +350,8 @@ int (*EVP_CIPHER_meth_get_ctrl(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *,
# define         EVP_CTRL_SET_PIPELINE_INPUT_BUFS        0x23
/* Set the input buffer lengths to use for a pipelined operation */
# define         EVP_CTRL_SET_PIPELINE_INPUT_LENS        0x24
/* Get the IV used by the cipher */
# define         EVP_CTRL_GET_IV                         0x25

/* Padding modes */
#define EVP_PADDING_PKCS7       1