summaryrefslogtreecommitdiffstats
path: root/src/plugins/crypto_openssl
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2019-04-11 09:55:56 +0000
committerNeale Ranns <nranns@cisco.com>2019-04-16 23:28:04 +0000
commit07a4d675c8d1b1bc19fa1846369f610ab91a9aba (patch)
tree40d27d684083ff527fd0232acf49cedfd9c3501b /src/plugins/crypto_openssl
parent141dea23f416568d7c57651cc26306628bd6e34f (diff)
crypto: add more AES-GCM test cases
Change-Id: Ibb3e2f3ba5f31482fc2f0dce53d68f8476608f4b Signed-off-by: Filip Tehlar <ftehlar@cisco.com> (cherry picked from commit 11a73973c98a5a10b78f7200e5681859354bb29a)
Diffstat (limited to 'src/plugins/crypto_openssl')
-rw-r--r--src/plugins/crypto_openssl/main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/crypto_openssl/main.c b/src/plugins/crypto_openssl/main.c
index 9611d127c26..0c8c17dc423 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, 8, 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);