diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2016-03-04 02:39:50 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2016-03-08 17:02:16 +0000 |
commit | 706a13f112d864b42f28a59f4a207e296fa1be08 (patch) | |
tree | 51131ceb27728af165ceaed64fd19bd726b4fc93 /crypto/dsa/dsa_asn1.c | |
parent | 9cae86d56faec7bdbf97a5b241e53052adc535ce (diff) | |
download | openssl-706a13f112d864b42f28a59f4a207e296fa1be08.tar.gz |
Make DSA_SIG opaque.
This adds a new accessor function DSA_SIG_get0.
The customisation of DSA_SIG structure initialisation has been removed this
means that the 'r' and 's' components are automatically allocated when
DSA_SIG_new() is called. Update documentation.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/dsa/dsa_asn1.c')
-rw-r--r-- | crypto/dsa/dsa_asn1.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/crypto/dsa/dsa_asn1.c b/crypto/dsa/dsa_asn1.c index 44696c372f..ddf3259f0e 100644 --- a/crypto/dsa/dsa_asn1.c +++ b/crypto/dsa/dsa_asn1.c @@ -62,33 +62,21 @@ #include <openssl/asn1.h> #include <openssl/asn1t.h> #include <openssl/rand.h> +#include "dsa_locl.h" -/* Override the default new methods */ -static int sig_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, - void *exarg) -{ - if (operation == ASN1_OP_NEW_PRE) { - DSA_SIG *sig; - sig = OPENSSL_malloc(sizeof(*sig)); - if (sig == NULL) { - DSAerr(DSA_F_SIG_CB, ERR_R_MALLOC_FAILURE); - return 0; - } - sig->r = NULL; - sig->s = NULL; - *pval = (ASN1_VALUE *)sig; - return 2; - } - return 1; -} - -ASN1_SEQUENCE_cb(DSA_SIG, sig_cb) = { +ASN1_SEQUENCE(DSA_SIG) = { ASN1_SIMPLE(DSA_SIG, r, CBIGNUM), ASN1_SIMPLE(DSA_SIG, s, CBIGNUM) -} static_ASN1_SEQUENCE_END_cb(DSA_SIG, DSA_SIG) +} static_ASN1_SEQUENCE_END(DSA_SIG) IMPLEMENT_ASN1_FUNCTIONS_const(DSA_SIG) +void DSA_SIG_get0(BIGNUM **pr, BIGNUM **ps, DSA_SIG *sig) +{ + *pr = sig->r; + *ps = sig->s; +} + /* Override the default free and new methods */ static int dsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) |