Latest update.

This commit is contained in:
2020-01-17 19:45:12 +09:00
parent 016df9f433
commit 0f7abb4eb6
1100 changed files with 47785 additions and 16292 deletions
+13 -18
View File
@@ -1342,32 +1342,27 @@ int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s)
return 1;
}
#ifndef FIPS_MODE
int ECDSA_size(const EC_KEY *r)
int ECDSA_size(const EC_KEY *ec)
{
int ret, i;
ASN1_INTEGER bs;
unsigned char buf[4];
int ret;
ECDSA_SIG sig;
const EC_GROUP *group;
const BIGNUM *bn;
if (r == NULL)
if (ec == NULL)
return 0;
group = EC_KEY_get0_group(r);
group = EC_KEY_get0_group(ec);
if (group == NULL)
return 0;
i = EC_GROUP_order_bits(group);
if (i == 0)
bn = EC_GROUP_get0_order(group);
if (bn == NULL)
return 0;
bs.length = (i + 7) / 8;
bs.data = buf;
bs.type = V_ASN1_INTEGER;
/* If the top bit is set the asn1 encoding is 1 larger. */
buf[0] = 0xff;
i = i2d_ASN1_INTEGER(&bs, NULL);
i += i; /* r and s */
ret = ASN1_object_size(1, i, V_ASN1_SEQUENCE);
sig.r = sig.s = (BIGNUM *)bn;
ret = i2d_ECDSA_SIG(&sig, NULL);
if (ret < 0)
ret = 0;
return ret;
}
#endif