summaryrefslogtreecommitdiff
path: root/lib/libcrypto/asn1/x_algor.c
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2015-01-28 04:14:32 +0000
committerBob Beck <beck@cvs.openbsd.org>2015-01-28 04:14:32 +0000
commitbbd6bf84a2c283dc5e8a632ef771dc8d2fcf1586 (patch)
treee4430735bebdd058efd10a3fd4cc1f1e584a9f8f /lib/libcrypto/asn1/x_algor.c
parent129ce8d7da6803fc1239aa28248901b414b1bec1 (diff)
Fix a number of issues relating to algorithms in signatures, Mostly
from OpenSSL with a hint of boring and some things done here. Addresses CVE-2014-8275 for OpenSSL fully ok miod@ doug@
Diffstat (limited to 'lib/libcrypto/asn1/x_algor.c')
-rw-r--r--lib/libcrypto/asn1/x_algor.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/libcrypto/asn1/x_algor.c b/lib/libcrypto/asn1/x_algor.c
index c069a5225c8..71aeaaade07 100644
--- a/lib/libcrypto/asn1/x_algor.c
+++ b/lib/libcrypto/asn1/x_algor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: x_algor.c,v 1.12 2014/06/12 15:49:27 deraadt Exp $ */
+/* $OpenBSD: x_algor.c,v 1.13 2015/01/28 04:14:31 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2000.
*/
@@ -136,3 +136,17 @@ X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md)
X509_ALGOR_set0(alg, OBJ_nid2obj(EVP_MD_type(md)), param_type, NULL);
}
+
+/* Returns 0 if they are equal, != 0 otherwise. */
+int
+X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b)
+{
+ int rv = OBJ_cmp(a->algorithm, b->algorithm);
+ if (!rv) {
+ if (!a->parameter && !b->parameter)
+ rv = 0;
+ else
+ rv = ASN1_TYPE_cmp(a->parameter, b->parameter);
+ }
+ return(rv);
+}