summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/a_sign.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/a_sign.c')
-rw-r--r--src/lib/libcrypto/asn1/a_sign.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/lib/libcrypto/asn1/a_sign.c b/src/lib/libcrypto/asn1/a_sign.c
index 195daa3b9f..4e545eb719 100644
--- a/src/lib/libcrypto/asn1/a_sign.c
+++ b/src/lib/libcrypto/asn1/a_sign.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_sign.c,v 1.21 2015/09/10 15:56:24 jsing Exp $ */ 1/* $OpenBSD: a_sign.c,v 1.22 2017/01/29 17:49:22 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 *
@@ -153,8 +153,7 @@ ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
153 pkey = EVP_PKEY_CTX_get0_pkey(ctx->pctx); 153 pkey = EVP_PKEY_CTX_get0_pkey(ctx->pctx);
154 154
155 if (!type || !pkey) { 155 if (!type || !pkey) {
156 ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX, 156 ASN1error(ASN1_R_CONTEXT_NOT_INITIALISED);
157 ASN1_R_CONTEXT_NOT_INITIALISED);
158 return 0; 157 return 0;
159 } 158 }
160 159
@@ -170,7 +169,7 @@ ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
170 * 3: ASN1 method sets algorithm identifiers: just sign. 169 * 3: ASN1 method sets algorithm identifiers: just sign.
171 */ 170 */
172 if (rv <= 0) 171 if (rv <= 0)
173 ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX, ERR_R_EVP_LIB); 172 ASN1error(ERR_R_EVP_LIB);
174 if (rv <= 1) 173 if (rv <= 1)
175 goto err; 174 goto err;
176 } else 175 } else
@@ -181,8 +180,7 @@ ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
181 if (!pkey->ameth || 180 if (!pkey->ameth ||
182 !OBJ_find_sigid_by_algs(&signid, 181 !OBJ_find_sigid_by_algs(&signid,
183 EVP_MD_nid(type), pkey->ameth->pkey_id)) { 182 EVP_MD_nid(type), pkey->ameth->pkey_id)) {
184 ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX, 183 ASN1error(ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED);
185 ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED);
186 return 0; 184 return 0;
187 } 185 }
188 } else 186 } else
@@ -207,14 +205,14 @@ ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
207 buf_out = malloc(outl); 205 buf_out = malloc(outl);
208 if ((buf_in == NULL) || (buf_out == NULL)) { 206 if ((buf_in == NULL) || (buf_out == NULL)) {
209 outl = 0; 207 outl = 0;
210 ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX, ERR_R_MALLOC_FAILURE); 208 ASN1error(ERR_R_MALLOC_FAILURE);
211 goto err; 209 goto err;
212 } 210 }
213 211
214 if (!EVP_DigestSignUpdate(ctx, buf_in, inl) || 212 if (!EVP_DigestSignUpdate(ctx, buf_in, inl) ||
215 !EVP_DigestSignFinal(ctx, buf_out, &outl)) { 213 !EVP_DigestSignFinal(ctx, buf_out, &outl)) {
216 outl = 0; 214 outl = 0;
217 ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX, ERR_R_EVP_LIB); 215 ASN1error(ERR_R_EVP_LIB);
218 goto err; 216 goto err;
219 } 217 }
220 free(signature->data); 218 free(signature->data);