diff options
Diffstat (limited to 'src/lib/libssl/src/crypto/asn1/d2i_pu.c')
| -rw-r--r-- | src/lib/libssl/src/crypto/asn1/d2i_pu.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/lib/libssl/src/crypto/asn1/d2i_pu.c b/src/lib/libssl/src/crypto/asn1/d2i_pu.c index c8f39ceb03..f04d230d70 100644 --- a/src/lib/libssl/src/crypto/asn1/d2i_pu.c +++ b/src/lib/libssl/src/crypto/asn1/d2i_pu.c | |||
| @@ -74,66 +74,66 @@ | |||
| 74 | 74 | ||
| 75 | EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, | 75 | EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, |
| 76 | long length) | 76 | long length) |
| 77 | { | 77 | { |
| 78 | EVP_PKEY *ret; | 78 | EVP_PKEY *ret; |
| 79 | 79 | ||
| 80 | if ((a == NULL) || (*a == NULL)) | 80 | if ((a == NULL) || (*a == NULL)) |
| 81 | { | 81 | { |
| 82 | if ((ret=EVP_PKEY_new()) == NULL) | 82 | if ((ret=EVP_PKEY_new()) == NULL) |
| 83 | { | 83 | { |
| 84 | ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_EVP_LIB); | 84 | ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_EVP_LIB); |
| 85 | return(NULL); | 85 | return(NULL); |
| 86 | } | ||
| 87 | } | 86 | } |
| 87 | } | ||
| 88 | else ret= *a; | 88 | else ret= *a; |
| 89 | 89 | ||
| 90 | if (!EVP_PKEY_set_type(ret, type)) | 90 | if (!EVP_PKEY_set_type(ret, type)) |
| 91 | { | 91 | { |
| 92 | ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_EVP_LIB); | 92 | ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_EVP_LIB); |
| 93 | goto err; | 93 | goto err; |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | switch (EVP_PKEY_id(ret)) | 96 | switch (EVP_PKEY_id(ret)) |
| 97 | { | 97 | { |
| 98 | #ifndef OPENSSL_NO_RSA | 98 | #ifndef OPENSSL_NO_RSA |
| 99 | case EVP_PKEY_RSA: | 99 | case EVP_PKEY_RSA: |
| 100 | if ((ret->pkey.rsa=d2i_RSAPublicKey(NULL, | 100 | if ((ret->pkey.rsa=d2i_RSAPublicKey(NULL, |
| 101 | (const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */ | 101 | (const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */ |
| 102 | { | 102 | { |
| 103 | ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB); | 103 | ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB); |
| 104 | goto err; | 104 | goto err; |
| 105 | } | 105 | } |
| 106 | break; | 106 | break; |
| 107 | #endif | 107 | #endif |
| 108 | #ifndef OPENSSL_NO_DSA | 108 | #ifndef OPENSSL_NO_DSA |
| 109 | case EVP_PKEY_DSA: | 109 | case EVP_PKEY_DSA: |
| 110 | if (!d2i_DSAPublicKey(&(ret->pkey.dsa), | 110 | if (!d2i_DSAPublicKey(&(ret->pkey.dsa), |
| 111 | (const unsigned char **)pp,length)) /* TMP UGLY CAST */ | 111 | (const unsigned char **)pp,length)) /* TMP UGLY CAST */ |
| 112 | { | 112 | { |
| 113 | ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB); | 113 | ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB); |
| 114 | goto err; | 114 | goto err; |
| 115 | } | 115 | } |
| 116 | break; | 116 | break; |
| 117 | #endif | 117 | #endif |
| 118 | #ifndef OPENSSL_NO_EC | 118 | #ifndef OPENSSL_NO_EC |
| 119 | case EVP_PKEY_EC: | 119 | case EVP_PKEY_EC: |
| 120 | if (!o2i_ECPublicKey(&(ret->pkey.ec), | 120 | if (!o2i_ECPublicKey(&(ret->pkey.ec), |
| 121 | (const unsigned char **)pp, length)) | 121 | (const unsigned char **)pp, length)) |
| 122 | { | 122 | { |
| 123 | ASN1err(ASN1_F_D2I_PUBLICKEY, ERR_R_ASN1_LIB); | 123 | ASN1err(ASN1_F_D2I_PUBLICKEY, ERR_R_ASN1_LIB); |
| 124 | goto err; | 124 | goto err; |
| 125 | } | 125 | } |
| 126 | break; | 126 | break; |
| 127 | #endif | 127 | #endif |
| 128 | default: | 128 | default: |
| 129 | ASN1err(ASN1_F_D2I_PUBLICKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE); | 129 | ASN1err(ASN1_F_D2I_PUBLICKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE); |
| 130 | goto err; | 130 | goto err; |
| 131 | /* break; */ | 131 | /* break; */ |
| 132 | } | 132 | } |
| 133 | if (a != NULL) (*a)=ret; | 133 | if (a != NULL) (*a)=ret; |
| 134 | return(ret); | 134 | return(ret); |
| 135 | err: | 135 | err: |
| 136 | if ((ret != NULL) && ((a == NULL) || (*a != ret))) EVP_PKEY_free(ret); | 136 | if ((ret != NULL) && ((a == NULL) || (*a != ret))) EVP_PKEY_free(ret); |
| 137 | return(NULL); | 137 | return(NULL); |
| 138 | } | 138 | } |
| 139 | 139 | ||
