diff options
author | Pauli <ppzgs1@gmail.com> | 2021-04-04 13:58:22 +1000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-04-07 18:06:06 +1000 |
commit | 581c4b1d5357bdf858a6675ea0b3121731bca5c3 (patch) | |
tree | b39437afe1189c370c11029618f3ba0bab68b4cf /crypto/asn1 | |
parent | 080669804799b2fef788029555ac7b26f3e67881 (diff) |
Ensure that the negative flag is correct set for ASN1 integer types.
Reported by: Scott McPeak <scott.g.mcpeak@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14768)
Diffstat (limited to 'crypto/asn1')
-rw-r--r-- | crypto/asn1/a_int.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/asn1/a_int.c b/crypto/asn1/a_int.c index 92c58b3418..6774ba627c 100644 --- a/crypto/asn1/a_int.c +++ b/crypto/asn1/a_int.c @@ -308,8 +308,10 @@ ASN1_INTEGER *ossl_c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, c2i_ibuf(ret->data, &neg, *pp, len); - if (neg) + if (neg != 0) ret->type |= V_ASN1_NEG; + else + ret->type &= ~V_ASN1_NEG; *pp += len; if (a != NULL) @@ -317,7 +319,7 @@ ASN1_INTEGER *ossl_c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, return ret; err: ERR_raise(ERR_LIB_ASN1, ERR_R_MALLOC_FAILURE); - if ((a == NULL) || (*a != ret)) + if (a == NULL || *a != ret) ASN1_INTEGER_free(ret); return NULL; } |