diff options
| author | tb <> | 2024-01-07 15:42:57 +0000 |
|---|---|---|
| committer | tb <> | 2024-01-07 15:42:57 +0000 |
| commit | c0b3ae168d37cd76986e12649d675f42f46cdfc3 (patch) | |
| tree | 968618b07754dd69ed33255d1984737459fd7ff1 /src | |
| parent | 126e387ca0e4e0928cfa8f76cc4647a7bf754e4d (diff) | |
| download | openbsd-c0b3ae168d37cd76986e12649d675f42f46cdfc3.tar.gz openbsd-c0b3ae168d37cd76986e12649d675f42f46cdfc3.tar.bz2 openbsd-c0b3ae168d37cd76986e12649d675f42f46cdfc3.zip | |
Convert the remaining legacy ciphers to C99 initializers
No change in the generated aarch64 assembly apart from line number changes.
ok jsing
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/evp/e_null.c | 24 | ||||
| -rw-r--r-- | src/lib/libcrypto/evp/e_rc2.c | 46 | ||||
| -rw-r--r-- | src/lib/libcrypto/evp/e_rc4.c | 46 | ||||
| -rw-r--r-- | src/lib/libcrypto/evp/e_rc4_hmac_md5.c | 26 | ||||
| -rw-r--r-- | src/lib/libcrypto/evp/e_xcbc_d.c | 24 |
5 files changed, 90 insertions, 76 deletions
diff --git a/src/lib/libcrypto/evp/e_null.c b/src/lib/libcrypto/evp/e_null.c index d3364de1c5..be46c1ccac 100644 --- a/src/lib/libcrypto/evp/e_null.c +++ b/src/lib/libcrypto/evp/e_null.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: e_null.c,v 1.19 2024/01/04 17:38:36 tb Exp $ */ | 1 | /* $OpenBSD: e_null.c,v 1.20 2024/01/07 15:42:57 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -70,16 +70,18 @@ static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 70 | const unsigned char *in, size_t inl); | 70 | const unsigned char *in, size_t inl); |
| 71 | 71 | ||
| 72 | static const EVP_CIPHER n_cipher = { | 72 | static const EVP_CIPHER n_cipher = { |
| 73 | NID_undef, | 73 | .nid = NID_undef, |
| 74 | 1, 0, 0, | 74 | .block_size = 1, |
| 75 | 0, | 75 | .key_len = 0, |
| 76 | null_init_key, | 76 | .iv_len = 0, |
| 77 | null_cipher, | 77 | .flags = 0, |
| 78 | NULL, | 78 | .init = null_init_key, |
| 79 | 0, | 79 | .do_cipher = null_cipher, |
| 80 | NULL, | 80 | .cleanup = NULL, |
| 81 | NULL, | 81 | .ctx_size = 0, |
| 82 | NULL, | 82 | .set_asn1_parameters = NULL, |
| 83 | .get_asn1_parameters = NULL, | ||
| 84 | .ctrl = NULL, | ||
| 83 | }; | 85 | }; |
| 84 | 86 | ||
| 85 | const EVP_CIPHER * | 87 | const EVP_CIPHER * |
diff --git a/src/lib/libcrypto/evp/e_rc2.c b/src/lib/libcrypto/evp/e_rc2.c index 6f8c051cff..0a19551109 100644 --- a/src/lib/libcrypto/evp/e_rc2.c +++ b/src/lib/libcrypto/evp/e_rc2.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: e_rc2.c,v 1.26 2024/01/04 17:38:36 tb Exp $ */ | 1 | /* $OpenBSD: e_rc2.c,v 1.27 2024/01/07 15:42:57 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -248,29 +248,33 @@ EVP_rc2_ecb(void) | |||
| 248 | #define RC2_128_MAGIC 0x3a | 248 | #define RC2_128_MAGIC 0x3a |
| 249 | 249 | ||
| 250 | static const EVP_CIPHER r2_64_cbc_cipher = { | 250 | static const EVP_CIPHER r2_64_cbc_cipher = { |
| 251 | NID_rc2_64_cbc, | 251 | .nid = NID_rc2_64_cbc, |
| 252 | 8, 8 /* 64 bit */, 8, | 252 | .block_size = 8, |
| 253 | EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT, | 253 | .key_len = 8, |
| 254 | rc2_init_key, | 254 | .iv_len = 8, |
| 255 | rc2_cbc_cipher, | 255 | .flags = EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT, |
| 256 | NULL, | 256 | .init = rc2_init_key, |
| 257 | sizeof(EVP_RC2_KEY), | 257 | .do_cipher = rc2_cbc_cipher, |
| 258 | rc2_set_asn1_type_and_iv, | 258 | .cleanup = NULL, |
| 259 | rc2_get_asn1_type_and_iv, | 259 | .ctx_size = sizeof(EVP_RC2_KEY), |
| 260 | rc2_ctrl, | 260 | .set_asn1_parameters = rc2_set_asn1_type_and_iv, |
| 261 | .get_asn1_parameters = rc2_get_asn1_type_and_iv, | ||
| 262 | .ctrl = rc2_ctrl, | ||
| 261 | }; | 263 | }; |
| 262 | 264 | ||
| 263 | static const EVP_CIPHER r2_40_cbc_cipher = { | 265 | static const EVP_CIPHER r2_40_cbc_cipher = { |
| 264 | NID_rc2_40_cbc, | 266 | .nid = NID_rc2_40_cbc, |
| 265 | 8, 5 /* 40 bit */, 8, | 267 | .block_size = 8, |
| 266 | EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT, | 268 | .key_len = 5, |
| 267 | rc2_init_key, | 269 | .iv_len = 8, |
| 268 | rc2_cbc_cipher, | 270 | .flags = EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT, |
| 269 | NULL, | 271 | .init = rc2_init_key, |
| 270 | sizeof(EVP_RC2_KEY), | 272 | .do_cipher = rc2_cbc_cipher, |
| 271 | rc2_set_asn1_type_and_iv, | 273 | .cleanup = NULL, |
| 272 | rc2_get_asn1_type_and_iv, | 274 | .ctx_size = sizeof(EVP_RC2_KEY), |
| 273 | rc2_ctrl, | 275 | .set_asn1_parameters = rc2_set_asn1_type_and_iv, |
| 276 | .get_asn1_parameters = rc2_get_asn1_type_and_iv, | ||
| 277 | .ctrl = rc2_ctrl, | ||
| 274 | }; | 278 | }; |
| 275 | 279 | ||
| 276 | const EVP_CIPHER * | 280 | const EVP_CIPHER * |
diff --git a/src/lib/libcrypto/evp/e_rc4.c b/src/lib/libcrypto/evp/e_rc4.c index 4588dfc719..c0f12fb03c 100644 --- a/src/lib/libcrypto/evp/e_rc4.c +++ b/src/lib/libcrypto/evp/e_rc4.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: e_rc4.c,v 1.18 2024/01/04 17:38:36 tb Exp $ */ | 1 | /* $OpenBSD: e_rc4.c,v 1.19 2024/01/07 15:42:57 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -83,29 +83,33 @@ static int rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | |||
| 83 | const unsigned char *in, size_t inl); | 83 | const unsigned char *in, size_t inl); |
| 84 | 84 | ||
| 85 | static const EVP_CIPHER r4_cipher = { | 85 | static const EVP_CIPHER r4_cipher = { |
| 86 | NID_rc4, | 86 | .nid = NID_rc4, |
| 87 | 1, EVP_RC4_KEY_SIZE, 0, | 87 | .block_size = 1, |
| 88 | EVP_CIPH_VARIABLE_LENGTH, | 88 | .key_len = EVP_RC4_KEY_SIZE, |
| 89 | rc4_init_key, | 89 | .iv_len = 0, |
| 90 | rc4_cipher, | 90 | .flags = EVP_CIPH_VARIABLE_LENGTH, |
| 91 | NULL, | 91 | .init = rc4_init_key, |
| 92 | sizeof(EVP_RC4_KEY), | 92 | .do_cipher = rc4_cipher, |
| 93 | NULL, | 93 | .cleanup = NULL, |
| 94 | NULL, | 94 | .ctx_size = sizeof(EVP_RC4_KEY), |
| 95 | NULL, | 95 | .set_asn1_parameters = NULL, |
| 96 | .get_asn1_parameters = NULL, | ||
| 97 | .ctrl = NULL, | ||
| 96 | }; | 98 | }; |
| 97 | 99 | ||
| 98 | static const EVP_CIPHER r4_40_cipher = { | 100 | static const EVP_CIPHER r4_40_cipher = { |
| 99 | NID_rc4_40, | 101 | .nid = NID_rc4_40, |
| 100 | 1, 5 /* 40 bit */, 0, | 102 | .block_size = 1, |
| 101 | EVP_CIPH_VARIABLE_LENGTH, | 103 | .key_len = 5, |
| 102 | rc4_init_key, | 104 | .iv_len = 0, |
| 103 | rc4_cipher, | 105 | .flags = EVP_CIPH_VARIABLE_LENGTH, |
| 104 | NULL, | 106 | .init = rc4_init_key, |
| 105 | sizeof(EVP_RC4_KEY), | 107 | .do_cipher = rc4_cipher, |
| 106 | NULL, | 108 | .cleanup = NULL, |
| 107 | NULL, | 109 | .ctx_size = sizeof(EVP_RC4_KEY), |
| 108 | NULL, | 110 | .set_asn1_parameters = NULL, |
| 111 | .get_asn1_parameters = NULL, | ||
| 112 | .ctrl = NULL, | ||
| 109 | }; | 113 | }; |
| 110 | 114 | ||
| 111 | const EVP_CIPHER * | 115 | const EVP_CIPHER * |
diff --git a/src/lib/libcrypto/evp/e_rc4_hmac_md5.c b/src/lib/libcrypto/evp/e_rc4_hmac_md5.c index a9301dcdc9..5701aeefc6 100644 --- a/src/lib/libcrypto/evp/e_rc4_hmac_md5.c +++ b/src/lib/libcrypto/evp/e_rc4_hmac_md5.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: e_rc4_hmac_md5.c,v 1.13 2024/01/04 17:38:36 tb Exp $ */ | 1 | /* $OpenBSD: e_rc4_hmac_md5.c,v 1.14 2024/01/07 15:42:57 tb Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2011 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -283,19 +283,21 @@ rc4_hmac_md5_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) | |||
| 283 | 283 | ||
| 284 | static EVP_CIPHER r4_hmac_md5_cipher = { | 284 | static EVP_CIPHER r4_hmac_md5_cipher = { |
| 285 | #ifdef NID_rc4_hmac_md5 | 285 | #ifdef NID_rc4_hmac_md5 |
| 286 | NID_rc4_hmac_md5, | 286 | .nid = NID_rc4_hmac_md5, |
| 287 | #else | 287 | #else |
| 288 | NID_undef, | 288 | .nid = NID_undef, |
| 289 | #endif | 289 | #endif |
| 290 | 1, EVP_RC4_KEY_SIZE, 0, | 290 | .block_size = 1, |
| 291 | EVP_CIPH_STREAM_CIPHER|EVP_CIPH_VARIABLE_LENGTH|EVP_CIPH_FLAG_AEAD_CIPHER, | 291 | .key_len = EVP_RC4_KEY_SIZE, |
| 292 | rc4_hmac_md5_init_key, | 292 | .iv_len = 0, |
| 293 | rc4_hmac_md5_cipher, | 293 | .flags = EVP_CIPH_STREAM_CIPHER|EVP_CIPH_VARIABLE_LENGTH|EVP_CIPH_FLAG_AEAD_CIPHER, |
| 294 | NULL, | 294 | .init = rc4_hmac_md5_init_key, |
| 295 | sizeof(EVP_RC4_HMAC_MD5), | 295 | .do_cipher = rc4_hmac_md5_cipher, |
| 296 | NULL, | 296 | .cleanup = NULL, |
| 297 | NULL, | 297 | .ctx_size = sizeof(EVP_RC4_HMAC_MD5), |
| 298 | rc4_hmac_md5_ctrl, | 298 | .set_asn1_parameters = NULL, |
| 299 | .get_asn1_parameters = NULL, | ||
| 300 | .ctrl = rc4_hmac_md5_ctrl, | ||
| 299 | }; | 301 | }; |
| 300 | 302 | ||
| 301 | const EVP_CIPHER * | 303 | const EVP_CIPHER * |
diff --git a/src/lib/libcrypto/evp/e_xcbc_d.c b/src/lib/libcrypto/evp/e_xcbc_d.c index 5a3d535661..dc01cbb982 100644 --- a/src/lib/libcrypto/evp/e_xcbc_d.c +++ b/src/lib/libcrypto/evp/e_xcbc_d.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: e_xcbc_d.c,v 1.16 2024/01/04 17:38:36 tb Exp $ */ | 1 | /* $OpenBSD: e_xcbc_d.c,v 1.17 2024/01/07 15:42:57 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -84,16 +84,18 @@ typedef struct { | |||
| 84 | #define data(ctx) ((DESX_CBC_KEY *)(ctx)->cipher_data) | 84 | #define data(ctx) ((DESX_CBC_KEY *)(ctx)->cipher_data) |
| 85 | 85 | ||
| 86 | static const EVP_CIPHER d_xcbc_cipher = { | 86 | static const EVP_CIPHER d_xcbc_cipher = { |
| 87 | NID_desx_cbc, | 87 | .nid = NID_desx_cbc, |
| 88 | 8, 24, 8, | 88 | .block_size = 8, |
| 89 | EVP_CIPH_CBC_MODE, | 89 | .key_len = 24, |
| 90 | desx_cbc_init_key, | 90 | .iv_len = 8, |
| 91 | desx_cbc_cipher, | 91 | .flags = EVP_CIPH_CBC_MODE, |
| 92 | NULL, | 92 | .init = desx_cbc_init_key, |
| 93 | sizeof(DESX_CBC_KEY), | 93 | .do_cipher = desx_cbc_cipher, |
| 94 | EVP_CIPHER_set_asn1_iv, | 94 | .cleanup = NULL, |
| 95 | EVP_CIPHER_get_asn1_iv, | 95 | .ctx_size = sizeof(DESX_CBC_KEY), |
| 96 | NULL, | 96 | .set_asn1_parameters = EVP_CIPHER_set_asn1_iv, |
| 97 | .get_asn1_parameters = EVP_CIPHER_get_asn1_iv, | ||
| 98 | .ctrl = NULL, | ||
| 97 | }; | 99 | }; |
| 98 | 100 | ||
| 99 | const EVP_CIPHER * | 101 | const EVP_CIPHER * |
