diff options
| author | miod <> | 2014-04-27 20:26:49 +0000 |
|---|---|---|
| committer | miod <> | 2014-04-27 20:26:49 +0000 |
| commit | 45bb7f0ae87ddf787dd06d515db9afb04a74bf6c (patch) | |
| tree | 319f4236c4f33e8d28d3d3a51c99e82d996e948f /src/lib/libcrypto/engine | |
| parent | cbbb78bcf8e4dca14564fbea5fdfe0703e2951cc (diff) | |
| download | openbsd-45bb7f0ae87ddf787dd06d515db9afb04a74bf6c.tar.gz openbsd-45bb7f0ae87ddf787dd06d515db9afb04a74bf6c.tar.bz2 openbsd-45bb7f0ae87ddf787dd06d515db9afb04a74bf6c.zip | |
Use C99 initializers for the various FOO_METHOD structs. More readable, and
avoid unreadable/unmaintainable constructs like that:
const EVP_PKEY_ASN1_METHOD cmac_asn1_meth =
{
EVP_PKEY_CMAC,
EVP_PKEY_CMAC,
0,
"CMAC",
"OpenSSL CMAC method",
0,0,0,0,
0,0,0,
cmac_size,
0,
0,0,0,0,0,0,0,
cmac_key_free,
0,
0,0
};
ok matthew@ deraadt@
Diffstat (limited to 'src/lib/libcrypto/engine')
| -rw-r--r-- | src/lib/libcrypto/engine/eng_padlock.c | 9 | ||||
| -rw-r--r-- | src/lib/libcrypto/engine/eng_rdrand.c | 14 | ||||
| -rw-r--r-- | src/lib/libcrypto/engine/eng_rsax.c | 22 | ||||
| -rw-r--r-- | src/lib/libcrypto/engine/hw_cryptodev.c | 34 |
4 files changed, 17 insertions, 62 deletions
diff --git a/src/lib/libcrypto/engine/eng_padlock.c b/src/lib/libcrypto/engine/eng_padlock.c index d5d9a16bf2..c27181ba75 100644 --- a/src/lib/libcrypto/engine/eng_padlock.c +++ b/src/lib/libcrypto/engine/eng_padlock.c | |||
| @@ -1086,12 +1086,9 @@ padlock_rand_status(void) | |||
| 1086 | 1086 | ||
| 1087 | /* Prepare structure for registration */ | 1087 | /* Prepare structure for registration */ |
| 1088 | static RAND_METHOD padlock_rand = { | 1088 | static RAND_METHOD padlock_rand = { |
| 1089 | NULL, /* seed */ | 1089 | .bytes = padlock_rand_bytes, |
| 1090 | padlock_rand_bytes, /* bytes */ | 1090 | .pseudorand = padlock_rand_bytes, |
| 1091 | NULL, /* cleanup */ | 1091 | .status = padlock_rand_status |
| 1092 | NULL, /* add */ | ||
| 1093 | padlock_rand_bytes, /* pseudorand */ | ||
| 1094 | padlock_rand_status, /* rand status */ | ||
| 1095 | }; | 1092 | }; |
| 1096 | 1093 | ||
| 1097 | #else /* !COMPILE_HW_PADLOCK */ | 1094 | #else /* !COMPILE_HW_PADLOCK */ |
diff --git a/src/lib/libcrypto/engine/eng_rdrand.c b/src/lib/libcrypto/engine/eng_rdrand.c index 4e9e91d54b..ba1b5bfbff 100644 --- a/src/lib/libcrypto/engine/eng_rdrand.c +++ b/src/lib/libcrypto/engine/eng_rdrand.c | |||
| @@ -84,15 +84,11 @@ static int get_random_bytes (unsigned char *buf, int num) | |||
| 84 | static int random_status (void) | 84 | static int random_status (void) |
| 85 | { return 1; } | 85 | { return 1; } |
| 86 | 86 | ||
| 87 | static RAND_METHOD rdrand_meth = | 87 | static RAND_METHOD rdrand_meth = { |
| 88 | { | 88 | .bytes = get_random_bytes, |
| 89 | NULL, /* seed */ | 89 | .pseudorand = get_random_bytes, |
| 90 | get_random_bytes, | 90 | .status = random_status |
| 91 | NULL, /* cleanup */ | 91 | }; |
| 92 | NULL, /* add */ | ||
| 93 | get_random_bytes, | ||
| 94 | random_status, | ||
| 95 | }; | ||
| 96 | 92 | ||
| 97 | static int rdrand_init(ENGINE *e) | 93 | static int rdrand_init(ENGINE *e) |
| 98 | { return 1; } | 94 | { return 1; } |
diff --git a/src/lib/libcrypto/engine/eng_rsax.c b/src/lib/libcrypto/engine/eng_rsax.c index fa9159499d..c0f6851601 100644 --- a/src/lib/libcrypto/engine/eng_rsax.c +++ b/src/lib/libcrypto/engine/eng_rsax.c | |||
| @@ -116,22 +116,12 @@ static const ENGINE_CMD_DEFN e_rsax_cmd_defns[] = { | |||
| 116 | 116 | ||
| 117 | #ifndef OPENSSL_NO_RSA | 117 | #ifndef OPENSSL_NO_RSA |
| 118 | /* Our internal RSA_METHOD that we provide pointers to */ | 118 | /* Our internal RSA_METHOD that we provide pointers to */ |
| 119 | static RSA_METHOD e_rsax_rsa = | 119 | static RSA_METHOD e_rsax_rsa = { |
| 120 | { | 120 | .name = "Intel RSA-X method", |
| 121 | "Intel RSA-X method", | 121 | .rsa_mod_exp = e_rsax_rsa_mod_exp, |
| 122 | NULL, | 122 | .finish = e_rsax_rsa_finish, |
| 123 | NULL, | 123 | .flags = RSA_FLAG_CACHE_PUBLIC|RSA_FLAG_CACHE_PRIVATE, |
| 124 | NULL, | 124 | }; |
| 125 | NULL, | ||
| 126 | e_rsax_rsa_mod_exp, | ||
| 127 | NULL, | ||
| 128 | NULL, | ||
| 129 | e_rsax_rsa_finish, | ||
| 130 | RSA_FLAG_CACHE_PUBLIC|RSA_FLAG_CACHE_PRIVATE, | ||
| 131 | NULL, | ||
| 132 | NULL, | ||
| 133 | NULL | ||
| 134 | }; | ||
| 135 | #endif | 125 | #endif |
| 136 | 126 | ||
| 137 | /* Constants used when creating the ENGINE */ | 127 | /* Constants used when creating the ENGINE */ |
diff --git a/src/lib/libcrypto/engine/hw_cryptodev.c b/src/lib/libcrypto/engine/hw_cryptodev.c index 190dcc4f75..9b24511b69 100644 --- a/src/lib/libcrypto/engine/hw_cryptodev.c +++ b/src/lib/libcrypto/engine/hw_cryptodev.c | |||
| @@ -1039,19 +1039,7 @@ err: | |||
| 1039 | } | 1039 | } |
| 1040 | 1040 | ||
| 1041 | static RSA_METHOD cryptodev_rsa = { | 1041 | static RSA_METHOD cryptodev_rsa = { |
| 1042 | "cryptodev RSA method", | 1042 | .name = "cryptodev RSA method" |
| 1043 | NULL, /* rsa_pub_enc */ | ||
| 1044 | NULL, /* rsa_pub_dec */ | ||
| 1045 | NULL, /* rsa_priv_enc */ | ||
| 1046 | NULL, /* rsa_priv_dec */ | ||
| 1047 | NULL, | ||
| 1048 | NULL, | ||
| 1049 | NULL, /* init */ | ||
| 1050 | NULL, /* finish */ | ||
| 1051 | 0, /* flags */ | ||
| 1052 | NULL, /* app_data */ | ||
| 1053 | NULL, /* rsa_sign */ | ||
| 1054 | NULL /* rsa_verify */ | ||
| 1055 | }; | 1043 | }; |
| 1056 | 1044 | ||
| 1057 | static int | 1045 | static int |
| @@ -1181,16 +1169,7 @@ err: | |||
| 1181 | } | 1169 | } |
| 1182 | 1170 | ||
| 1183 | static DSA_METHOD cryptodev_dsa = { | 1171 | static DSA_METHOD cryptodev_dsa = { |
| 1184 | "cryptodev DSA method", | 1172 | .name = "cryptodev DSA method" |
| 1185 | NULL, | ||
| 1186 | NULL, /* dsa_sign_setup */ | ||
| 1187 | NULL, | ||
| 1188 | NULL, /* dsa_mod_exp */ | ||
| 1189 | NULL, | ||
| 1190 | NULL, /* init */ | ||
| 1191 | NULL, /* finish */ | ||
| 1192 | 0, /* flags */ | ||
| 1193 | NULL /* app_data */ | ||
| 1194 | }; | 1173 | }; |
| 1195 | 1174 | ||
| 1196 | static int | 1175 | static int |
| @@ -1244,14 +1223,7 @@ err: | |||
| 1244 | } | 1223 | } |
| 1245 | 1224 | ||
| 1246 | static DH_METHOD cryptodev_dh = { | 1225 | static DH_METHOD cryptodev_dh = { |
| 1247 | "cryptodev DH method", | 1226 | .name = "cryptodev DH method" |
| 1248 | NULL, /* cryptodev_dh_generate_key */ | ||
| 1249 | NULL, | ||
| 1250 | NULL, | ||
| 1251 | NULL, | ||
| 1252 | NULL, | ||
| 1253 | 0, /* flags */ | ||
| 1254 | NULL /* app_data */ | ||
| 1255 | }; | 1227 | }; |
| 1256 | 1228 | ||
| 1257 | /* | 1229 | /* |
