summaryrefslogtreecommitdiff
path: root/src/lib/libssl/src/crypto/asn1/a_sign.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/src/crypto/asn1/a_sign.c')
-rw-r--r--src/lib/libssl/src/crypto/asn1/a_sign.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/lib/libssl/src/crypto/asn1/a_sign.c b/src/lib/libssl/src/crypto/asn1/a_sign.c
index 52ce7e3974..1081950518 100644
--- a/src/lib/libssl/src/crypto/asn1/a_sign.c
+++ b/src/lib/libssl/src/crypto/asn1/a_sign.c
@@ -56,7 +56,7 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58/* ==================================================================== 58/* ====================================================================
59 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 59 * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved.
60 * 60 *
61 * Redistribution and use in source and binary forms, with or without 61 * Redistribution and use in source and binary forms, with or without
62 * modification, are permitted provided that the following conditions 62 * modification, are permitted provided that the following conditions
@@ -126,9 +126,9 @@
126 126
127#ifndef NO_ASN1_OLD 127#ifndef NO_ASN1_OLD
128 128
129int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2, 129int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1, X509_ALGOR *algor2,
130 ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey, 130 ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey,
131 const EVP_MD *type) 131 const EVP_MD *type)
132 { 132 {
133 EVP_MD_CTX ctx; 133 EVP_MD_CTX ctx;
134 unsigned char *p,*buf_in=NULL,*buf_out=NULL; 134 unsigned char *p,*buf_in=NULL,*buf_out=NULL;
@@ -229,10 +229,11 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
229 else 229 else
230 a=algor2; 230 a=algor2;
231 if (a == NULL) continue; 231 if (a == NULL) continue;
232 if (type->pkey_type == NID_dsaWithSHA1) 232 if (type->pkey_type == NID_dsaWithSHA1 ||
233 type->pkey_type == NID_ecdsa_with_SHA1)
233 { 234 {
234 /* special case: RFC 2459 tells us to omit 'parameters' 235 /* special case: RFC 3279 tells us to omit 'parameters'
235 * with id-dsa-with-sha1 */ 236 * with id-dsa-with-sha1 and ecdsa-with-SHA1 */
236 ASN1_TYPE_free(a->parameter); 237 ASN1_TYPE_free(a->parameter);
237 a->parameter = NULL; 238 a->parameter = NULL;
238 } 239 }
@@ -247,12 +248,12 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
247 a->algorithm=OBJ_nid2obj(type->pkey_type); 248 a->algorithm=OBJ_nid2obj(type->pkey_type);
248 if (a->algorithm == NULL) 249 if (a->algorithm == NULL)
249 { 250 {
250 ASN1err(ASN1_F_ASN1_SIGN,ASN1_R_UNKNOWN_OBJECT_TYPE); 251 ASN1err(ASN1_F_ASN1_ITEM_SIGN,ASN1_R_UNKNOWN_OBJECT_TYPE);
251 goto err; 252 goto err;
252 } 253 }
253 if (a->algorithm->length == 0) 254 if (a->algorithm->length == 0)
254 { 255 {
255 ASN1err(ASN1_F_ASN1_SIGN,ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD); 256 ASN1err(ASN1_F_ASN1_ITEM_SIGN,ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD);
256 goto err; 257 goto err;
257 } 258 }
258 } 259 }
@@ -262,7 +263,7 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
262 if ((buf_in == NULL) || (buf_out == NULL)) 263 if ((buf_in == NULL) || (buf_out == NULL))
263 { 264 {
264 outl=0; 265 outl=0;
265 ASN1err(ASN1_F_ASN1_SIGN,ERR_R_MALLOC_FAILURE); 266 ASN1err(ASN1_F_ASN1_ITEM_SIGN,ERR_R_MALLOC_FAILURE);
266 goto err; 267 goto err;
267 } 268 }
268 269
@@ -272,7 +273,7 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
272 (unsigned int *)&outl,pkey)) 273 (unsigned int *)&outl,pkey))
273 { 274 {
274 outl=0; 275 outl=0;
275 ASN1err(ASN1_F_ASN1_SIGN,ERR_R_EVP_LIB); 276 ASN1err(ASN1_F_ASN1_ITEM_SIGN,ERR_R_EVP_LIB);
276 goto err; 277 goto err;
277 } 278 }
278 if (signature->data != NULL) OPENSSL_free(signature->data); 279 if (signature->data != NULL) OPENSSL_free(signature->data);