summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1')
-rw-r--r--src/lib/libcrypto/asn1/a_verify.c9
-rw-r--r--src/lib/libcrypto/asn1/asn1.h3
-rw-r--r--src/lib/libcrypto/asn1/x_algor.c16
3 files changed, 25 insertions, 3 deletions
diff --git a/src/lib/libcrypto/asn1/a_verify.c b/src/lib/libcrypto/asn1/a_verify.c
index ea937cab3a..3fc79b78f6 100644
--- a/src/lib/libcrypto/asn1/a_verify.c
+++ b/src/lib/libcrypto/asn1/a_verify.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_verify.c,v 1.20 2014/07/11 08:44:47 jsing Exp $ */ 1/* $OpenBSD: a_verify.c,v 1.21 2015/01/28 04:14:31 beck 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 *
@@ -85,6 +85,13 @@ ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a,
85 return -1; 85 return -1;
86 } 86 }
87 87
88 if (signature->type == V_ASN1_BIT_STRING && signature->flags & 0x7)
89 {
90 ASN1err(ASN1_F_ASN1_VERIFY,
91 ASN1_R_INVALID_BIT_STRING_BITS_LEFT);
92 return -1;
93 }
94
88 EVP_MD_CTX_init(&ctx); 95 EVP_MD_CTX_init(&ctx);
89 96
90 /* Convert signature OID into digest and public key OIDs */ 97 /* Convert signature OID into digest and public key OIDs */
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h
index a1cc718856..5ec89db3f0 100644
--- a/src/lib/libcrypto/asn1/asn1.h
+++ b/src/lib/libcrypto/asn1/asn1.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1.h,v 1.28 2014/06/12 15:49:27 deraadt Exp $ */ 1/* $OpenBSD: asn1.h,v 1.29 2015/01/28 04:14:31 beck 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 *
@@ -1279,6 +1279,7 @@ void ERR_load_ASN1_strings(void);
1279#define ASN1_R_ILLEGAL_TIME_VALUE 184 1279#define ASN1_R_ILLEGAL_TIME_VALUE 184
1280#define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185 1280#define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185
1281#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128 1281#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128
1282#define ASN1_R_INVALID_BIT_STRING_BITS_LEFT 220
1282#define ASN1_R_INVALID_BMPSTRING_LENGTH 129 1283#define ASN1_R_INVALID_BMPSTRING_LENGTH 129
1283#define ASN1_R_INVALID_DIGIT 130 1284#define ASN1_R_INVALID_DIGIT 130
1284#define ASN1_R_INVALID_MIME_TYPE 205 1285#define ASN1_R_INVALID_MIME_TYPE 205
diff --git a/src/lib/libcrypto/asn1/x_algor.c b/src/lib/libcrypto/asn1/x_algor.c
index c069a5225c..71aeaaade0 100644
--- a/src/lib/libcrypto/asn1/x_algor.c
+++ b/src/lib/libcrypto/asn1/x_algor.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x_algor.c,v 1.12 2014/06/12 15:49:27 deraadt Exp $ */ 1/* $OpenBSD: x_algor.c,v 1.13 2015/01/28 04:14:31 beck Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -136,3 +136,17 @@ X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md)
136 136
137 X509_ALGOR_set0(alg, OBJ_nid2obj(EVP_MD_type(md)), param_type, NULL); 137 X509_ALGOR_set0(alg, OBJ_nid2obj(EVP_MD_type(md)), param_type, NULL);
138} 138}
139
140/* Returns 0 if they are equal, != 0 otherwise. */
141int
142X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b)
143{
144 int rv = OBJ_cmp(a->algorithm, b->algorithm);
145 if (!rv) {
146 if (!a->parameter && !b->parameter)
147 rv = 0;
148 else
149 rv = ASN1_TYPE_cmp(a->parameter, b->parameter);
150 }
151 return(rv);
152}