summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/x509/x509_cmp.c
diff options
context:
space:
mode:
authortb <>2019-03-13 20:34:00 +0000
committertb <>2019-03-13 20:34:00 +0000
commite44d7af88579ebe18a2d8ef57242b067993706b1 (patch)
tree81f6ab2828c3099781b20bfb3c3d4c20a8449029 /src/lib/libcrypto/x509/x509_cmp.c
parent06abece690d53a96a5357c7304e3672e1601f54a (diff)
downloadopenbsd-e44d7af88579ebe18a2d8ef57242b067993706b1.tar.gz
openbsd-e44d7af88579ebe18a2d8ef57242b067993706b1.tar.bz2
openbsd-e44d7af88579ebe18a2d8ef57242b067993706b1.zip
Fix a number of ASN1_INTEGER vs ASN1_STRING mixups coming from the
mechanical M_ASN1 macro expansion. The ASN1_INTEGER_cmp function takes signs into account while ASN1_STRING_cmp doesn't. The mixups mostly involve serialNumbers, which, in principle, should be positive. However, it is unclear whether that is checked or enforced anywhere in the code, so these are probably bugs. Patch from Holger Mikolon ok jsing
Diffstat (limited to 'src/lib/libcrypto/x509/x509_cmp.c')
-rw-r--r--src/lib/libcrypto/x509/x509_cmp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libcrypto/x509/x509_cmp.c b/src/lib/libcrypto/x509/x509_cmp.c
index 2141f871e5..6d6e840899 100644
--- a/src/lib/libcrypto/x509/x509_cmp.c
+++ b/src/lib/libcrypto/x509/x509_cmp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_cmp.c,v 1.34 2018/08/24 19:59:32 tb Exp $ */ 1/* $OpenBSD: x509_cmp.c,v 1.35 2019/03/13 20:34:00 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -76,7 +76,7 @@ X509_issuer_and_serial_cmp(const X509 *a, const X509 *b)
76 76
77 ai = a->cert_info; 77 ai = a->cert_info;
78 bi = b->cert_info; 78 bi = b->cert_info;
79 i = ASN1_STRING_cmp(ai->serialNumber, bi->serialNumber); 79 i = ASN1_INTEGER_cmp(ai->serialNumber, bi->serialNumber);
80 if (i) 80 if (i)
81 return (i); 81 return (i);
82 return (X509_NAME_cmp(ai->issuer, bi->issuer)); 82 return (X509_NAME_cmp(ai->issuer, bi->issuer));