summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/asn1/asn1_mac.h17
-rw-r--r--src/lib/libcrypto/asn1/x_pkey.c21
-rw-r--r--src/lib/libssl/src/crypto/asn1/asn1_mac.h17
-rw-r--r--src/lib/libssl/src/crypto/asn1/x_pkey.c21
4 files changed, 32 insertions, 44 deletions
diff --git a/src/lib/libcrypto/asn1/asn1_mac.h b/src/lib/libcrypto/asn1/asn1_mac.h
index 9d989eb797..fd524dc21c 100644
--- a/src/lib/libcrypto/asn1/asn1_mac.h
+++ b/src/lib/libcrypto/asn1/asn1_mac.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1_mac.h,v 1.13 2014/06/12 15:49:27 deraadt Exp $ */ 1/* $OpenBSD: asn1_mac.h,v 1.14 2014/06/27 04:41:09 miod 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 *
@@ -287,21 +287,6 @@ err:\
287 c.slen-=(c.p-c.q); \ 287 c.slen-=(c.p-c.q); \
288 } 288 }
289 289
290/* New macros */
291#define M_ASN1_New_Malloc(ret,type) \
292 if ((ret = malloc(sizeof(type))) == NULL) \
293 { c.line=__LINE__; goto err2; }
294
295#define M_ASN1_New(arg,func) \
296 if (((arg)=func()) == NULL) return(NULL)
297
298#define M_ASN1_New_Error(a) \
299/* err: ASN1_MAC_H_err((a),ERR_R_NESTED_ASN1_ERROR,c.line); \
300 return(NULL);*/ \
301 err2: ASN1_MAC_H_err((a),ERR_R_MALLOC_FAILURE,c.line); \
302 return(NULL)
303
304
305/* BIG UGLY WARNING! This is so damn ugly I wanna puke. Unfortunately, 290/* BIG UGLY WARNING! This is so damn ugly I wanna puke. Unfortunately,
306 some macros that use ASN1_const_CTX still insist on writing in the input 291 some macros that use ASN1_const_CTX still insist on writing in the input
307 stream. ARGH! ARGH! ARGH! Let's get rid of this macro package. 292 stream. ARGH! ARGH! ARGH! Let's get rid of this macro package.
diff --git a/src/lib/libcrypto/asn1/x_pkey.c b/src/lib/libcrypto/asn1/x_pkey.c
index 2e7745315f..bbf7666b54 100644
--- a/src/lib/libcrypto/asn1/x_pkey.c
+++ b/src/lib/libcrypto/asn1/x_pkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x_pkey.c,v 1.11 2014/06/12 15:49:27 deraadt Exp $ */ 1/* $OpenBSD: x_pkey.c,v 1.12 2014/06/27 04:41:09 miod 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 *
@@ -107,12 +107,22 @@ X509_PKEY *
107X509_PKEY_new(void) 107X509_PKEY_new(void)
108{ 108{
109 X509_PKEY *ret = NULL; 109 X509_PKEY *ret = NULL;
110 ASN1_CTX c;
111 110
112 M_ASN1_New_Malloc(ret, X509_PKEY); 111 if ((ret = malloc(sizeof(X509_PKEY))) == NULL) {
112 ASN1_MAC_H_err(ASN1_F_X509_PKEY_NEW, ERR_R_MALLOC_FAILURE,
113 __LINE__);
114 return NULL;
115 }
113 ret->version = 0; 116 ret->version = 0;
114 M_ASN1_New(ret->enc_algor, X509_ALGOR_new); 117 if ((ret->enc_algor = X509_ALGOR_new()) == NULL) {
115 M_ASN1_New(ret->enc_pkey, M_ASN1_OCTET_STRING_new); 118 free(ret);
119 return NULL;
120 }
121 if ((ret->enc_pkey = M_ASN1_OCTET_STRING_new()) == NULL) {
122 X509_ALGOR_free(ret->enc_algor);
123 free(ret);
124 return NULL;
125 }
116 ret->dec_pkey = NULL; 126 ret->dec_pkey = NULL;
117 ret->key_length = 0; 127 ret->key_length = 0;
118 ret->key_data = NULL; 128 ret->key_data = NULL;
@@ -121,7 +131,6 @@ X509_PKEY_new(void)
121 memset(ret->cipher.iv, 0, EVP_MAX_IV_LENGTH); 131 memset(ret->cipher.iv, 0, EVP_MAX_IV_LENGTH);
122 ret->references = 1; 132 ret->references = 1;
123 return (ret); 133 return (ret);
124 M_ASN1_New_Error(ASN1_F_X509_PKEY_NEW);
125} 134}
126 135
127void 136void
diff --git a/src/lib/libssl/src/crypto/asn1/asn1_mac.h b/src/lib/libssl/src/crypto/asn1/asn1_mac.h
index 9d989eb797..fd524dc21c 100644
--- a/src/lib/libssl/src/crypto/asn1/asn1_mac.h
+++ b/src/lib/libssl/src/crypto/asn1/asn1_mac.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1_mac.h,v 1.13 2014/06/12 15:49:27 deraadt Exp $ */ 1/* $OpenBSD: asn1_mac.h,v 1.14 2014/06/27 04:41:09 miod 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 *
@@ -287,21 +287,6 @@ err:\
287 c.slen-=(c.p-c.q); \ 287 c.slen-=(c.p-c.q); \
288 } 288 }
289 289
290/* New macros */
291#define M_ASN1_New_Malloc(ret,type) \
292 if ((ret = malloc(sizeof(type))) == NULL) \
293 { c.line=__LINE__; goto err2; }
294
295#define M_ASN1_New(arg,func) \
296 if (((arg)=func()) == NULL) return(NULL)
297
298#define M_ASN1_New_Error(a) \
299/* err: ASN1_MAC_H_err((a),ERR_R_NESTED_ASN1_ERROR,c.line); \
300 return(NULL);*/ \
301 err2: ASN1_MAC_H_err((a),ERR_R_MALLOC_FAILURE,c.line); \
302 return(NULL)
303
304
305/* BIG UGLY WARNING! This is so damn ugly I wanna puke. Unfortunately, 290/* BIG UGLY WARNING! This is so damn ugly I wanna puke. Unfortunately,
306 some macros that use ASN1_const_CTX still insist on writing in the input 291 some macros that use ASN1_const_CTX still insist on writing in the input
307 stream. ARGH! ARGH! ARGH! Let's get rid of this macro package. 292 stream. ARGH! ARGH! ARGH! Let's get rid of this macro package.
diff --git a/src/lib/libssl/src/crypto/asn1/x_pkey.c b/src/lib/libssl/src/crypto/asn1/x_pkey.c
index 2e7745315f..bbf7666b54 100644
--- a/src/lib/libssl/src/crypto/asn1/x_pkey.c
+++ b/src/lib/libssl/src/crypto/asn1/x_pkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x_pkey.c,v 1.11 2014/06/12 15:49:27 deraadt Exp $ */ 1/* $OpenBSD: x_pkey.c,v 1.12 2014/06/27 04:41:09 miod 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 *
@@ -107,12 +107,22 @@ X509_PKEY *
107X509_PKEY_new(void) 107X509_PKEY_new(void)
108{ 108{
109 X509_PKEY *ret = NULL; 109 X509_PKEY *ret = NULL;
110 ASN1_CTX c;
111 110
112 M_ASN1_New_Malloc(ret, X509_PKEY); 111 if ((ret = malloc(sizeof(X509_PKEY))) == NULL) {
112 ASN1_MAC_H_err(ASN1_F_X509_PKEY_NEW, ERR_R_MALLOC_FAILURE,
113 __LINE__);
114 return NULL;
115 }
113 ret->version = 0; 116 ret->version = 0;
114 M_ASN1_New(ret->enc_algor, X509_ALGOR_new); 117 if ((ret->enc_algor = X509_ALGOR_new()) == NULL) {
115 M_ASN1_New(ret->enc_pkey, M_ASN1_OCTET_STRING_new); 118 free(ret);
119 return NULL;
120 }
121 if ((ret->enc_pkey = M_ASN1_OCTET_STRING_new()) == NULL) {
122 X509_ALGOR_free(ret->enc_algor);
123 free(ret);
124 return NULL;
125 }
116 ret->dec_pkey = NULL; 126 ret->dec_pkey = NULL;
117 ret->key_length = 0; 127 ret->key_length = 0;
118 ret->key_data = NULL; 128 ret->key_data = NULL;
@@ -121,7 +131,6 @@ X509_PKEY_new(void)
121 memset(ret->cipher.iv, 0, EVP_MAX_IV_LENGTH); 131 memset(ret->cipher.iv, 0, EVP_MAX_IV_LENGTH);
122 ret->references = 1; 132 ret->references = 1;
123 return (ret); 133 return (ret);
124 M_ASN1_New_Error(ASN1_F_X509_PKEY_NEW);
125} 134}
126 135
127void 136void