Any reason for this:
> /* Override the default new methods */
> static int sig_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
> {
> if(operation == ASN1_OP_NEW_PRE) {
> ECDSA_SIG *sig;
> sig = OPENSSL_malloc(sizeof(ECDSA_SIG));
> if (sig == NULL)
> {
> ECDSAerr(ECDSA_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(ECDSA_SIG, sig_cb) = {
> ASN1_SIMPLE(ECDSA_SIG, r, CBIGNUM),
> ASN1_SIMPLE(ECDSA_SIG, s, CBIGNUM)
> } ASN1_SEQUENCE_END_cb(ECDSA_SIG, ECDSA_SIG)
>
What this actually does is to override the default ASN1 "new" behaviour:
this should be avoided in new code where possible. If the original new
behaviour is retained it will be identical except it will populate
sig->r, sig->s using BN_new(). Shouldn't be a problem provided the
relevant assignment code takes note of this.
This actually looks identical to the DSA_SIG code. In that case
DSA_new() already existed and didn't allocate BIGNUMs for 'r' and 's' so
it has to override the default behaviour to avoid breaking existing
code.
Steve.
--
Dr Stephen N. Henson. http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED]
Senior crypto engineer, Gemplus: http://www.gemplus.com/
Core developer of the OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]