Use C99 initializers for the various FOO_METHOD structs. More readable, and
authormiod <miod@openbsd.org>
Sun, 27 Apr 2014 20:26:46 +0000 (20:26 +0000)
committermiod <miod@openbsd.org>
Sun, 27 Apr 2014 20:26:46 +0000 (20:26 +0000)
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@

114 files changed:
lib/libcrypto/asn1/bio_asn1.c
lib/libcrypto/asn1/x_crl.c
lib/libcrypto/bio/bf_buff.c
lib/libcrypto/bio/bf_lbuf.c
lib/libcrypto/bio/bf_nbio.c
lib/libcrypto/bio/bf_null.c
lib/libcrypto/bio/bss_acpt.c
lib/libcrypto/bio/bss_bio.c
lib/libcrypto/bio/bss_conn.c
lib/libcrypto/bio/bss_dgram.c
lib/libcrypto/bio/bss_fd.c
lib/libcrypto/bio/bss_file.c
lib/libcrypto/bio/bss_log.c
lib/libcrypto/bio/bss_mem.c
lib/libcrypto/bio/bss_null.c
lib/libcrypto/bio/bss_sock.c
lib/libcrypto/cmac/cm_ameth.c
lib/libcrypto/cmac/cm_pmeth.c
lib/libcrypto/comp/c_rle.c
lib/libcrypto/comp/c_zlib.c
lib/libcrypto/conf/conf_def.c
lib/libcrypto/dh/dh_ameth.c
lib/libcrypto/dh/dh_key.c
lib/libcrypto/dh/dh_pmeth.c
lib/libcrypto/dsa/dsa_ameth.c
lib/libcrypto/dsa/dsa_ossl.c
lib/libcrypto/dsa/dsa_pmeth.c
lib/libcrypto/dso/dso_dlfcn.c
lib/libcrypto/dso/dso_null.c
lib/libcrypto/ec/ec2_smpl.c
lib/libcrypto/ec/ec_ameth.c
lib/libcrypto/ec/ec_pmeth.c
lib/libcrypto/ec/ecp_mont.c
lib/libcrypto/ec/ecp_nist.c
lib/libcrypto/ec/ecp_nistp224.c
lib/libcrypto/ec/ecp_nistp256.c
lib/libcrypto/ec/ecp_nistp521.c
lib/libcrypto/ec/ecp_smpl.c
lib/libcrypto/ecdh/ech_ossl.c
lib/libcrypto/ecdsa/ecs_ossl.c
lib/libcrypto/engine/eng_padlock.c
lib/libcrypto/engine/eng_rdrand.c
lib/libcrypto/engine/eng_rsax.c
lib/libcrypto/engine/hw_cryptodev.c
lib/libcrypto/evp/bio_b64.c
lib/libcrypto/evp/bio_enc.c
lib/libcrypto/evp/bio_md.c
lib/libcrypto/evp/bio_ok.c
lib/libcrypto/hmac/hm_ameth.c
lib/libcrypto/hmac/hm_pmeth.c
lib/libcrypto/pkcs7/bio_ber.c
lib/libcrypto/rsa/rsa_ameth.c
lib/libcrypto/rsa/rsa_eay.c
lib/libcrypto/rsa/rsa_null.c
lib/libcrypto/rsa/rsa_pmeth.c
lib/libcrypto/store/str_mem.c
lib/libcrypto/ui/ui_openssl.c
lib/libssl/src/crypto/asn1/bio_asn1.c
lib/libssl/src/crypto/asn1/x_crl.c
lib/libssl/src/crypto/bio/bf_buff.c
lib/libssl/src/crypto/bio/bf_lbuf.c
lib/libssl/src/crypto/bio/bf_nbio.c
lib/libssl/src/crypto/bio/bf_null.c
lib/libssl/src/crypto/bio/bss_acpt.c
lib/libssl/src/crypto/bio/bss_bio.c
lib/libssl/src/crypto/bio/bss_conn.c
lib/libssl/src/crypto/bio/bss_dgram.c
lib/libssl/src/crypto/bio/bss_fd.c
lib/libssl/src/crypto/bio/bss_file.c
lib/libssl/src/crypto/bio/bss_log.c
lib/libssl/src/crypto/bio/bss_mem.c
lib/libssl/src/crypto/bio/bss_null.c
lib/libssl/src/crypto/bio/bss_sock.c
lib/libssl/src/crypto/cmac/cm_ameth.c
lib/libssl/src/crypto/cmac/cm_pmeth.c
lib/libssl/src/crypto/comp/c_rle.c
lib/libssl/src/crypto/comp/c_zlib.c
lib/libssl/src/crypto/conf/conf_def.c
lib/libssl/src/crypto/dh/dh_ameth.c
lib/libssl/src/crypto/dh/dh_key.c
lib/libssl/src/crypto/dh/dh_pmeth.c
lib/libssl/src/crypto/dsa/dsa_ameth.c
lib/libssl/src/crypto/dsa/dsa_ossl.c
lib/libssl/src/crypto/dsa/dsa_pmeth.c
lib/libssl/src/crypto/dso/dso_dlfcn.c
lib/libssl/src/crypto/dso/dso_null.c
lib/libssl/src/crypto/ec/ec2_smpl.c
lib/libssl/src/crypto/ec/ec_ameth.c
lib/libssl/src/crypto/ec/ec_pmeth.c
lib/libssl/src/crypto/ec/ecp_mont.c
lib/libssl/src/crypto/ec/ecp_nist.c
lib/libssl/src/crypto/ec/ecp_nistp224.c
lib/libssl/src/crypto/ec/ecp_nistp256.c
lib/libssl/src/crypto/ec/ecp_nistp521.c
lib/libssl/src/crypto/ec/ecp_smpl.c
lib/libssl/src/crypto/ecdh/ech_ossl.c
lib/libssl/src/crypto/ecdsa/ecs_ossl.c
lib/libssl/src/crypto/engine/eng_padlock.c
lib/libssl/src/crypto/engine/eng_rdrand.c
lib/libssl/src/crypto/engine/eng_rsax.c
lib/libssl/src/crypto/engine/hw_cryptodev.c
lib/libssl/src/crypto/evp/bio_b64.c
lib/libssl/src/crypto/evp/bio_enc.c
lib/libssl/src/crypto/evp/bio_md.c
lib/libssl/src/crypto/evp/bio_ok.c
lib/libssl/src/crypto/hmac/hm_ameth.c
lib/libssl/src/crypto/hmac/hm_pmeth.c
lib/libssl/src/crypto/pkcs7/bio_ber.c
lib/libssl/src/crypto/rsa/rsa_ameth.c
lib/libssl/src/crypto/rsa/rsa_eay.c
lib/libssl/src/crypto/rsa/rsa_null.c
lib/libssl/src/crypto/rsa/rsa_pmeth.c
lib/libssl/src/crypto/store/str_mem.c
lib/libssl/src/crypto/ui/ui_openssl.c

index 36b8275..327355e 100644 (file)
@@ -124,16 +124,16 @@ static int asn1_bio_setup_ex(BIO *b, BIO_ASN1_BUF_CTX *ctx,
     asn1_bio_state_t other_state);
 
 static BIO_METHOD methods_asn1 = {
-       BIO_TYPE_ASN1,
-       "asn1",
-       asn1_bio_write,
-       asn1_bio_read,
-       asn1_bio_puts,
-       asn1_bio_gets,
-       asn1_bio_ctrl,
-       asn1_bio_new,
-       asn1_bio_free,
-       asn1_bio_callback_ctrl,
+       .type = BIO_TYPE_ASN1,
+       .name = "asn1",
+       .bwrite = asn1_bio_write,
+       .bread = asn1_bio_read,
+       .bputs = asn1_bio_puts,
+       .bgets = asn1_bio_gets,
+       .ctrl = asn1_bio_ctrl,
+       .create = asn1_bio_new,
+       .destroy = asn1_bio_free,
+       .callback_ctrl = asn1_bio_callback_ctrl
 };
 
 BIO_METHOD *
index 674cca4..097a39c 100644 (file)
@@ -78,11 +78,8 @@ static int def_crl_lookup(X509_CRL *crl, X509_REVOKED **ret,
     ASN1_INTEGER *serial, X509_NAME *issuer);
 
 static X509_CRL_METHOD int_crl_meth = {
-       0,
-       0,
-       0,
-       def_crl_lookup,
-       def_crl_verify
+       .crl_lookup = def_crl_lookup,
+       .crl_verify = def_crl_verify
 };
 
 static const X509_CRL_METHOD *default_crl_method = &int_crl_meth;
index 99be1a6..e96da40 100644 (file)
@@ -72,16 +72,16 @@ static long buffer_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
 #define DEFAULT_BUFFER_SIZE    4096
 
 static BIO_METHOD methods_buffer = {
-       BIO_TYPE_BUFFER,
-       "buffer",
-       buffer_write,
-       buffer_read,
-       buffer_puts,
-       buffer_gets,
-       buffer_ctrl,
-       buffer_new,
-       buffer_free,
-       buffer_callback_ctrl,
+       .type = BIO_TYPE_BUFFER,
+       .name = "buffer",
+       .bwrite = buffer_write,
+       .bread = buffer_read,
+       .bputs = buffer_puts,
+       .bgets = buffer_gets,
+       .ctrl = buffer_ctrl,
+       .create = buffer_new,
+       .destroy = buffer_free,
+       .callback_ctrl = buffer_callback_ctrl
 };
 
 BIO_METHOD *
index f0bd0d7..54c370d 100644 (file)
@@ -77,16 +77,16 @@ static long linebuffer_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
 /* #define DEBUG */
 
 static BIO_METHOD methods_linebuffer = {
-       BIO_TYPE_LINEBUFFER,
-       "linebuffer",
-       linebuffer_write,
-       linebuffer_read,
-       linebuffer_puts,
-       linebuffer_gets,
-       linebuffer_ctrl,
-       linebuffer_new,
-       linebuffer_free,
-       linebuffer_callback_ctrl,
+       .type = BIO_TYPE_LINEBUFFER,
+       .name = "linebuffer",
+       .bwrite = linebuffer_write,
+       .bread = linebuffer_read,
+       .bputs = linebuffer_puts,
+       .bgets = linebuffer_gets,
+       .ctrl = linebuffer_ctrl,
+       .create = linebuffer_new,
+       .destroy = linebuffer_free,
+       .callback_ctrl = linebuffer_callback_ctrl
 };
 
 BIO_METHOD *
index 048e689..5a0f6b2 100644 (file)
@@ -81,16 +81,16 @@ typedef struct nbio_test_st {
 } NBIO_TEST;
 
 static BIO_METHOD methods_nbiof = {
-       BIO_TYPE_NBIO_TEST,
-       "non-blocking IO test filter",
-       nbiof_write,
-       nbiof_read,
-       nbiof_puts,
-       nbiof_gets,
-       nbiof_ctrl,
-       nbiof_new,
-       nbiof_free,
-       nbiof_callback_ctrl,
+       .type = BIO_TYPE_NBIO_TEST,
+       .name = "non-blocking IO test filter",
+       .bwrite = nbiof_write,
+       .bread = nbiof_read,
+       .bputs = nbiof_puts,
+       .bgets = nbiof_gets,
+       .ctrl = nbiof_ctrl,
+       .create = nbiof_new,
+       .destroy = nbiof_free,
+       .callback_ctrl = nbiof_callback_ctrl
 };
 
 BIO_METHOD *
index 3bba2af..7554ed9 100644 (file)
@@ -74,16 +74,16 @@ static int nullf_free(BIO *data);
 static long nullf_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
 
 static BIO_METHOD methods_nullf = {
-       BIO_TYPE_NULL_FILTER,
-       "NULL filter",
-       nullf_write,
-       nullf_read,
-       nullf_puts,
-       nullf_gets,
-       nullf_ctrl,
-       nullf_new,
-       nullf_free,
-       nullf_callback_ctrl,
+       .type = BIO_TYPE_NULL_FILTER,
+       .name = "NULL filter",
+       .bwrite = nullf_write,
+       .bread = nullf_read,
+       .bputs = nullf_puts,
+       .bgets = nullf_gets,
+       .ctrl = nullf_ctrl,
+       .create = nullf_new,
+       .destroy = nullf_free,
+       .callback_ctrl = nullf_callback_ctrl
 };
 
 BIO_METHOD *
index 916af3c..943d3d9 100644 (file)
@@ -98,16 +98,14 @@ static void BIO_ACCEPT_free(BIO_ACCEPT *a);
 #define ACPT_S_OK                      3
 
 static BIO_METHOD methods_acceptp = {
-       BIO_TYPE_ACCEPT,
-       "socket accept",
-       acpt_write,
-       acpt_read,
-       acpt_puts,
-       NULL, /* connect_gets, */
-       acpt_ctrl,
-       acpt_new,
-       acpt_free,
-       NULL,
+       .type = BIO_TYPE_ACCEPT,
+       .name = "socket accept",
+       .bwrite = acpt_write,
+       .bread = acpt_read,
+       .bputs = acpt_puts,
+       .ctrl = acpt_ctrl,
+       .create = acpt_new,
+       .destroy = acpt_free
 };
 
 BIO_METHOD *
index d31e598..1a17cdf 100644 (file)
@@ -94,16 +94,14 @@ static int bio_make_pair(BIO *bio1, BIO *bio2);
 static void bio_destroy_pair(BIO *bio);
 
 static BIO_METHOD methods_biop = {
-       BIO_TYPE_BIO,
-       "BIO pair",
-       bio_write,
-       bio_read,
-       bio_puts,
-       NULL /* no bio_gets */,
-       bio_ctrl,
-       bio_new,
-       bio_free,
-       NULL /* no bio_callback_ctrl */
+       .type = BIO_TYPE_BIO,
+       .name = "BIO pair",
+       .bwrite = bio_write,
+       .bread = bio_read,
+       .bputs = bio_puts,
+       .ctrl = bio_ctrl,
+       .create = bio_new,
+       .destroy = bio_free
 };
 
 BIO_METHOD *
index d7a8619..7ed8f1f 100644 (file)
@@ -103,16 +103,15 @@ BIO_CONNECT *BIO_CONNECT_new(void);
 void BIO_CONNECT_free(BIO_CONNECT *a);
 
 static BIO_METHOD methods_connectp = {
-       BIO_TYPE_CONNECT,
-       "socket connect",
-       conn_write,
-       conn_read,
-       conn_puts,
-       NULL, /* connect_gets, */
-       conn_ctrl,
-       conn_new,
-       conn_free,
-       conn_callback_ctrl,
+       .type = BIO_TYPE_CONNECT,
+       .name = "socket connect",
+       .bwrite = conn_write,
+       .bread = conn_read,
+       .bputs = conn_puts,
+       .ctrl = conn_ctrl,
+       .create = conn_new,
+       .destroy = conn_free,
+       .callback_ctrl = conn_callback_ctrl
 };
 
 static int
index 8c08eff..8f7439c 100644 (file)
@@ -106,30 +106,26 @@ static int BIO_dgram_should_retry(int s);
 static void get_current_time(struct timeval *t);
 
 static BIO_METHOD methods_dgramp = {
-       BIO_TYPE_DGRAM,
-       "datagram socket",
-       dgram_write,
-       dgram_read,
-       dgram_puts,
-       NULL, /* dgram_gets, */
-       dgram_ctrl,
-       dgram_new,
-       dgram_free,
-       NULL,
+       .type = BIO_TYPE_DGRAM,
+       .name = "datagram socket",
+       .bwrite = dgram_write,
+       .bread = dgram_read,
+       .bputs = dgram_puts,
+       .ctrl = dgram_ctrl,
+       .create = dgram_new,
+       .destroy = dgram_free
 };
 
 #ifndef OPENSSL_NO_SCTP
 static BIO_METHOD methods_dgramp_sctp = {
-       BIO_TYPE_DGRAM_SCTP,
-       "datagram sctp socket",
-       dgram_sctp_write,
-       dgram_sctp_read,
-       dgram_sctp_puts,
-       NULL, /* dgram_gets, */
-       dgram_sctp_ctrl,
-       dgram_sctp_new,
-       dgram_sctp_free,
-       NULL,
+       .type = BIO_TYPE_DGRAM_SCTP,
+       .name = "datagram sctp socket",
+       .bwrite = dgram_sctp_write,
+       .bread = dgram_sctp_read,
+       .bputs = dgram_sctp_puts,
+       .ctrl = dgram_sctp_ctrl,
+       .create = dgram_sctp_new,
+       .destroy = dgram_sctp_free
 };
 #endif
 
index 8ea80f1..04a88a1 100644 (file)
@@ -79,15 +79,15 @@ static int fd_free(BIO *data);
 int BIO_fd_should_retry(int s);
 
 static BIO_METHOD methods_fdp = {
-       BIO_TYPE_FD, "file descriptor",
-       fd_write,
-       fd_read,
-       fd_puts,
-       fd_gets,
-       fd_ctrl,
-       fd_new,
-       fd_free,
-       NULL,
+       .type = BIO_TYPE_FD,
+       .name = "file descriptor",
+       .bwrite = fd_write,
+       .bread = fd_read,
+       .bputs = fd_puts,
+       .bgets = fd_gets,
+       .ctrl = fd_ctrl,
+       .create = fd_new,
+       .destroy = fd_free
 };
 
 BIO_METHOD *
index 6d5444f..6f81a45 100644 (file)
@@ -100,16 +100,15 @@ static int file_new(BIO *h);
 static int file_free(BIO *data);
 
 static BIO_METHOD methods_filep = {
-       BIO_TYPE_FILE,
-       "FILE pointer",
-       file_write,
-       file_read,
-       file_puts,
-       file_gets,
-       file_ctrl,
-       file_new,
-       file_free,
-       NULL,
+       .type = BIO_TYPE_FILE,
+       .name = "FILE pointer",
+       .bwrite = file_write,
+       .bread = file_read,
+       .bputs = file_puts,
+       .bgets = file_gets,
+       .ctrl = file_ctrl,
+       .create = file_new,
+       .destroy = file_free
 };
 
 BIO *
index 6aa2d8b..ac1cbc5 100644 (file)
@@ -86,15 +86,13 @@ static void xsyslog(BIO* bp, int priority, const char* string);
 static void xcloselog(BIO* bp);
 
 static BIO_METHOD methods_slg = {
-       BIO_TYPE_MEM, "syslog",
-       slg_write,
-       NULL,
-       slg_puts,
-       NULL,
-       slg_ctrl,
-       slg_new,
-       slg_free,
-       NULL,
+       .type = BIO_TYPE_MEM,
+       .name = "syslog",
+       .bwrite = slg_write,
+       .bputs = slg_puts,
+       .ctrl = slg_ctrl,
+       .create = slg_new,
+       .destroy = slg_free
 };
 
 BIO_METHOD *
index 1a477c1..b147a8e 100644 (file)
@@ -70,16 +70,15 @@ static int mem_new(BIO *h);
 static int mem_free(BIO *data);
 
 static BIO_METHOD mem_method = {
-       BIO_TYPE_MEM,
-       "memory buffer",
-       mem_write,
-       mem_read,
-       mem_puts,
-       mem_gets,
-       mem_ctrl,
-       mem_new,
-       mem_free,
-       NULL,
+       .type = BIO_TYPE_MEM,
+       .name = "memory buffer",
+       .bwrite = mem_write,
+       .bread = mem_read,
+       .bputs = mem_puts,
+       .bgets = mem_gets,
+       .ctrl = mem_ctrl,
+       .create = mem_new,
+       .destroy = mem_free
 };
 
 /* bio->num is used to hold the value to return on 'empty', if it is
index c728972..a5796ea 100644 (file)
@@ -70,16 +70,15 @@ static int null_new(BIO *h);
 static int null_free(BIO *data);
 
 static BIO_METHOD null_method = {
-       BIO_TYPE_NULL,
-       "NULL",
-       null_write,
-       null_read,
-       null_puts,
-       null_gets,
-       null_ctrl,
-       null_new,
-       null_free,
-       NULL,
+       .type = BIO_TYPE_NULL,
+       .name = "NULL",
+       .bwrite = null_write,
+       .bread = null_read,
+       .bputs = null_puts,
+       .bgets = null_gets,
+       .ctrl = null_ctrl,
+       .create = null_new,
+       .destroy = null_free
 };
 
 BIO_METHOD *
index 3dae256..757e1db 100644 (file)
@@ -74,16 +74,14 @@ static int sock_free(BIO *data);
 int BIO_sock_should_retry(int s);
 
 static BIO_METHOD methods_sockp = {
-       BIO_TYPE_SOCKET,
-       "socket",
-       sock_write,
-       sock_read,
-       sock_puts,
-       NULL, /* sock_gets, */
-       sock_ctrl,
-       sock_new,
-       sock_free,
-       NULL,
+       .type = BIO_TYPE_SOCKET,
+       .name = "socket",
+       .bwrite = sock_write,
+       .bread = sock_read,
+       .bputs = sock_puts,
+       .ctrl = sock_ctrl,
+       .create = sock_new,
+       .destroy = sock_free
 };
 
 BIO_METHOD *
index 0b8e567..c960e1c 100644 (file)
@@ -73,25 +73,14 @@ static void cmac_key_free(EVP_PKEY *pkey)
                CMAC_CTX_free(cmctx);
        }
 
-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,
+const EVP_PKEY_ASN1_METHOD cmac_asn1_meth = {
+       .pkey_id = EVP_PKEY_CMAC,
+       .pkey_base_id = EVP_PKEY_CMAC,
 
-       cmac_size,
-       0,
-       0,0,0,0,0,0,0,
+       .pem_str = "CMAC",
+       .info = "OpenSSL CMAC method",
 
-       cmac_key_free,
-       0,
-       0,0
-       };
+       .pkey_size = cmac_size,
+       .pkey_free = cmac_key_free
+};
 
index 00aa4d6..e1a00e9 100644 (file)
@@ -188,37 +188,19 @@ static int pkey_cmac_ctrl_str(EVP_PKEY_CTX *ctx,
        return -2;
        }
 
-const EVP_PKEY_METHOD cmac_pkey_meth = 
-       {
-       EVP_PKEY_CMAC,
-       EVP_PKEY_FLAG_SIGCTX_CUSTOM,
-       pkey_cmac_init,
-       pkey_cmac_copy,
-       pkey_cmac_cleanup,
-
-       0, 0,
-
-       0,
-       pkey_cmac_keygen,
-
-       0, 0,
-
-       0, 0,
-
-       0,0,
-
-       cmac_signctx_init,
-       cmac_signctx,
-
-       0,0,
-
-       0,0,
+const EVP_PKEY_METHOD cmac_pkey_meth = {
+       .pkey_id = EVP_PKEY_CMAC,
+       .flags = EVP_PKEY_FLAG_SIGCTX_CUSTOM,
 
-       0,0,
+       .init = pkey_cmac_init,
+       .copy = pkey_cmac_copy,
+       .cleanup = pkey_cmac_cleanup,
 
-       0,0,
+       .keygen = pkey_cmac_keygen,
 
-       pkey_cmac_ctrl,
-       pkey_cmac_ctrl_str
+       .signctx_init = cmac_signctx_init,
+       .signctx = cmac_signctx,
 
-       };
+       .ctrl = pkey_cmac_ctrl,
+       .ctrl_str = pkey_cmac_ctrl_str
+};
index 7a5db29..48e48cb 100644 (file)
@@ -10,14 +10,10 @@ static int rle_expand_block(COMP_CTX *ctx, unsigned char *out,
     unsigned int olen, unsigned char *in, unsigned int ilen);
 
 static COMP_METHOD rle_method = {
-       NID_rle_compression,
-       LN_rle_compression,
-       NULL,
-       NULL,
-       rle_compress_block,
-       rle_expand_block,
-       NULL,
-       NULL,
+       .type = NID_rle_compression,
+       .name = LN_rle_compression,
+       .compress = rle_compress_block,
+       .expand = rle_expand_block
 };
 
 COMP_METHOD *
index 3a73b3d..26c6507 100644 (file)
@@ -8,14 +8,8 @@
 COMP_METHOD *COMP_zlib(void );
 
 static COMP_METHOD zlib_method_nozlib = {
-       NID_undef,
-       "(undef)",
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
+       .type = NID_undef,
+       .name = "(undef)"
 };
 
 #ifndef ZLIB
@@ -55,26 +49,20 @@ static int zz_uncompress(Bytef *dest, uLongf *destLen, const Bytef *source,
     uLong sourceLen);
 
 static COMP_METHOD zlib_stateless_method = {
-       NID_zlib_compression,
-       LN_zlib_compression,
-       NULL,
-       NULL,
-       zlib_compress_block,
-       zlib_expand_block,
-       NULL,
-       NULL,
+       .type = NID_zlib_compression,
+       .name = LN_zlib_compression,
+       .compress = zlib_compress_block,
+       .expand = zlib_expand_block
 };
 #endif
 
 static COMP_METHOD zlib_stateful_method = {
-       NID_zlib_compression,
-       LN_zlib_compression,
-       zlib_stateful_init,
-       zlib_stateful_finish,
-       zlib_stateful_compress_block,
-       zlib_stateful_expand_block,
-       NULL,
-       NULL,
+       .type = NID_zlib_compression,
+       .name = LN_zlib_compression,
+       .init = zlib_stateful_init,
+       .finish = zlib_stateful_finish,
+       .compress = zlib_stateful_compress_block,
+       .expand = zlib_stateful_expand_block
 };
 
 #ifdef ZLIB_SHARED
@@ -433,16 +421,14 @@ static long bio_zlib_ctrl(BIO *b, int cmd, long num, void *ptr);
 static long bio_zlib_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp);
 
 static BIO_METHOD bio_meth_zlib = {
-       BIO_TYPE_COMP,
-       "zlib",
-       bio_zlib_write,
-       bio_zlib_read,
-       NULL,
-       NULL,
-       bio_zlib_ctrl,
-       bio_zlib_new,
-       bio_zlib_free,
-       bio_zlib_callback_ctrl
+       .type = BIO_TYPE_COMP,
+       .name = "zlib",
+       .bwrite = bio_zlib_write,
+       .bread = bio_zlib_read,
+       .ctrl = bio_zlib_ctrl,
+       .create = bio_zlib_new,
+       .destroy = bio_zlib_free,
+       .callback_ctrl = bio_zlib_callback_ctrl
 };
 
 BIO_METHOD *
index d85773d..b3c75e1 100644 (file)
@@ -91,16 +91,16 @@ static int def_to_int(const CONF *conf, char c);
 const char CONF_def_version[]="CONF_def" OPENSSL_VERSION_PTEXT;
 
 static CONF_METHOD default_method = {
-       "OpenSSL default",
-       def_create,
-       def_init_default,
-       def_destroy,
-       def_destroy_data,
-       def_load_bio,
-       def_dump,
-       def_is_number,
-       def_to_int,
-       def_load
+       .name = "OpenSSL default",
+       .create = def_create,
+       .init = def_init_default,
+       .destroy = def_destroy,
+       .destroy_data = def_destroy_data,
+       .load_bio = def_load_bio,
+       .dump = def_dump,
+       .is_number = def_is_number,
+       .to_int = def_to_int,
+       .load = def_load
 };
 
 static CONF_METHOD WIN32_method = {
index d39f4b3..a22614a 100644 (file)
@@ -466,36 +466,32 @@ int DHparams_print(BIO *bp, const DH *x)
        return do_dh_print(bp, x, 4, NULL, 0);
        }
 
-const EVP_PKEY_ASN1_METHOD dh_asn1_meth = 
-       {
-       EVP_PKEY_DH,
-       EVP_PKEY_DH,
-       0,
-
-       "DH",
-       "OpenSSL PKCS#3 DH method",
-
-       dh_pub_decode,
-       dh_pub_encode,
-       dh_pub_cmp,
-       dh_public_print,
-
-       dh_priv_decode,
-       dh_priv_encode,
-       dh_private_print,
-
-       int_dh_size,
-       dh_bits,
-
-       dh_param_decode,
-       dh_param_encode,
-       dh_missing_parameters,
-       dh_copy_parameters,
-       dh_cmp_parameters,
-       dh_param_print,
-       0,
-
-       int_dh_free,
-       0
-       };
+const EVP_PKEY_ASN1_METHOD dh_asn1_meth = {
+       .pkey_id = EVP_PKEY_DH,
+       .pkey_base_id = EVP_PKEY_DH,
+
+       .pem_str = "DH",
+       .info = "OpenSSL PKCS#3 DH method",
+
+       .pub_decode = dh_pub_decode,
+       .pub_encode = dh_pub_encode,
+       .pub_cmp = dh_pub_cmp,
+       .pub_print = dh_public_print,
+
+       .priv_decode = dh_priv_decode,
+       .priv_encode = dh_priv_encode,
+       .priv_print = dh_private_print,
+
+       .pkey_size = int_dh_size,
+       .pkey_bits = dh_bits,
+
+       .param_decode = dh_param_decode,
+       .param_encode = dh_param_encode,
+       .param_missing = dh_missing_parameters,
+       .param_copy = dh_copy_parameters,
+       .param_cmp = dh_cmp_parameters,
+       .param_print = dh_param_print,
+
+       .pkey_free = int_dh_free,
+};
 
index 9596270..91352a9 100644 (file)
@@ -82,15 +82,12 @@ int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
        }
 
 static DH_METHOD dh_ossl = {
-"OpenSSL DH Method",
-generate_key,
-compute_key,
-dh_bn_mod_exp,
-dh_init,
-dh_finish,
-0,
-NULL,
-NULL
+       .name = "OpenSSL DH Method",
+       .generate_key = generate_key,
+       .compute_key = compute_key,
+       .bn_mod_exp = dh_bn_mod_exp,
+       .init = dh_init,
+       .finish = dh_finish,
 };
 
 const DH_METHOD *DH_OpenSSL(void)
index ec4553c..c359bb4 100644 (file)
@@ -217,38 +217,20 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen)
        return 1;
        }
 
-const EVP_PKEY_METHOD dh_pkey_meth = 
-       {
-       EVP_PKEY_DH,
-       EVP_PKEY_FLAG_AUTOARGLEN,
-       pkey_dh_init,
-       pkey_dh_copy,
-       pkey_dh_cleanup,
-
-       0,
-       pkey_dh_paramgen,
-
-       0,
-       pkey_dh_keygen,
-
-       0,
-       0,
-
-       0,
-       0,
-
-       0,0,
-
-       0,0,0,0,
+const EVP_PKEY_METHOD dh_pkey_meth = {
+       .pkey_id = EVP_PKEY_DH,
+       .flags = EVP_PKEY_FLAG_AUTOARGLEN,
 
-       0,0,
+       .init = pkey_dh_init,
+       .copy = pkey_dh_copy,
+       .cleanup = pkey_dh_cleanup,
 
-       0,0,
+       .paramgen = pkey_dh_paramgen,
 
-       0,
-       pkey_dh_derive,
+       .keygen = pkey_dh_keygen,
 
-       pkey_dh_ctrl,
-       pkey_dh_ctrl_str
+       .derive = pkey_dh_derive,
 
-       };
+       .ctrl = pkey_dh_ctrl,
+       .ctrl_str = pkey_dh_ctrl_str
+};
index e9c5498..ebca5ec 100644 (file)
@@ -640,65 +640,61 @@ static int dsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
 
 /* NB these are sorted in pkey_id order, lowest first */
 
-const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[] = 
+const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[] = {
        {
+               .pkey_id = EVP_PKEY_DSA2,
+               .pkey_base_id = EVP_PKEY_DSA,
+               .pkey_flags = ASN1_PKEY_ALIAS
+       },
 
-               {
-               EVP_PKEY_DSA2,
-               EVP_PKEY_DSA,
-               ASN1_PKEY_ALIAS
-               },
-
-               {
-               EVP_PKEY_DSA1,
-               EVP_PKEY_DSA,
-               ASN1_PKEY_ALIAS
-               },
-
-               {
-               EVP_PKEY_DSA4,
-               EVP_PKEY_DSA,
-               ASN1_PKEY_ALIAS
-               },
+       {
+               .pkey_id = EVP_PKEY_DSA1,
+               .pkey_base_id = EVP_PKEY_DSA,
+               .pkey_flags = ASN1_PKEY_ALIAS
+       },
 
-               {
-               EVP_PKEY_DSA3,
-               EVP_PKEY_DSA,
-               ASN1_PKEY_ALIAS
-               },
+       {
+               .pkey_id = EVP_PKEY_DSA4,
+               .pkey_base_id = EVP_PKEY_DSA,
+               .pkey_flags = ASN1_PKEY_ALIAS
+       },
 
-               {
-               EVP_PKEY_DSA,
-               EVP_PKEY_DSA,
-               0,
-
-               "DSA",
-               "OpenSSL DSA method",
-
-               dsa_pub_decode,
-               dsa_pub_encode,
-               dsa_pub_cmp,
-               dsa_pub_print,
-
-               dsa_priv_decode,
-               dsa_priv_encode,
-               dsa_priv_print,
-
-               int_dsa_size,
-               dsa_bits,
-
-               dsa_param_decode,
-               dsa_param_encode,
-               dsa_missing_parameters,
-               dsa_copy_parameters,
-               dsa_cmp_parameters,
-               dsa_param_print,
-               dsa_sig_print,
-
-               int_dsa_free,
-               dsa_pkey_ctrl,
-               old_dsa_priv_decode,
-               old_dsa_priv_encode
-               }
-       };
+       {
+               .pkey_id = EVP_PKEY_DSA3,
+               .pkey_base_id = EVP_PKEY_DSA,
+               .pkey_flags = ASN1_PKEY_ALIAS
+       },
 
+       {
+               .pkey_id = EVP_PKEY_DSA,
+               .pkey_base_id = EVP_PKEY_DSA,
+
+               .pem_str = "DSA",
+               .info = "OpenSSL DSA method",
+
+               .pub_decode = dsa_pub_decode,
+               .pub_encode = dsa_pub_encode,
+               .pub_cmp = dsa_pub_cmp,
+               .pub_print = dsa_pub_print,
+
+               .priv_decode = dsa_priv_decode,
+               .priv_encode = dsa_priv_encode,
+               .priv_print = dsa_priv_print,
+
+               .pkey_size = int_dsa_size,
+               .pkey_bits = dsa_bits,
+
+               .param_decode = dsa_param_decode,
+               .param_encode = dsa_param_encode,
+               .param_missing = dsa_missing_parameters,
+               .param_copy = dsa_copy_parameters,
+               .param_cmp = dsa_cmp_parameters,
+               .param_print = dsa_param_print,
+               .sig_print = dsa_sig_print,
+
+               .pkey_free = int_dsa_free,
+               .pkey_ctrl = dsa_pkey_ctrl,
+               .old_priv_decode = old_dsa_priv_decode,
+               .old_priv_encode = old_dsa_priv_encode
+       }
+};
index b3d78e5..7e0e3b0 100644 (file)
@@ -74,18 +74,12 @@ static int dsa_init(DSA *dsa);
 static int dsa_finish(DSA *dsa);
 
 static DSA_METHOD openssl_dsa_meth = {
-"OpenSSL DSA method",
-dsa_do_sign,
-dsa_sign_setup,
-dsa_do_verify,
-NULL, /* dsa_mod_exp, */
-NULL, /* dsa_bn_mod_exp, */
-dsa_init,
-dsa_finish,
-0,
-NULL,
-NULL,
-NULL
+       .name = "OpenSSL DSA method",
+       .dsa_do_sign = dsa_do_sign,
+       .dsa_sign_setup = dsa_sign_setup,
+       .dsa_do_verify = dsa_do_verify,
+       .init = dsa_init,
+       .finish = dsa_finish
 };
 
 /* These macro wrappers replace attempts to use the dsa_mod_exp() and
index 7076bf7..4e77c6f 100644 (file)
@@ -281,38 +281,22 @@ static int pkey_dsa_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
        return DSA_generate_key(pkey->pkey.dsa);
        }
 
-const EVP_PKEY_METHOD dsa_pkey_meth = 
-       {
-       EVP_PKEY_DSA,
-       EVP_PKEY_FLAG_AUTOARGLEN,
-       pkey_dsa_init,
-       pkey_dsa_copy,
-       pkey_dsa_cleanup,
-
-       0,
-       pkey_dsa_paramgen,
-
-       0,
-       pkey_dsa_keygen,
-
-       0,
-       pkey_dsa_sign,
-
-       0,
-       pkey_dsa_verify,
-
-       0,0,
-
-       0,0,0,0,
+const EVP_PKEY_METHOD dsa_pkey_meth = {
+       .pkey_id = EVP_PKEY_DSA,
+       .flags = EVP_PKEY_FLAG_AUTOARGLEN,
 
-       0,0,
+       .init = pkey_dsa_init,
+       .copy = pkey_dsa_copy,
+       .cleanup = pkey_dsa_cleanup,
 
-       0,0,
+       .paramgen = pkey_dsa_paramgen,
 
-       0,0,
+       .keygen = pkey_dsa_keygen,
 
-       pkey_dsa_ctrl,
-       pkey_dsa_ctrl_str
+       .sign = pkey_dsa_sign,
 
+       .verify = pkey_dsa_verify,
 
-       };
+       .ctrl = pkey_dsa_ctrl,
+       .ctrl_str = pkey_dsa_ctrl_str
+};
index 6cf9ab2..bebfdcd 100644 (file)
@@ -93,23 +93,15 @@ static int dlfcn_pathbyaddr(void *addr, char *path, int sz);
 static void *dlfcn_globallookup(const char *name);
 
 static DSO_METHOD dso_meth_dlfcn = {
-       "OpenSSL 'dlfcn' shared library method",
-       dlfcn_load,
-       dlfcn_unload,
-       dlfcn_bind_var,
-       dlfcn_bind_func,
-/* For now, "unbind" doesn't exist */
-#if 0
-       NULL, /* unbind_var */
-       NULL, /* unbind_func */
-#endif
-       NULL, /* ctrl */
-       dlfcn_name_converter,
-       dlfcn_merger,
-       NULL, /* init */
-       NULL, /* finish */
-       dlfcn_pathbyaddr,
-       dlfcn_globallookup
+       .name = "OpenSSL 'dlfcn' shared library method",
+       .dso_load = dlfcn_load,
+       .dso_unload = dlfcn_unload,
+       .dso_bind_var = dlfcn_bind_var,
+       .dso_bind_func = dlfcn_bind_func,
+       .dso_name_converter = dlfcn_name_converter,
+       .dso_merger = dlfcn_merger,
+       .pathbyaddr = dlfcn_pathbyaddr,
+       .globallookup = dlfcn_globallookup
 };
 
 DSO_METHOD *
index 0c877ab..c9f4226 100644 (file)
 #include <openssl/dso.h>
 
 static DSO_METHOD dso_meth_null = {
-       "NULL shared library method",
-       NULL, /* load */
-       NULL, /* unload */
-       NULL, /* bind_var */
-       NULL, /* bind_func */
-/* For now, "unbind" doesn't exist */
-#if 0
-       NULL, /* unbind_var */
-       NULL, /* unbind_func */
-#endif
-       NULL, /* ctrl */
-       NULL, /* dso_name_converter */
-       NULL, /* dso_merger */
-       NULL, /* init */
-       NULL, /* finish */
-       NULL, /* pathbyaddr */
-       NULL  /* globallookup */
+       .name = "NULL shared library method"
 };
 
 DSO_METHOD *
index 0cf681f..5682bfa 100644 (file)
 
 #ifndef OPENSSL_NO_EC2M
 
-const EC_METHOD *EC_GF2m_simple_method(void)
-       {
+const EC_METHOD *
+EC_GF2m_simple_method(void)
+{
        static const EC_METHOD ret = {
-               EC_FLAGS_DEFAULT_OCT,
-               NID_X9_62_characteristic_two_field,
-               ec_GF2m_simple_group_init,
-               ec_GF2m_simple_group_finish,
-               ec_GF2m_simple_group_clear_finish,
-               ec_GF2m_simple_group_copy,
-               ec_GF2m_simple_group_set_curve,
-               ec_GF2m_simple_group_get_curve,
-               ec_GF2m_simple_group_get_degree,
-               ec_GF2m_simple_group_check_discriminant,
-               ec_GF2m_simple_point_init,
-               ec_GF2m_simple_point_finish,
-               ec_GF2m_simple_point_clear_finish,
-               ec_GF2m_simple_point_copy,
-               ec_GF2m_simple_point_set_to_infinity,
-               0 /* set_Jprojective_coordinates_GFp */,
-               0 /* get_Jprojective_coordinates_GFp */,
-               ec_GF2m_simple_point_set_affine_coordinates,
-               ec_GF2m_simple_point_get_affine_coordinates,
-               0,0,0,
-               ec_GF2m_simple_add,
-               ec_GF2m_simple_dbl,
-               ec_GF2m_simple_invert,
-               ec_GF2m_simple_is_at_infinity,
-               ec_GF2m_simple_is_on_curve,
-               ec_GF2m_simple_cmp,
-               ec_GF2m_simple_make_affine,
-               ec_GF2m_simple_points_make_affine,
+               .flags = EC_FLAGS_DEFAULT_OCT,
+               .field_type = NID_X9_62_characteristic_two_field,
+               .group_init = ec_GF2m_simple_group_init,
+               .group_finish = ec_GF2m_simple_group_finish,
+               .group_clear_finish = ec_GF2m_simple_group_clear_finish,
+               .group_copy = ec_GF2m_simple_group_copy,
+               .group_set_curve = ec_GF2m_simple_group_set_curve,
+               .group_get_curve = ec_GF2m_simple_group_get_curve,
+               .group_get_degree = ec_GF2m_simple_group_get_degree,
+               .group_check_discriminant =
+                   ec_GF2m_simple_group_check_discriminant,
+               .point_init = ec_GF2m_simple_point_init,
+               .point_finish = ec_GF2m_simple_point_finish,
+               .point_clear_finish = ec_GF2m_simple_point_clear_finish,
+               .point_copy = ec_GF2m_simple_point_copy,
+               .point_set_to_infinity = ec_GF2m_simple_point_set_to_infinity,
+               .point_set_affine_coordinates =
+                   ec_GF2m_simple_point_set_affine_coordinates,
+               .point_get_affine_coordinates =
+                   ec_GF2m_simple_point_get_affine_coordinates,
+               .add = ec_GF2m_simple_add,
+               .dbl = ec_GF2m_simple_dbl,
+               .invert = ec_GF2m_simple_invert,
+               .is_at_infinity = ec_GF2m_simple_is_at_infinity,
+               .is_on_curve = ec_GF2m_simple_is_on_curve,
+               .point_cmp = ec_GF2m_simple_cmp,
+               .make_affine = ec_GF2m_simple_make_affine,
+               .points_make_affine = ec_GF2m_simple_points_make_affine,
 
                /* the following three method functions are defined in ec2_mult.c */
-               ec_GF2m_simple_mul,
-               ec_GF2m_precompute_mult,
-               ec_GF2m_have_precompute_mult,
+               .mul = ec_GF2m_simple_mul,
+               .precompute_mult = ec_GF2m_precompute_mult,
+               .have_precompute_mult = ec_GF2m_have_precompute_mult,
 
-               ec_GF2m_simple_field_mul,
-               ec_GF2m_simple_field_sqr,
-               ec_GF2m_simple_field_div,
-               0 /* field_encode */,
-               0 /* field_decode */,
-               0 /* field_set_to_one */ };
+               .field_mul = ec_GF2m_simple_field_mul,
+               .field_sqr = ec_GF2m_simple_field_sqr,
+               .field_div = ec_GF2m_simple_field_div,
+       };
 
        return &ret;
-       }
+}
 
 
 /* Initialize a GF(2^m)-based EC_GROUP structure.
index 79dd110..0e6381f 100644 (file)
@@ -626,36 +626,34 @@ static int ec_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
 
        }
 
-const EVP_PKEY_ASN1_METHOD eckey_asn1_meth = 
-       {
-       EVP_PKEY_EC,
-       EVP_PKEY_EC,
-       0,
-       "EC",
-       "OpenSSL EC algorithm",
-
-       eckey_pub_decode,
-       eckey_pub_encode,
-       eckey_pub_cmp,
-       eckey_pub_print,
-
-       eckey_priv_decode,
-       eckey_priv_encode,
-       eckey_priv_print,
-
-       int_ec_size,
-       ec_bits,
-
-       eckey_param_decode,
-       eckey_param_encode,
-       ec_missing_parameters,
-       ec_copy_parameters,
-       ec_cmp_parameters,
-       eckey_param_print,
-       0,
-
-       int_ec_free,
-       ec_pkey_ctrl,
-       old_ec_priv_decode,
-       old_ec_priv_encode
-       };
+const EVP_PKEY_ASN1_METHOD eckey_asn1_meth = {
+       .pkey_id = EVP_PKEY_EC,
+       .pkey_base_id = EVP_PKEY_EC,
+
+       .pem_str = "EC",
+       .info = "OpenSSL EC algorithm",
+
+       .pub_decode = eckey_pub_decode,
+       .pub_encode = eckey_pub_encode,
+       .pub_cmp = eckey_pub_cmp,
+       .pub_print = eckey_pub_print,
+
+       .priv_decode = eckey_priv_decode,
+       .priv_encode = eckey_priv_encode,
+       .priv_print = eckey_priv_print,
+
+       .pkey_size = int_ec_size,
+       .pkey_bits = ec_bits,
+
+       .param_decode = eckey_param_decode,
+       .param_encode = eckey_param_encode,
+       .param_missing = ec_missing_parameters,
+       .param_copy = ec_copy_parameters,
+       .param_cmp = ec_cmp_parameters,
+       .param_print = eckey_param_print,
+
+       .pkey_free = int_ec_free,
+       .pkey_ctrl = ec_pkey_ctrl,
+       .old_priv_decode = old_ec_priv_decode,
+       .old_priv_encode = old_ec_priv_encode
+};
index dfc8ace..c970d8c 100644 (file)
@@ -304,38 +304,23 @@ static int pkey_ec_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
        return EC_KEY_generate_key(pkey->pkey.ec);
        }
 
-const EVP_PKEY_METHOD ec_pkey_meth = 
-       {
-       EVP_PKEY_EC,
-       0,
-       pkey_ec_init,
-       pkey_ec_copy,
-       pkey_ec_cleanup,
-
-       0,
-       pkey_ec_paramgen,
-
-       0,
-       pkey_ec_keygen,
-
-       0,
-       pkey_ec_sign,
-
-       0,
-       pkey_ec_verify,
+const EVP_PKEY_METHOD ec_pkey_meth = {
+       .pkey_id = EVP_PKEY_EC,
 
-       0,0,
+       .init = pkey_ec_init,
+       .copy = pkey_ec_copy,
+       .cleanup = pkey_ec_cleanup,
 
-       0,0,0,0,
+       .paramgen = pkey_ec_paramgen,
 
-       0,0,
+       .keygen = pkey_ec_keygen,
 
-       0,0,
+       .sign = pkey_ec_sign,
 
-       0,
-       pkey_ec_derive,
+       .verify = pkey_ec_verify,
 
-       pkey_ec_ctrl,
-       pkey_ec_ctrl_str
+       .derive = pkey_ec_derive,
 
-       };
+       .ctrl = pkey_ec_ctrl,
+       .ctrl_str = pkey_ec_ctrl_str
+};
index cee0fee..6b5b856 100644 (file)
 #include "ec_lcl.h"
 
 
-const EC_METHOD *EC_GFp_mont_method(void)
-       {
+const EC_METHOD *
+EC_GFp_mont_method(void)
+{
        static const EC_METHOD ret = {
-               EC_FLAGS_DEFAULT_OCT,
-               NID_X9_62_prime_field,
-               ec_GFp_mont_group_init,
-               ec_GFp_mont_group_finish,
-               ec_GFp_mont_group_clear_finish,
-               ec_GFp_mont_group_copy,
-               ec_GFp_mont_group_set_curve,
-               ec_GFp_simple_group_get_curve,
-               ec_GFp_simple_group_get_degree,
-               ec_GFp_simple_group_check_discriminant,
-               ec_GFp_simple_point_init,
-               ec_GFp_simple_point_finish,
-               ec_GFp_simple_point_clear_finish,
-               ec_GFp_simple_point_copy,
-               ec_GFp_simple_point_set_to_infinity,
-               ec_GFp_simple_set_Jprojective_coordinates_GFp,
-               ec_GFp_simple_get_Jprojective_coordinates_GFp,
-               ec_GFp_simple_point_set_affine_coordinates,
-               ec_GFp_simple_point_get_affine_coordinates,
-               0,0,0,
-               ec_GFp_simple_add,
-               ec_GFp_simple_dbl,
-               ec_GFp_simple_invert,
-               ec_GFp_simple_is_at_infinity,
-               ec_GFp_simple_is_on_curve,
-               ec_GFp_simple_cmp,
-               ec_GFp_simple_make_affine,
-               ec_GFp_simple_points_make_affine,
-               0 /* mul */,
-               0 /* precompute_mult */,
-               0 /* have_precompute_mult */,   
-               ec_GFp_mont_field_mul,
-               ec_GFp_mont_field_sqr,
-               0 /* field_div */,
-               ec_GFp_mont_field_encode,
-               ec_GFp_mont_field_decode,
-               ec_GFp_mont_field_set_to_one };
+               .flags = EC_FLAGS_DEFAULT_OCT,
+               .field_type = NID_X9_62_prime_field,
+               .group_init = ec_GFp_mont_group_init,
+               .group_finish = ec_GFp_mont_group_finish,
+               .group_clear_finish = ec_GFp_mont_group_clear_finish,
+               .group_copy = ec_GFp_mont_group_copy,
+               .group_set_curve = ec_GFp_mont_group_set_curve,
+               .group_get_curve = ec_GFp_simple_group_get_curve,
+               .group_get_degree = ec_GFp_simple_group_get_degree,
+               .group_check_discriminant =
+                   ec_GFp_simple_group_check_discriminant,
+               .point_init = ec_GFp_simple_point_init,
+               .point_finish = ec_GFp_simple_point_finish,
+               .point_clear_finish = ec_GFp_simple_point_clear_finish,
+               .point_copy = ec_GFp_simple_point_copy,
+               .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity,
+               .point_set_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_set_Jprojective_coordinates_GFp,
+               .point_get_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_get_Jprojective_coordinates_GFp,
+               .point_set_affine_coordinates =
+                   ec_GFp_simple_point_set_affine_coordinates,
+               .point_get_affine_coordinates =
+                   ec_GFp_simple_point_get_affine_coordinates,
+               .add = ec_GFp_simple_add,
+               .dbl = ec_GFp_simple_dbl,
+               .invert = ec_GFp_simple_invert,
+               .is_at_infinity = ec_GFp_simple_is_at_infinity,
+               .is_on_curve = ec_GFp_simple_is_on_curve,
+               .point_cmp = ec_GFp_simple_cmp,
+               .make_affine = ec_GFp_simple_make_affine,
+               .points_make_affine = ec_GFp_simple_points_make_affine,
+               .field_mul = ec_GFp_mont_field_mul,
+               .field_sqr = ec_GFp_mont_field_sqr,
+               .field_encode = ec_GFp_mont_field_encode,
+               .field_decode = ec_GFp_mont_field_decode,
+               .field_set_to_one = ec_GFp_mont_field_set_to_one
+       };
 
        return &ret;
-       }
+}
 
 
 int ec_GFp_mont_group_init(EC_GROUP *group)
index ac5b814..479cff8 100644 (file)
 #include <openssl/obj_mac.h>
 #include "ec_lcl.h"
 
-const EC_METHOD *EC_GFp_nist_method(void)
-       {
+const EC_METHOD *
+EC_GFp_nist_method(void)
+{
        static const EC_METHOD ret = {
-               EC_FLAGS_DEFAULT_OCT,
-               NID_X9_62_prime_field,
-               ec_GFp_simple_group_init,
-               ec_GFp_simple_group_finish,
-               ec_GFp_simple_group_clear_finish,
-               ec_GFp_nist_group_copy,
-               ec_GFp_nist_group_set_curve,
-               ec_GFp_simple_group_get_curve,
-               ec_GFp_simple_group_get_degree,
-               ec_GFp_simple_group_check_discriminant,
-               ec_GFp_simple_point_init,
-               ec_GFp_simple_point_finish,
-               ec_GFp_simple_point_clear_finish,
-               ec_GFp_simple_point_copy,
-               ec_GFp_simple_point_set_to_infinity,
-               ec_GFp_simple_set_Jprojective_coordinates_GFp,
-               ec_GFp_simple_get_Jprojective_coordinates_GFp,
-               ec_GFp_simple_point_set_affine_coordinates,
-               ec_GFp_simple_point_get_affine_coordinates,
-               0,0,0,
-               ec_GFp_simple_add,
-               ec_GFp_simple_dbl,
-               ec_GFp_simple_invert,
-               ec_GFp_simple_is_at_infinity,
-               ec_GFp_simple_is_on_curve,
-               ec_GFp_simple_cmp,
-               ec_GFp_simple_make_affine,
-               ec_GFp_simple_points_make_affine,
-               0 /* mul */,
-               0 /* precompute_mult */,
-               0 /* have_precompute_mult */,   
-               ec_GFp_nist_field_mul,
-               ec_GFp_nist_field_sqr,
-               0 /* field_div */,
-               0 /* field_encode */,
-               0 /* field_decode */,
-               0 /* field_set_to_one */ };
+               .flags = EC_FLAGS_DEFAULT_OCT,
+               .field_type = NID_X9_62_prime_field,
+               .group_init = ec_GFp_simple_group_init,
+               .group_finish = ec_GFp_simple_group_finish,
+               .group_clear_finish = ec_GFp_simple_group_clear_finish,
+               .group_copy = ec_GFp_nist_group_copy,
+               .group_set_curve = ec_GFp_nist_group_set_curve,
+               .group_get_curve = ec_GFp_simple_group_get_curve,
+               .group_get_degree = ec_GFp_simple_group_get_degree,
+               .group_check_discriminant =
+                   ec_GFp_simple_group_check_discriminant,
+               .point_init = ec_GFp_simple_point_init,
+               .point_finish = ec_GFp_simple_point_finish,
+               .point_clear_finish = ec_GFp_simple_point_clear_finish,
+               .point_copy = ec_GFp_simple_point_copy,
+               .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity,
+               .point_set_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_set_Jprojective_coordinates_GFp,
+               .point_get_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_get_Jprojective_coordinates_GFp,
+               .point_set_affine_coordinates =
+                   ec_GFp_simple_point_set_affine_coordinates,
+               .point_get_affine_coordinates =
+                   ec_GFp_simple_point_get_affine_coordinates,
+               .add = ec_GFp_simple_add,
+               .dbl = ec_GFp_simple_dbl,
+               .invert = ec_GFp_simple_invert,
+               .is_at_infinity = ec_GFp_simple_is_at_infinity,
+               .is_on_curve = ec_GFp_simple_is_on_curve,
+               .point_cmp = ec_GFp_simple_cmp,
+               .make_affine = ec_GFp_simple_make_affine,
+               .points_make_affine = ec_GFp_simple_points_make_affine,
+               .field_mul = ec_GFp_nist_field_mul,
+               .field_sqr = ec_GFp_nist_field_sqr
+       };
 
        return &ret;
-       }
+}
 
 int ec_GFp_nist_group_copy(EC_GROUP *dest, const EC_GROUP *src)
        {
index 03f2d9c..696024a 100644 (file)
@@ -233,51 +233,51 @@ typedef struct {
        int references;
 } NISTP224_PRE_COMP;
 
-const EC_METHOD *EC_GFp_nistp224_method(void)
-       {
+const EC_METHOD *
+EC_GFp_nistp224_method(void)
+{
        static const EC_METHOD ret = {
-               EC_FLAGS_DEFAULT_OCT,
-               NID_X9_62_prime_field,
-               ec_GFp_nistp224_group_init,
-               ec_GFp_simple_group_finish,
-               ec_GFp_simple_group_clear_finish,
-               ec_GFp_nist_group_copy,
-               ec_GFp_nistp224_group_set_curve,
-               ec_GFp_simple_group_get_curve,
-               ec_GFp_simple_group_get_degree,
-               ec_GFp_simple_group_check_discriminant,
-               ec_GFp_simple_point_init,
-               ec_GFp_simple_point_finish,
-               ec_GFp_simple_point_clear_finish,
-               ec_GFp_simple_point_copy,
-               ec_GFp_simple_point_set_to_infinity,
-               ec_GFp_simple_set_Jprojective_coordinates_GFp,
-               ec_GFp_simple_get_Jprojective_coordinates_GFp,
-               ec_GFp_simple_point_set_affine_coordinates,
-               ec_GFp_nistp224_point_get_affine_coordinates,
-               0 /* point_set_compressed_coordinates */,
-               0 /* point2oct */,
-               0 /* oct2point */,
-               ec_GFp_simple_add,
-               ec_GFp_simple_dbl,
-               ec_GFp_simple_invert,
-               ec_GFp_simple_is_at_infinity,
-               ec_GFp_simple_is_on_curve,
-               ec_GFp_simple_cmp,
-               ec_GFp_simple_make_affine,
-               ec_GFp_simple_points_make_affine,
-               ec_GFp_nistp224_points_mul,
-               ec_GFp_nistp224_precompute_mult,
-               ec_GFp_nistp224_have_precompute_mult,
-               ec_GFp_nist_field_mul,
-               ec_GFp_nist_field_sqr,
-               0 /* field_div */,
-               0 /* field_encode */,
-               0 /* field_decode */,
-               0 /* field_set_to_one */ };
+               .flags = EC_FLAGS_DEFAULT_OCT,
+               .field_type = NID_X9_62_prime_field,
+               .group_init = ec_GFp_nistp224_group_init,
+               .group_finish = ec_GFp_simple_group_finish,
+               .group_clear_finish = ec_GFp_simple_group_clear_finish,
+               .group_copy = ec_GFp_nist_group_copy,
+               .group_set_curve = ec_GFp_nistp224_group_set_curve,
+               .group_get_curve = ec_GFp_simple_group_get_curve,
+               .group_get_degree = ec_GFp_simple_group_get_degree,
+               .group_check_discriminant =
+                   ec_GFp_simple_group_check_discriminant,
+               .point_init = ec_GFp_simple_point_init,
+               .point_finish = ec_GFp_simple_point_finish,
+               .point_clear_finish = ec_GFp_simple_point_clear_finish,
+               .point_copy = ec_GFp_simple_point_copy,
+               .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity,
+               .point_set_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_set_Jprojective_coordinates_GFp,
+               .point_get_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_get_Jprojective_coordinates_GFp,
+               .point_set_affine_coordinates =
+                   ec_GFp_simple_point_set_affine_coordinates,
+               .point_get_affine_coordinates =
+                   ec_GFp_nistp224_point_get_affine_coordinates,
+               .add = ec_GFp_simple_add,
+               .dbl = ec_GFp_simple_dbl,
+               .invert = ec_GFp_simple_invert,
+               .is_at_infinity = ec_GFp_simple_is_at_infinity,
+               .is_on_curve = ec_GFp_simple_is_on_curve,
+               .point_cmp = ec_GFp_simple_cmp,
+               .make_affine = ec_GFp_simple_make_affine,
+               .points_make_affine = ec_GFp_simple_points_make_affine,
+               .mul = ec_GFp_nistp224_points_mul,
+               .precompute_mult = ec_GFp_nistp224_precompute_mult,
+               .have_precompute_mult = ec_GFp_nistp224_have_precompute_mult,
+               .field_mul = ec_GFp_nist_field_mul,
+               .field_sqr = ec_GFp_nist_field_sqr
+       };
 
        return &ret;
-       }
+}
 
 /* Helper functions to convert field elements to/from internal representation */
 static void bin28_to_felem(felem out, const u8 in[28])
index 947fb7e..132ca0d 100644 (file)
@@ -1613,51 +1613,51 @@ typedef struct {
        int references;
 } NISTP256_PRE_COMP;
 
-const EC_METHOD *EC_GFp_nistp256_method(void)
-       {
+const EC_METHOD *
+EC_GFp_nistp256_method(void)
+{
        static const EC_METHOD ret = {
-               EC_FLAGS_DEFAULT_OCT,
-               NID_X9_62_prime_field,
-               ec_GFp_nistp256_group_init,
-               ec_GFp_simple_group_finish,
-               ec_GFp_simple_group_clear_finish,
-               ec_GFp_nist_group_copy,
-               ec_GFp_nistp256_group_set_curve,
-               ec_GFp_simple_group_get_curve,
-               ec_GFp_simple_group_get_degree,
-               ec_GFp_simple_group_check_discriminant,
-               ec_GFp_simple_point_init,
-               ec_GFp_simple_point_finish,
-               ec_GFp_simple_point_clear_finish,
-               ec_GFp_simple_point_copy,
-               ec_GFp_simple_point_set_to_infinity,
-               ec_GFp_simple_set_Jprojective_coordinates_GFp,
-               ec_GFp_simple_get_Jprojective_coordinates_GFp,
-               ec_GFp_simple_point_set_affine_coordinates,
-               ec_GFp_nistp256_point_get_affine_coordinates,
-               0 /* point_set_compressed_coordinates */,
-               0 /* point2oct */,
-               0 /* oct2point */,
-               ec_GFp_simple_add,
-               ec_GFp_simple_dbl,
-               ec_GFp_simple_invert,
-               ec_GFp_simple_is_at_infinity,
-               ec_GFp_simple_is_on_curve,
-               ec_GFp_simple_cmp,
-               ec_GFp_simple_make_affine,
-               ec_GFp_simple_points_make_affine,
-               ec_GFp_nistp256_points_mul,
-               ec_GFp_nistp256_precompute_mult,
-               ec_GFp_nistp256_have_precompute_mult,
-               ec_GFp_nist_field_mul,
-               ec_GFp_nist_field_sqr,
-               0 /* field_div */,
-               0 /* field_encode */,
-               0 /* field_decode */,
-               0 /* field_set_to_one */ };
+               .flags = EC_FLAGS_DEFAULT_OCT,
+               .field_type = NID_X9_62_prime_field,
+               .group_init = ec_GFp_nistp256_group_init,
+               .group_finish = ec_GFp_simple_group_finish,
+               .group_clear_finish = ec_GFp_simple_group_clear_finish,
+               .group_copy = ec_GFp_nist_group_copy,
+               .group_set_curve = ec_GFp_nistp256_group_set_curve,
+               .group_get_curve = ec_GFp_simple_group_get_curve,
+               .group_get_degree = ec_GFp_simple_group_get_degree,
+               .group_check_discriminant =
+                   ec_GFp_simple_group_check_discriminant,
+               .point_init = ec_GFp_simple_point_init,
+               .point_finish = ec_GFp_simple_point_finish,
+               .point_clear_finish = ec_GFp_simple_point_clear_finish,
+               .point_copy = ec_GFp_simple_point_copy,
+               .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity,
+               .point_set_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_set_Jprojective_coordinates_GFp,
+               .point_get_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_get_Jprojective_coordinates_GFp,
+               .point_set_affine_coordinates =
+                   ec_GFp_simple_point_set_affine_coordinates,
+               .point_get_affine_coordinates =
+                   ec_GFp_nistp256_point_get_affine_coordinates,
+               .add = ec_GFp_simple_add,
+               .dbl = ec_GFp_simple_dbl,
+               .invert = ec_GFp_simple_invert,
+               .is_at_infinity = ec_GFp_simple_is_at_infinity,
+               .is_on_curve = ec_GFp_simple_is_on_curve,
+               .point_cmp = ec_GFp_simple_cmp,
+               .make_affine = ec_GFp_simple_make_affine,
+               .points_make_affine = ec_GFp_simple_points_make_affine,
+               .mul = ec_GFp_nistp256_points_mul,
+               .precompute_mult = ec_GFp_nistp256_precompute_mult,
+               .have_precompute_mult = ec_GFp_nistp256_have_precompute_mult,
+               .field_mul = ec_GFp_nist_field_mul,
+               .field_sqr = ec_GFp_nist_field_sqr
+       };
 
        return &ret;
-       }
+}
 
 /******************************************************************************/
 /*                    FUNCTIONS TO MANAGE PRECOMPUTATION
index 24eb032..c34c38b 100644 (file)
@@ -1479,51 +1479,51 @@ typedef struct {
        int references;
 } NISTP521_PRE_COMP;
 
-const EC_METHOD *EC_GFp_nistp521_method(void)
-       {
+const EC_METHOD *
+EC_GFp_nistp521_method(void)
+{
        static const EC_METHOD ret = {
-               EC_FLAGS_DEFAULT_OCT,
-               NID_X9_62_prime_field,
-               ec_GFp_nistp521_group_init,
-               ec_GFp_simple_group_finish,
-               ec_GFp_simple_group_clear_finish,
-               ec_GFp_nist_group_copy,
-               ec_GFp_nistp521_group_set_curve,
-               ec_GFp_simple_group_get_curve,
-               ec_GFp_simple_group_get_degree,
-               ec_GFp_simple_group_check_discriminant,
-               ec_GFp_simple_point_init,
-               ec_GFp_simple_point_finish,
-               ec_GFp_simple_point_clear_finish,
-               ec_GFp_simple_point_copy,
-               ec_GFp_simple_point_set_to_infinity,
-               ec_GFp_simple_set_Jprojective_coordinates_GFp,
-               ec_GFp_simple_get_Jprojective_coordinates_GFp,
-               ec_GFp_simple_point_set_affine_coordinates,
-               ec_GFp_nistp521_point_get_affine_coordinates,
-               0 /* point_set_compressed_coordinates */,
-               0 /* point2oct */,
-               0 /* oct2point */,
-               ec_GFp_simple_add,
-               ec_GFp_simple_dbl,
-               ec_GFp_simple_invert,
-               ec_GFp_simple_is_at_infinity,
-               ec_GFp_simple_is_on_curve,
-               ec_GFp_simple_cmp,
-               ec_GFp_simple_make_affine,
-               ec_GFp_simple_points_make_affine,
-               ec_GFp_nistp521_points_mul,
-               ec_GFp_nistp521_precompute_mult,
-               ec_GFp_nistp521_have_precompute_mult,
-               ec_GFp_nist_field_mul,
-               ec_GFp_nist_field_sqr,
-               0 /* field_div */,
-               0 /* field_encode */,
-               0 /* field_decode */,
-               0 /* field_set_to_one */ };
+               .flags = EC_FLAGS_DEFAULT_OCT,
+               .field_type = NID_X9_62_prime_field,
+               .group_init = ec_GFp_nistp521_group_init,
+               .group_finish = ec_GFp_simple_group_finish,
+               .group_clear_finish = ec_GFp_simple_group_clear_finish,
+               .group_copy = ec_GFp_nist_group_copy,
+               .group_set_curve = ec_GFp_nistp521_group_set_curve,
+               .group_get_curve = ec_GFp_simple_group_get_curve,
+               .group_get_degree = ec_GFp_simple_group_get_degree,
+               .group_check_discriminant =
+                   ec_GFp_simple_group_check_discriminant,
+               .point_init = ec_GFp_simple_point_init,
+               .point_finish = ec_GFp_simple_point_finish,
+               .point_clear_finish = ec_GFp_simple_point_clear_finish,
+               .point_copy = ec_GFp_simple_point_copy,
+               .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity,
+               .point_set_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_set_Jprojective_coordinates_GFp,
+               .point_get_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_get_Jprojective_coordinates_GFp,
+               .point_set_affine_coordinates =
+                   ec_GFp_simple_point_set_affine_coordinates,
+               .point_get_affine_coordinates =
+                   ec_GFp_nistp521_point_get_affine_coordinates,
+               .add = ec_GFp_simple_add,
+               .dbl = ec_GFp_simple_dbl,
+               .invert = ec_GFp_simple_invert,
+               .is_at_infinity = ec_GFp_simple_is_at_infinity,
+               .is_on_curve = ec_GFp_simple_is_on_curve,
+               .point_cmp = ec_GFp_simple_cmp,
+               .make_affine = ec_GFp_simple_make_affine,
+               .points_make_affine = ec_GFp_simple_points_make_affine,
+               .mul = ec_GFp_nistp521_points_mul,
+               .precompute_mult = ec_GFp_nistp521_precompute_mult,
+               .have_precompulte_mult = ec_GFp_nistp521_have_precompute_mult,
+               .field_mul = ec_GFp_nist_field_mul,
+               .field_sqr = ec_GFp_nist_field_sqr
+       };
 
        return &ret;
-       }
+}
 
 
 /******************************************************************************/
index a146752..c99348f 100644 (file)
 
 #include "ec_lcl.h"
 
-const EC_METHOD *EC_GFp_simple_method(void)
-       {
+const EC_METHOD *
+EC_GFp_simple_method(void)
+{
        static const EC_METHOD ret = {
-               EC_FLAGS_DEFAULT_OCT,
-               NID_X9_62_prime_field,
-               ec_GFp_simple_group_init,
-               ec_GFp_simple_group_finish,
-               ec_GFp_simple_group_clear_finish,
-               ec_GFp_simple_group_copy,
-               ec_GFp_simple_group_set_curve,
-               ec_GFp_simple_group_get_curve,
-               ec_GFp_simple_group_get_degree,
-               ec_GFp_simple_group_check_discriminant,
-               ec_GFp_simple_point_init,
-               ec_GFp_simple_point_finish,
-               ec_GFp_simple_point_clear_finish,
-               ec_GFp_simple_point_copy,
-               ec_GFp_simple_point_set_to_infinity,
-               ec_GFp_simple_set_Jprojective_coordinates_GFp,
-               ec_GFp_simple_get_Jprojective_coordinates_GFp,
-               ec_GFp_simple_point_set_affine_coordinates,
-               ec_GFp_simple_point_get_affine_coordinates,
-               0,0,0,
-               ec_GFp_simple_add,
-               ec_GFp_simple_dbl,
-               ec_GFp_simple_invert,
-               ec_GFp_simple_is_at_infinity,
-               ec_GFp_simple_is_on_curve,
-               ec_GFp_simple_cmp,
-               ec_GFp_simple_make_affine,
-               ec_GFp_simple_points_make_affine,
-               0 /* mul */,
-               0 /* precompute_mult */,
-               0 /* have_precompute_mult */,   
-               ec_GFp_simple_field_mul,
-               ec_GFp_simple_field_sqr,
-               0 /* field_div */,
-               0 /* field_encode */,
-               0 /* field_decode */,
-               0 /* field_set_to_one */ };
+               .flags = EC_FLAGS_DEFAULT_OCT,
+               .field_type = NID_X9_62_prime_field,
+               .group_init = ec_GFp_simple_group_init,
+               .group_finish = ec_GFp_simple_group_finish,
+               .group_clear_finish = ec_GFp_simple_group_clear_finish,
+               .group_copy = ec_GFp_simple_group_copy,
+               .group_set_curve = ec_GFp_simple_group_set_curve,
+               .group_get_curve = ec_GFp_simple_group_get_curve,
+               .group_get_degree = ec_GFp_simple_group_get_degree,
+               .group_check_discriminant =
+                   ec_GFp_simple_group_check_discriminant,
+               .point_init = ec_GFp_simple_point_init,
+               .point_finish = ec_GFp_simple_point_finish,
+               .point_clear_finish = ec_GFp_simple_point_clear_finish,
+               .point_copy = ec_GFp_simple_point_copy,
+               .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity,
+               .point_set_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_set_Jprojective_coordinates_GFp,
+               .point_get_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_get_Jprojective_coordinates_GFp,
+               .point_set_affine_coordinates = 
+                   ec_GFp_simple_point_set_affine_coordinates,
+               .point_get_affine_coordinates = 
+                   ec_GFp_simple_point_get_affine_coordinates,
+               .add = ec_GFp_simple_add,
+               .dbl = ec_GFp_simple_dbl,
+               .invert = ec_GFp_simple_invert,
+               .is_at_infinity = ec_GFp_simple_is_at_infinity,
+               .is_on_curve = ec_GFp_simple_is_on_curve,
+               .point_cmp = ec_GFp_simple_cmp,
+               .make_affine = ec_GFp_simple_make_affine,
+               .points_make_affine = ec_GFp_simple_points_make_affine,
+               .field_mul = ec_GFp_simple_field_mul,
+               .field_sqr = ec_GFp_simple_field_sqr
+       };
 
        return &ret;
-       }
+}
 
 
 /* Most method functions in this file are designed to work with
index a63eb49..129475f 100644 (file)
@@ -84,14 +84,8 @@ static int ecdh_compute_key(void *out, size_t len, const EC_POINT *pub_key,
        void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen));
 
 static ECDH_METHOD openssl_ecdh_meth = {
-       "OpenSSL ECDH method",
-       ecdh_compute_key,
-#if 0
-       NULL, /* init     */
-       NULL, /* finish   */
-#endif
-       0,    /* flags    */
-       NULL  /* app_data */
+       .name = "OpenSSL ECDH method",
+       .compute_key = ecdh_compute_key
 };
 
 const ECDH_METHOD *ECDH_OpenSSL(void)
index 7725935..4a6e04e 100644 (file)
@@ -69,16 +69,10 @@ static int ecdsa_do_verify(const unsigned char *dgst, int dgst_len,
                const ECDSA_SIG *sig, EC_KEY *eckey);
 
 static ECDSA_METHOD openssl_ecdsa_meth = {
-       "OpenSSL ECDSA method",
-       ecdsa_do_sign,
-       ecdsa_sign_setup,
-       ecdsa_do_verify,
-#if 0
-       NULL, /* init     */
-       NULL, /* finish   */
-#endif
-       0,    /* flags    */
-       NULL  /* app_data */
+       .name = "OpenSSL ECDSA method",
+       .ecdsa_do_sign = ecdsa_do_sign,
+       .ecdsa_sign_setup = ecdsa_sign_setup,
+       .ecdsa_do_verify = ecdsa_do_verify
 };
 
 const ECDSA_METHOD *ECDSA_OpenSSL(void)
index d5d9a16..c27181b 100644 (file)
@@ -1086,12 +1086,9 @@ padlock_rand_status(void)
 
 /* Prepare structure for registration */
 static RAND_METHOD padlock_rand = {
-       NULL,                   /* seed */
-       padlock_rand_bytes,     /* bytes */
-       NULL,                   /* cleanup */
-       NULL,                   /* add */
-       padlock_rand_bytes,     /* pseudorand */
-       padlock_rand_status,    /* rand status */
+       .bytes = padlock_rand_bytes,
+       .pseudorand = padlock_rand_bytes,
+       .status = padlock_rand_status
 };
 
 #else  /* !COMPILE_HW_PADLOCK */
index 4e9e91d..ba1b5bf 100644 (file)
@@ -84,15 +84,11 @@ static int get_random_bytes (unsigned char *buf, int num)
 static int random_status (void)
 {      return 1;       }
 
-static RAND_METHOD rdrand_meth =
-       {
-       NULL,   /* seed */
-       get_random_bytes,
-       NULL,   /* cleanup */
-       NULL,   /* add */
-       get_random_bytes,
-       random_status,
-       };
+static RAND_METHOD rdrand_meth = {
+       .bytes = get_random_bytes,
+       .pseudorand = get_random_bytes,
+       .status = random_status
+};
 
 static int rdrand_init(ENGINE *e)
 {      return 1;       }
index fa91594..c0f6851 100644 (file)
@@ -116,22 +116,12 @@ static const ENGINE_CMD_DEFN e_rsax_cmd_defns[] = {
 
 #ifndef OPENSSL_NO_RSA
 /* Our internal RSA_METHOD that we provide pointers to */
-static RSA_METHOD e_rsax_rsa =
-       {
-       "Intel RSA-X method",
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       e_rsax_rsa_mod_exp,
-       NULL,
-       NULL,
-       e_rsax_rsa_finish,
-       RSA_FLAG_CACHE_PUBLIC|RSA_FLAG_CACHE_PRIVATE,
-       NULL,
-       NULL,
-       NULL
-       };
+static RSA_METHOD e_rsax_rsa = {
+       .name = "Intel RSA-X method",
+       .rsa_mod_exp = e_rsax_rsa_mod_exp,
+       .finish = e_rsax_rsa_finish,
+       .flags = RSA_FLAG_CACHE_PUBLIC|RSA_FLAG_CACHE_PRIVATE,
+};
 #endif
 
 /* Constants used when creating the ENGINE */
index 190dcc4..9b24511 100644 (file)
@@ -1039,19 +1039,7 @@ err:
 }
 
 static RSA_METHOD cryptodev_rsa = {
-       "cryptodev RSA method",
-       NULL,                           /* rsa_pub_enc */
-       NULL,                           /* rsa_pub_dec */
-       NULL,                           /* rsa_priv_enc */
-       NULL,                           /* rsa_priv_dec */
-       NULL,
-       NULL,
-       NULL,                           /* init */
-       NULL,                           /* finish */
-       0,                              /* flags */
-       NULL,                           /* app_data */
-       NULL,                           /* rsa_sign */
-       NULL                            /* rsa_verify */
+       .name = "cryptodev RSA method"
 };
 
 static int
@@ -1181,16 +1169,7 @@ err:
 }
 
 static DSA_METHOD cryptodev_dsa = {
-       "cryptodev DSA method",
-       NULL,
-       NULL,                           /* dsa_sign_setup */
-       NULL,
-       NULL,                           /* dsa_mod_exp */
-       NULL,
-       NULL,                           /* init */
-       NULL,                           /* finish */
-       0,      /* flags */
-       NULL    /* app_data */
+       .name = "cryptodev DSA method"
 };
 
 static int
@@ -1244,14 +1223,7 @@ err:
 }
 
 static DH_METHOD cryptodev_dh = {
-       "cryptodev DH method",
-       NULL,                           /* cryptodev_dh_generate_key */
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       0,      /* flags */
-       NULL    /* app_data */
+       .name = "cryptodev DH method"
 };
 
 /*
index 27fc587..02631ec 100644 (file)
@@ -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)
        {
index 8fe9a45..3362c25 100644 (file)
@@ -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)
        {
index 144fdfd..85eead6 100644 (file)
@@ -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)
        {
index 09a762f..d0bcbc2 100644 (file)
@@ -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)
        {
index fbada40..0625b06 100644 (file)
@@ -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
        };
 
index f1c6732..4d28772 100644 (file)
@@ -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
+};
index d787495..216d237 100644 (file)
@@ -106,18 +106,16 @@ typedef struct bio_ber_struct
        unsigned char buf[BER_BUF_SIZE];
        } BIO_BER_CTX;
 
-static BIO_METHOD methods_ber=
-       {
-       BIO_TYPE_CIPHER,"cipher",
-       ber_write,
-       ber_read,
-       NULL, /* ber_puts, */
-       NULL, /* ber_gets, */
-       ber_ctrl,
-       ber_new,
-       ber_free,
-       ber_callback_ctrl,
-       };
+static BIO_METHOD methods_ber = {
+       .type = BIO_TYPE_CIPHER,
+       .name = "cipher",
+       .bwrite = ber_write,
+       .bread = ber_read,
+       .ctrl = ber_ctrl,
+       .create = ber_new,
+       .destroy = ber_free,
+       .callback_ctrl = ber_callback_ctrl
+};
 
 BIO_METHOD *BIO_f_ber(void)
        {
index fdd1183..f0a346a 100644 (file)
@@ -657,42 +657,40 @@ static int rsa_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
        return 2;
        }
 
-const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[] = 
+const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[] = {
        {
-               {
-               EVP_PKEY_RSA,
-               EVP_PKEY_RSA,
-               ASN1_PKEY_SIGPARAM_NULL,
+               .pkey_id = EVP_PKEY_RSA,
+               .pkey_base_id = EVP_PKEY_RSA,
+               .pkey_flags = ASN1_PKEY_SIGPARAM_NULL,
 
-               "RSA",
-               "OpenSSL RSA method",
+               .pem_str = "RSA",
+               .info = "OpenSSL RSA method",
 
-               rsa_pub_decode,
-               rsa_pub_encode,
-               rsa_pub_cmp,
-               rsa_pub_print,
+               .pub_decode = rsa_pub_decode,
+               .pub_encode = rsa_pub_encode,
+               .pub_cmp = rsa_pub_cmp,
+               .pub_print = rsa_pub_print,
 
-               rsa_priv_decode,
-               rsa_priv_encode,
-               rsa_priv_print,
+               .priv_decode = rsa_priv_decode,
+               .priv_encode = rsa_priv_encode,
+               .priv_print = rsa_priv_print,
 
-               int_rsa_size,
-               rsa_bits,
+               .pkey_size = int_rsa_size,
+               .pkey_bits = rsa_bits,
 
-               0,0,0,0,0,0,
+               .sig_print = rsa_sig_print,
 
-               rsa_sig_print,
-               int_rsa_free,
-               rsa_pkey_ctrl,
-               old_rsa_priv_decode,
-               old_rsa_priv_encode,
-               rsa_item_verify,
-               rsa_item_sign
-               },
+               .pkey_free = int_rsa_free,
+               .pkey_ctrl = rsa_pkey_ctrl,
+               .old_priv_decode = old_rsa_priv_decode,
+               .old_priv_encode = old_rsa_priv_encode,
+               .item_verify = rsa_item_verify,
+               .item_sign = rsa_item_sign
+       },
 
-               {
-               EVP_PKEY_RSA2,
-               EVP_PKEY_RSA,
-               ASN1_PKEY_ALIAS
-               }
-       };
+       {
+               .pkey_id = EVP_PKEY_RSA2,
+               .pkey_base_id = EVP_PKEY_RSA,
+               .pkey_flags = ASN1_PKEY_ALIAS
+       }
+};
index dcf0c16..845e288 100644 (file)
@@ -128,22 +128,17 @@ static int RSA_eay_private_decrypt(int flen, const unsigned char *from,
 static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *i, RSA *rsa, BN_CTX *ctx);
 static int RSA_eay_init(RSA *rsa);
 static int RSA_eay_finish(RSA *rsa);
-static RSA_METHOD rsa_pkcs1_eay_meth={
-       "Eric Young's PKCS#1 RSA",
-       RSA_eay_public_encrypt,
-       RSA_eay_public_decrypt, /* signature verification */
-       RSA_eay_private_encrypt, /* signing */
-       RSA_eay_private_decrypt,
-       RSA_eay_mod_exp,
-       BN_mod_exp_mont, /* XXX probably we should not use Montgomery if  e == 3 */
-       RSA_eay_init,
-       RSA_eay_finish,
-       0, /* flags */
-       NULL,
-       0, /* rsa_sign */
-       0, /* rsa_verify */
-       NULL /* rsa_keygen */
-       };
+static RSA_METHOD rsa_pkcs1_eay_meth = {
+       .name = "Eric Young's PKCS#1 RSA",
+       .rsa_pub_enc = RSA_eay_public_encrypt,
+       .rsa_pub_dec = RSA_eay_public_decrypt, /* signature verification */
+       .rsa_priv_enc = RSA_eay_private_encrypt, /* signing */
+       .rsa_priv_dec = RSA_eay_private_decrypt,
+       .rsa_mod_exp = RSA_eay_mod_exp,
+       .bn_mod_exp = BN_mod_exp_mont, /* XXX probably we should not use Montgomery if  e == 3 */
+       .init = RSA_eay_init,
+       .finish = RSA_eay_finish,
+};
 
 const RSA_METHOD *RSA_PKCS1_SSLeay(void)
        {
index 2f2202f..5b9317c 100644 (file)
@@ -82,22 +82,15 @@ static int RSA_null_mod_exp(const BIGNUM *r0, const BIGNUM *i, RSA *rsa);
 #endif
 static int RSA_null_init(RSA *rsa);
 static int RSA_null_finish(RSA *rsa);
-static RSA_METHOD rsa_null_meth={
-       "Null RSA",
-       RSA_null_public_encrypt,
-       RSA_null_public_decrypt,
-       RSA_null_private_encrypt,
-       RSA_null_private_decrypt,
-       NULL,
-       NULL,
-       RSA_null_init,
-       RSA_null_finish,
-       0,
-       NULL,
-       NULL,
-       NULL,
-       NULL
-       };
+static RSA_METHOD rsa_null_meth = {
+       .name = "Null RSA",
+       .rsa_pub_enc = RSA_null_public_encrypt,
+       .rsa_pub_dec = RSA_null_public_decrypt,
+       .rsa_priv_enc = RSA_null_private_encrypt,
+       .rsa_priv_dec = RSA_null_private_decrypt,
+       .init = RSA_null_init,
+       .finish = RSA_null_finish,
+};
 
 const RSA_METHOD *RSA_null_method(void)
        {
index adec632..09ef090 100644 (file)
@@ -609,41 +609,26 @@ static int pkey_rsa_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
        return ret;
        }
 
-const EVP_PKEY_METHOD rsa_pkey_meth = 
-       {
-       EVP_PKEY_RSA,
-       EVP_PKEY_FLAG_AUTOARGLEN,
-       pkey_rsa_init,
-       pkey_rsa_copy,
-       pkey_rsa_cleanup,
-
-       0,0,
-
-       0,
-       pkey_rsa_keygen,
-
-       0,
-       pkey_rsa_sign,
-
-       0,
-       pkey_rsa_verify,
-
-       0,
-       pkey_rsa_verifyrecover,
+const EVP_PKEY_METHOD rsa_pkey_meth = {
+       .pkey_id = EVP_PKEY_RSA,
+       .flags = EVP_PKEY_FLAG_AUTOARGLEN,
 
+       .init = pkey_rsa_init,
+       .copy = pkey_rsa_copy,
+       .cleanup = pkey_rsa_cleanup,
 
-       0,0,0,0,
+       .keygen = pkey_rsa_keygen,
 
-       0,
-       pkey_rsa_encrypt,
+       .sign = pkey_rsa_sign,
 
-       0,
-       pkey_rsa_decrypt,
+       .verify = pkey_rsa_verify,
 
-       0,0,
+       .verify_recover = pkey_rsa_verifyrecover,
 
-       pkey_rsa_ctrl,
-       pkey_rsa_ctrl_str
+       .encrypt = pkey_rsa_encrypt,
 
+       .decrypt = pkey_rsa_decrypt,
 
-       };
+       .ctrl = pkey_rsa_ctrl,
+       .ctrl_str = pkey_rsa_ctrl_str
+};
index 997e60f..a73279c 100644 (file)
@@ -133,25 +133,22 @@ static int mem_unlock(STORE *s, OPENSSL_ITEM attributes[],
        OPENSSL_ITEM parameters[]);
 static int mem_ctrl(STORE *s, int cmd, long l, void *p, void (*f)(void));
 
-static STORE_METHOD store_memory =
-       {
-       "OpenSSL memory store interface",
-       mem_init,
-       mem_clean,
-       mem_generate,
-       mem_get,
-       mem_store,
-       mem_modify,
-       NULL, /* revoke */
-       mem_delete,
-       mem_list_start,
-       mem_list_next,
-       mem_list_end,
-       mem_list_endp,
-       NULL, /* update */
-       mem_lock,
-       mem_unlock,
-       mem_ctrl
+static STORE_METHOD store_memory = {
+       .name = "OpenSSL memory store interface",
+       .init = mem_init,
+       .clean = mem_clean,
+       .generate_object = mem_generate,
+       .get_object = mem_get,
+       .store_object = mem_store,
+       .modify_object = mem_modify,
+       .delete_object = mem_delete,
+       .list_object_start = mem_list_start,
+       .list_object_next = mem_list_next,
+       .list_object_end = mem_list_end,
+       .list_object_endp = mem_list_endp,
+       .lock_store = mem_lock,
+       .unlock_store = mem_unlock,
+       .ctrl = mem_ctrl
        };
 
 const STORE_METHOD *STORE_Memory(void)
index d3be332..3b79eca 100644 (file)
@@ -157,13 +157,11 @@ static int noecho_console(UI *ui);
 static int close_console(UI *ui);
 
 static UI_METHOD ui_openssl = {
-       "OpenSSL default user interface",
-       open_console,
-       write_string,
-       NULL,                   /* No flusher is needed for command lines */
-       read_string,
-       close_console,
-       NULL
+       .name = "OpenSSL default user interface",
+       .ui_open_session = open_console,
+       .ui_write_string = write_string,
+       .ui_read_string = read_string,
+       .ui_close_session = close_console,
 };
 
 /* The method with all the built-in thingies */
index 36b8275..327355e 100644 (file)
@@ -124,16 +124,16 @@ static int asn1_bio_setup_ex(BIO *b, BIO_ASN1_BUF_CTX *ctx,
     asn1_bio_state_t other_state);
 
 static BIO_METHOD methods_asn1 = {
-       BIO_TYPE_ASN1,
-       "asn1",
-       asn1_bio_write,
-       asn1_bio_read,
-       asn1_bio_puts,
-       asn1_bio_gets,
-       asn1_bio_ctrl,
-       asn1_bio_new,
-       asn1_bio_free,
-       asn1_bio_callback_ctrl,
+       .type = BIO_TYPE_ASN1,
+       .name = "asn1",
+       .bwrite = asn1_bio_write,
+       .bread = asn1_bio_read,
+       .bputs = asn1_bio_puts,
+       .bgets = asn1_bio_gets,
+       .ctrl = asn1_bio_ctrl,
+       .create = asn1_bio_new,
+       .destroy = asn1_bio_free,
+       .callback_ctrl = asn1_bio_callback_ctrl
 };
 
 BIO_METHOD *
index 674cca4..097a39c 100644 (file)
@@ -78,11 +78,8 @@ static int def_crl_lookup(X509_CRL *crl, X509_REVOKED **ret,
     ASN1_INTEGER *serial, X509_NAME *issuer);
 
 static X509_CRL_METHOD int_crl_meth = {
-       0,
-       0,
-       0,
-       def_crl_lookup,
-       def_crl_verify
+       .crl_lookup = def_crl_lookup,
+       .crl_verify = def_crl_verify
 };
 
 static const X509_CRL_METHOD *default_crl_method = &int_crl_meth;
index 99be1a6..e96da40 100644 (file)
@@ -72,16 +72,16 @@ static long buffer_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
 #define DEFAULT_BUFFER_SIZE    4096
 
 static BIO_METHOD methods_buffer = {
-       BIO_TYPE_BUFFER,
-       "buffer",
-       buffer_write,
-       buffer_read,
-       buffer_puts,
-       buffer_gets,
-       buffer_ctrl,
-       buffer_new,
-       buffer_free,
-       buffer_callback_ctrl,
+       .type = BIO_TYPE_BUFFER,
+       .name = "buffer",
+       .bwrite = buffer_write,
+       .bread = buffer_read,
+       .bputs = buffer_puts,
+       .bgets = buffer_gets,
+       .ctrl = buffer_ctrl,
+       .create = buffer_new,
+       .destroy = buffer_free,
+       .callback_ctrl = buffer_callback_ctrl
 };
 
 BIO_METHOD *
index f0bd0d7..54c370d 100644 (file)
@@ -77,16 +77,16 @@ static long linebuffer_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
 /* #define DEBUG */
 
 static BIO_METHOD methods_linebuffer = {
-       BIO_TYPE_LINEBUFFER,
-       "linebuffer",
-       linebuffer_write,
-       linebuffer_read,
-       linebuffer_puts,
-       linebuffer_gets,
-       linebuffer_ctrl,
-       linebuffer_new,
-       linebuffer_free,
-       linebuffer_callback_ctrl,
+       .type = BIO_TYPE_LINEBUFFER,
+       .name = "linebuffer",
+       .bwrite = linebuffer_write,
+       .bread = linebuffer_read,
+       .bputs = linebuffer_puts,
+       .bgets = linebuffer_gets,
+       .ctrl = linebuffer_ctrl,
+       .create = linebuffer_new,
+       .destroy = linebuffer_free,
+       .callback_ctrl = linebuffer_callback_ctrl
 };
 
 BIO_METHOD *
index 048e689..5a0f6b2 100644 (file)
@@ -81,16 +81,16 @@ typedef struct nbio_test_st {
 } NBIO_TEST;
 
 static BIO_METHOD methods_nbiof = {
-       BIO_TYPE_NBIO_TEST,
-       "non-blocking IO test filter",
-       nbiof_write,
-       nbiof_read,
-       nbiof_puts,
-       nbiof_gets,
-       nbiof_ctrl,
-       nbiof_new,
-       nbiof_free,
-       nbiof_callback_ctrl,
+       .type = BIO_TYPE_NBIO_TEST,
+       .name = "non-blocking IO test filter",
+       .bwrite = nbiof_write,
+       .bread = nbiof_read,
+       .bputs = nbiof_puts,
+       .bgets = nbiof_gets,
+       .ctrl = nbiof_ctrl,
+       .create = nbiof_new,
+       .destroy = nbiof_free,
+       .callback_ctrl = nbiof_callback_ctrl
 };
 
 BIO_METHOD *
index 3bba2af..7554ed9 100644 (file)
@@ -74,16 +74,16 @@ static int nullf_free(BIO *data);
 static long nullf_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
 
 static BIO_METHOD methods_nullf = {
-       BIO_TYPE_NULL_FILTER,
-       "NULL filter",
-       nullf_write,
-       nullf_read,
-       nullf_puts,
-       nullf_gets,
-       nullf_ctrl,
-       nullf_new,
-       nullf_free,
-       nullf_callback_ctrl,
+       .type = BIO_TYPE_NULL_FILTER,
+       .name = "NULL filter",
+       .bwrite = nullf_write,
+       .bread = nullf_read,
+       .bputs = nullf_puts,
+       .bgets = nullf_gets,
+       .ctrl = nullf_ctrl,
+       .create = nullf_new,
+       .destroy = nullf_free,
+       .callback_ctrl = nullf_callback_ctrl
 };
 
 BIO_METHOD *
index 916af3c..943d3d9 100644 (file)
@@ -98,16 +98,14 @@ static void BIO_ACCEPT_free(BIO_ACCEPT *a);
 #define ACPT_S_OK                      3
 
 static BIO_METHOD methods_acceptp = {
-       BIO_TYPE_ACCEPT,
-       "socket accept",
-       acpt_write,
-       acpt_read,
-       acpt_puts,
-       NULL, /* connect_gets, */
-       acpt_ctrl,
-       acpt_new,
-       acpt_free,
-       NULL,
+       .type = BIO_TYPE_ACCEPT,
+       .name = "socket accept",
+       .bwrite = acpt_write,
+       .bread = acpt_read,
+       .bputs = acpt_puts,
+       .ctrl = acpt_ctrl,
+       .create = acpt_new,
+       .destroy = acpt_free
 };
 
 BIO_METHOD *
index d31e598..1a17cdf 100644 (file)
@@ -94,16 +94,14 @@ static int bio_make_pair(BIO *bio1, BIO *bio2);
 static void bio_destroy_pair(BIO *bio);
 
 static BIO_METHOD methods_biop = {
-       BIO_TYPE_BIO,
-       "BIO pair",
-       bio_write,
-       bio_read,
-       bio_puts,
-       NULL /* no bio_gets */,
-       bio_ctrl,
-       bio_new,
-       bio_free,
-       NULL /* no bio_callback_ctrl */
+       .type = BIO_TYPE_BIO,
+       .name = "BIO pair",
+       .bwrite = bio_write,
+       .bread = bio_read,
+       .bputs = bio_puts,
+       .ctrl = bio_ctrl,
+       .create = bio_new,
+       .destroy = bio_free
 };
 
 BIO_METHOD *
index d7a8619..7ed8f1f 100644 (file)
@@ -103,16 +103,15 @@ BIO_CONNECT *BIO_CONNECT_new(void);
 void BIO_CONNECT_free(BIO_CONNECT *a);
 
 static BIO_METHOD methods_connectp = {
-       BIO_TYPE_CONNECT,
-       "socket connect",
-       conn_write,
-       conn_read,
-       conn_puts,
-       NULL, /* connect_gets, */
-       conn_ctrl,
-       conn_new,
-       conn_free,
-       conn_callback_ctrl,
+       .type = BIO_TYPE_CONNECT,
+       .name = "socket connect",
+       .bwrite = conn_write,
+       .bread = conn_read,
+       .bputs = conn_puts,
+       .ctrl = conn_ctrl,
+       .create = conn_new,
+       .destroy = conn_free,
+       .callback_ctrl = conn_callback_ctrl
 };
 
 static int
index 8c08eff..8f7439c 100644 (file)
@@ -106,30 +106,26 @@ static int BIO_dgram_should_retry(int s);
 static void get_current_time(struct timeval *t);
 
 static BIO_METHOD methods_dgramp = {
-       BIO_TYPE_DGRAM,
-       "datagram socket",
-       dgram_write,
-       dgram_read,
-       dgram_puts,
-       NULL, /* dgram_gets, */
-       dgram_ctrl,
-       dgram_new,
-       dgram_free,
-       NULL,
+       .type = BIO_TYPE_DGRAM,
+       .name = "datagram socket",
+       .bwrite = dgram_write,
+       .bread = dgram_read,
+       .bputs = dgram_puts,
+       .ctrl = dgram_ctrl,
+       .create = dgram_new,
+       .destroy = dgram_free
 };
 
 #ifndef OPENSSL_NO_SCTP
 static BIO_METHOD methods_dgramp_sctp = {
-       BIO_TYPE_DGRAM_SCTP,
-       "datagram sctp socket",
-       dgram_sctp_write,
-       dgram_sctp_read,
-       dgram_sctp_puts,
-       NULL, /* dgram_gets, */
-       dgram_sctp_ctrl,
-       dgram_sctp_new,
-       dgram_sctp_free,
-       NULL,
+       .type = BIO_TYPE_DGRAM_SCTP,
+       .name = "datagram sctp socket",
+       .bwrite = dgram_sctp_write,
+       .bread = dgram_sctp_read,
+       .bputs = dgram_sctp_puts,
+       .ctrl = dgram_sctp_ctrl,
+       .create = dgram_sctp_new,
+       .destroy = dgram_sctp_free
 };
 #endif
 
index 8ea80f1..04a88a1 100644 (file)
@@ -79,15 +79,15 @@ static int fd_free(BIO *data);
 int BIO_fd_should_retry(int s);
 
 static BIO_METHOD methods_fdp = {
-       BIO_TYPE_FD, "file descriptor",
-       fd_write,
-       fd_read,
-       fd_puts,
-       fd_gets,
-       fd_ctrl,
-       fd_new,
-       fd_free,
-       NULL,
+       .type = BIO_TYPE_FD,
+       .name = "file descriptor",
+       .bwrite = fd_write,
+       .bread = fd_read,
+       .bputs = fd_puts,
+       .bgets = fd_gets,
+       .ctrl = fd_ctrl,
+       .create = fd_new,
+       .destroy = fd_free
 };
 
 BIO_METHOD *
index 6d5444f..6f81a45 100644 (file)
@@ -100,16 +100,15 @@ static int file_new(BIO *h);
 static int file_free(BIO *data);
 
 static BIO_METHOD methods_filep = {
-       BIO_TYPE_FILE,
-       "FILE pointer",
-       file_write,
-       file_read,
-       file_puts,
-       file_gets,
-       file_ctrl,
-       file_new,
-       file_free,
-       NULL,
+       .type = BIO_TYPE_FILE,
+       .name = "FILE pointer",
+       .bwrite = file_write,
+       .bread = file_read,
+       .bputs = file_puts,
+       .bgets = file_gets,
+       .ctrl = file_ctrl,
+       .create = file_new,
+       .destroy = file_free
 };
 
 BIO *
index 6aa2d8b..ac1cbc5 100644 (file)
@@ -86,15 +86,13 @@ static void xsyslog(BIO* bp, int priority, const char* string);
 static void xcloselog(BIO* bp);
 
 static BIO_METHOD methods_slg = {
-       BIO_TYPE_MEM, "syslog",
-       slg_write,
-       NULL,
-       slg_puts,
-       NULL,
-       slg_ctrl,
-       slg_new,
-       slg_free,
-       NULL,
+       .type = BIO_TYPE_MEM,
+       .name = "syslog",
+       .bwrite = slg_write,
+       .bputs = slg_puts,
+       .ctrl = slg_ctrl,
+       .create = slg_new,
+       .destroy = slg_free
 };
 
 BIO_METHOD *
index 1a477c1..b147a8e 100644 (file)
@@ -70,16 +70,15 @@ static int mem_new(BIO *h);
 static int mem_free(BIO *data);
 
 static BIO_METHOD mem_method = {
-       BIO_TYPE_MEM,
-       "memory buffer",
-       mem_write,
-       mem_read,
-       mem_puts,
-       mem_gets,
-       mem_ctrl,
-       mem_new,
-       mem_free,
-       NULL,
+       .type = BIO_TYPE_MEM,
+       .name = "memory buffer",
+       .bwrite = mem_write,
+       .bread = mem_read,
+       .bputs = mem_puts,
+       .bgets = mem_gets,
+       .ctrl = mem_ctrl,
+       .create = mem_new,
+       .destroy = mem_free
 };
 
 /* bio->num is used to hold the value to return on 'empty', if it is
index c728972..a5796ea 100644 (file)
@@ -70,16 +70,15 @@ static int null_new(BIO *h);
 static int null_free(BIO *data);
 
 static BIO_METHOD null_method = {
-       BIO_TYPE_NULL,
-       "NULL",
-       null_write,
-       null_read,
-       null_puts,
-       null_gets,
-       null_ctrl,
-       null_new,
-       null_free,
-       NULL,
+       .type = BIO_TYPE_NULL,
+       .name = "NULL",
+       .bwrite = null_write,
+       .bread = null_read,
+       .bputs = null_puts,
+       .bgets = null_gets,
+       .ctrl = null_ctrl,
+       .create = null_new,
+       .destroy = null_free
 };
 
 BIO_METHOD *
index 3dae256..757e1db 100644 (file)
@@ -74,16 +74,14 @@ static int sock_free(BIO *data);
 int BIO_sock_should_retry(int s);
 
 static BIO_METHOD methods_sockp = {
-       BIO_TYPE_SOCKET,
-       "socket",
-       sock_write,
-       sock_read,
-       sock_puts,
-       NULL, /* sock_gets, */
-       sock_ctrl,
-       sock_new,
-       sock_free,
-       NULL,
+       .type = BIO_TYPE_SOCKET,
+       .name = "socket",
+       .bwrite = sock_write,
+       .bread = sock_read,
+       .bputs = sock_puts,
+       .ctrl = sock_ctrl,
+       .create = sock_new,
+       .destroy = sock_free
 };
 
 BIO_METHOD *
index 0b8e567..c960e1c 100644 (file)
@@ -73,25 +73,14 @@ static void cmac_key_free(EVP_PKEY *pkey)
                CMAC_CTX_free(cmctx);
        }
 
-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,
+const EVP_PKEY_ASN1_METHOD cmac_asn1_meth = {
+       .pkey_id = EVP_PKEY_CMAC,
+       .pkey_base_id = EVP_PKEY_CMAC,
 
-       cmac_size,
-       0,
-       0,0,0,0,0,0,0,
+       .pem_str = "CMAC",
+       .info = "OpenSSL CMAC method",
 
-       cmac_key_free,
-       0,
-       0,0
-       };
+       .pkey_size = cmac_size,
+       .pkey_free = cmac_key_free
+};
 
index 00aa4d6..e1a00e9 100644 (file)
@@ -188,37 +188,19 @@ static int pkey_cmac_ctrl_str(EVP_PKEY_CTX *ctx,
        return -2;
        }
 
-const EVP_PKEY_METHOD cmac_pkey_meth = 
-       {
-       EVP_PKEY_CMAC,
-       EVP_PKEY_FLAG_SIGCTX_CUSTOM,
-       pkey_cmac_init,
-       pkey_cmac_copy,
-       pkey_cmac_cleanup,
-
-       0, 0,
-
-       0,
-       pkey_cmac_keygen,
-
-       0, 0,
-
-       0, 0,
-
-       0,0,
-
-       cmac_signctx_init,
-       cmac_signctx,
-
-       0,0,
-
-       0,0,
+const EVP_PKEY_METHOD cmac_pkey_meth = {
+       .pkey_id = EVP_PKEY_CMAC,
+       .flags = EVP_PKEY_FLAG_SIGCTX_CUSTOM,
 
-       0,0,
+       .init = pkey_cmac_init,
+       .copy = pkey_cmac_copy,
+       .cleanup = pkey_cmac_cleanup,
 
-       0,0,
+       .keygen = pkey_cmac_keygen,
 
-       pkey_cmac_ctrl,
-       pkey_cmac_ctrl_str
+       .signctx_init = cmac_signctx_init,
+       .signctx = cmac_signctx,
 
-       };
+       .ctrl = pkey_cmac_ctrl,
+       .ctrl_str = pkey_cmac_ctrl_str
+};
index 7a5db29..48e48cb 100644 (file)
@@ -10,14 +10,10 @@ static int rle_expand_block(COMP_CTX *ctx, unsigned char *out,
     unsigned int olen, unsigned char *in, unsigned int ilen);
 
 static COMP_METHOD rle_method = {
-       NID_rle_compression,
-       LN_rle_compression,
-       NULL,
-       NULL,
-       rle_compress_block,
-       rle_expand_block,
-       NULL,
-       NULL,
+       .type = NID_rle_compression,
+       .name = LN_rle_compression,
+       .compress = rle_compress_block,
+       .expand = rle_expand_block
 };
 
 COMP_METHOD *
index 3a73b3d..26c6507 100644 (file)
@@ -8,14 +8,8 @@
 COMP_METHOD *COMP_zlib(void );
 
 static COMP_METHOD zlib_method_nozlib = {
-       NID_undef,
-       "(undef)",
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       NULL,
+       .type = NID_undef,
+       .name = "(undef)"
 };
 
 #ifndef ZLIB
@@ -55,26 +49,20 @@ static int zz_uncompress(Bytef *dest, uLongf *destLen, const Bytef *source,
     uLong sourceLen);
 
 static COMP_METHOD zlib_stateless_method = {
-       NID_zlib_compression,
-       LN_zlib_compression,
-       NULL,
-       NULL,
-       zlib_compress_block,
-       zlib_expand_block,
-       NULL,
-       NULL,
+       .type = NID_zlib_compression,
+       .name = LN_zlib_compression,
+       .compress = zlib_compress_block,
+       .expand = zlib_expand_block
 };
 #endif
 
 static COMP_METHOD zlib_stateful_method = {
-       NID_zlib_compression,
-       LN_zlib_compression,
-       zlib_stateful_init,
-       zlib_stateful_finish,
-       zlib_stateful_compress_block,
-       zlib_stateful_expand_block,
-       NULL,
-       NULL,
+       .type = NID_zlib_compression,
+       .name = LN_zlib_compression,
+       .init = zlib_stateful_init,
+       .finish = zlib_stateful_finish,
+       .compress = zlib_stateful_compress_block,
+       .expand = zlib_stateful_expand_block
 };
 
 #ifdef ZLIB_SHARED
@@ -433,16 +421,14 @@ static long bio_zlib_ctrl(BIO *b, int cmd, long num, void *ptr);
 static long bio_zlib_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp);
 
 static BIO_METHOD bio_meth_zlib = {
-       BIO_TYPE_COMP,
-       "zlib",
-       bio_zlib_write,
-       bio_zlib_read,
-       NULL,
-       NULL,
-       bio_zlib_ctrl,
-       bio_zlib_new,
-       bio_zlib_free,
-       bio_zlib_callback_ctrl
+       .type = BIO_TYPE_COMP,
+       .name = "zlib",
+       .bwrite = bio_zlib_write,
+       .bread = bio_zlib_read,
+       .ctrl = bio_zlib_ctrl,
+       .create = bio_zlib_new,
+       .destroy = bio_zlib_free,
+       .callback_ctrl = bio_zlib_callback_ctrl
 };
 
 BIO_METHOD *
index d85773d..b3c75e1 100644 (file)
@@ -91,16 +91,16 @@ static int def_to_int(const CONF *conf, char c);
 const char CONF_def_version[]="CONF_def" OPENSSL_VERSION_PTEXT;
 
 static CONF_METHOD default_method = {
-       "OpenSSL default",
-       def_create,
-       def_init_default,
-       def_destroy,
-       def_destroy_data,
-       def_load_bio,
-       def_dump,
-       def_is_number,
-       def_to_int,
-       def_load
+       .name = "OpenSSL default",
+       .create = def_create,
+       .init = def_init_default,
+       .destroy = def_destroy,
+       .destroy_data = def_destroy_data,
+       .load_bio = def_load_bio,
+       .dump = def_dump,
+       .is_number = def_is_number,
+       .to_int = def_to_int,
+       .load = def_load
 };
 
 static CONF_METHOD WIN32_method = {
index d39f4b3..a22614a 100644 (file)
@@ -466,36 +466,32 @@ int DHparams_print(BIO *bp, const DH *x)
        return do_dh_print(bp, x, 4, NULL, 0);
        }
 
-const EVP_PKEY_ASN1_METHOD dh_asn1_meth = 
-       {
-       EVP_PKEY_DH,
-       EVP_PKEY_DH,
-       0,
-
-       "DH",
-       "OpenSSL PKCS#3 DH method",
-
-       dh_pub_decode,
-       dh_pub_encode,
-       dh_pub_cmp,
-       dh_public_print,
-
-       dh_priv_decode,
-       dh_priv_encode,
-       dh_private_print,
-
-       int_dh_size,
-       dh_bits,
-
-       dh_param_decode,
-       dh_param_encode,
-       dh_missing_parameters,
-       dh_copy_parameters,
-       dh_cmp_parameters,
-       dh_param_print,
-       0,
-
-       int_dh_free,
-       0
-       };
+const EVP_PKEY_ASN1_METHOD dh_asn1_meth = {
+       .pkey_id = EVP_PKEY_DH,
+       .pkey_base_id = EVP_PKEY_DH,
+
+       .pem_str = "DH",
+       .info = "OpenSSL PKCS#3 DH method",
+
+       .pub_decode = dh_pub_decode,
+       .pub_encode = dh_pub_encode,
+       .pub_cmp = dh_pub_cmp,
+       .pub_print = dh_public_print,
+
+       .priv_decode = dh_priv_decode,
+       .priv_encode = dh_priv_encode,
+       .priv_print = dh_private_print,
+
+       .pkey_size = int_dh_size,
+       .pkey_bits = dh_bits,
+
+       .param_decode = dh_param_decode,
+       .param_encode = dh_param_encode,
+       .param_missing = dh_missing_parameters,
+       .param_copy = dh_copy_parameters,
+       .param_cmp = dh_cmp_parameters,
+       .param_print = dh_param_print,
+
+       .pkey_free = int_dh_free,
+};
 
index 9596270..91352a9 100644 (file)
@@ -82,15 +82,12 @@ int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
        }
 
 static DH_METHOD dh_ossl = {
-"OpenSSL DH Method",
-generate_key,
-compute_key,
-dh_bn_mod_exp,
-dh_init,
-dh_finish,
-0,
-NULL,
-NULL
+       .name = "OpenSSL DH Method",
+       .generate_key = generate_key,
+       .compute_key = compute_key,
+       .bn_mod_exp = dh_bn_mod_exp,
+       .init = dh_init,
+       .finish = dh_finish,
 };
 
 const DH_METHOD *DH_OpenSSL(void)
index ec4553c..c359bb4 100644 (file)
@@ -217,38 +217,20 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen)
        return 1;
        }
 
-const EVP_PKEY_METHOD dh_pkey_meth = 
-       {
-       EVP_PKEY_DH,
-       EVP_PKEY_FLAG_AUTOARGLEN,
-       pkey_dh_init,
-       pkey_dh_copy,
-       pkey_dh_cleanup,
-
-       0,
-       pkey_dh_paramgen,
-
-       0,
-       pkey_dh_keygen,
-
-       0,
-       0,
-
-       0,
-       0,
-
-       0,0,
-
-       0,0,0,0,
+const EVP_PKEY_METHOD dh_pkey_meth = {
+       .pkey_id = EVP_PKEY_DH,
+       .flags = EVP_PKEY_FLAG_AUTOARGLEN,
 
-       0,0,
+       .init = pkey_dh_init,
+       .copy = pkey_dh_copy,
+       .cleanup = pkey_dh_cleanup,
 
-       0,0,
+       .paramgen = pkey_dh_paramgen,
 
-       0,
-       pkey_dh_derive,
+       .keygen = pkey_dh_keygen,
 
-       pkey_dh_ctrl,
-       pkey_dh_ctrl_str
+       .derive = pkey_dh_derive,
 
-       };
+       .ctrl = pkey_dh_ctrl,
+       .ctrl_str = pkey_dh_ctrl_str
+};
index e9c5498..ebca5ec 100644 (file)
@@ -640,65 +640,61 @@ static int dsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
 
 /* NB these are sorted in pkey_id order, lowest first */
 
-const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[] = 
+const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[] = {
        {
+               .pkey_id = EVP_PKEY_DSA2,
+               .pkey_base_id = EVP_PKEY_DSA,
+               .pkey_flags = ASN1_PKEY_ALIAS
+       },
 
-               {
-               EVP_PKEY_DSA2,
-               EVP_PKEY_DSA,
-               ASN1_PKEY_ALIAS
-               },
-
-               {
-               EVP_PKEY_DSA1,
-               EVP_PKEY_DSA,
-               ASN1_PKEY_ALIAS
-               },
-
-               {
-               EVP_PKEY_DSA4,
-               EVP_PKEY_DSA,
-               ASN1_PKEY_ALIAS
-               },
+       {
+               .pkey_id = EVP_PKEY_DSA1,
+               .pkey_base_id = EVP_PKEY_DSA,
+               .pkey_flags = ASN1_PKEY_ALIAS
+       },
 
-               {
-               EVP_PKEY_DSA3,
-               EVP_PKEY_DSA,
-               ASN1_PKEY_ALIAS
-               },
+       {
+               .pkey_id = EVP_PKEY_DSA4,
+               .pkey_base_id = EVP_PKEY_DSA,
+               .pkey_flags = ASN1_PKEY_ALIAS
+       },
 
-               {
-               EVP_PKEY_DSA,
-               EVP_PKEY_DSA,
-               0,
-
-               "DSA",
-               "OpenSSL DSA method",
-
-               dsa_pub_decode,
-               dsa_pub_encode,
-               dsa_pub_cmp,
-               dsa_pub_print,
-
-               dsa_priv_decode,
-               dsa_priv_encode,
-               dsa_priv_print,
-
-               int_dsa_size,
-               dsa_bits,
-
-               dsa_param_decode,
-               dsa_param_encode,
-               dsa_missing_parameters,
-               dsa_copy_parameters,
-               dsa_cmp_parameters,
-               dsa_param_print,
-               dsa_sig_print,
-
-               int_dsa_free,
-               dsa_pkey_ctrl,
-               old_dsa_priv_decode,
-               old_dsa_priv_encode
-               }
-       };
+       {
+               .pkey_id = EVP_PKEY_DSA3,
+               .pkey_base_id = EVP_PKEY_DSA,
+               .pkey_flags = ASN1_PKEY_ALIAS
+       },
 
+       {
+               .pkey_id = EVP_PKEY_DSA,
+               .pkey_base_id = EVP_PKEY_DSA,
+
+               .pem_str = "DSA",
+               .info = "OpenSSL DSA method",
+
+               .pub_decode = dsa_pub_decode,
+               .pub_encode = dsa_pub_encode,
+               .pub_cmp = dsa_pub_cmp,
+               .pub_print = dsa_pub_print,
+
+               .priv_decode = dsa_priv_decode,
+               .priv_encode = dsa_priv_encode,
+               .priv_print = dsa_priv_print,
+
+               .pkey_size = int_dsa_size,
+               .pkey_bits = dsa_bits,
+
+               .param_decode = dsa_param_decode,
+               .param_encode = dsa_param_encode,
+               .param_missing = dsa_missing_parameters,
+               .param_copy = dsa_copy_parameters,
+               .param_cmp = dsa_cmp_parameters,
+               .param_print = dsa_param_print,
+               .sig_print = dsa_sig_print,
+
+               .pkey_free = int_dsa_free,
+               .pkey_ctrl = dsa_pkey_ctrl,
+               .old_priv_decode = old_dsa_priv_decode,
+               .old_priv_encode = old_dsa_priv_encode
+       }
+};
index b3d78e5..7e0e3b0 100644 (file)
@@ -74,18 +74,12 @@ static int dsa_init(DSA *dsa);
 static int dsa_finish(DSA *dsa);
 
 static DSA_METHOD openssl_dsa_meth = {
-"OpenSSL DSA method",
-dsa_do_sign,
-dsa_sign_setup,
-dsa_do_verify,
-NULL, /* dsa_mod_exp, */
-NULL, /* dsa_bn_mod_exp, */
-dsa_init,
-dsa_finish,
-0,
-NULL,
-NULL,
-NULL
+       .name = "OpenSSL DSA method",
+       .dsa_do_sign = dsa_do_sign,
+       .dsa_sign_setup = dsa_sign_setup,
+       .dsa_do_verify = dsa_do_verify,
+       .init = dsa_init,
+       .finish = dsa_finish
 };
 
 /* These macro wrappers replace attempts to use the dsa_mod_exp() and
index 7076bf7..4e77c6f 100644 (file)
@@ -281,38 +281,22 @@ static int pkey_dsa_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
        return DSA_generate_key(pkey->pkey.dsa);
        }
 
-const EVP_PKEY_METHOD dsa_pkey_meth = 
-       {
-       EVP_PKEY_DSA,
-       EVP_PKEY_FLAG_AUTOARGLEN,
-       pkey_dsa_init,
-       pkey_dsa_copy,
-       pkey_dsa_cleanup,
-
-       0,
-       pkey_dsa_paramgen,
-
-       0,
-       pkey_dsa_keygen,
-
-       0,
-       pkey_dsa_sign,
-
-       0,
-       pkey_dsa_verify,
-
-       0,0,
-
-       0,0,0,0,
+const EVP_PKEY_METHOD dsa_pkey_meth = {
+       .pkey_id = EVP_PKEY_DSA,
+       .flags = EVP_PKEY_FLAG_AUTOARGLEN,
 
-       0,0,
+       .init = pkey_dsa_init,
+       .copy = pkey_dsa_copy,
+       .cleanup = pkey_dsa_cleanup,
 
-       0,0,
+       .paramgen = pkey_dsa_paramgen,
 
-       0,0,
+       .keygen = pkey_dsa_keygen,
 
-       pkey_dsa_ctrl,
-       pkey_dsa_ctrl_str
+       .sign = pkey_dsa_sign,
 
+       .verify = pkey_dsa_verify,
 
-       };
+       .ctrl = pkey_dsa_ctrl,
+       .ctrl_str = pkey_dsa_ctrl_str
+};
index 6cf9ab2..bebfdcd 100644 (file)
@@ -93,23 +93,15 @@ static int dlfcn_pathbyaddr(void *addr, char *path, int sz);
 static void *dlfcn_globallookup(const char *name);
 
 static DSO_METHOD dso_meth_dlfcn = {
-       "OpenSSL 'dlfcn' shared library method",
-       dlfcn_load,
-       dlfcn_unload,
-       dlfcn_bind_var,
-       dlfcn_bind_func,
-/* For now, "unbind" doesn't exist */
-#if 0
-       NULL, /* unbind_var */
-       NULL, /* unbind_func */
-#endif
-       NULL, /* ctrl */
-       dlfcn_name_converter,
-       dlfcn_merger,
-       NULL, /* init */
-       NULL, /* finish */
-       dlfcn_pathbyaddr,
-       dlfcn_globallookup
+       .name = "OpenSSL 'dlfcn' shared library method",
+       .dso_load = dlfcn_load,
+       .dso_unload = dlfcn_unload,
+       .dso_bind_var = dlfcn_bind_var,
+       .dso_bind_func = dlfcn_bind_func,
+       .dso_name_converter = dlfcn_name_converter,
+       .dso_merger = dlfcn_merger,
+       .pathbyaddr = dlfcn_pathbyaddr,
+       .globallookup = dlfcn_globallookup
 };
 
 DSO_METHOD *
index 0c877ab..c9f4226 100644 (file)
 #include <openssl/dso.h>
 
 static DSO_METHOD dso_meth_null = {
-       "NULL shared library method",
-       NULL, /* load */
-       NULL, /* unload */
-       NULL, /* bind_var */
-       NULL, /* bind_func */
-/* For now, "unbind" doesn't exist */
-#if 0
-       NULL, /* unbind_var */
-       NULL, /* unbind_func */
-#endif
-       NULL, /* ctrl */
-       NULL, /* dso_name_converter */
-       NULL, /* dso_merger */
-       NULL, /* init */
-       NULL, /* finish */
-       NULL, /* pathbyaddr */
-       NULL  /* globallookup */
+       .name = "NULL shared library method"
 };
 
 DSO_METHOD *
index 0cf681f..5682bfa 100644 (file)
 
 #ifndef OPENSSL_NO_EC2M
 
-const EC_METHOD *EC_GF2m_simple_method(void)
-       {
+const EC_METHOD *
+EC_GF2m_simple_method(void)
+{
        static const EC_METHOD ret = {
-               EC_FLAGS_DEFAULT_OCT,
-               NID_X9_62_characteristic_two_field,
-               ec_GF2m_simple_group_init,
-               ec_GF2m_simple_group_finish,
-               ec_GF2m_simple_group_clear_finish,
-               ec_GF2m_simple_group_copy,
-               ec_GF2m_simple_group_set_curve,
-               ec_GF2m_simple_group_get_curve,
-               ec_GF2m_simple_group_get_degree,
-               ec_GF2m_simple_group_check_discriminant,
-               ec_GF2m_simple_point_init,
-               ec_GF2m_simple_point_finish,
-               ec_GF2m_simple_point_clear_finish,
-               ec_GF2m_simple_point_copy,
-               ec_GF2m_simple_point_set_to_infinity,
-               0 /* set_Jprojective_coordinates_GFp */,
-               0 /* get_Jprojective_coordinates_GFp */,
-               ec_GF2m_simple_point_set_affine_coordinates,
-               ec_GF2m_simple_point_get_affine_coordinates,
-               0,0,0,
-               ec_GF2m_simple_add,
-               ec_GF2m_simple_dbl,
-               ec_GF2m_simple_invert,
-               ec_GF2m_simple_is_at_infinity,
-               ec_GF2m_simple_is_on_curve,
-               ec_GF2m_simple_cmp,
-               ec_GF2m_simple_make_affine,
-               ec_GF2m_simple_points_make_affine,
+               .flags = EC_FLAGS_DEFAULT_OCT,
+               .field_type = NID_X9_62_characteristic_two_field,
+               .group_init = ec_GF2m_simple_group_init,
+               .group_finish = ec_GF2m_simple_group_finish,
+               .group_clear_finish = ec_GF2m_simple_group_clear_finish,
+               .group_copy = ec_GF2m_simple_group_copy,
+               .group_set_curve = ec_GF2m_simple_group_set_curve,
+               .group_get_curve = ec_GF2m_simple_group_get_curve,
+               .group_get_degree = ec_GF2m_simple_group_get_degree,
+               .group_check_discriminant =
+                   ec_GF2m_simple_group_check_discriminant,
+               .point_init = ec_GF2m_simple_point_init,
+               .point_finish = ec_GF2m_simple_point_finish,
+               .point_clear_finish = ec_GF2m_simple_point_clear_finish,
+               .point_copy = ec_GF2m_simple_point_copy,
+               .point_set_to_infinity = ec_GF2m_simple_point_set_to_infinity,
+               .point_set_affine_coordinates =
+                   ec_GF2m_simple_point_set_affine_coordinates,
+               .point_get_affine_coordinates =
+                   ec_GF2m_simple_point_get_affine_coordinates,
+               .add = ec_GF2m_simple_add,
+               .dbl = ec_GF2m_simple_dbl,
+               .invert = ec_GF2m_simple_invert,
+               .is_at_infinity = ec_GF2m_simple_is_at_infinity,
+               .is_on_curve = ec_GF2m_simple_is_on_curve,
+               .point_cmp = ec_GF2m_simple_cmp,
+               .make_affine = ec_GF2m_simple_make_affine,
+               .points_make_affine = ec_GF2m_simple_points_make_affine,
 
                /* the following three method functions are defined in ec2_mult.c */
-               ec_GF2m_simple_mul,
-               ec_GF2m_precompute_mult,
-               ec_GF2m_have_precompute_mult,
+               .mul = ec_GF2m_simple_mul,
+               .precompute_mult = ec_GF2m_precompute_mult,
+               .have_precompute_mult = ec_GF2m_have_precompute_mult,
 
-               ec_GF2m_simple_field_mul,
-               ec_GF2m_simple_field_sqr,
-               ec_GF2m_simple_field_div,
-               0 /* field_encode */,
-               0 /* field_decode */,
-               0 /* field_set_to_one */ };
+               .field_mul = ec_GF2m_simple_field_mul,
+               .field_sqr = ec_GF2m_simple_field_sqr,
+               .field_div = ec_GF2m_simple_field_div,
+       };
 
        return &ret;
-       }
+}
 
 
 /* Initialize a GF(2^m)-based EC_GROUP structure.
index 79dd110..0e6381f 100644 (file)
@@ -626,36 +626,34 @@ static int ec_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
 
        }
 
-const EVP_PKEY_ASN1_METHOD eckey_asn1_meth = 
-       {
-       EVP_PKEY_EC,
-       EVP_PKEY_EC,
-       0,
-       "EC",
-       "OpenSSL EC algorithm",
-
-       eckey_pub_decode,
-       eckey_pub_encode,
-       eckey_pub_cmp,
-       eckey_pub_print,
-
-       eckey_priv_decode,
-       eckey_priv_encode,
-       eckey_priv_print,
-
-       int_ec_size,
-       ec_bits,
-
-       eckey_param_decode,
-       eckey_param_encode,
-       ec_missing_parameters,
-       ec_copy_parameters,
-       ec_cmp_parameters,
-       eckey_param_print,
-       0,
-
-       int_ec_free,
-       ec_pkey_ctrl,
-       old_ec_priv_decode,
-       old_ec_priv_encode
-       };
+const EVP_PKEY_ASN1_METHOD eckey_asn1_meth = {
+       .pkey_id = EVP_PKEY_EC,
+       .pkey_base_id = EVP_PKEY_EC,
+
+       .pem_str = "EC",
+       .info = "OpenSSL EC algorithm",
+
+       .pub_decode = eckey_pub_decode,
+       .pub_encode = eckey_pub_encode,
+       .pub_cmp = eckey_pub_cmp,
+       .pub_print = eckey_pub_print,
+
+       .priv_decode = eckey_priv_decode,
+       .priv_encode = eckey_priv_encode,
+       .priv_print = eckey_priv_print,
+
+       .pkey_size = int_ec_size,
+       .pkey_bits = ec_bits,
+
+       .param_decode = eckey_param_decode,
+       .param_encode = eckey_param_encode,
+       .param_missing = ec_missing_parameters,
+       .param_copy = ec_copy_parameters,
+       .param_cmp = ec_cmp_parameters,
+       .param_print = eckey_param_print,
+
+       .pkey_free = int_ec_free,
+       .pkey_ctrl = ec_pkey_ctrl,
+       .old_priv_decode = old_ec_priv_decode,
+       .old_priv_encode = old_ec_priv_encode
+};
index dfc8ace..c970d8c 100644 (file)
@@ -304,38 +304,23 @@ static int pkey_ec_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
        return EC_KEY_generate_key(pkey->pkey.ec);
        }
 
-const EVP_PKEY_METHOD ec_pkey_meth = 
-       {
-       EVP_PKEY_EC,
-       0,
-       pkey_ec_init,
-       pkey_ec_copy,
-       pkey_ec_cleanup,
-
-       0,
-       pkey_ec_paramgen,
-
-       0,
-       pkey_ec_keygen,
-
-       0,
-       pkey_ec_sign,
-
-       0,
-       pkey_ec_verify,
+const EVP_PKEY_METHOD ec_pkey_meth = {
+       .pkey_id = EVP_PKEY_EC,
 
-       0,0,
+       .init = pkey_ec_init,
+       .copy = pkey_ec_copy,
+       .cleanup = pkey_ec_cleanup,
 
-       0,0,0,0,
+       .paramgen = pkey_ec_paramgen,
 
-       0,0,
+       .keygen = pkey_ec_keygen,
 
-       0,0,
+       .sign = pkey_ec_sign,
 
-       0,
-       pkey_ec_derive,
+       .verify = pkey_ec_verify,
 
-       pkey_ec_ctrl,
-       pkey_ec_ctrl_str
+       .derive = pkey_ec_derive,
 
-       };
+       .ctrl = pkey_ec_ctrl,
+       .ctrl_str = pkey_ec_ctrl_str
+};
index cee0fee..6b5b856 100644 (file)
 #include "ec_lcl.h"
 
 
-const EC_METHOD *EC_GFp_mont_method(void)
-       {
+const EC_METHOD *
+EC_GFp_mont_method(void)
+{
        static const EC_METHOD ret = {
-               EC_FLAGS_DEFAULT_OCT,
-               NID_X9_62_prime_field,
-               ec_GFp_mont_group_init,
-               ec_GFp_mont_group_finish,
-               ec_GFp_mont_group_clear_finish,
-               ec_GFp_mont_group_copy,
-               ec_GFp_mont_group_set_curve,
-               ec_GFp_simple_group_get_curve,
-               ec_GFp_simple_group_get_degree,
-               ec_GFp_simple_group_check_discriminant,
-               ec_GFp_simple_point_init,
-               ec_GFp_simple_point_finish,
-               ec_GFp_simple_point_clear_finish,
-               ec_GFp_simple_point_copy,
-               ec_GFp_simple_point_set_to_infinity,
-               ec_GFp_simple_set_Jprojective_coordinates_GFp,
-               ec_GFp_simple_get_Jprojective_coordinates_GFp,
-               ec_GFp_simple_point_set_affine_coordinates,
-               ec_GFp_simple_point_get_affine_coordinates,
-               0,0,0,
-               ec_GFp_simple_add,
-               ec_GFp_simple_dbl,
-               ec_GFp_simple_invert,
-               ec_GFp_simple_is_at_infinity,
-               ec_GFp_simple_is_on_curve,
-               ec_GFp_simple_cmp,
-               ec_GFp_simple_make_affine,
-               ec_GFp_simple_points_make_affine,
-               0 /* mul */,
-               0 /* precompute_mult */,
-               0 /* have_precompute_mult */,   
-               ec_GFp_mont_field_mul,
-               ec_GFp_mont_field_sqr,
-               0 /* field_div */,
-               ec_GFp_mont_field_encode,
-               ec_GFp_mont_field_decode,
-               ec_GFp_mont_field_set_to_one };
+               .flags = EC_FLAGS_DEFAULT_OCT,
+               .field_type = NID_X9_62_prime_field,
+               .group_init = ec_GFp_mont_group_init,
+               .group_finish = ec_GFp_mont_group_finish,
+               .group_clear_finish = ec_GFp_mont_group_clear_finish,
+               .group_copy = ec_GFp_mont_group_copy,
+               .group_set_curve = ec_GFp_mont_group_set_curve,
+               .group_get_curve = ec_GFp_simple_group_get_curve,
+               .group_get_degree = ec_GFp_simple_group_get_degree,
+               .group_check_discriminant =
+                   ec_GFp_simple_group_check_discriminant,
+               .point_init = ec_GFp_simple_point_init,
+               .point_finish = ec_GFp_simple_point_finish,
+               .point_clear_finish = ec_GFp_simple_point_clear_finish,
+               .point_copy = ec_GFp_simple_point_copy,
+               .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity,
+               .point_set_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_set_Jprojective_coordinates_GFp,
+               .point_get_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_get_Jprojective_coordinates_GFp,
+               .point_set_affine_coordinates =
+                   ec_GFp_simple_point_set_affine_coordinates,
+               .point_get_affine_coordinates =
+                   ec_GFp_simple_point_get_affine_coordinates,
+               .add = ec_GFp_simple_add,
+               .dbl = ec_GFp_simple_dbl,
+               .invert = ec_GFp_simple_invert,
+               .is_at_infinity = ec_GFp_simple_is_at_infinity,
+               .is_on_curve = ec_GFp_simple_is_on_curve,
+               .point_cmp = ec_GFp_simple_cmp,
+               .make_affine = ec_GFp_simple_make_affine,
+               .points_make_affine = ec_GFp_simple_points_make_affine,
+               .field_mul = ec_GFp_mont_field_mul,
+               .field_sqr = ec_GFp_mont_field_sqr,
+               .field_encode = ec_GFp_mont_field_encode,
+               .field_decode = ec_GFp_mont_field_decode,
+               .field_set_to_one = ec_GFp_mont_field_set_to_one
+       };
 
        return &ret;
-       }
+}
 
 
 int ec_GFp_mont_group_init(EC_GROUP *group)
index ac5b814..479cff8 100644 (file)
 #include <openssl/obj_mac.h>
 #include "ec_lcl.h"
 
-const EC_METHOD *EC_GFp_nist_method(void)
-       {
+const EC_METHOD *
+EC_GFp_nist_method(void)
+{
        static const EC_METHOD ret = {
-               EC_FLAGS_DEFAULT_OCT,
-               NID_X9_62_prime_field,
-               ec_GFp_simple_group_init,
-               ec_GFp_simple_group_finish,
-               ec_GFp_simple_group_clear_finish,
-               ec_GFp_nist_group_copy,
-               ec_GFp_nist_group_set_curve,
-               ec_GFp_simple_group_get_curve,
-               ec_GFp_simple_group_get_degree,
-               ec_GFp_simple_group_check_discriminant,
-               ec_GFp_simple_point_init,
-               ec_GFp_simple_point_finish,
-               ec_GFp_simple_point_clear_finish,
-               ec_GFp_simple_point_copy,
-               ec_GFp_simple_point_set_to_infinity,
-               ec_GFp_simple_set_Jprojective_coordinates_GFp,
-               ec_GFp_simple_get_Jprojective_coordinates_GFp,
-               ec_GFp_simple_point_set_affine_coordinates,
-               ec_GFp_simple_point_get_affine_coordinates,
-               0,0,0,
-               ec_GFp_simple_add,
-               ec_GFp_simple_dbl,
-               ec_GFp_simple_invert,
-               ec_GFp_simple_is_at_infinity,
-               ec_GFp_simple_is_on_curve,
-               ec_GFp_simple_cmp,
-               ec_GFp_simple_make_affine,
-               ec_GFp_simple_points_make_affine,
-               0 /* mul */,
-               0 /* precompute_mult */,
-               0 /* have_precompute_mult */,   
-               ec_GFp_nist_field_mul,
-               ec_GFp_nist_field_sqr,
-               0 /* field_div */,
-               0 /* field_encode */,
-               0 /* field_decode */,
-               0 /* field_set_to_one */ };
+               .flags = EC_FLAGS_DEFAULT_OCT,
+               .field_type = NID_X9_62_prime_field,
+               .group_init = ec_GFp_simple_group_init,
+               .group_finish = ec_GFp_simple_group_finish,
+               .group_clear_finish = ec_GFp_simple_group_clear_finish,
+               .group_copy = ec_GFp_nist_group_copy,
+               .group_set_curve = ec_GFp_nist_group_set_curve,
+               .group_get_curve = ec_GFp_simple_group_get_curve,
+               .group_get_degree = ec_GFp_simple_group_get_degree,
+               .group_check_discriminant =
+                   ec_GFp_simple_group_check_discriminant,
+               .point_init = ec_GFp_simple_point_init,
+               .point_finish = ec_GFp_simple_point_finish,
+               .point_clear_finish = ec_GFp_simple_point_clear_finish,
+               .point_copy = ec_GFp_simple_point_copy,
+               .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity,
+               .point_set_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_set_Jprojective_coordinates_GFp,
+               .point_get_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_get_Jprojective_coordinates_GFp,
+               .point_set_affine_coordinates =
+                   ec_GFp_simple_point_set_affine_coordinates,
+               .point_get_affine_coordinates =
+                   ec_GFp_simple_point_get_affine_coordinates,
+               .add = ec_GFp_simple_add,
+               .dbl = ec_GFp_simple_dbl,
+               .invert = ec_GFp_simple_invert,
+               .is_at_infinity = ec_GFp_simple_is_at_infinity,
+               .is_on_curve = ec_GFp_simple_is_on_curve,
+               .point_cmp = ec_GFp_simple_cmp,
+               .make_affine = ec_GFp_simple_make_affine,
+               .points_make_affine = ec_GFp_simple_points_make_affine,
+               .field_mul = ec_GFp_nist_field_mul,
+               .field_sqr = ec_GFp_nist_field_sqr
+       };
 
        return &ret;
-       }
+}
 
 int ec_GFp_nist_group_copy(EC_GROUP *dest, const EC_GROUP *src)
        {
index 03f2d9c..696024a 100644 (file)
@@ -233,51 +233,51 @@ typedef struct {
        int references;
 } NISTP224_PRE_COMP;
 
-const EC_METHOD *EC_GFp_nistp224_method(void)
-       {
+const EC_METHOD *
+EC_GFp_nistp224_method(void)
+{
        static const EC_METHOD ret = {
-               EC_FLAGS_DEFAULT_OCT,
-               NID_X9_62_prime_field,
-               ec_GFp_nistp224_group_init,
-               ec_GFp_simple_group_finish,
-               ec_GFp_simple_group_clear_finish,
-               ec_GFp_nist_group_copy,
-               ec_GFp_nistp224_group_set_curve,
-               ec_GFp_simple_group_get_curve,
-               ec_GFp_simple_group_get_degree,
-               ec_GFp_simple_group_check_discriminant,
-               ec_GFp_simple_point_init,
-               ec_GFp_simple_point_finish,
-               ec_GFp_simple_point_clear_finish,
-               ec_GFp_simple_point_copy,
-               ec_GFp_simple_point_set_to_infinity,
-               ec_GFp_simple_set_Jprojective_coordinates_GFp,
-               ec_GFp_simple_get_Jprojective_coordinates_GFp,
-               ec_GFp_simple_point_set_affine_coordinates,
-               ec_GFp_nistp224_point_get_affine_coordinates,
-               0 /* point_set_compressed_coordinates */,
-               0 /* point2oct */,
-               0 /* oct2point */,
-               ec_GFp_simple_add,
-               ec_GFp_simple_dbl,
-               ec_GFp_simple_invert,
-               ec_GFp_simple_is_at_infinity,
-               ec_GFp_simple_is_on_curve,
-               ec_GFp_simple_cmp,
-               ec_GFp_simple_make_affine,
-               ec_GFp_simple_points_make_affine,
-               ec_GFp_nistp224_points_mul,
-               ec_GFp_nistp224_precompute_mult,
-               ec_GFp_nistp224_have_precompute_mult,
-               ec_GFp_nist_field_mul,
-               ec_GFp_nist_field_sqr,
-               0 /* field_div */,
-               0 /* field_encode */,
-               0 /* field_decode */,
-               0 /* field_set_to_one */ };
+               .flags = EC_FLAGS_DEFAULT_OCT,
+               .field_type = NID_X9_62_prime_field,
+               .group_init = ec_GFp_nistp224_group_init,
+               .group_finish = ec_GFp_simple_group_finish,
+               .group_clear_finish = ec_GFp_simple_group_clear_finish,
+               .group_copy = ec_GFp_nist_group_copy,
+               .group_set_curve = ec_GFp_nistp224_group_set_curve,
+               .group_get_curve = ec_GFp_simple_group_get_curve,
+               .group_get_degree = ec_GFp_simple_group_get_degree,
+               .group_check_discriminant =
+                   ec_GFp_simple_group_check_discriminant,
+               .point_init = ec_GFp_simple_point_init,
+               .point_finish = ec_GFp_simple_point_finish,
+               .point_clear_finish = ec_GFp_simple_point_clear_finish,
+               .point_copy = ec_GFp_simple_point_copy,
+               .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity,
+               .point_set_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_set_Jprojective_coordinates_GFp,
+               .point_get_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_get_Jprojective_coordinates_GFp,
+               .point_set_affine_coordinates =
+                   ec_GFp_simple_point_set_affine_coordinates,
+               .point_get_affine_coordinates =
+                   ec_GFp_nistp224_point_get_affine_coordinates,
+               .add = ec_GFp_simple_add,
+               .dbl = ec_GFp_simple_dbl,
+               .invert = ec_GFp_simple_invert,
+               .is_at_infinity = ec_GFp_simple_is_at_infinity,
+               .is_on_curve = ec_GFp_simple_is_on_curve,
+               .point_cmp = ec_GFp_simple_cmp,
+               .make_affine = ec_GFp_simple_make_affine,
+               .points_make_affine = ec_GFp_simple_points_make_affine,
+               .mul = ec_GFp_nistp224_points_mul,
+               .precompute_mult = ec_GFp_nistp224_precompute_mult,
+               .have_precompute_mult = ec_GFp_nistp224_have_precompute_mult,
+               .field_mul = ec_GFp_nist_field_mul,
+               .field_sqr = ec_GFp_nist_field_sqr
+       };
 
        return &ret;
-       }
+}
 
 /* Helper functions to convert field elements to/from internal representation */
 static void bin28_to_felem(felem out, const u8 in[28])
index 947fb7e..132ca0d 100644 (file)
@@ -1613,51 +1613,51 @@ typedef struct {
        int references;
 } NISTP256_PRE_COMP;
 
-const EC_METHOD *EC_GFp_nistp256_method(void)
-       {
+const EC_METHOD *
+EC_GFp_nistp256_method(void)
+{
        static const EC_METHOD ret = {
-               EC_FLAGS_DEFAULT_OCT,
-               NID_X9_62_prime_field,
-               ec_GFp_nistp256_group_init,
-               ec_GFp_simple_group_finish,
-               ec_GFp_simple_group_clear_finish,
-               ec_GFp_nist_group_copy,
-               ec_GFp_nistp256_group_set_curve,
-               ec_GFp_simple_group_get_curve,
-               ec_GFp_simple_group_get_degree,
-               ec_GFp_simple_group_check_discriminant,
-               ec_GFp_simple_point_init,
-               ec_GFp_simple_point_finish,
-               ec_GFp_simple_point_clear_finish,
-               ec_GFp_simple_point_copy,
-               ec_GFp_simple_point_set_to_infinity,
-               ec_GFp_simple_set_Jprojective_coordinates_GFp,
-               ec_GFp_simple_get_Jprojective_coordinates_GFp,
-               ec_GFp_simple_point_set_affine_coordinates,
-               ec_GFp_nistp256_point_get_affine_coordinates,
-               0 /* point_set_compressed_coordinates */,
-               0 /* point2oct */,
-               0 /* oct2point */,
-               ec_GFp_simple_add,
-               ec_GFp_simple_dbl,
-               ec_GFp_simple_invert,
-               ec_GFp_simple_is_at_infinity,
-               ec_GFp_simple_is_on_curve,
-               ec_GFp_simple_cmp,
-               ec_GFp_simple_make_affine,
-               ec_GFp_simple_points_make_affine,
-               ec_GFp_nistp256_points_mul,
-               ec_GFp_nistp256_precompute_mult,
-               ec_GFp_nistp256_have_precompute_mult,
-               ec_GFp_nist_field_mul,
-               ec_GFp_nist_field_sqr,
-               0 /* field_div */,
-               0 /* field_encode */,
-               0 /* field_decode */,
-               0 /* field_set_to_one */ };
+               .flags = EC_FLAGS_DEFAULT_OCT,
+               .field_type = NID_X9_62_prime_field,
+               .group_init = ec_GFp_nistp256_group_init,
+               .group_finish = ec_GFp_simple_group_finish,
+               .group_clear_finish = ec_GFp_simple_group_clear_finish,
+               .group_copy = ec_GFp_nist_group_copy,
+               .group_set_curve = ec_GFp_nistp256_group_set_curve,
+               .group_get_curve = ec_GFp_simple_group_get_curve,
+               .group_get_degree = ec_GFp_simple_group_get_degree,
+               .group_check_discriminant =
+                   ec_GFp_simple_group_check_discriminant,
+               .point_init = ec_GFp_simple_point_init,
+               .point_finish = ec_GFp_simple_point_finish,
+               .point_clear_finish = ec_GFp_simple_point_clear_finish,
+               .point_copy = ec_GFp_simple_point_copy,
+               .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity,
+               .point_set_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_set_Jprojective_coordinates_GFp,
+               .point_get_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_get_Jprojective_coordinates_GFp,
+               .point_set_affine_coordinates =
+                   ec_GFp_simple_point_set_affine_coordinates,
+               .point_get_affine_coordinates =
+                   ec_GFp_nistp256_point_get_affine_coordinates,
+               .add = ec_GFp_simple_add,
+               .dbl = ec_GFp_simple_dbl,
+               .invert = ec_GFp_simple_invert,
+               .is_at_infinity = ec_GFp_simple_is_at_infinity,
+               .is_on_curve = ec_GFp_simple_is_on_curve,
+               .point_cmp = ec_GFp_simple_cmp,
+               .make_affine = ec_GFp_simple_make_affine,
+               .points_make_affine = ec_GFp_simple_points_make_affine,
+               .mul = ec_GFp_nistp256_points_mul,
+               .precompute_mult = ec_GFp_nistp256_precompute_mult,
+               .have_precompute_mult = ec_GFp_nistp256_have_precompute_mult,
+               .field_mul = ec_GFp_nist_field_mul,
+               .field_sqr = ec_GFp_nist_field_sqr
+       };
 
        return &ret;
-       }
+}
 
 /******************************************************************************/
 /*                    FUNCTIONS TO MANAGE PRECOMPUTATION
index 24eb032..c34c38b 100644 (file)
@@ -1479,51 +1479,51 @@ typedef struct {
        int references;
 } NISTP521_PRE_COMP;
 
-const EC_METHOD *EC_GFp_nistp521_method(void)
-       {
+const EC_METHOD *
+EC_GFp_nistp521_method(void)
+{
        static const EC_METHOD ret = {
-               EC_FLAGS_DEFAULT_OCT,
-               NID_X9_62_prime_field,
-               ec_GFp_nistp521_group_init,
-               ec_GFp_simple_group_finish,
-               ec_GFp_simple_group_clear_finish,
-               ec_GFp_nist_group_copy,
-               ec_GFp_nistp521_group_set_curve,
-               ec_GFp_simple_group_get_curve,
-               ec_GFp_simple_group_get_degree,
-               ec_GFp_simple_group_check_discriminant,
-               ec_GFp_simple_point_init,
-               ec_GFp_simple_point_finish,
-               ec_GFp_simple_point_clear_finish,
-               ec_GFp_simple_point_copy,
-               ec_GFp_simple_point_set_to_infinity,
-               ec_GFp_simple_set_Jprojective_coordinates_GFp,
-               ec_GFp_simple_get_Jprojective_coordinates_GFp,
-               ec_GFp_simple_point_set_affine_coordinates,
-               ec_GFp_nistp521_point_get_affine_coordinates,
-               0 /* point_set_compressed_coordinates */,
-               0 /* point2oct */,
-               0 /* oct2point */,
-               ec_GFp_simple_add,
-               ec_GFp_simple_dbl,
-               ec_GFp_simple_invert,
-               ec_GFp_simple_is_at_infinity,
-               ec_GFp_simple_is_on_curve,
-               ec_GFp_simple_cmp,
-               ec_GFp_simple_make_affine,
-               ec_GFp_simple_points_make_affine,
-               ec_GFp_nistp521_points_mul,
-               ec_GFp_nistp521_precompute_mult,
-               ec_GFp_nistp521_have_precompute_mult,
-               ec_GFp_nist_field_mul,
-               ec_GFp_nist_field_sqr,
-               0 /* field_div */,
-               0 /* field_encode */,
-               0 /* field_decode */,
-               0 /* field_set_to_one */ };
+               .flags = EC_FLAGS_DEFAULT_OCT,
+               .field_type = NID_X9_62_prime_field,
+               .group_init = ec_GFp_nistp521_group_init,
+               .group_finish = ec_GFp_simple_group_finish,
+               .group_clear_finish = ec_GFp_simple_group_clear_finish,
+               .group_copy = ec_GFp_nist_group_copy,
+               .group_set_curve = ec_GFp_nistp521_group_set_curve,
+               .group_get_curve = ec_GFp_simple_group_get_curve,
+               .group_get_degree = ec_GFp_simple_group_get_degree,
+               .group_check_discriminant =
+                   ec_GFp_simple_group_check_discriminant,
+               .point_init = ec_GFp_simple_point_init,
+               .point_finish = ec_GFp_simple_point_finish,
+               .point_clear_finish = ec_GFp_simple_point_clear_finish,
+               .point_copy = ec_GFp_simple_point_copy,
+               .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity,
+               .point_set_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_set_Jprojective_coordinates_GFp,
+               .point_get_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_get_Jprojective_coordinates_GFp,
+               .point_set_affine_coordinates =
+                   ec_GFp_simple_point_set_affine_coordinates,
+               .point_get_affine_coordinates =
+                   ec_GFp_nistp521_point_get_affine_coordinates,
+               .add = ec_GFp_simple_add,
+               .dbl = ec_GFp_simple_dbl,
+               .invert = ec_GFp_simple_invert,
+               .is_at_infinity = ec_GFp_simple_is_at_infinity,
+               .is_on_curve = ec_GFp_simple_is_on_curve,
+               .point_cmp = ec_GFp_simple_cmp,
+               .make_affine = ec_GFp_simple_make_affine,
+               .points_make_affine = ec_GFp_simple_points_make_affine,
+               .mul = ec_GFp_nistp521_points_mul,
+               .precompute_mult = ec_GFp_nistp521_precompute_mult,
+               .have_precompulte_mult = ec_GFp_nistp521_have_precompute_mult,
+               .field_mul = ec_GFp_nist_field_mul,
+               .field_sqr = ec_GFp_nist_field_sqr
+       };
 
        return &ret;
-       }
+}
 
 
 /******************************************************************************/
index a146752..c99348f 100644 (file)
 
 #include "ec_lcl.h"
 
-const EC_METHOD *EC_GFp_simple_method(void)
-       {
+const EC_METHOD *
+EC_GFp_simple_method(void)
+{
        static const EC_METHOD ret = {
-               EC_FLAGS_DEFAULT_OCT,
-               NID_X9_62_prime_field,
-               ec_GFp_simple_group_init,
-               ec_GFp_simple_group_finish,
-               ec_GFp_simple_group_clear_finish,
-               ec_GFp_simple_group_copy,
-               ec_GFp_simple_group_set_curve,
-               ec_GFp_simple_group_get_curve,
-               ec_GFp_simple_group_get_degree,
-               ec_GFp_simple_group_check_discriminant,
-               ec_GFp_simple_point_init,
-               ec_GFp_simple_point_finish,
-               ec_GFp_simple_point_clear_finish,
-               ec_GFp_simple_point_copy,
-               ec_GFp_simple_point_set_to_infinity,
-               ec_GFp_simple_set_Jprojective_coordinates_GFp,
-               ec_GFp_simple_get_Jprojective_coordinates_GFp,
-               ec_GFp_simple_point_set_affine_coordinates,
-               ec_GFp_simple_point_get_affine_coordinates,
-               0,0,0,
-               ec_GFp_simple_add,
-               ec_GFp_simple_dbl,
-               ec_GFp_simple_invert,
-               ec_GFp_simple_is_at_infinity,
-               ec_GFp_simple_is_on_curve,
-               ec_GFp_simple_cmp,
-               ec_GFp_simple_make_affine,
-               ec_GFp_simple_points_make_affine,
-               0 /* mul */,
-               0 /* precompute_mult */,
-               0 /* have_precompute_mult */,   
-               ec_GFp_simple_field_mul,
-               ec_GFp_simple_field_sqr,
-               0 /* field_div */,
-               0 /* field_encode */,
-               0 /* field_decode */,
-               0 /* field_set_to_one */ };
+               .flags = EC_FLAGS_DEFAULT_OCT,
+               .field_type = NID_X9_62_prime_field,
+               .group_init = ec_GFp_simple_group_init,
+               .group_finish = ec_GFp_simple_group_finish,
+               .group_clear_finish = ec_GFp_simple_group_clear_finish,
+               .group_copy = ec_GFp_simple_group_copy,
+               .group_set_curve = ec_GFp_simple_group_set_curve,
+               .group_get_curve = ec_GFp_simple_group_get_curve,
+               .group_get_degree = ec_GFp_simple_group_get_degree,
+               .group_check_discriminant =
+                   ec_GFp_simple_group_check_discriminant,
+               .point_init = ec_GFp_simple_point_init,
+               .point_finish = ec_GFp_simple_point_finish,
+               .point_clear_finish = ec_GFp_simple_point_clear_finish,
+               .point_copy = ec_GFp_simple_point_copy,
+               .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity,
+               .point_set_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_set_Jprojective_coordinates_GFp,
+               .point_get_Jprojective_coordinates_GFp =
+                   ec_GFp_simple_get_Jprojective_coordinates_GFp,
+               .point_set_affine_coordinates = 
+                   ec_GFp_simple_point_set_affine_coordinates,
+               .point_get_affine_coordinates = 
+                   ec_GFp_simple_point_get_affine_coordinates,
+               .add = ec_GFp_simple_add,
+               .dbl = ec_GFp_simple_dbl,
+               .invert = ec_GFp_simple_invert,
+               .is_at_infinity = ec_GFp_simple_is_at_infinity,
+               .is_on_curve = ec_GFp_simple_is_on_curve,
+               .point_cmp = ec_GFp_simple_cmp,
+               .make_affine = ec_GFp_simple_make_affine,
+               .points_make_affine = ec_GFp_simple_points_make_affine,
+               .field_mul = ec_GFp_simple_field_mul,
+               .field_sqr = ec_GFp_simple_field_sqr
+       };
 
        return &ret;
-       }
+}
 
 
 /* Most method functions in this file are designed to work with
index a63eb49..129475f 100644 (file)
@@ -84,14 +84,8 @@ static int ecdh_compute_key(void *out, size_t len, const EC_POINT *pub_key,
        void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen));
 
 static ECDH_METHOD openssl_ecdh_meth = {
-       "OpenSSL ECDH method",
-       ecdh_compute_key,
-#if 0
-       NULL, /* init     */
-       NULL, /* finish   */
-#endif
-       0,    /* flags    */
-       NULL  /* app_data */
+       .name = "OpenSSL ECDH method",
+       .compute_key = ecdh_compute_key
 };
 
 const ECDH_METHOD *ECDH_OpenSSL(void)
index 7725935..4a6e04e 100644 (file)
@@ -69,16 +69,10 @@ static int ecdsa_do_verify(const unsigned char *dgst, int dgst_len,
                const ECDSA_SIG *sig, EC_KEY *eckey);
 
 static ECDSA_METHOD openssl_ecdsa_meth = {
-       "OpenSSL ECDSA method",
-       ecdsa_do_sign,
-       ecdsa_sign_setup,
-       ecdsa_do_verify,
-#if 0
-       NULL, /* init     */
-       NULL, /* finish   */
-#endif
-       0,    /* flags    */
-       NULL  /* app_data */
+       .name = "OpenSSL ECDSA method",
+       .ecdsa_do_sign = ecdsa_do_sign,
+       .ecdsa_sign_setup = ecdsa_sign_setup,
+       .ecdsa_do_verify = ecdsa_do_verify
 };
 
 const ECDSA_METHOD *ECDSA_OpenSSL(void)
index d5d9a16..c27181b 100644 (file)
@@ -1086,12 +1086,9 @@ padlock_rand_status(void)
 
 /* Prepare structure for registration */
 static RAND_METHOD padlock_rand = {
-       NULL,                   /* seed */
-       padlock_rand_bytes,     /* bytes */
-       NULL,                   /* cleanup */
-       NULL,                   /* add */
-       padlock_rand_bytes,     /* pseudorand */
-       padlock_rand_status,    /* rand status */
+       .bytes = padlock_rand_bytes,
+       .pseudorand = padlock_rand_bytes,
+       .status = padlock_rand_status
 };
 
 #else  /* !COMPILE_HW_PADLOCK */
index 4e9e91d..ba1b5bf 100644 (file)
@@ -84,15 +84,11 @@ static int get_random_bytes (unsigned char *buf, int num)
 static int random_status (void)
 {      return 1;       }
 
-static RAND_METHOD rdrand_meth =
-       {
-       NULL,   /* seed */
-       get_random_bytes,
-       NULL,   /* cleanup */
-       NULL,   /* add */
-       get_random_bytes,
-       random_status,
-       };
+static RAND_METHOD rdrand_meth = {
+       .bytes = get_random_bytes,
+       .pseudorand = get_random_bytes,
+       .status = random_status
+};
 
 static int rdrand_init(ENGINE *e)
 {      return 1;       }
index fa91594..c0f6851 100644 (file)
@@ -116,22 +116,12 @@ static const ENGINE_CMD_DEFN e_rsax_cmd_defns[] = {
 
 #ifndef OPENSSL_NO_RSA
 /* Our internal RSA_METHOD that we provide pointers to */
-static RSA_METHOD e_rsax_rsa =
-       {
-       "Intel RSA-X method",
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       e_rsax_rsa_mod_exp,
-       NULL,
-       NULL,
-       e_rsax_rsa_finish,
-       RSA_FLAG_CACHE_PUBLIC|RSA_FLAG_CACHE_PRIVATE,
-       NULL,
-       NULL,
-       NULL
-       };
+static RSA_METHOD e_rsax_rsa = {
+       .name = "Intel RSA-X method",
+       .rsa_mod_exp = e_rsax_rsa_mod_exp,
+       .finish = e_rsax_rsa_finish,
+       .flags = RSA_FLAG_CACHE_PUBLIC|RSA_FLAG_CACHE_PRIVATE,
+};
 #endif
 
 /* Constants used when creating the ENGINE */
index 190dcc4..9b24511 100644 (file)
@@ -1039,19 +1039,7 @@ err:
 }
 
 static RSA_METHOD cryptodev_rsa = {
-       "cryptodev RSA method",
-       NULL,                           /* rsa_pub_enc */
-       NULL,                           /* rsa_pub_dec */
-       NULL,                           /* rsa_priv_enc */
-       NULL,                           /* rsa_priv_dec */
-       NULL,
-       NULL,
-       NULL,                           /* init */
-       NULL,                           /* finish */
-       0,                              /* flags */
-       NULL,                           /* app_data */
-       NULL,                           /* rsa_sign */
-       NULL                            /* rsa_verify */
+       .name = "cryptodev RSA method"
 };
 
 static int
@@ -1181,16 +1169,7 @@ err:
 }
 
 static DSA_METHOD cryptodev_dsa = {
-       "cryptodev DSA method",
-       NULL,
-       NULL,                           /* dsa_sign_setup */
-       NULL,
-       NULL,                           /* dsa_mod_exp */
-       NULL,
-       NULL,                           /* init */
-       NULL,                           /* finish */
-       0,      /* flags */
-       NULL    /* app_data */
+       .name = "cryptodev DSA method"
 };
 
 static int
@@ -1244,14 +1223,7 @@ err:
 }
 
 static DH_METHOD cryptodev_dh = {
-       "cryptodev DH method",
-       NULL,                           /* cryptodev_dh_generate_key */
-       NULL,
-       NULL,
-       NULL,
-       NULL,
-       0,      /* flags */
-       NULL    /* app_data */
+       .name = "cryptodev DH method"
 };
 
 /*
index 27fc587..02631ec 100644 (file)
@@ -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)
        {
index 8fe9a45..3362c25 100644 (file)
@@ -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)
        {
index 144fdfd..85eead6 100644 (file)
@@ -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)
        {
index 09a762f..d0bcbc2 100644 (file)
@@ -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)
        {
index fbada40..0625b06 100644 (file)
@@ -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
        };
 
index f1c6732..4d28772 100644 (file)
@@ -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
+};
index d787495..216d237 100644 (file)
@@ -106,18 +106,16 @@ typedef struct bio_ber_struct
        unsigned char buf[BER_BUF_SIZE];
        } BIO_BER_CTX;
 
-static BIO_METHOD methods_ber=
-       {
-       BIO_TYPE_CIPHER,"cipher",
-       ber_write,
-       ber_read,
-       NULL, /* ber_puts, */
-       NULL, /* ber_gets, */
-       ber_ctrl,
-       ber_new,
-       ber_free,
-       ber_callback_ctrl,
-       };
+static BIO_METHOD methods_ber = {
+       .type = BIO_TYPE_CIPHER,
+       .name = "cipher",
+       .bwrite = ber_write,
+       .bread = ber_read,
+       .ctrl = ber_ctrl,
+       .create = ber_new,
+       .destroy = ber_free,
+       .callback_ctrl = ber_callback_ctrl
+};
 
 BIO_METHOD *BIO_f_ber(void)
        {
index fdd1183..f0a346a 100644 (file)
@@ -657,42 +657,40 @@ static int rsa_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
        return 2;
        }
 
-const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[] = 
+const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[] = {
        {
-               {
-               EVP_PKEY_RSA,
-               EVP_PKEY_RSA,
-               ASN1_PKEY_SIGPARAM_NULL,
+               .pkey_id = EVP_PKEY_RSA,
+               .pkey_base_id = EVP_PKEY_RSA,
+               .pkey_flags = ASN1_PKEY_SIGPARAM_NULL,
 
-               "RSA",
-               "OpenSSL RSA method",
+               .pem_str = "RSA",
+               .info = "OpenSSL RSA method",
 
-               rsa_pub_decode,
-               rsa_pub_encode,
-               rsa_pub_cmp,
-               rsa_pub_print,
+               .pub_decode = rsa_pub_decode,
+               .pub_encode = rsa_pub_encode,
+               .pub_cmp = rsa_pub_cmp,
+               .pub_print = rsa_pub_print,
 
-               rsa_priv_decode,
-               rsa_priv_encode,
-               rsa_priv_print,
+               .priv_decode = rsa_priv_decode,
+               .priv_encode = rsa_priv_encode,
+               .priv_print = rsa_priv_print,
 
-               int_rsa_size,
-               rsa_bits,
+               .pkey_size = int_rsa_size,
+               .pkey_bits = rsa_bits,
 
-               0,0,0,0,0,0,
+               .sig_print = rsa_sig_print,
 
-               rsa_sig_print,
-               int_rsa_free,
-               rsa_pkey_ctrl,
-               old_rsa_priv_decode,
-               old_rsa_priv_encode,
-               rsa_item_verify,
-               rsa_item_sign
-               },
+               .pkey_free = int_rsa_free,
+               .pkey_ctrl = rsa_pkey_ctrl,
+               .old_priv_decode = old_rsa_priv_decode,
+               .old_priv_encode = old_rsa_priv_encode,
+               .item_verify = rsa_item_verify,
+               .item_sign = rsa_item_sign
+       },
 
-               {
-               EVP_PKEY_RSA2,
-               EVP_PKEY_RSA,
-               ASN1_PKEY_ALIAS
-               }
-       };
+       {
+               .pkey_id = EVP_PKEY_RSA2,
+               .pkey_base_id = EVP_PKEY_RSA,
+               .pkey_flags = ASN1_PKEY_ALIAS
+       }
+};
index dcf0c16..845e288 100644 (file)
@@ -128,22 +128,17 @@ static int RSA_eay_private_decrypt(int flen, const unsigned char *from,
 static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *i, RSA *rsa, BN_CTX *ctx);
 static int RSA_eay_init(RSA *rsa);
 static int RSA_eay_finish(RSA *rsa);
-static RSA_METHOD rsa_pkcs1_eay_meth={
-       "Eric Young's PKCS#1 RSA",
-       RSA_eay_public_encrypt,
-       RSA_eay_public_decrypt, /* signature verification */
-       RSA_eay_private_encrypt, /* signing */
-       RSA_eay_private_decrypt,
-       RSA_eay_mod_exp,
-       BN_mod_exp_mont, /* XXX probably we should not use Montgomery if  e == 3 */
-       RSA_eay_init,
-       RSA_eay_finish,
-       0, /* flags */
-       NULL,
-       0, /* rsa_sign */
-       0, /* rsa_verify */
-       NULL /* rsa_keygen */
-       };
+static RSA_METHOD rsa_pkcs1_eay_meth = {
+       .name = "Eric Young's PKCS#1 RSA",
+       .rsa_pub_enc = RSA_eay_public_encrypt,
+       .rsa_pub_dec = RSA_eay_public_decrypt, /* signature verification */
+       .rsa_priv_enc = RSA_eay_private_encrypt, /* signing */
+       .rsa_priv_dec = RSA_eay_private_decrypt,
+       .rsa_mod_exp = RSA_eay_mod_exp,
+       .bn_mod_exp = BN_mod_exp_mont, /* XXX probably we should not use Montgomery if  e == 3 */
+       .init = RSA_eay_init,
+       .finish = RSA_eay_finish,
+};
 
 const RSA_METHOD *RSA_PKCS1_SSLeay(void)
        {
index 2f2202f..5b9317c 100644 (file)
@@ -82,22 +82,15 @@ static int RSA_null_mod_exp(const BIGNUM *r0, const BIGNUM *i, RSA *rsa);
 #endif
 static int RSA_null_init(RSA *rsa);
 static int RSA_null_finish(RSA *rsa);
-static RSA_METHOD rsa_null_meth={
-       "Null RSA",
-       RSA_null_public_encrypt,
-       RSA_null_public_decrypt,
-       RSA_null_private_encrypt,
-       RSA_null_private_decrypt,
-       NULL,
-       NULL,
-       RSA_null_init,
-       RSA_null_finish,
-       0,
-       NULL,
-       NULL,
-       NULL,
-       NULL
-       };
+static RSA_METHOD rsa_null_meth = {
+       .name = "Null RSA",
+       .rsa_pub_enc = RSA_null_public_encrypt,
+       .rsa_pub_dec = RSA_null_public_decrypt,
+       .rsa_priv_enc = RSA_null_private_encrypt,
+       .rsa_priv_dec = RSA_null_private_decrypt,
+       .init = RSA_null_init,
+       .finish = RSA_null_finish,
+};
 
 const RSA_METHOD *RSA_null_method(void)
        {
index adec632..09ef090 100644 (file)
@@ -609,41 +609,26 @@ static int pkey_rsa_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
        return ret;
        }
 
-const EVP_PKEY_METHOD rsa_pkey_meth = 
-       {
-       EVP_PKEY_RSA,
-       EVP_PKEY_FLAG_AUTOARGLEN,
-       pkey_rsa_init,
-       pkey_rsa_copy,
-       pkey_rsa_cleanup,
-
-       0,0,
-
-       0,
-       pkey_rsa_keygen,
-
-       0,
-       pkey_rsa_sign,
-
-       0,
-       pkey_rsa_verify,
-
-       0,
-       pkey_rsa_verifyrecover,
+const EVP_PKEY_METHOD rsa_pkey_meth = {
+       .pkey_id = EVP_PKEY_RSA,
+       .flags = EVP_PKEY_FLAG_AUTOARGLEN,
 
+       .init = pkey_rsa_init,
+       .copy = pkey_rsa_copy,
+       .cleanup = pkey_rsa_cleanup,
 
-       0,0,0,0,
+       .keygen = pkey_rsa_keygen,
 
-       0,
-       pkey_rsa_encrypt,
+       .sign = pkey_rsa_sign,
 
-       0,
-       pkey_rsa_decrypt,
+       .verify = pkey_rsa_verify,
 
-       0,0,
+       .verify_recover = pkey_rsa_verifyrecover,
 
-       pkey_rsa_ctrl,
-       pkey_rsa_ctrl_str
+       .encrypt = pkey_rsa_encrypt,
 
+       .decrypt = pkey_rsa_decrypt,
 
-       };
+       .ctrl = pkey_rsa_ctrl,
+       .ctrl_str = pkey_rsa_ctrl_str
+};
index 997e60f..a73279c 100644 (file)
@@ -133,25 +133,22 @@ static int mem_unlock(STORE *s, OPENSSL_ITEM attributes[],
        OPENSSL_ITEM parameters[]);
 static int mem_ctrl(STORE *s, int cmd, long l, void *p, void (*f)(void));
 
-static STORE_METHOD store_memory =
-       {
-       "OpenSSL memory store interface",
-       mem_init,
-       mem_clean,
-       mem_generate,
-       mem_get,
-       mem_store,
-       mem_modify,
-       NULL, /* revoke */
-       mem_delete,
-       mem_list_start,
-       mem_list_next,
-       mem_list_end,
-       mem_list_endp,
-       NULL, /* update */
-       mem_lock,
-       mem_unlock,
-       mem_ctrl
+static STORE_METHOD store_memory = {
+       .name = "OpenSSL memory store interface",
+       .init = mem_init,
+       .clean = mem_clean,
+       .generate_object = mem_generate,
+       .get_object = mem_get,
+       .store_object = mem_store,
+       .modify_object = mem_modify,
+       .delete_object = mem_delete,
+       .list_object_start = mem_list_start,
+       .list_object_next = mem_list_next,
+       .list_object_end = mem_list_end,
+       .list_object_endp = mem_list_endp,
+       .lock_store = mem_lock,
+       .unlock_store = mem_unlock,
+       .ctrl = mem_ctrl
        };
 
 const STORE_METHOD *STORE_Memory(void)
index d3be332..3b79eca 100644 (file)
@@ -157,13 +157,11 @@ static int noecho_console(UI *ui);
 static int close_console(UI *ui);
 
 static UI_METHOD ui_openssl = {
-       "OpenSSL default user interface",
-       open_console,
-       write_string,
-       NULL,                   /* No flusher is needed for command lines */
-       read_string,
-       close_console,
-       NULL
+       .name = "OpenSSL default user interface",
+       .ui_open_session = open_console,
+       .ui_write_string = write_string,
+       .ui_read_string = read_string,
+       .ui_close_session = close_console,
 };
 
 /* The method with all the built-in thingies */