diff options
author | Theo Buehler <theorbuehler@gmail.com> | 2024-03-16 16:49:53 +1000 |
---|---|---|
committer | Boringssl LUCI CQ <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-03-16 22:48:54 +0000 |
commit | f57a11ae566ac17c1b028d79950227a33ae32fad (patch) | |
tree | b382db5a2d9293cee730036f85fe46c4f6ad429d | |
parent | fae0964b3d44e94ca2a2d21f86e61dabe683d130 (diff) | |
download | boringssl-f57a11ae566ac17c1b028d79950227a33ae32fad.zip boringssl-f57a11ae566ac17c1b028d79950227a33ae32fad.tar.gz boringssl-f57a11ae566ac17c1b028d79950227a33ae32fad.tar.bz2 |
Remove unused app_data from EVP_CIPHER
This field makes no sense for static const structures. It was added
early on but never used as far as I can tell.
Change-Id: Ie0272c5f498ad777cb3b114589248d8b403ae457
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/67047
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
-rw-r--r-- | crypto/cipher_extra/e_des.c | 6 | ||||
-rw-r--r-- | crypto/cipher_extra/e_null.c | 6 | ||||
-rw-r--r-- | crypto/cipher_extra/e_rc2.c | 2 | ||||
-rw-r--r-- | crypto/cipher_extra/e_rc4.c | 9 | ||||
-rw-r--r-- | crypto/fipsmodule/cipher/internal.h | 3 | ||||
-rw-r--r-- | decrepit/blowfish/blowfish.c | 33 | ||||
-rw-r--r-- | decrepit/cast/cast.c | 22 | ||||
-rw-r--r-- | decrepit/cfb/cfb.c | 24 | ||||
-rw-r--r-- | decrepit/xts/xts.c | 13 |
9 files changed, 54 insertions, 64 deletions
diff --git a/crypto/cipher_extra/e_des.c b/crypto/cipher_extra/e_des.c index a4a876e..baf0be0 100644 --- a/crypto/cipher_extra/e_des.c +++ b/crypto/cipher_extra/e_des.c @@ -91,7 +91,6 @@ static const EVP_CIPHER evp_des_cbc = { /* iv_len = */ 8, /* ctx_size = */ sizeof(EVP_DES_KEY), /* flags = */ EVP_CIPH_CBC_MODE, - /* app_data = */ NULL, /* init = */ des_init_key, /* cipher = */ des_cbc_cipher, /* cleanup = */ NULL, @@ -121,7 +120,6 @@ static const EVP_CIPHER evp_des_ecb = { /* iv_len = */ 0, /* ctx_size = */ sizeof(EVP_DES_KEY), /* flags = */ EVP_CIPH_ECB_MODE, - /* app_data = */ NULL, /* init = */ des_init_key, /* cipher = */ des_ecb_cipher, /* cleanup = */ NULL, @@ -161,7 +159,6 @@ static const EVP_CIPHER evp_des_ede3_cbc = { /* iv_len = */ 8, /* ctx_size = */ sizeof(DES_EDE_KEY), /* flags = */ EVP_CIPH_CBC_MODE, - /* app_data = */ NULL, /* init = */ des_ede3_init_key, /* cipher = */ des_ede3_cbc_cipher, /* cleanup = */ NULL, @@ -187,7 +184,6 @@ static const EVP_CIPHER evp_des_ede_cbc = { /* iv_len = */ 8, /* ctx_size = */ sizeof(DES_EDE_KEY), /* flags = */ EVP_CIPH_CBC_MODE, - /* app_data = */ NULL, /* init = */ des_ede_init_key, /* cipher = */ des_ede3_cbc_cipher, /* cleanup = */ NULL, @@ -218,7 +214,6 @@ static const EVP_CIPHER evp_des_ede = { /* iv_len = */ 0, /* ctx_size = */ sizeof(DES_EDE_KEY), /* flags = */ EVP_CIPH_ECB_MODE, - /* app_data = */ NULL, /* init = */ des_ede_init_key, /* cipher = */ des_ede_ecb_cipher, /* cleanup = */ NULL, @@ -234,7 +229,6 @@ static const EVP_CIPHER evp_des_ede3 = { /* iv_len = */ 0, /* ctx_size = */ sizeof(DES_EDE_KEY), /* flags = */ EVP_CIPH_ECB_MODE, - /* app_data = */ NULL, /* init = */ des_ede3_init_key, /* cipher = */ des_ede_ecb_cipher, /* cleanup = */ NULL, diff --git a/crypto/cipher_extra/e_null.c b/crypto/cipher_extra/e_null.c index e9ee8ad..10a5c26 100644 --- a/crypto/cipher_extra/e_null.c +++ b/crypto/cipher_extra/e_null.c @@ -78,9 +78,9 @@ static int null_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out, } static const EVP_CIPHER n_cipher = { - NID_undef, 1 /* block size */, 0 /* key_len */, 0 /* iv_len */, - 0 /* ctx_size */, 0 /* flags */, NULL /* app_data */, null_init_key, - null_cipher, NULL /* cleanup */, NULL /* ctrl */, + NID_undef, 1 /* block size */, 0 /* key_len */, 0 /* iv_len */, + 0 /* ctx_size */, 0 /* flags */, null_init_key, null_cipher, + NULL /* cleanup */, NULL /* ctrl */, }; const EVP_CIPHER *EVP_enc_null(void) { return &n_cipher; } diff --git a/crypto/cipher_extra/e_rc2.c b/crypto/cipher_extra/e_rc2.c index ffc5e6b..acc99ad 100644 --- a/crypto/cipher_extra/e_rc2.c +++ b/crypto/cipher_extra/e_rc2.c @@ -433,7 +433,6 @@ static const EVP_CIPHER rc2_40_cbc = { 8 /* iv len */, sizeof(EVP_RC2_KEY), EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT, - NULL /* app_data */, rc2_init_key, rc2_cbc_cipher, NULL, @@ -451,7 +450,6 @@ static const EVP_CIPHER rc2_cbc = { 8 /* iv len */, sizeof(EVP_RC2_KEY), EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT, - NULL /* app_data */, rc2_init_key, rc2_cbc_cipher, NULL, diff --git a/crypto/cipher_extra/e_rc4.c b/crypto/cipher_extra/e_rc4.c index 2f4f9bb..e252ad8 100644 --- a/crypto/cipher_extra/e_rc4.c +++ b/crypto/cipher_extra/e_rc4.c @@ -81,9 +81,10 @@ static int rc4_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out, const uint8_t *in, } static const EVP_CIPHER rc4 = { - NID_rc4, 1 /* block_size */, 16 /* key_size */, - 0 /* iv_len */, sizeof(RC4_KEY), EVP_CIPH_VARIABLE_LENGTH, - NULL /* app_data */, rc4_init_key, rc4_cipher, - NULL /* cleanup */, NULL /* ctrl */, }; + NID_rc4, 1 /* block_size */, 16 /* key_size */, + 0 /* iv_len */, sizeof(RC4_KEY), EVP_CIPH_VARIABLE_LENGTH, + rc4_init_key, rc4_cipher, NULL /* cleanup */, + NULL /* ctrl */, +}; const EVP_CIPHER *EVP_rc4(void) { return &rc4; } diff --git a/crypto/fipsmodule/cipher/internal.h b/crypto/fipsmodule/cipher/internal.h index 6ec9a3b..af902e0 100644 --- a/crypto/fipsmodule/cipher/internal.h +++ b/crypto/fipsmodule/cipher/internal.h @@ -134,9 +134,6 @@ struct evp_cipher_st { // flags contains the OR of a number of flags. See |EVP_CIPH_*|. uint32_t flags; - // app_data is a pointer to opaque, user data. - void *app_data; - int (*init)(EVP_CIPHER_CTX *ctx, const uint8_t *key, const uint8_t *iv, int enc); diff --git a/decrepit/blowfish/blowfish.c b/decrepit/blowfish/blowfish.c index 7c209da..654cd86 100644 --- a/decrepit/blowfish/blowfish.c +++ b/decrepit/blowfish/blowfish.c @@ -594,30 +594,27 @@ static int bf_cfb_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out, const uint8_t *in, } static const EVP_CIPHER bf_ecb = { - NID_bf_ecb, BF_BLOCK /* block_size */, - 16 /* key_size */, BF_BLOCK /* iv_len */, - sizeof(BF_KEY), EVP_CIPH_ECB_MODE | EVP_CIPH_VARIABLE_LENGTH, - NULL /* app_data */, bf_init_key, - bf_ecb_cipher, NULL /* cleanup */, - NULL /* ctrl */, + NID_bf_ecb, BF_BLOCK /* block_size */, + 16 /* key_size */, BF_BLOCK /* iv_len */, + sizeof(BF_KEY), EVP_CIPH_ECB_MODE | EVP_CIPH_VARIABLE_LENGTH, + bf_init_key, bf_ecb_cipher, + NULL /* cleanup */, NULL /* ctrl */, }; static const EVP_CIPHER bf_cbc = { - NID_bf_cbc, BF_BLOCK /* block_size */, - 16 /* key_size */, BF_BLOCK /* iv_len */, - sizeof(BF_KEY), EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH, - NULL /* app_data */, bf_init_key, - bf_cbc_cipher, NULL /* cleanup */, - NULL /* ctrl */, + NID_bf_cbc, BF_BLOCK /* block_size */, + 16 /* key_size */, BF_BLOCK /* iv_len */, + sizeof(BF_KEY), EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH, + bf_init_key, bf_cbc_cipher, + NULL /* cleanup */, NULL /* ctrl */, }; static const EVP_CIPHER bf_cfb = { - NID_bf_cfb64, 1 /* block_size */, - 16 /* key_size */, BF_BLOCK /* iv_len */, - sizeof(BF_KEY), EVP_CIPH_CFB_MODE | EVP_CIPH_VARIABLE_LENGTH, - NULL /* app_data */, bf_init_key, - bf_cfb_cipher, NULL /* cleanup */, - NULL /* ctrl */, + NID_bf_cfb64, 1 /* block_size */, + 16 /* key_size */, BF_BLOCK /* iv_len */, + sizeof(BF_KEY), EVP_CIPH_CFB_MODE | EVP_CIPH_VARIABLE_LENGTH, + bf_init_key, bf_cfb_cipher, + NULL /* cleanup */, NULL /* ctrl */, }; const EVP_CIPHER *EVP_bf_ecb(void) { return &bf_ecb; } diff --git a/decrepit/cast/cast.c b/decrepit/cast/cast.c index 314e3da..9e87b3f 100644 --- a/decrepit/cast/cast.c +++ b/decrepit/cast/cast.c @@ -437,21 +437,19 @@ static int cast_cbc_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out, const uint8_t *in, } static const EVP_CIPHER cast5_ecb = { - NID_cast5_ecb, CAST_BLOCK, - CAST_KEY_LENGTH, CAST_BLOCK /* iv_len */, - sizeof(CAST_KEY), EVP_CIPH_ECB_MODE | EVP_CIPH_VARIABLE_LENGTH, - NULL /* app_data */, cast_init_key, - cast_ecb_cipher, NULL /* cleanup */, - NULL /* ctrl */, + NID_cast5_ecb, CAST_BLOCK, + CAST_KEY_LENGTH, CAST_BLOCK /* iv_len */, + sizeof(CAST_KEY), EVP_CIPH_ECB_MODE | EVP_CIPH_VARIABLE_LENGTH, + cast_init_key, cast_ecb_cipher, + NULL /* cleanup */, NULL /* ctrl */, }; static const EVP_CIPHER cast5_cbc = { - NID_cast5_cbc, CAST_BLOCK, - CAST_KEY_LENGTH, CAST_BLOCK /* iv_len */, - sizeof(CAST_KEY), EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH, - NULL /* app_data */, cast_init_key, - cast_cbc_cipher, NULL /* cleanup */, - NULL /* ctrl */, + NID_cast5_cbc, CAST_BLOCK, + CAST_KEY_LENGTH, CAST_BLOCK /* iv_len */, + sizeof(CAST_KEY), EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH, + cast_init_key, cast_cbc_cipher, + NULL /* cleanup */, NULL /* ctrl */, }; const EVP_CIPHER *EVP_cast5_ecb(void) { return &cast5_ecb; } diff --git a/decrepit/cfb/cfb.c b/decrepit/cfb/cfb.c index c15292c..12709a4 100644 --- a/decrepit/cfb/cfb.c +++ b/decrepit/cfb/cfb.c @@ -52,24 +52,24 @@ static int aes_cfb128_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out, } static const EVP_CIPHER aes_128_cfb128 = { - NID_aes_128_cfb128, 1 /* block_size */, 16 /* key_size */, - 16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE, - NULL /* app_data */, aes_cfb_init_key, aes_cfb128_cipher, - NULL /* cleanup */, NULL /* ctrl */, + NID_aes_128_cfb128, 1 /* block_size */, 16 /* key_size */, + 16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE, + aes_cfb_init_key, aes_cfb128_cipher, NULL /* cleanup */, + NULL /* ctrl */, }; static const EVP_CIPHER aes_192_cfb128 = { - NID_aes_192_cfb128, 1 /* block_size */, 24 /* key_size */, - 16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE, - NULL /* app_data */, aes_cfb_init_key, aes_cfb128_cipher, - NULL /* cleanup */, NULL /* ctrl */, + NID_aes_192_cfb128, 1 /* block_size */, 24 /* key_size */, + 16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE, + aes_cfb_init_key, aes_cfb128_cipher, NULL /* cleanup */, + NULL /* ctrl */, }; static const EVP_CIPHER aes_256_cfb128 = { - NID_aes_256_cfb128, 1 /* block_size */, 32 /* key_size */, - 16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE, - NULL /* app_data */, aes_cfb_init_key, aes_cfb128_cipher, - NULL /* cleanup */, NULL /* ctrl */, + NID_aes_256_cfb128, 1 /* block_size */, 32 /* key_size */, + 16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE, + aes_cfb_init_key, aes_cfb128_cipher, NULL /* cleanup */, + NULL /* ctrl */, }; const EVP_CIPHER *EVP_aes_128_cfb128(void) { return &aes_128_cfb128; } diff --git a/decrepit/xts/xts.c b/decrepit/xts/xts.c index 8a66f0f..b44d6f4 100644 --- a/decrepit/xts/xts.c +++ b/decrepit/xts/xts.c @@ -229,11 +229,16 @@ static int aes_xts_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) { } static const EVP_CIPHER aes_256_xts = { - NID_aes_256_xts, 1 /* block_size */, 64 /* key_size (2 AES keys) */, - 16 /* iv_len */, sizeof(EVP_AES_XTS_CTX), + NID_aes_256_xts, + 1 /* block_size */, + 64 /* key_size (2 AES keys) */, + 16 /* iv_len */, + sizeof(EVP_AES_XTS_CTX), EVP_CIPH_XTS_MODE | EVP_CIPH_CUSTOM_IV | EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CTRL_INIT | EVP_CIPH_CUSTOM_COPY, - NULL /* app_data */, aes_xts_init_key, aes_xts_cipher, - NULL /* cleanup */, aes_xts_ctrl}; + aes_xts_init_key, + aes_xts_cipher, + NULL /* cleanup */, + aes_xts_ctrl}; const EVP_CIPHER *EVP_aes_256_xts(void) { return &aes_256_xts; } |