From 11a73973c98a5a10b78f7200e5681859354bb29a Mon Sep 17 00:00:00 2001 From: Filip Tehlar Date: Thu, 11 Apr 2019 09:55:56 +0000 Subject: crypto: add more AES-GCM test cases Change-Id: Ibb3e2f3ba5f31482fc2f0dce53d68f8476608f4b Signed-off-by: Filip Tehlar --- src/plugins/crypto_openssl/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/plugins/crypto_openssl') diff --git a/src/plugins/crypto_openssl/main.c b/src/plugins/crypto_openssl/main.c index 9a78cb46dd9..13981e929c7 100644 --- a/src/plugins/crypto_openssl/main.c +++ b/src/plugins/crypto_openssl/main.c @@ -120,7 +120,8 @@ openssl_ops_enc_gcm (vlib_main_t * vm, vnet_crypto_op_t * ops[], u32 n_ops, EVP_EncryptInit_ex (ctx, cipher, 0, 0, 0); EVP_CIPHER_CTX_ctrl (ctx, EVP_CTRL_GCM_SET_IVLEN, op->iv_len, NULL); EVP_EncryptInit_ex (ctx, 0, 0, op->key, op->iv); - EVP_EncryptUpdate (ctx, NULL, &len, op->aad, op->aad_len); + if (op->aad_len) + EVP_EncryptUpdate (ctx, NULL, &len, op->aad, op->aad_len); EVP_EncryptUpdate (ctx, op->dst, &len, op->src, op->len); EVP_EncryptFinal_ex (ctx, op->dst + len, &len); EVP_CIPHER_CTX_ctrl (ctx, EVP_CTRL_GCM_GET_TAG, op->tag_len, op->tag); @@ -145,7 +146,8 @@ openssl_ops_dec_gcm (vlib_main_t * vm, vnet_crypto_op_t * ops[], u32 n_ops, EVP_DecryptInit_ex (ctx, cipher, 0, 0, 0); EVP_CIPHER_CTX_ctrl (ctx, EVP_CTRL_GCM_SET_IVLEN, op->iv_len, 0); EVP_DecryptInit_ex (ctx, 0, 0, op->key, op->iv); - EVP_DecryptUpdate (ctx, 0, &len, op->aad, op->aad_len); + if (op->aad_len) + EVP_DecryptUpdate (ctx, 0, &len, op->aad, op->aad_len); EVP_DecryptUpdate (ctx, op->dst, &len, op->src, op->len); EVP_CIPHER_CTX_ctrl (ctx, EVP_CTRL_GCM_SET_TAG, op->tag_len, op->tag); -- cgit 1.2.3-korg