x_pkey.c (302408) | x_pkey.c (325337) |
---|---|
1/* crypto/asn1/x_pkey.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 92 unchanged lines hidden (view full) --- 101 M_ASN1_D2I_Finish(a, X509_PKEY_free, ASN1_F_D2I_X509_PKEY); 102} 103 104X509_PKEY *X509_PKEY_new(void) 105{ 106 X509_PKEY *ret = NULL; 107 ASN1_CTX c; 108 | 1/* crypto/asn1/x_pkey.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 92 unchanged lines hidden (view full) --- 101 M_ASN1_D2I_Finish(a, X509_PKEY_free, ASN1_F_D2I_X509_PKEY); 102} 103 104X509_PKEY *X509_PKEY_new(void) 105{ 106 X509_PKEY *ret = NULL; 107 ASN1_CTX c; 108 |
109 M_ASN1_New_Malloc(ret, X509_PKEY); | 109 ret = OPENSSL_malloc(sizeof(X509_PKEY)); 110 if (ret == NULL) { 111 c.line = __LINE__; 112 goto err; 113 } |
110 ret->version = 0; | 114 ret->version = 0; |
111 M_ASN1_New(ret->enc_algor, X509_ALGOR_new); 112 M_ASN1_New(ret->enc_pkey, M_ASN1_OCTET_STRING_new); | 115 ret->enc_algor = X509_ALGOR_new(); 116 ret->enc_pkey = M_ASN1_OCTET_STRING_new(); |
113 ret->dec_pkey = NULL; 114 ret->key_length = 0; 115 ret->key_data = NULL; 116 ret->key_free = 0; 117 ret->cipher.cipher = NULL; 118 memset(ret->cipher.iv, 0, EVP_MAX_IV_LENGTH); 119 ret->references = 1; | 117 ret->dec_pkey = NULL; 118 ret->key_length = 0; 119 ret->key_data = NULL; 120 ret->key_free = 0; 121 ret->cipher.cipher = NULL; 122 memset(ret->cipher.iv, 0, EVP_MAX_IV_LENGTH); 123 ret->references = 1; |
120 return (ret); 121 M_ASN1_New_Error(ASN1_F_X509_PKEY_NEW); | 124 if (ret->enc_algor == NULL || ret->enc_pkey == NULL) { 125 c.line = __LINE__; 126 goto err; 127 } 128 return ret; 129err: 130 X509_PKEY_free(ret); 131 ASN1_MAC_H_err(ASN1_F_X509_PKEY_NEW, ERR_R_MALLOC_FAILURE, c.line); 132 return NULL; |
122} 123 124void X509_PKEY_free(X509_PKEY *x) 125{ 126 int i; 127 128 if (x == NULL) 129 return; --- 24 unchanged lines hidden --- | 133} 134 135void X509_PKEY_free(X509_PKEY *x) 136{ 137 int i; 138 139 if (x == NULL) 140 return; --- 24 unchanged lines hidden --- |