Skip to content

Commit 1c115c6

Browse files
botovqsamuel40791765
authored andcommitted
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 <[email protected]> Commit-Queue: Adam Langley <[email protected]> Reviewed-by: Adam Langley <[email protected]> (cherry picked from commit f57a11ae566ac17c1b028d79950227a33ae32fad)
1 parent 04a0f10 commit 1c115c6

File tree

11 files changed

+65
-85
lines changed

11 files changed

+65
-85
lines changed

crypto/cipher_extra/e_aes_cbc_hmac_sha1.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,6 @@ static const EVP_CIPHER aesni_128_cbc_hmac_sha1_cipher = {
372372
AES_BLOCK_SIZE /* iv len */,
373373
sizeof(EVP_AES_HMAC_SHA1) /* ctx_size */,
374374
EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_AEAD_CIPHER /* flags */,
375-
NULL /* app_data */,
376375
aesni_cbc_hmac_sha1_init_key,
377376
aesni_cbc_hmac_sha1_cipher,
378377
NULL /* cleanup */,
@@ -385,7 +384,6 @@ static const EVP_CIPHER aesni_256_cbc_hmac_sha1_cipher = {
385384
AES_BLOCK_SIZE /* iv len */,
386385
sizeof(EVP_AES_HMAC_SHA1) /* ctx_size */,
387386
EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_AEAD_CIPHER /* flags */,
388-
NULL /* app_data */,
389387
aesni_cbc_hmac_sha1_init_key,
390388
aesni_cbc_hmac_sha1_cipher,
391389
NULL,

crypto/cipher_extra/e_aes_cbc_hmac_sha256.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,6 @@ static const EVP_CIPHER aesni_128_cbc_hmac_sha256_cipher = {
368368
AES_BLOCK_SIZE /* iv len */,
369369
sizeof(EVP_AES_HMAC_SHA256) /* ctx_size */,
370370
EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_AEAD_CIPHER /* flags */,
371-
NULL /* app_data */,
372371
aesni_cbc_hmac_sha256_init_key,
373372
aesni_cbc_hmac_sha256_cipher,
374373
NULL /* cleanup */,
@@ -381,7 +380,6 @@ static const EVP_CIPHER aesni_256_cbc_hmac_sha256_cipher = {
381380
AES_BLOCK_SIZE /* iv len */,
382381
sizeof(EVP_AES_HMAC_SHA256) /* ctx_size */,
383382
EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_AEAD_CIPHER /* flags */,
384-
NULL /* app_data */,
385383
aesni_cbc_hmac_sha256_init_key,
386384
aesni_cbc_hmac_sha256_cipher,
387385
NULL /* cleanup */,

crypto/cipher_extra/e_chacha20poly1305.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,6 @@ static EVP_CIPHER cipher_chacha20_poly1305 = {
727727
sizeof(CIPHER_CHACHA_POLY_CTX),
728728
EVP_CIPH_FLAG_AEAD_CIPHER | EVP_CIPH_CUSTOM_IV | EVP_CIPH_ALWAYS_CALL_INIT |
729729
EVP_CIPH_CTRL_INIT | EVP_CIPH_CUSTOM_COPY | EVP_CIPH_FLAG_CUSTOM_CIPHER,
730-
NULL, // app_data
731730
cipher_chacha20_poly1305_init,
732731
cipher_chacha20_poly1305_do_cipher,
733732
cipher_chacha20_poly1305_cleanup,

crypto/cipher_extra/e_des.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ static const EVP_CIPHER evp_des_cbc = {
9191
/* iv_len = */ 8,
9292
/* ctx_size = */ sizeof(EVP_DES_KEY),
9393
/* flags = */ EVP_CIPH_CBC_MODE,
94-
/* app_data = */ NULL,
9594
/* init = */ des_init_key,
9695
/* cipher = */ des_cbc_cipher,
9796
/* cleanup = */ NULL,
@@ -121,7 +120,6 @@ static const EVP_CIPHER evp_des_ecb = {
121120
/* iv_len = */ 0,
122121
/* ctx_size = */ sizeof(EVP_DES_KEY),
123122
/* flags = */ EVP_CIPH_ECB_MODE,
124-
/* app_data = */ NULL,
125123
/* init = */ des_init_key,
126124
/* cipher = */ des_ecb_cipher,
127125
/* cleanup = */ NULL,
@@ -161,7 +159,6 @@ static const EVP_CIPHER evp_des_ede3_cbc = {
161159
/* iv_len = */ 8,
162160
/* ctx_size = */ sizeof(DES_EDE_KEY),
163161
/* flags = */ EVP_CIPH_CBC_MODE,
164-
/* app_data = */ NULL,
165162
/* init = */ des_ede3_init_key,
166163
/* cipher = */ des_ede3_cbc_cipher,
167164
/* cleanup = */ NULL,
@@ -187,7 +184,6 @@ static const EVP_CIPHER evp_des_ede_cbc = {
187184
/* iv_len = */ 8,
188185
/* ctx_size = */ sizeof(DES_EDE_KEY),
189186
/* flags = */ EVP_CIPH_CBC_MODE,
190-
/* app_data = */ NULL,
191187
/* init = */ des_ede_init_key,
192188
/* cipher = */ des_ede3_cbc_cipher,
193189
/* cleanup = */ NULL,
@@ -218,7 +214,6 @@ static const EVP_CIPHER evp_des_ede = {
218214
/* iv_len = */ 0,
219215
/* ctx_size = */ sizeof(DES_EDE_KEY),
220216
/* flags = */ EVP_CIPH_ECB_MODE,
221-
/* app_data = */ NULL,
222217
/* init = */ des_ede_init_key,
223218
/* cipher = */ des_ede_ecb_cipher,
224219
/* cleanup = */ NULL,
@@ -234,7 +229,6 @@ static const EVP_CIPHER evp_des_ede3 = {
234229
/* iv_len = */ 0,
235230
/* ctx_size = */ sizeof(DES_EDE_KEY),
236231
/* flags = */ EVP_CIPH_ECB_MODE,
237-
/* app_data = */ NULL,
238232
/* init = */ des_ede3_init_key,
239233
/* cipher = */ des_ede_ecb_cipher,
240234
/* cleanup = */ NULL,

crypto/cipher_extra/e_null.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ static int null_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out,
7878
}
7979

8080
static const EVP_CIPHER n_cipher = {
81-
NID_undef, 1 /* block size */, 0 /* key_len */, 0 /* iv_len */,
82-
0 /* ctx_size */, 0 /* flags */, NULL /* app_data */, null_init_key,
83-
null_cipher, NULL /* cleanup */, NULL /* ctrl */,
81+
NID_undef, 1 /* block size */, 0 /* key_len */, 0 /* iv_len */,
82+
0 /* ctx_size */, 0 /* flags */, null_init_key, null_cipher,
83+
NULL /* cleanup */, NULL /* ctrl */,
8484
};
8585

8686
const EVP_CIPHER *EVP_enc_null(void) { return &n_cipher; }

crypto/cipher_extra/e_rc2.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,6 @@ static const EVP_CIPHER rc2_40_cbc = {
433433
8 /* iv len */,
434434
sizeof(EVP_RC2_KEY),
435435
EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT,
436-
NULL /* app_data */,
437436
rc2_init_key,
438437
rc2_cbc_cipher,
439438
NULL,
@@ -451,7 +450,6 @@ static const EVP_CIPHER rc2_cbc = {
451450
8 /* iv len */,
452451
sizeof(EVP_RC2_KEY),
453452
EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT,
454-
NULL /* app_data */,
455453
rc2_init_key,
456454
rc2_cbc_cipher,
457455
NULL,

crypto/cipher_extra/e_rc4.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ static int rc4_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out, const uint8_t *in,
8181
}
8282

8383
static const EVP_CIPHER rc4 = {
84-
NID_rc4, 1 /* block_size */, 16 /* key_size */,
85-
0 /* iv_len */, sizeof(RC4_KEY), EVP_CIPH_VARIABLE_LENGTH,
86-
NULL /* app_data */, rc4_init_key, rc4_cipher,
87-
NULL /* cleanup */, NULL /* ctrl */, };
84+
NID_rc4, 1 /* block_size */, 16 /* key_size */,
85+
0 /* iv_len */, sizeof(RC4_KEY), EVP_CIPH_VARIABLE_LENGTH,
86+
rc4_init_key, rc4_cipher, NULL /* cleanup */,
87+
NULL /* ctrl */,
88+
};
8889

8990
const EVP_CIPHER *EVP_rc4(void) { return &rc4; }

crypto/decrepit/blowfish/blowfish.c

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -594,30 +594,27 @@ static int bf_cfb_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out, const uint8_t *in,
594594
}
595595

596596
static const EVP_CIPHER bf_ecb = {
597-
NID_bf_ecb, BF_BLOCK /* block_size */,
598-
16 /* key_size */, BF_BLOCK /* iv_len */,
599-
sizeof(BF_KEY), EVP_CIPH_ECB_MODE | EVP_CIPH_VARIABLE_LENGTH,
600-
NULL /* app_data */, bf_init_key,
601-
bf_ecb_cipher, NULL /* cleanup */,
602-
NULL /* ctrl */,
597+
NID_bf_ecb, BF_BLOCK /* block_size */,
598+
16 /* key_size */, BF_BLOCK /* iv_len */,
599+
sizeof(BF_KEY), EVP_CIPH_ECB_MODE | EVP_CIPH_VARIABLE_LENGTH,
600+
bf_init_key, bf_ecb_cipher,
601+
NULL /* cleanup */, NULL /* ctrl */,
603602
};
604603

605604
static const EVP_CIPHER bf_cbc = {
606-
NID_bf_cbc, BF_BLOCK /* block_size */,
607-
16 /* key_size */, BF_BLOCK /* iv_len */,
608-
sizeof(BF_KEY), EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH,
609-
NULL /* app_data */, bf_init_key,
610-
bf_cbc_cipher, NULL /* cleanup */,
611-
NULL /* ctrl */,
605+
NID_bf_cbc, BF_BLOCK /* block_size */,
606+
16 /* key_size */, BF_BLOCK /* iv_len */,
607+
sizeof(BF_KEY), EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH,
608+
bf_init_key, bf_cbc_cipher,
609+
NULL /* cleanup */, NULL /* ctrl */,
612610
};
613611

614612
static const EVP_CIPHER bf_cfb = {
615-
NID_bf_cfb64, 1 /* block_size */,
616-
16 /* key_size */, BF_BLOCK /* iv_len */,
617-
sizeof(BF_KEY), EVP_CIPH_CFB_MODE | EVP_CIPH_VARIABLE_LENGTH,
618-
NULL /* app_data */, bf_init_key,
619-
bf_cfb_cipher, NULL /* cleanup */,
620-
NULL /* ctrl */,
613+
NID_bf_cfb64, 1 /* block_size */,
614+
16 /* key_size */, BF_BLOCK /* iv_len */,
615+
sizeof(BF_KEY), EVP_CIPH_CFB_MODE | EVP_CIPH_VARIABLE_LENGTH,
616+
bf_init_key, bf_cfb_cipher,
617+
NULL /* cleanup */, NULL /* ctrl */,
621618
};
622619

623620
const EVP_CIPHER *EVP_bf_ecb(void) { return &bf_ecb; }

crypto/decrepit/cast/cast.c

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -384,21 +384,19 @@ static int cast_cbc_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out, const uint8_t *in,
384384
}
385385

386386
static const EVP_CIPHER cast5_ecb = {
387-
NID_cast5_ecb, CAST_BLOCK,
388-
CAST_KEY_LENGTH, CAST_BLOCK /* iv_len */,
389-
sizeof(CAST_KEY), EVP_CIPH_ECB_MODE | EVP_CIPH_VARIABLE_LENGTH,
390-
NULL /* app_data */, cast_init_key,
391-
cast_ecb_cipher, NULL /* cleanup */,
392-
NULL /* ctrl */,
387+
NID_cast5_ecb, CAST_BLOCK,
388+
CAST_KEY_LENGTH, CAST_BLOCK /* iv_len */,
389+
sizeof(CAST_KEY), EVP_CIPH_ECB_MODE | EVP_CIPH_VARIABLE_LENGTH,
390+
cast_init_key, cast_ecb_cipher,
391+
NULL /* cleanup */, NULL /* ctrl */,
393392
};
394393

395394
static const EVP_CIPHER cast5_cbc = {
396-
NID_cast5_cbc, CAST_BLOCK,
397-
CAST_KEY_LENGTH, CAST_BLOCK /* iv_len */,
398-
sizeof(CAST_KEY), EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH,
399-
NULL /* app_data */, cast_init_key,
400-
cast_cbc_cipher, NULL /* cleanup */,
401-
NULL /* ctrl */,
395+
NID_cast5_cbc, CAST_BLOCK,
396+
CAST_KEY_LENGTH, CAST_BLOCK /* iv_len */,
397+
sizeof(CAST_KEY), EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH,
398+
cast_init_key, cast_cbc_cipher,
399+
NULL /* cleanup */, NULL /* ctrl */,
402400
};
403401

404402
const EVP_CIPHER *EVP_cast5_ecb(void) { return &cast5_ecb; }

crypto/decrepit/cfb/cfb.c

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -105,66 +105,66 @@ static int aes_cfb128_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out,
105105
}
106106

107107
static const EVP_CIPHER aes_128_cfb1 = {
108-
NID_aes_128_cfb1, 1 /* block_size */, 16 /* key_size */,
109-
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
110-
NULL /* app_data */, aes_cfb_init_key, aes_cfb1_cipher,
111-
NULL /* cleanup */, NULL /* ctrl */,
108+
NID_aes_128_cfb1, 1 /* block_size */, 16 /* key_size */,
109+
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
110+
aes_cfb_init_key, aes_cfb1_cipher, NULL /* cleanup */,
111+
NULL /* ctrl */,
112112
};
113113

114114
static const EVP_CIPHER aes_128_cfb8 = {
115-
NID_aes_128_cfb8, 1 /* block_size */, 16 /* key_size */,
116-
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
117-
NULL /* app_data */, aes_cfb_init_key, aes_cfb8_cipher,
118-
NULL /* cleanup */, NULL /* ctrl */,
115+
NID_aes_128_cfb8, 1 /* block_size */, 16 /* key_size */,
116+
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
117+
aes_cfb_init_key, aes_cfb8_cipher, NULL /* cleanup */,
118+
NULL /* ctrl */,
119119
};
120120

121121
static const EVP_CIPHER aes_128_cfb128 = {
122-
NID_aes_128_cfb128, 1 /* block_size */, 16 /* key_size */,
123-
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
124-
NULL /* app_data */, aes_cfb_init_key, aes_cfb128_cipher,
125-
NULL /* cleanup */, NULL /* ctrl */,
122+
NID_aes_128_cfb128, 1 /* block_size */, 16 /* key_size */,
123+
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
124+
aes_cfb_init_key, aes_cfb128_cipher, NULL /* cleanup */,
125+
NULL /* ctrl */,
126126
};
127127

128128
static const EVP_CIPHER aes_192_cfb1 = {
129-
NID_aes_192_cfb1, 1 /* block_size */, 24 /* key_size */,
130-
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
131-
NULL /* app_data */, aes_cfb_init_key, aes_cfb1_cipher,
132-
NULL /* cleanup */, NULL /* ctrl */,
129+
NID_aes_192_cfb1, 1 /* block_size */, 24 /* key_size */,
130+
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
131+
aes_cfb_init_key, aes_cfb1_cipher, NULL /* cleanup */,
132+
NULL /* ctrl */,
133133
};
134134

135135
static const EVP_CIPHER aes_192_cfb8 = {
136-
NID_aes_192_cfb8, 1 /* block_size */, 24 /* key_size */,
137-
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
138-
NULL /* app_data */, aes_cfb_init_key, aes_cfb8_cipher,
139-
NULL /* cleanup */, NULL /* ctrl */,
136+
NID_aes_192_cfb8, 1 /* block_size */, 24 /* key_size */,
137+
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
138+
aes_cfb_init_key, aes_cfb8_cipher, NULL /* cleanup */,
139+
NULL /* ctrl */,
140140
};
141141

142142
static const EVP_CIPHER aes_192_cfb128 = {
143-
NID_aes_192_cfb128, 1 /* block_size */, 24 /* key_size */,
144-
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
145-
NULL /* app_data */, aes_cfb_init_key, aes_cfb128_cipher,
146-
NULL /* cleanup */, NULL /* ctrl */,
143+
NID_aes_192_cfb128, 1 /* block_size */, 24 /* key_size */,
144+
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
145+
aes_cfb_init_key, aes_cfb128_cipher, NULL /* cleanup */,
146+
NULL /* ctrl */,
147147
};
148148

149149
static const EVP_CIPHER aes_256_cfb1 = {
150-
NID_aes_256_cfb1, 1 /* block_size */, 32 /* key_size */,
151-
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
152-
NULL /* app_data */, aes_cfb_init_key, aes_cfb1_cipher,
153-
NULL /* cleanup */, NULL /* ctrl */,
150+
NID_aes_256_cfb1, 1 /* block_size */, 32 /* key_size */,
151+
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
152+
aes_cfb_init_key, aes_cfb1_cipher, NULL /* cleanup */,
153+
NULL /* ctrl */,
154154
};
155155

156156
static const EVP_CIPHER aes_256_cfb8 = {
157157
NID_aes_256_cfb8, 1 /* block_size */, 32 /* key_size */,
158158
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
159-
NULL /* app_data */, aes_cfb_init_key, aes_cfb8_cipher,
160-
NULL /* cleanup */, NULL /* ctrl */,
159+
aes_cfb_init_key, aes_cfb8_cipher, NULL /* cleanup */,
160+
NULL /* ctrl */,
161161
};
162162

163163
static const EVP_CIPHER aes_256_cfb128 = {
164164
NID_aes_256_cfb128, 1 /* block_size */, 32 /* key_size */,
165165
16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE,
166-
NULL /* app_data */, aes_cfb_init_key, aes_cfb128_cipher,
167-
NULL /* cleanup */, NULL /* ctrl */,
166+
aes_cfb_init_key, aes_cfb128_cipher, NULL /* cleanup */,
167+
NULL /* ctrl */,
168168
};
169169

170170
const EVP_CIPHER *EVP_aes_128_cfb1(void) { return &aes_128_cfb1; }

crypto/fipsmodule/cipher/internal.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,6 @@ struct evp_cipher_st {
175175
// flags contains the OR of a number of flags. See |EVP_CIPH_*|.
176176
uint32_t flags;
177177

178-
// app_data is a pointer to opaque, user data.
179-
void *app_data;
180-
181178
int (*init)(EVP_CIPHER_CTX *ctx, const uint8_t *key, const uint8_t *iv,
182179
int enc);
183180

0 commit comments

Comments
 (0)