diff options
author | Bodo Möller <bodo@openssl.org> | 2002-11-04 13:17:22 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2002-11-04 13:17:22 +0000 |
commit | b53e44e57259b2b015c54de8ecbcf4e06be23298 (patch) | |
tree | 4d06528db2e5e7d8ad1680fc59159a4c689c7b3c /crypto/asn1 | |
parent | e5f4d8279dccad0f6dde324f52333291739dcca3 (diff) |
implement and use new macros BN_get_sign(), BN_set_sign()
Submitted by: Nils Larsch
Diffstat (limited to 'crypto/asn1')
-rw-r--r-- | crypto/asn1/a_enum.c | 4 | ||||
-rw-r--r-- | crypto/asn1/a_int.c | 6 | ||||
-rw-r--r-- | crypto/asn1/t_pkey.c | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/crypto/asn1/a_enum.c b/crypto/asn1/a_enum.c index ad8f0ffd1a..68a525fb12 100644 --- a/crypto/asn1/a_enum.c +++ b/crypto/asn1/a_enum.c @@ -147,7 +147,7 @@ ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai) ASN1err(ASN1_F_BN_TO_ASN1_ENUMERATED,ERR_R_NESTED_ASN1_ERROR); goto err; } - if(bn->neg) ret->type = V_ASN1_NEG_ENUMERATED; + if(BN_get_sign(bn)) ret->type = V_ASN1_NEG_ENUMERATED; else ret->type=V_ASN1_ENUMERATED; j=BN_num_bits(bn); len=((j == 0)?0:((j/8)+1)); @@ -175,6 +175,6 @@ BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai, BIGNUM *bn) if ((ret=BN_bin2bn(ai->data,ai->length,bn)) == NULL) ASN1err(ASN1_F_ASN1_ENUMERATED_TO_BN,ASN1_R_BN_LIB); - else if(ai->type == V_ASN1_NEG_ENUMERATED) ret->neg = 1; + else if(ai->type == V_ASN1_NEG_ENUMERATED) BN_set_sign(ret,1); return(ret); } diff --git a/crypto/asn1/a_int.c b/crypto/asn1/a_int.c index edb243c021..78402cd985 100644 --- a/crypto/asn1/a_int.c +++ b/crypto/asn1/a_int.c @@ -393,7 +393,8 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai) ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_NESTED_ASN1_ERROR); goto err; } - if(bn->neg) ret->type = V_ASN1_NEG_INTEGER; + if (BN_get_sign(bn)) + ret->type = V_ASN1_NEG_INTEGER; else ret->type=V_ASN1_INTEGER; j=BN_num_bits(bn); len=((j == 0)?0:((j/8)+1)); @@ -426,7 +427,8 @@ BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai, BIGNUM *bn) if ((ret=BN_bin2bn(ai->data,ai->length,bn)) == NULL) ASN1err(ASN1_F_ASN1_INTEGER_TO_BN,ASN1_R_BN_LIB); - else if(ai->type == V_ASN1_NEG_INTEGER) ret->neg = 1; + else if(ai->type == V_ASN1_NEG_INTEGER) + BN_set_sign(ret, 1); return(ret); } diff --git a/crypto/asn1/t_pkey.c b/crypto/asn1/t_pkey.c index 46fb86a3b9..e3e0739bbd 100644 --- a/crypto/asn1/t_pkey.c +++ b/crypto/asn1/t_pkey.c @@ -575,7 +575,7 @@ static int print(BIO *bp, const char *number, BIGNUM *num, unsigned char *buf, const char *neg; if (num == NULL) return(1); - neg=(num->neg)?"-":""; + neg = (BN_get_sign(num))?"-":""; if (off) { if (off > 128) off=128; |