diff options
Diffstat (limited to 'src/lib/libcrypto/x509v3/v3_ia5.c')
| -rw-r--r-- | src/lib/libcrypto/x509v3/v3_ia5.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/lib/libcrypto/x509v3/v3_ia5.c b/src/lib/libcrypto/x509v3/v3_ia5.c index 3446c5cd6a..f9414456de 100644 --- a/src/lib/libcrypto/x509v3/v3_ia5.c +++ b/src/lib/libcrypto/x509v3/v3_ia5.c | |||
| @@ -63,7 +63,6 @@ | |||
| 63 | #include <openssl/conf.h> | 63 | #include <openssl/conf.h> |
| 64 | #include <openssl/x509v3.h> | 64 | #include <openssl/x509v3.h> |
| 65 | 65 | ||
| 66 | static ASN1_IA5STRING *ia5string_new(void); | ||
| 67 | 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); |
| 68 | 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, X509V3_CTX *ctx, char *str); |
| 69 | X509V3_EXT_METHOD v3_ns_ia5_list[] = { | 68 | X509V3_EXT_METHOD v3_ns_ia5_list[] = { |
| @@ -78,17 +77,12 @@ EXT_END | |||
| 78 | }; | 77 | }; |
| 79 | 78 | ||
| 80 | 79 | ||
| 81 | static ASN1_IA5STRING *ia5string_new(void) | ||
| 82 | { | ||
| 83 | return ASN1_IA5STRING_new(); | ||
| 84 | } | ||
| 85 | |||
| 86 | static char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, | 80 | static char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, |
| 87 | ASN1_IA5STRING *ia5) | 81 | ASN1_IA5STRING *ia5) |
| 88 | { | 82 | { |
| 89 | char *tmp; | 83 | char *tmp; |
| 90 | if(!ia5 || !ia5->length) return NULL; | 84 | if(!ia5 || !ia5->length) return NULL; |
| 91 | tmp = Malloc(ia5->length + 1); | 85 | if (!(tmp = OPENSSL_malloc(ia5->length + 1))) return NULL; |
| 92 | memcpy(tmp, ia5->data, ia5->length); | 86 | memcpy(tmp, ia5->data, ia5->length); |
| 93 | tmp[ia5->length] = 0; | 87 | tmp[ia5->length] = 0; |
| 94 | return tmp; | 88 | return tmp; |
| @@ -102,12 +96,15 @@ static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, | |||
| 102 | X509V3err(X509V3_F_S2I_ASN1_IA5STRING,X509V3_R_INVALID_NULL_ARGUMENT); | 96 | X509V3err(X509V3_F_S2I_ASN1_IA5STRING,X509V3_R_INVALID_NULL_ARGUMENT); |
| 103 | return NULL; | 97 | return NULL; |
| 104 | } | 98 | } |
| 105 | if(!(ia5 = ASN1_IA5STRING_new())) goto err; | 99 | if(!(ia5 = M_ASN1_IA5STRING_new())) goto err; |
| 106 | if(!ASN1_STRING_set((ASN1_STRING *)ia5, (unsigned char*)str, | 100 | if(!ASN1_STRING_set((ASN1_STRING *)ia5, (unsigned char*)str, |
| 107 | strlen(str))) { | 101 | strlen(str))) { |
| 108 | ASN1_IA5STRING_free(ia5); | 102 | M_ASN1_IA5STRING_free(ia5); |
| 109 | goto err; | 103 | goto err; |
| 110 | } | 104 | } |
| 105 | #ifdef CHARSET_EBCDIC | ||
| 106 | ebcdic2ascii(ia5->data, ia5->data, ia5->length); | ||
| 107 | #endif /*CHARSET_EBCDIC*/ | ||
| 111 | return ia5; | 108 | return ia5; |
| 112 | err: | 109 | err: |
| 113 | X509V3err(X509V3_F_S2I_ASN1_IA5STRING,ERR_R_MALLOC_FAILURE); | 110 | X509V3err(X509V3_F_S2I_ASN1_IA5STRING,ERR_R_MALLOC_FAILURE); |
