summaryrefslogtreecommitdiff
path: root/lib/libcrypto
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2024-01-07 15:42:58 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2024-01-07 15:42:58 +0000
commit63d9f76e37ef82b57a84e8c199ef66422ada4cda (patch)
treeb6c551e658fe0143fef750cb09fa5c1557cbb03d /lib/libcrypto
parent36612a29052e627ed6307be61935eed055dc0f6e (diff)
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 'lib/libcrypto')
-rw-r--r--lib/libcrypto/evp/e_null.c24
-rw-r--r--lib/libcrypto/evp/e_rc2.c46
-rw-r--r--lib/libcrypto/evp/e_rc4.c46
-rw-r--r--lib/libcrypto/evp/e_rc4_hmac_md5.c26
-rw-r--r--lib/libcrypto/evp/e_xcbc_d.c24
5 files changed, 90 insertions, 76 deletions
diff --git a/lib/libcrypto/evp/e_null.c b/lib/libcrypto/evp/e_null.c
index d3364de1c51..be46c1ccacc 100644
--- a/lib/libcrypto/evp/e_null.c
+++ b/lib/libcrypto/evp/e_null.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: e_null.c,v 1.19 2024/01/04 17:38:36 tb Exp $ */
+/* $OpenBSD: e_null.c,v 1.20 2024/01/07 15:42:57 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -70,16 +70,18 @@ static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
const unsigned char *in, size_t inl);
static const EVP_CIPHER n_cipher = {
- NID_undef,
- 1, 0, 0,
- 0,
- null_init_key,
- null_cipher,
- NULL,
- 0,
- NULL,
- NULL,
- NULL,
+ .nid = NID_undef,
+ .block_size = 1,
+ .key_len = 0,
+ .iv_len = 0,
+ .flags = 0,
+ .init = null_init_key,
+ .do_cipher = null_cipher,
+ .cleanup = NULL,
+ .ctx_size = 0,
+ .set_asn1_parameters = NULL,
+ .get_asn1_parameters = NULL,
+ .ctrl = NULL,
};
const EVP_CIPHER *
diff --git a/lib/libcrypto/evp/e_rc2.c b/lib/libcrypto/evp/e_rc2.c
index 6f8c051cffc..0a19551109a 100644
--- a/lib/libcrypto/evp/e_rc2.c
+++ b/lib/libcrypto/evp/e_rc2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: e_rc2.c,v 1.26 2024/01/04 17:38:36 tb Exp $ */
+/* $OpenBSD: e_rc2.c,v 1.27 2024/01/07 15:42:57 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -248,29 +248,33 @@ EVP_rc2_ecb(void)
#define RC2_128_MAGIC 0x3a
static const EVP_CIPHER r2_64_cbc_cipher = {
- NID_rc2_64_cbc,
- 8, 8 /* 64 bit */, 8,
- EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT,
- rc2_init_key,
- rc2_cbc_cipher,
- NULL,
- sizeof(EVP_RC2_KEY),
- rc2_set_asn1_type_and_iv,
- rc2_get_asn1_type_and_iv,
- rc2_ctrl,
+ .nid = NID_rc2_64_cbc,
+ .block_size = 8,
+ .key_len = 8,
+ .iv_len = 8,
+ .flags = EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT,
+ .init = rc2_init_key,
+ .do_cipher = rc2_cbc_cipher,
+ .cleanup = NULL,
+ .ctx_size = sizeof(EVP_RC2_KEY),
+ .set_asn1_parameters = rc2_set_asn1_type_and_iv,
+ .get_asn1_parameters = rc2_get_asn1_type_and_iv,
+ .ctrl = rc2_ctrl,
};
static const EVP_CIPHER r2_40_cbc_cipher = {
- NID_rc2_40_cbc,
- 8, 5 /* 40 bit */, 8,
- EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT,
- rc2_init_key,
- rc2_cbc_cipher,
- NULL,
- sizeof(EVP_RC2_KEY),
- rc2_set_asn1_type_and_iv,
- rc2_get_asn1_type_and_iv,
- rc2_ctrl,
+ .nid = NID_rc2_40_cbc,
+ .block_size = 8,
+ .key_len = 5,
+ .iv_len = 8,
+ .flags = EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT,
+ .init = rc2_init_key,
+ .do_cipher = rc2_cbc_cipher,
+ .cleanup = NULL,
+ .ctx_size = sizeof(EVP_RC2_KEY),
+ .set_asn1_parameters = rc2_set_asn1_type_and_iv,
+ .get_asn1_parameters = rc2_get_asn1_type_and_iv,
+ .ctrl = rc2_ctrl,
};
const EVP_CIPHER *
diff --git a/lib/libcrypto/evp/e_rc4.c b/lib/libcrypto/evp/e_rc4.c
index 4588dfc719c..c0f12fb03cf 100644
--- a/lib/libcrypto/evp/e_rc4.c
+++ b/lib/libcrypto/evp/e_rc4.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: e_rc4.c,v 1.18 2024/01/04 17:38:36 tb Exp $ */
+/* $OpenBSD: e_rc4.c,v 1.19 2024/01/07 15:42:57 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -83,29 +83,33 @@ static int rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
const unsigned char *in, size_t inl);
static const EVP_CIPHER r4_cipher = {
- NID_rc4,
- 1, EVP_RC4_KEY_SIZE, 0,
- EVP_CIPH_VARIABLE_LENGTH,
- rc4_init_key,
- rc4_cipher,
- NULL,
- sizeof(EVP_RC4_KEY),
- NULL,
- NULL,
- NULL,
+ .nid = NID_rc4,
+ .block_size = 1,
+ .key_len = EVP_RC4_KEY_SIZE,
+ .iv_len = 0,
+ .flags = EVP_CIPH_VARIABLE_LENGTH,
+ .init = rc4_init_key,
+ .do_cipher = rc4_cipher,
+ .cleanup = NULL,
+ .ctx_size = sizeof(EVP_RC4_KEY),
+ .set_asn1_parameters = NULL,
+ .get_asn1_parameters = NULL,
+ .ctrl = NULL,
};
static const EVP_CIPHER r4_40_cipher = {
- NID_rc4_40,
- 1, 5 /* 40 bit */, 0,
- EVP_CIPH_VARIABLE_LENGTH,
- rc4_init_key,
- rc4_cipher,
- NULL,
- sizeof(EVP_RC4_KEY),
- NULL,
- NULL,
- NULL,
+ .nid = NID_rc4_40,
+ .block_size = 1,
+ .key_len = 5,
+ .iv_len = 0,
+ .flags = EVP_CIPH_VARIABLE_LENGTH,
+ .init = rc4_init_key,
+ .do_cipher = rc4_cipher,
+ .cleanup = NULL,
+ .ctx_size = sizeof(EVP_RC4_KEY),
+ .set_asn1_parameters = NULL,
+ .get_asn1_parameters = NULL,
+ .ctrl = NULL,
};
const EVP_CIPHER *
diff --git a/lib/libcrypto/evp/e_rc4_hmac_md5.c b/lib/libcrypto/evp/e_rc4_hmac_md5.c
index a9301dcdc92..5701aeefc68 100644
--- a/lib/libcrypto/evp/e_rc4_hmac_md5.c
+++ b/lib/libcrypto/evp/e_rc4_hmac_md5.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: e_rc4_hmac_md5.c,v 1.13 2024/01/04 17:38:36 tb Exp $ */
+/* $OpenBSD: e_rc4_hmac_md5.c,v 1.14 2024/01/07 15:42:57 tb Exp $ */
/* ====================================================================
* Copyright (c) 2011 The OpenSSL Project. All rights reserved.
*
@@ -283,19 +283,21 @@ rc4_hmac_md5_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)
static EVP_CIPHER r4_hmac_md5_cipher = {
#ifdef NID_rc4_hmac_md5
- NID_rc4_hmac_md5,
+ .nid = NID_rc4_hmac_md5,
#else
- NID_undef,
+ .nid = NID_undef,
#endif
- 1, EVP_RC4_KEY_SIZE, 0,
- EVP_CIPH_STREAM_CIPHER|EVP_CIPH_VARIABLE_LENGTH|EVP_CIPH_FLAG_AEAD_CIPHER,
- rc4_hmac_md5_init_key,
- rc4_hmac_md5_cipher,
- NULL,
- sizeof(EVP_RC4_HMAC_MD5),
- NULL,
- NULL,
- rc4_hmac_md5_ctrl,
+ .block_size = 1,
+ .key_len = EVP_RC4_KEY_SIZE,
+ .iv_len = 0,
+ .flags = EVP_CIPH_STREAM_CIPHER|EVP_CIPH_VARIABLE_LENGTH|EVP_CIPH_FLAG_AEAD_CIPHER,
+ .init = rc4_hmac_md5_init_key,
+ .do_cipher = rc4_hmac_md5_cipher,
+ .cleanup = NULL,
+ .ctx_size = sizeof(EVP_RC4_HMAC_MD5),
+ .set_asn1_parameters = NULL,
+ .get_asn1_parameters = NULL,
+ .ctrl = rc4_hmac_md5_ctrl,
};
const EVP_CIPHER *
diff --git a/lib/libcrypto/evp/e_xcbc_d.c b/lib/libcrypto/evp/e_xcbc_d.c
index 5a3d535661e..dc01cbb9825 100644
--- a/lib/libcrypto/evp/e_xcbc_d.c
+++ b/lib/libcrypto/evp/e_xcbc_d.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: e_xcbc_d.c,v 1.16 2024/01/04 17:38:36 tb Exp $ */
+/* $OpenBSD: e_xcbc_d.c,v 1.17 2024/01/07 15:42:57 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -84,16 +84,18 @@ typedef struct {
#define data(ctx) ((DESX_CBC_KEY *)(ctx)->cipher_data)
static const EVP_CIPHER d_xcbc_cipher = {
- NID_desx_cbc,
- 8, 24, 8,
- EVP_CIPH_CBC_MODE,
- desx_cbc_init_key,
- desx_cbc_cipher,
- NULL,
- sizeof(DESX_CBC_KEY),
- EVP_CIPHER_set_asn1_iv,
- EVP_CIPHER_get_asn1_iv,
- NULL,
+ .nid = NID_desx_cbc,
+ .block_size = 8,
+ .key_len = 24,
+ .iv_len = 8,
+ .flags = EVP_CIPH_CBC_MODE,
+ .init = desx_cbc_init_key,
+ .do_cipher = desx_cbc_cipher,
+ .cleanup = NULL,
+ .ctx_size = sizeof(DESX_CBC_KEY),
+ .set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
+ .get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
+ .ctrl = NULL,
};
const EVP_CIPHER *