diff options
author | Adam Langley <agl@google.com> | 2015-04-23 13:54:37 -0700 |
---|---|---|
committer | Kenny Root <kroot@google.com> | 2015-04-23 21:57:00 +0000 |
commit | d82ab38ca2b63638a2cb0b5d8a2c76d90c86dd31 (patch) | |
tree | 3cea780c4956edec6e4be340cf510a618b794c8c /src/crypto/asn1 | |
parent | 217eaab310220731646f2a1a0159d71e4eb09d4a (diff) | |
download | external_boringssl-d82ab38ca2b63638a2cb0b5d8a2c76d90c86dd31.zip external_boringssl-d82ab38ca2b63638a2cb0b5d8a2c76d90c86dd31.tar.gz external_boringssl-d82ab38ca2b63638a2cb0b5d8a2c76d90c86dd31.tar.bz2 |
Ensure BN_asc2bn, BN_dec2bn, and BN_hex2bn never give -0.
When |BN_dec2bn| and |BN_hex2bn| were merged (way back in the initial
BoringSSL change), the neg flag was set too soon and could be cleared by
|BN_add_word|.
This is an import of upstream's c85573cc. The unittest change isn't
included here because bn_test.c has changed significantly in upstream
and BoringSSL unittests aren't run in the Android environment.
Bug: 20523350
Change-Id: Iaf8efe2fe3419218437f5ebb9a15f73559860a0f
Diffstat (limited to 'src/crypto/asn1')
-rw-r--r-- | src/crypto/asn1/a_int.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/crypto/asn1/a_int.c b/src/crypto/asn1/a_int.c index eb0887a..2ecccc5 100644 --- a/src/crypto/asn1/a_int.c +++ b/src/crypto/asn1/a_int.c @@ -416,7 +416,7 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai) OPENSSL_PUT_ERROR(ASN1, BN_to_ASN1_INTEGER, ASN1_R_NESTED_ASN1_ERROR); goto err; } - if (BN_is_negative(bn)) + if (BN_is_negative(bn) && !BN_is_zero(bn)) ret->type = V_ASN1_NEG_INTEGER; else ret->type=V_ASN1_INTEGER; j=BN_num_bits(bn); |