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/evp | |
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/evp')
-rw-r--r-- | lib/libcrypto/evp/bio_b64.c | 23 | ||||
-rw-r--r-- | lib/libcrypto/evp/bio_enc.c | 22 | ||||
-rw-r--r-- | lib/libcrypto/evp/bio_md.c | 23 | ||||
-rw-r--r-- | lib/libcrypto/evp/bio_ok.c | 22 |
4 files changed, 42 insertions, 48 deletions
diff --git a/lib/libcrypto/evp/bio_b64.c b/lib/libcrypto/evp/bio_b64.c index 27fc587ca80..02631ec05a0 100644 --- a/lib/libcrypto/evp/bio_b64.c +++ b/lib/libcrypto/evp/bio_b64.c @@ -91,18 +91,17 @@ typedef struct b64_struct char tmp[B64_BLOCK_SIZE]; } BIO_B64_CTX; -static BIO_METHOD methods_b64= - { - BIO_TYPE_BASE64,"base64 encoding", - b64_write, - b64_read, - b64_puts, - NULL, /* b64_gets, */ - b64_ctrl, - b64_new, - b64_free, - b64_callback_ctrl, - }; +static BIO_METHOD methods_b64= { + .type = BIO_TYPE_BASE64, + .name = "base64 encoding", + .bwrite = b64_write, + .bread = b64_read, + .bputs = b64_puts, + .ctrl = b64_ctrl, + .create = b64_new, + .destroy = b64_free, + .callback_ctrl = b64_callback_ctrl +}; BIO_METHOD *BIO_f_base64(void) { diff --git a/lib/libcrypto/evp/bio_enc.c b/lib/libcrypto/evp/bio_enc.c index 8fe9a45e481..3362c257681 100644 --- a/lib/libcrypto/evp/bio_enc.c +++ b/lib/libcrypto/evp/bio_enc.c @@ -87,18 +87,16 @@ typedef struct enc_struct char buf[ENC_BLOCK_SIZE+BUF_OFFSET+2]; } BIO_ENC_CTX; -static BIO_METHOD methods_enc= - { - BIO_TYPE_CIPHER,"cipher", - enc_write, - enc_read, - NULL, /* enc_puts, */ - NULL, /* enc_gets, */ - enc_ctrl, - enc_new, - enc_free, - enc_callback_ctrl, - }; +static BIO_METHOD methods_enc= { + .type = BIO_TYPE_CIPHER, + .name = "cipher", + .bwrite = enc_write, + .bread = enc_read, + .ctrl = enc_ctrl, + .create = enc_new, + .destroy = enc_free, + .callback_ctrl = enc_callback_ctrl +}; BIO_METHOD *BIO_f_cipher(void) { diff --git a/lib/libcrypto/evp/bio_md.c b/lib/libcrypto/evp/bio_md.c index 144fdfd56a0..85eead6c952 100644 --- a/lib/libcrypto/evp/bio_md.c +++ b/lib/libcrypto/evp/bio_md.c @@ -74,18 +74,17 @@ static int md_new(BIO *h); static int md_free(BIO *data); static long md_callback_ctrl(BIO *h,int cmd,bio_info_cb *fp); -static BIO_METHOD methods_md= - { - BIO_TYPE_MD,"message digest", - md_write, - md_read, - NULL, /* md_puts, */ - md_gets, - md_ctrl, - md_new, - md_free, - md_callback_ctrl, - }; +static BIO_METHOD methods_md = { + .type = BIO_TYPE_MD, + .name = "message digest", + .bwrite = md_write, + .bread = md_read, + .bgets = md_gets, + .ctrl = md_ctrl, + .create = md_new, + .destroy = md_free, + .callback_ctrl = md_callback_ctrl +}; BIO_METHOD *BIO_f_md(void) { diff --git a/lib/libcrypto/evp/bio_ok.c b/lib/libcrypto/evp/bio_ok.c index 09a762ffacd..d0bcbc2bef9 100644 --- a/lib/libcrypto/evp/bio_ok.c +++ b/lib/libcrypto/evp/bio_ok.c @@ -157,18 +157,16 @@ typedef struct ok_struct unsigned char buf[IOBS]; } BIO_OK_CTX; -static BIO_METHOD methods_ok= - { - BIO_TYPE_CIPHER,"reliable", - ok_write, - ok_read, - NULL, /* ok_puts, */ - NULL, /* ok_gets, */ - ok_ctrl, - ok_new, - ok_free, - ok_callback_ctrl, - }; +static BIO_METHOD methods_ok = { + .type = BIO_TYPE_CIPHER, + .name = "reliable", + .bwrite = ok_write, + .bread = ok_read, + .ctrl = ok_ctrl, + .create = ok_new, + .destroy = ok_free, + .callback_ctrl = ok_callback_ctrl +}; BIO_METHOD *BIO_f_reliable(void) { |