diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2014-04-27 20:26:50 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2014-04-27 20:26:50 +0000 |
commit | e5cffcd34247f85edfdeb62a15a64dfbfbd449e0 (patch) | |
tree | da4996e6e0a1e6f377715dfbc7b3352529477cba /lib/libcrypto/hmac | |
parent | a87db0183f55bcd74e22af7a30de8ff482d0495b (diff) |
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 'lib/libcrypto/hmac')
-rw-r--r-- | lib/libcrypto/hmac/hm_ameth.c | 30 | ||||
-rw-r--r-- | lib/libcrypto/hmac/hm_pmeth.c | 41 |
2 files changed, 21 insertions, 50 deletions
diff --git a/lib/libcrypto/hmac/hm_ameth.c b/lib/libcrypto/hmac/hm_ameth.c index fbada40d9cc..0625b066511 100644 --- a/lib/libcrypto/hmac/hm_ameth.c +++ b/lib/libcrypto/hmac/hm_ameth.c @@ -138,30 +138,20 @@ static int old_hmac_encode(const EVP_PKEY *pkey, unsigned char **pder) #endif -const EVP_PKEY_ASN1_METHOD hmac_asn1_meth = - { - EVP_PKEY_HMAC, - EVP_PKEY_HMAC, - 0, - - "HMAC", - "OpenSSL HMAC method", - - 0,0,0,0, +const EVP_PKEY_ASN1_METHOD hmac_asn1_meth = { + .pkey_id = EVP_PKEY_HMAC, + .pkey_base_id = EVP_PKEY_HMAC, - 0,0,0, + .pem_str = "HMAC", + .info = "OpenSSL HMAC method", - hmac_size, - 0, - 0,0,0,0,0,0,0, + .pkey_size = hmac_size, - hmac_key_free, - hmac_pkey_ctrl, + .pkey_free = hmac_key_free, + .pkey_ctrl = hmac_pkey_ctrl, #ifdef HMAC_TEST_PRIVATE_KEY_FORMAT - old_hmac_decode, - old_hmac_encode -#else - 0,0 + .old_priv_decode = old_hmac_decode, + .old_priv_encode = old_hmac_encode #endif }; diff --git a/lib/libcrypto/hmac/hm_pmeth.c b/lib/libcrypto/hmac/hm_pmeth.c index f1c67329d03..4d287724c30 100644 --- a/lib/libcrypto/hmac/hm_pmeth.c +++ b/lib/libcrypto/hmac/hm_pmeth.c @@ -235,37 +235,18 @@ static int pkey_hmac_ctrl_str(EVP_PKEY_CTX *ctx, return -2; } -const EVP_PKEY_METHOD hmac_pkey_meth = - { - EVP_PKEY_HMAC, - 0, - pkey_hmac_init, - pkey_hmac_copy, - pkey_hmac_cleanup, - - 0, 0, - - 0, - pkey_hmac_keygen, - - 0, 0, - - 0, 0, - - 0,0, - - hmac_signctx_init, - hmac_signctx, - - 0,0, - - 0,0, +const EVP_PKEY_METHOD hmac_pkey_meth = { + .pkey_id = EVP_PKEY_HMAC, - 0,0, + .init = pkey_hmac_init, + .copy = pkey_hmac_copy, + .cleanup = pkey_hmac_cleanup, - 0,0, + .keygen = pkey_hmac_keygen, - pkey_hmac_ctrl, - pkey_hmac_ctrl_str + .signctx_init = hmac_signctx_init, + .signctx = hmac_signctx, - }; + .ctrl = pkey_hmac_ctrl, + .ctrl_str = pkey_hmac_ctrl_str +}; |