aboutsummaryrefslogtreecommitdiff
path: root/openssl/crypto/asn1/a_int.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-06-15 20:18:50 +0200
committerMike DePaulo <mikedep333@gmail.com>2015-06-22 01:16:46 -0400
commit36da4a2e0e43928a29ac2ee5c55bf681e90e2f42 (patch)
tree92633e1022d705c72d0f97315891e719648dd17e /openssl/crypto/asn1/a_int.c
parentbec4be4c48239613ed1c704ae71bf08754eef711 (diff)
downloadvcxsrv-release/external-1.17.0.0-x.tar.gz
vcxsrv-release/external-1.17.0.0-x.tar.bz2
vcxsrv-release/external-1.17.0.0-x.zip
Update to openssl-1.0.2crelease/external-1.17.0.0-x
Diffstat (limited to 'openssl/crypto/asn1/a_int.c')
-rw-r--r--openssl/crypto/asn1/a_int.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/openssl/crypto/asn1/a_int.c b/openssl/crypto/asn1/a_int.c
index 70c2b8e62..7e26704a5 100644
--- a/openssl/crypto/asn1/a_int.c
+++ b/openssl/crypto/asn1/a_int.c
@@ -124,6 +124,8 @@ int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp)
else {
ret = a->length;
i = a->data[0];
+ if (ret == 1 && i == 0)
+ neg = 0;
if (!neg && (i > 127)) {
pad = 1;
pb = 0;
@@ -162,7 +164,7 @@ int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp)
p += a->length - 1;
i = a->length;
/* Copy zeros to destination as long as source is zero */
- while (!*n) {
+ while (!*n && i > 1) {
*(p--) = 0;
n--;
i--;
@@ -419,7 +421,7 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai)
ASN1err(ASN1_F_BN_TO_ASN1_INTEGER, ERR_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;