diff options
author | Matt Caswell <matt@openssl.org> | 2015-01-27 15:00:50 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2015-01-28 11:38:38 +0100 |
commit | d57d135c33938dfdac441c98b2c40183a8cb66b0 (patch) | |
tree | c67c5400cf24eaa05c8526147e89e8a7201b6b2f | |
parent | Dead code removal: Fortezza identifiers (diff) | |
download | openssl-d57d135c33938dfdac441c98b2c40183a8cb66b0.tar.xz openssl-d57d135c33938dfdac441c98b2c40183a8cb66b0.zip |
Replace EVP_CTRL_OCB_SET_TAGLEN with EVP_CTRL_SET_TAG for consistency with
CCM
Reviewed-by: Tim Hudson <tjh@openssl.org>
-rw-r--r-- | crypto/evp/e_aes.c | 16 | ||||
-rw-r--r-- | crypto/evp/evp.h | 1 | ||||
-rw-r--r-- | crypto/evp/evp_test.c | 6 |
3 files changed, 10 insertions, 13 deletions
diff --git a/crypto/evp/e_aes.c b/crypto/evp/e_aes.c index 8b31388690..435d9ea772 100644 --- a/crypto/evp/e_aes.c +++ b/crypto/evp/e_aes.c @@ -2225,15 +2225,15 @@ static int aes_ocb_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) octx->ivlen = arg; return 1; - case EVP_CTRL_OCB_SET_TAGLEN: - /* Tag len must be 0 to 16 */ - if (arg < 0 || arg > 16) - return 0; - - octx->taglen = arg; - return 1; - case EVP_CTRL_SET_TAG: + if (!ptr) { + /* Tag len must be 0 to 16 */ + if (arg < 0 || arg > 16) + return 0; + + octx->taglen = arg; + return 1; + } if (arg != octx->taglen || c->encrypt) return 0; memcpy(octx->tag, ptr, arg); diff --git a/crypto/evp/evp.h b/crypto/evp/evp.h index 74f6217884..3101905c75 100644 --- a/crypto/evp/evp.h +++ b/crypto/evp/evp.h @@ -433,7 +433,6 @@ typedef struct { # define EVP_CTRL_SET_IVLEN EVP_CTRL_GCM_SET_IVLEN # define EVP_CTRL_GET_TAG EVP_CTRL_GCM_GET_TAG # define EVP_CTRL_SET_TAG EVP_CTRL_GCM_SET_TAG -# define EVP_CTRL_OCB_SET_TAGLEN 0x1c /* GCM TLS constants */ /* Length of fixed part of IV derived from PRF */ diff --git a/crypto/evp/evp_test.c b/crypto/evp/evp_test.c index dde9e16903..5784874baa 100644 --- a/crypto/evp/evp_test.c +++ b/crypto/evp/evp_test.c @@ -185,8 +185,7 @@ static void test1(const EVP_CIPHER *c, const unsigned char *key, int kn, test1_exit(11); } if ((mode == EVP_CIPH_OCB_MODE) && - !EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_OCB_SET_TAGLEN, tn, NULL)) - { + !EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_TAG, tn, NULL)) { fprintf(stderr, "Tag length set failed\n"); ERR_print_errors_fp(stderr); test1_exit(15); @@ -301,8 +300,7 @@ static void test1(const EVP_CIPHER *c, const unsigned char *key, int kn, test1_exit(11); } if ((mode == EVP_CIPH_OCB_MODE) && - !EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_OCB_SET_TAGLEN, tn, NULL)) - { + !EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_TAG, tn, NULL)) { fprintf(stderr, "Tag length set failed\n"); ERR_print_errors_fp(stderr); test1_exit(15); |