diff options
Diffstat (limited to 'src/lib/libcrypto/x509v3/v3_ia5.c')
-rw-r--r-- | src/lib/libcrypto/x509v3/v3_ia5.c | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/src/lib/libcrypto/x509v3/v3_ia5.c b/src/lib/libcrypto/x509v3/v3_ia5.c index 98789b36e9..090fe49b20 100644 --- a/src/lib/libcrypto/x509v3/v3_ia5.c +++ b/src/lib/libcrypto/x509v3/v3_ia5.c | |||
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -64,26 +64,29 @@ | |||
64 | #include <openssl/x509v3.h> | 64 | #include <openssl/x509v3.h> |
65 | 65 | ||
66 | static char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5); | 66 | static char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5); |
67 | static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *str); | 67 | static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, |
68 | const X509V3_EXT_METHOD v3_ns_ia5_list[] = { | 68 | X509V3_CTX *ctx, char *str); |
69 | EXT_IA5STRING(NID_netscape_base_url), | ||
70 | EXT_IA5STRING(NID_netscape_revocation_url), | ||
71 | EXT_IA5STRING(NID_netscape_ca_revocation_url), | ||
72 | EXT_IA5STRING(NID_netscape_renewal_url), | ||
73 | EXT_IA5STRING(NID_netscape_ca_policy_url), | ||
74 | EXT_IA5STRING(NID_netscape_ssl_server_name), | ||
75 | EXT_IA5STRING(NID_netscape_comment), | ||
76 | EXT_END | ||
77 | }; | ||
78 | 69 | ||
70 | const X509V3_EXT_METHOD v3_ns_ia5_list[] = { | ||
71 | EXT_IA5STRING(NID_netscape_base_url), | ||
72 | EXT_IA5STRING(NID_netscape_revocation_url), | ||
73 | EXT_IA5STRING(NID_netscape_ca_revocation_url), | ||
74 | EXT_IA5STRING(NID_netscape_renewal_url), | ||
75 | EXT_IA5STRING(NID_netscape_ca_policy_url), | ||
76 | EXT_IA5STRING(NID_netscape_ssl_server_name), | ||
77 | EXT_IA5STRING(NID_netscape_comment), | ||
78 | EXT_END | ||
79 | }; | ||
79 | 80 | ||
80 | static char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, | 81 | static char * |
81 | ASN1_IA5STRING *ia5) | 82 | i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5) |
82 | { | 83 | { |
83 | char *tmp; | 84 | char *tmp; |
84 | if(!ia5 || !ia5->length) return NULL; | 85 | |
85 | if(!(tmp = malloc(ia5->length + 1))) { | 86 | if (!ia5 || !ia5->length) |
86 | X509V3err(X509V3_F_I2S_ASN1_IA5STRING,ERR_R_MALLOC_FAILURE); | 87 | return NULL; |
88 | if (!(tmp = malloc(ia5->length + 1))) { | ||
89 | X509V3err(X509V3_F_I2S_ASN1_IA5STRING, ERR_R_MALLOC_FAILURE); | ||
87 | return NULL; | 90 | return NULL; |
88 | } | 91 | } |
89 | memcpy(tmp, ia5->data, ia5->length); | 92 | memcpy(tmp, ia5->data, ia5->length); |
@@ -91,23 +94,25 @@ static char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, | |||
91 | return tmp; | 94 | return tmp; |
92 | } | 95 | } |
93 | 96 | ||
94 | static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, | 97 | static ASN1_IA5STRING * |
95 | X509V3_CTX *ctx, char *str) | 98 | s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *str) |
96 | { | 99 | { |
97 | ASN1_IA5STRING *ia5; | 100 | ASN1_IA5STRING *ia5; |
98 | if(!str) { | 101 | if (!str) { |
99 | X509V3err(X509V3_F_S2I_ASN1_IA5STRING,X509V3_R_INVALID_NULL_ARGUMENT); | 102 | X509V3err(X509V3_F_S2I_ASN1_IA5STRING, |
103 | X509V3_R_INVALID_NULL_ARGUMENT); | ||
100 | return NULL; | 104 | return NULL; |
101 | } | 105 | } |
102 | if(!(ia5 = M_ASN1_IA5STRING_new())) goto err; | 106 | if (!(ia5 = M_ASN1_IA5STRING_new())) |
103 | if(!ASN1_STRING_set((ASN1_STRING *)ia5, (unsigned char*)str, | 107 | goto err; |
104 | strlen(str))) { | 108 | if (!ASN1_STRING_set((ASN1_STRING *)ia5, (unsigned char*)str, |
109 | strlen(str))) { | ||
105 | M_ASN1_IA5STRING_free(ia5); | 110 | M_ASN1_IA5STRING_free(ia5); |
106 | goto err; | 111 | goto err; |
107 | } | 112 | } |
108 | return ia5; | 113 | return ia5; |
109 | err: | 114 | |
110 | X509V3err(X509V3_F_S2I_ASN1_IA5STRING,ERR_R_MALLOC_FAILURE); | 115 | err: |
116 | X509V3err(X509V3_F_S2I_ASN1_IA5STRING, ERR_R_MALLOC_FAILURE); | ||
111 | return NULL; | 117 | return NULL; |
112 | } | 118 | } |
113 | |||