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, 11 insertions, 12 deletions
diff --git a/src/lib/libssl/src/crypto/asn1/a_sign.c b/src/lib/libssl/src/crypto/asn1/a_sign.c
index 1081950518..52ce7e3974 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-2003 The OpenSSL Project. All rights reserved. 59 * Copyright (c) 1998-2002 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(i2d_of_void *i2d, X509_ALGOR *algor1, X509_ALGOR *algor2, 129int ASN1_sign(int (*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,11 +229,10 @@ 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)
234 { 233 {
235 /* special case: RFC 3279 tells us to omit 'parameters' 234 /* special case: RFC 2459 tells us to omit 'parameters'
236 * with id-dsa-with-sha1 and ecdsa-with-SHA1 */ 235 * with id-dsa-with-sha1 */
237 ASN1_TYPE_free(a->parameter); 236 ASN1_TYPE_free(a->parameter);
238 a->parameter = NULL; 237 a->parameter = NULL;
239 } 238 }
@@ -248,12 +247,12 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
248 a->algorithm=OBJ_nid2obj(type->pkey_type); 247 a->algorithm=OBJ_nid2obj(type->pkey_type);
249 if (a->algorithm == NULL) 248 if (a->algorithm == NULL)
250 { 249 {
251 ASN1err(ASN1_F_ASN1_ITEM_SIGN,ASN1_R_UNKNOWN_OBJECT_TYPE); 250 ASN1err(ASN1_F_ASN1_SIGN,ASN1_R_UNKNOWN_OBJECT_TYPE);
252 goto err; 251 goto err;
253 } 252 }
254 if (a->algorithm->length == 0) 253 if (a->algorithm->length == 0)
255 { 254 {
256 ASN1err(ASN1_F_ASN1_ITEM_SIGN,ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD); 255 ASN1err(ASN1_F_ASN1_SIGN,ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD);
257 goto err; 256 goto err;
258 } 257 }
259 } 258 }
@@ -263,7 +262,7 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
263 if ((buf_in == NULL) || (buf_out == NULL)) 262 if ((buf_in == NULL) || (buf_out == NULL))
264 { 263 {
265 outl=0; 264 outl=0;
266 ASN1err(ASN1_F_ASN1_ITEM_SIGN,ERR_R_MALLOC_FAILURE); 265 ASN1err(ASN1_F_ASN1_SIGN,ERR_R_MALLOC_FAILURE);
267 goto err; 266 goto err;
268 } 267 }
269 268
@@ -273,7 +272,7 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
273 (unsigned int *)&outl,pkey)) 272 (unsigned int *)&outl,pkey))
274 { 273 {
275 outl=0; 274 outl=0;
276 ASN1err(ASN1_F_ASN1_ITEM_SIGN,ERR_R_EVP_LIB); 275 ASN1err(ASN1_F_ASN1_SIGN,ERR_R_EVP_LIB);
277 goto err; 276 goto err;
278 } 277 }
279 if (signature->data != NULL) OPENSSL_free(signature->data); 278 if (signature->data != NULL) OPENSSL_free(signature->data);