projects
/
oweals
/
openssl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b5a93e2
)
Make ASN1_INTEGER_cmp() work as expected with negative integers.
author
Dr. Stephen Henson
<steve@openssl.org>
Tue, 10 Aug 2004 17:40:14 +0000
(17:40 +0000)
committer
Dr. Stephen Henson
<steve@openssl.org>
Tue, 10 Aug 2004 17:40:14 +0000
(17:40 +0000)
crypto/asn1/a_int.c
patch
|
blob
|
history
diff --git
a/crypto/asn1/a_int.c
b/crypto/asn1/a_int.c
index c81fa00c4c0b49466644613835ad590f46ba9e80..78a6cb0d295e42fe69042a84d339f4388d9e0faf 100644
(file)
--- a/
crypto/asn1/a_int.c
+++ b/
crypto/asn1/a_int.c
@@
-65,7
+65,26
@@
ASN1_INTEGER *ASN1_INTEGER_dup(ASN1_INTEGER *x)
{ return M_ASN1_INTEGER_dup(x);}
int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y)
-{ return M_ASN1_INTEGER_cmp(x,y);}
+ {
+ int neg, ret;
+ /* Compare signs */
+ neg = x->type & V_ASN1_NEG;
+ if (neg != (y->type & V_ASN1_NEG))
+ {
+ if (neg)
+ return -1;
+ else
+ return 1;
+ }
+
+ ret = ASN1_STRING_cmp(x, y);
+
+ if (neg)
+ return -ret;
+ else
+ return ret;
+ }
+
/*
* This converts an ASN1 INTEGER into its content encoding.