From f95583215e42c03127b28492f776bc9ade14f242 Mon Sep 17 00:00:00 2001 From: jsing Date: Fri, 16 Oct 2015 15:12:30 +0000 Subject: [PATCH] Expand DECLARE_ASN1_ALLOC_FUNCTIONS and DECLARE_ASN1_FUNCTIONS_const macros. The only change in the generated assembly is due to line numbering. --- lib/libcrypto/asn1/n_pkey.c | 14 +++++++++++--- lib/libcrypto/ec/ec_asn1.c | 23 +++++++++++++++++------ lib/libcrypto/ecdsa/ecs_asn1.c | 8 ++++++-- lib/libssl/src/crypto/asn1/n_pkey.c | 14 +++++++++++--- lib/libssl/src/crypto/ec/ec_asn1.c | 23 +++++++++++++++++------ lib/libssl/src/crypto/ecdsa/ecs_asn1.c | 8 ++++++-- 6 files changed, 68 insertions(+), 22 deletions(-) diff --git a/lib/libcrypto/asn1/n_pkey.c b/lib/libcrypto/asn1/n_pkey.c index 664d39216bd..bc78606d394 100644 --- a/lib/libcrypto/asn1/n_pkey.c +++ b/lib/libcrypto/asn1/n_pkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_pkey.c,v 1.28 2015/10/16 15:09:28 jsing Exp $ */ +/* $OpenBSD: n_pkey.c,v 1.29 2015/10/16 15:12:30 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -113,7 +113,11 @@ const ASN1_ITEM NETSCAPE_ENCRYPTED_PKEY_it = { .sname = "NETSCAPE_ENCRYPTED_PKEY", }; -DECLARE_ASN1_FUNCTIONS_const(NETSCAPE_ENCRYPTED_PKEY) +NETSCAPE_ENCRYPTED_PKEY *NETSCAPE_ENCRYPTED_PKEY_new(void); +void NETSCAPE_ENCRYPTED_PKEY_free(NETSCAPE_ENCRYPTED_PKEY *a); +NETSCAPE_ENCRYPTED_PKEY *d2i_NETSCAPE_ENCRYPTED_PKEY(NETSCAPE_ENCRYPTED_PKEY **a, const unsigned char **in, long len); +int i2d_NETSCAPE_ENCRYPTED_PKEY(const NETSCAPE_ENCRYPTED_PKEY *a, unsigned char **out); +extern const ASN1_ITEM NETSCAPE_ENCRYPTED_PKEY_it; NETSCAPE_ENCRYPTED_PKEY * d2i_NETSCAPE_ENCRYPTED_PKEY(NETSCAPE_ENCRYPTED_PKEY **a, const unsigned char **in, long len) @@ -167,7 +171,11 @@ const ASN1_ITEM NETSCAPE_PKEY_it = { .sname = "NETSCAPE_PKEY", }; -DECLARE_ASN1_FUNCTIONS_const(NETSCAPE_PKEY) +NETSCAPE_PKEY *NETSCAPE_PKEY_new(void); +void NETSCAPE_PKEY_free(NETSCAPE_PKEY *a); +NETSCAPE_PKEY *d2i_NETSCAPE_PKEY(NETSCAPE_PKEY **a, const unsigned char **in, long len); +int i2d_NETSCAPE_PKEY(const NETSCAPE_PKEY *a, unsigned char **out); +extern const ASN1_ITEM NETSCAPE_PKEY_it; NETSCAPE_PKEY * d2i_NETSCAPE_PKEY(NETSCAPE_PKEY **a, const unsigned char **in, long len) diff --git a/lib/libcrypto/ec/ec_asn1.c b/lib/libcrypto/ec/ec_asn1.c index f937672d678..5aeb5615311 100644 --- a/lib/libcrypto/ec/ec_asn1.c +++ b/lib/libcrypto/ec/ec_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_asn1.c,v 1.19 2015/10/16 15:09:28 jsing Exp $ */ +/* $OpenBSD: ec_asn1.c,v 1.20 2015/10/16 15:12:30 jsing Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -232,7 +232,8 @@ const ASN1_ITEM X9_62_PENTANOMIAL_it = { .sname = "X9_62_PENTANOMIAL", }; -DECLARE_ASN1_ALLOC_FUNCTIONS(X9_62_PENTANOMIAL) +X9_62_PENTANOMIAL *X9_62_PENTANOMIAL_new(void); +void X9_62_PENTANOMIAL_free(X9_62_PENTANOMIAL *a); X9_62_PENTANOMIAL * X9_62_PENTANOMIAL_new(void) @@ -333,7 +334,8 @@ const ASN1_ITEM X9_62_CHARACTERISTIC_TWO_it = { .size = sizeof(X9_62_CHARACTERISTIC_TWO), .sname = "X9_62_CHARACTERISTIC_TWO", }; -DECLARE_ASN1_ALLOC_FUNCTIONS(X9_62_CHARACTERISTIC_TWO) +X9_62_CHARACTERISTIC_TWO *X9_62_CHARACTERISTIC_TWO_new(void); +void X9_62_CHARACTERISTIC_TWO_free(X9_62_CHARACTERISTIC_TWO *a); X9_62_CHARACTERISTIC_TWO * X9_62_CHARACTERISTIC_TWO_new(void) @@ -504,7 +506,8 @@ const ASN1_ITEM ECPARAMETERS_it = { .size = sizeof(ECPARAMETERS), .sname = "ECPARAMETERS", }; -DECLARE_ASN1_ALLOC_FUNCTIONS(ECPARAMETERS) +ECPARAMETERS *ECPARAMETERS_new(void); +void ECPARAMETERS_free(ECPARAMETERS *a); ECPARAMETERS * ECPARAMETERS_new(void) @@ -552,7 +555,11 @@ const ASN1_ITEM ECPKPARAMETERS_it = { .sname = "ECPKPARAMETERS", }; -DECLARE_ASN1_FUNCTIONS_const(ECPKPARAMETERS) +ECPKPARAMETERS *ECPKPARAMETERS_new(void); +void ECPKPARAMETERS_free(ECPKPARAMETERS *a); +ECPKPARAMETERS *d2i_ECPKPARAMETERS(ECPKPARAMETERS **a, const unsigned char **in, long len); +int i2d_ECPKPARAMETERS(const ECPKPARAMETERS *a, unsigned char **out); +extern const ASN1_ITEM ECPKPARAMETERS_it; ECPKPARAMETERS * d2i_ECPKPARAMETERS(ECPKPARAMETERS **a, const unsigned char **in, long len) @@ -620,7 +627,11 @@ const ASN1_ITEM EC_PRIVATEKEY_it = { .sname = "EC_PRIVATEKEY", }; -DECLARE_ASN1_FUNCTIONS_const(EC_PRIVATEKEY) +EC_PRIVATEKEY *EC_PRIVATEKEY_new(void); +void EC_PRIVATEKEY_free(EC_PRIVATEKEY *a); +EC_PRIVATEKEY *d2i_EC_PRIVATEKEY(EC_PRIVATEKEY **a, const unsigned char **in, long len); +int i2d_EC_PRIVATEKEY(const EC_PRIVATEKEY *a, unsigned char **out); +extern const ASN1_ITEM EC_PRIVATEKEY_it; EC_PRIVATEKEY * d2i_EC_PRIVATEKEY(EC_PRIVATEKEY **a, const unsigned char **in, long len) diff --git a/lib/libcrypto/ecdsa/ecs_asn1.c b/lib/libcrypto/ecdsa/ecs_asn1.c index 7f2d646c442..bb543072545 100644 --- a/lib/libcrypto/ecdsa/ecs_asn1.c +++ b/lib/libcrypto/ecdsa/ecs_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecs_asn1.c,v 1.6 2015/10/16 15:09:28 jsing Exp $ */ +/* $OpenBSD: ecs_asn1.c,v 1.7 2015/10/16 15:12:30 jsing Exp $ */ /* ==================================================================== * Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved. * @@ -84,7 +84,11 @@ const ASN1_ITEM ECDSA_SIG_it = { .sname = "ECDSA_SIG", }; -DECLARE_ASN1_FUNCTIONS_const(ECDSA_SIG) +ECDSA_SIG *ECDSA_SIG_new(void); +void ECDSA_SIG_free(ECDSA_SIG *a); +ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **a, const unsigned char **in, long len); +int i2d_ECDSA_SIG(const ECDSA_SIG *a, unsigned char **out); +extern const ASN1_ITEM ECDSA_SIG_it; ECDSA_SIG * d2i_ECDSA_SIG(ECDSA_SIG **a, const unsigned char **in, long len) diff --git a/lib/libssl/src/crypto/asn1/n_pkey.c b/lib/libssl/src/crypto/asn1/n_pkey.c index 664d39216bd..bc78606d394 100644 --- a/lib/libssl/src/crypto/asn1/n_pkey.c +++ b/lib/libssl/src/crypto/asn1/n_pkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_pkey.c,v 1.28 2015/10/16 15:09:28 jsing Exp $ */ +/* $OpenBSD: n_pkey.c,v 1.29 2015/10/16 15:12:30 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -113,7 +113,11 @@ const ASN1_ITEM NETSCAPE_ENCRYPTED_PKEY_it = { .sname = "NETSCAPE_ENCRYPTED_PKEY", }; -DECLARE_ASN1_FUNCTIONS_const(NETSCAPE_ENCRYPTED_PKEY) +NETSCAPE_ENCRYPTED_PKEY *NETSCAPE_ENCRYPTED_PKEY_new(void); +void NETSCAPE_ENCRYPTED_PKEY_free(NETSCAPE_ENCRYPTED_PKEY *a); +NETSCAPE_ENCRYPTED_PKEY *d2i_NETSCAPE_ENCRYPTED_PKEY(NETSCAPE_ENCRYPTED_PKEY **a, const unsigned char **in, long len); +int i2d_NETSCAPE_ENCRYPTED_PKEY(const NETSCAPE_ENCRYPTED_PKEY *a, unsigned char **out); +extern const ASN1_ITEM NETSCAPE_ENCRYPTED_PKEY_it; NETSCAPE_ENCRYPTED_PKEY * d2i_NETSCAPE_ENCRYPTED_PKEY(NETSCAPE_ENCRYPTED_PKEY **a, const unsigned char **in, long len) @@ -167,7 +171,11 @@ const ASN1_ITEM NETSCAPE_PKEY_it = { .sname = "NETSCAPE_PKEY", }; -DECLARE_ASN1_FUNCTIONS_const(NETSCAPE_PKEY) +NETSCAPE_PKEY *NETSCAPE_PKEY_new(void); +void NETSCAPE_PKEY_free(NETSCAPE_PKEY *a); +NETSCAPE_PKEY *d2i_NETSCAPE_PKEY(NETSCAPE_PKEY **a, const unsigned char **in, long len); +int i2d_NETSCAPE_PKEY(const NETSCAPE_PKEY *a, unsigned char **out); +extern const ASN1_ITEM NETSCAPE_PKEY_it; NETSCAPE_PKEY * d2i_NETSCAPE_PKEY(NETSCAPE_PKEY **a, const unsigned char **in, long len) diff --git a/lib/libssl/src/crypto/ec/ec_asn1.c b/lib/libssl/src/crypto/ec/ec_asn1.c index f937672d678..5aeb5615311 100644 --- a/lib/libssl/src/crypto/ec/ec_asn1.c +++ b/lib/libssl/src/crypto/ec/ec_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_asn1.c,v 1.19 2015/10/16 15:09:28 jsing Exp $ */ +/* $OpenBSD: ec_asn1.c,v 1.20 2015/10/16 15:12:30 jsing Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -232,7 +232,8 @@ const ASN1_ITEM X9_62_PENTANOMIAL_it = { .sname = "X9_62_PENTANOMIAL", }; -DECLARE_ASN1_ALLOC_FUNCTIONS(X9_62_PENTANOMIAL) +X9_62_PENTANOMIAL *X9_62_PENTANOMIAL_new(void); +void X9_62_PENTANOMIAL_free(X9_62_PENTANOMIAL *a); X9_62_PENTANOMIAL * X9_62_PENTANOMIAL_new(void) @@ -333,7 +334,8 @@ const ASN1_ITEM X9_62_CHARACTERISTIC_TWO_it = { .size = sizeof(X9_62_CHARACTERISTIC_TWO), .sname = "X9_62_CHARACTERISTIC_TWO", }; -DECLARE_ASN1_ALLOC_FUNCTIONS(X9_62_CHARACTERISTIC_TWO) +X9_62_CHARACTERISTIC_TWO *X9_62_CHARACTERISTIC_TWO_new(void); +void X9_62_CHARACTERISTIC_TWO_free(X9_62_CHARACTERISTIC_TWO *a); X9_62_CHARACTERISTIC_TWO * X9_62_CHARACTERISTIC_TWO_new(void) @@ -504,7 +506,8 @@ const ASN1_ITEM ECPARAMETERS_it = { .size = sizeof(ECPARAMETERS), .sname = "ECPARAMETERS", }; -DECLARE_ASN1_ALLOC_FUNCTIONS(ECPARAMETERS) +ECPARAMETERS *ECPARAMETERS_new(void); +void ECPARAMETERS_free(ECPARAMETERS *a); ECPARAMETERS * ECPARAMETERS_new(void) @@ -552,7 +555,11 @@ const ASN1_ITEM ECPKPARAMETERS_it = { .sname = "ECPKPARAMETERS", }; -DECLARE_ASN1_FUNCTIONS_const(ECPKPARAMETERS) +ECPKPARAMETERS *ECPKPARAMETERS_new(void); +void ECPKPARAMETERS_free(ECPKPARAMETERS *a); +ECPKPARAMETERS *d2i_ECPKPARAMETERS(ECPKPARAMETERS **a, const unsigned char **in, long len); +int i2d_ECPKPARAMETERS(const ECPKPARAMETERS *a, unsigned char **out); +extern const ASN1_ITEM ECPKPARAMETERS_it; ECPKPARAMETERS * d2i_ECPKPARAMETERS(ECPKPARAMETERS **a, const unsigned char **in, long len) @@ -620,7 +627,11 @@ const ASN1_ITEM EC_PRIVATEKEY_it = { .sname = "EC_PRIVATEKEY", }; -DECLARE_ASN1_FUNCTIONS_const(EC_PRIVATEKEY) +EC_PRIVATEKEY *EC_PRIVATEKEY_new(void); +void EC_PRIVATEKEY_free(EC_PRIVATEKEY *a); +EC_PRIVATEKEY *d2i_EC_PRIVATEKEY(EC_PRIVATEKEY **a, const unsigned char **in, long len); +int i2d_EC_PRIVATEKEY(const EC_PRIVATEKEY *a, unsigned char **out); +extern const ASN1_ITEM EC_PRIVATEKEY_it; EC_PRIVATEKEY * d2i_EC_PRIVATEKEY(EC_PRIVATEKEY **a, const unsigned char **in, long len) diff --git a/lib/libssl/src/crypto/ecdsa/ecs_asn1.c b/lib/libssl/src/crypto/ecdsa/ecs_asn1.c index 7f2d646c442..bb543072545 100644 --- a/lib/libssl/src/crypto/ecdsa/ecs_asn1.c +++ b/lib/libssl/src/crypto/ecdsa/ecs_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecs_asn1.c,v 1.6 2015/10/16 15:09:28 jsing Exp $ */ +/* $OpenBSD: ecs_asn1.c,v 1.7 2015/10/16 15:12:30 jsing Exp $ */ /* ==================================================================== * Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved. * @@ -84,7 +84,11 @@ const ASN1_ITEM ECDSA_SIG_it = { .sname = "ECDSA_SIG", }; -DECLARE_ASN1_FUNCTIONS_const(ECDSA_SIG) +ECDSA_SIG *ECDSA_SIG_new(void); +void ECDSA_SIG_free(ECDSA_SIG *a); +ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **a, const unsigned char **in, long len); +int i2d_ECDSA_SIG(const ECDSA_SIG *a, unsigned char **out); +extern const ASN1_ITEM ECDSA_SIG_it; ECDSA_SIG * d2i_ECDSA_SIG(ECDSA_SIG **a, const unsigned char **in, long len) -- 2.20.1