Deleted Added
full compact
d2i_pu.c (109998) d2i_pu.c (160814)
1/* crypto/asn1/d2i_pu.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 *

--- 54 unchanged lines hidden (view full) ---

63#include <openssl/objects.h>
64#include <openssl/asn1.h>
65#ifndef OPENSSL_NO_RSA
66#include <openssl/rsa.h>
67#endif
68#ifndef OPENSSL_NO_DSA
69#include <openssl/dsa.h>
70#endif
1/* crypto/asn1/d2i_pu.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 *

--- 54 unchanged lines hidden (view full) ---

63#include <openssl/objects.h>
64#include <openssl/asn1.h>
65#ifndef OPENSSL_NO_RSA
66#include <openssl/rsa.h>
67#endif
68#ifndef OPENSSL_NO_DSA
69#include <openssl/dsa.h>
70#endif
71#ifndef OPENSSL_NO_EC
72#include <openssl/ec.h>
73#endif
71
74
72EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp,
75EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp,
73 long length)
74 {
75 EVP_PKEY *ret;
76
77 if ((a == NULL) || (*a == NULL))
78 {
79 if ((ret=EVP_PKEY_new()) == NULL)
80 {

--- 14 unchanged lines hidden (view full) ---

95 {
96 ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB);
97 goto err;
98 }
99 break;
100#endif
101#ifndef OPENSSL_NO_DSA
102 case EVP_PKEY_DSA:
76 long length)
77 {
78 EVP_PKEY *ret;
79
80 if ((a == NULL) || (*a == NULL))
81 {
82 if ((ret=EVP_PKEY_new()) == NULL)
83 {

--- 14 unchanged lines hidden (view full) ---

98 {
99 ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB);
100 goto err;
101 }
102 break;
103#endif
104#ifndef OPENSSL_NO_DSA
105 case EVP_PKEY_DSA:
103 if ((ret->pkey.dsa=d2i_DSAPublicKey(NULL,
104 (const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */
106 if (!d2i_DSAPublicKey(&(ret->pkey.dsa),
107 (const unsigned char **)pp,length)) /* TMP UGLY CAST */
105 {
106 ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB);
107 goto err;
108 }
109 break;
110#endif
108 {
109 ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB);
110 goto err;
111 }
112 break;
113#endif
114#ifndef OPENSSL_NO_EC
115 case EVP_PKEY_EC:
116 if (!o2i_ECPublicKey(&(ret->pkey.ec),
117 (const unsigned char **)pp, length))
118 {
119 ASN1err(ASN1_F_D2I_PUBLICKEY, ERR_R_ASN1_LIB);
120 goto err;
121 }
122 break;
123#endif
111 default:
112 ASN1err(ASN1_F_D2I_PUBLICKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
113 goto err;
114 /* break; */
115 }
116 if (a != NULL) (*a)=ret;
117 return(ret);
118err:
119 if ((ret != NULL) && ((a == NULL) || (*a != ret))) EVP_PKEY_free(ret);
120 return(NULL);
121 }
122
124 default:
125 ASN1err(ASN1_F_D2I_PUBLICKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
126 goto err;
127 /* break; */
128 }
129 if (a != NULL) (*a)=ret;
130 return(ret);
131err:
132 if ((ret != NULL) && ((a == NULL) || (*a != ret))) EVP_PKEY_free(ret);
133 return(NULL);
134 }
135