diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2019-09-11 17:52:30 +1000 |
---|---|---|
committer | Shane Lontis <shane.lontis@oracle.com> | 2019-09-11 17:52:30 +1000 |
commit | dc64dc2edd215d6cc5843c1bfe1f0b64bff26adc (patch) | |
tree | 2e2fb32d97e77ddc2cac66d0577dba3ddd73fa1c /test | |
parent | 64115f05ac950390e80e3993703513cda439fca0 (diff) |
Add EVP_CIPHER_CTX_tag_length()
There is no deprecated CTRL support for this new field.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9698)
Diffstat (limited to 'test')
-rw-r--r-- | test/aesgcmtest.c | 2 | ||||
-rw-r--r-- | test/evp_extra_test.c | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/test/aesgcmtest.c b/test/aesgcmtest.c index a13e9b856c..4a255d502c 100644 --- a/test/aesgcmtest.c +++ b/test/aesgcmtest.c @@ -54,6 +54,7 @@ static int do_encrypt(unsigned char *iv_gen, unsigned char *ct, int *ct_len, && TEST_true(EVP_EncryptUpdate(ctx, ct, ct_len, gcm_pt, sizeof(gcm_pt)) > 0) && TEST_true(EVP_EncryptFinal_ex(ctx, outbuf, &outlen) > 0) + && TEST_int_eq(EVP_CIPHER_CTX_tag_length(ctx), 16) && TEST_true(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, 16, tag) > 0) && TEST_true(iv_gen == NULL @@ -75,6 +76,7 @@ static int do_decrypt(const unsigned char *iv, const unsigned char *ct, && TEST_true(EVP_DecryptInit_ex(ctx, EVP_aes_256_gcm(), NULL, NULL, NULL) > 0) && TEST_true(EVP_DecryptInit_ex(ctx, NULL, NULL, gcm_key, iv) > 0) + && TEST_int_eq(EVP_CIPHER_CTX_tag_length(ctx), 16) && TEST_true(EVP_DecryptUpdate(ctx, NULL, &outlen, gcm_aad, sizeof(gcm_aad)) > 0) && TEST_true(EVP_DecryptUpdate(ctx, pt, &ptlen, ct, diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c index 7b7c632dd1..631ad65540 100644 --- a/test/evp_extra_test.c +++ b/test/evp_extra_test.c @@ -1241,10 +1241,13 @@ static int encrypt_decrypt(const EVP_CIPHER *cipher, const unsigned char *msg, memset(key, 0, sizeof(key)); if (!TEST_ptr(ctx = EVP_CIPHER_CTX_new()) + || !TEST_int_eq(EVP_CIPHER_CTX_tag_length(ctx), 0) || !TEST_true(EVP_CipherInit_ex(ctx, cipher, NULL, key, NULL, 1)) + || !TEST_int_eq(EVP_CIPHER_CTX_tag_length(ctx), 0) || !TEST_true(EVP_CipherUpdate(ctx, ct, &ctlen, msg, len)) || !TEST_true(EVP_CipherFinal_ex(ctx, ct, &ctlen)) || !TEST_true(EVP_CipherInit_ex(ctx, cipher, NULL, key, NULL, 0)) + || !TEST_int_eq(EVP_CIPHER_CTX_tag_length(ctx), 0) || !TEST_true(EVP_CipherUpdate(ctx, pt, &ptlen, ct, ctlen)) || !TEST_true(EVP_CipherFinal_ex(ctx, pt, &ptlen)) || !TEST_mem_eq(pt, ptlen, msg, len)) |