X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fx509v3%2Fv3_ia5.c;h=3bfd345bc677c42cf3f580fb8eaf44269646549d;hp=1030d8ea69a60a44dc49c1a6b2db5c410fcd9b4b;hb=6452a139fe2ec75db9b700d7f8f1b172960f4141;hpb=e527ba09a66837cad0d8973409e660474db63f89 diff --git a/crypto/x509v3/v3_ia5.c b/crypto/x509v3/v3_ia5.c index 1030d8ea69..3bfd345bc6 100644 --- a/crypto/x509v3/v3_ia5.c +++ b/crypto/x509v3/v3_ia5.c @@ -1,5 +1,5 @@ /* v3_ia5.c */ -/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL +/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ /* ==================================================================== @@ -59,21 +59,11 @@ #include #include "cryptlib.h" -#include "asn1.h" -#include "conf.h" -#include "x509v3.h" +#include +#include +#include -#ifndef NOPROTO -static ASN1_IA5STRING *ia5string_new(void); -static char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5); -static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *str); -#else -static ASN1_IA5STRING *ia5string_new(); -static char *i2s_ASN1_IA5STRING(); -static ASN1_IA5STRING *s2i_ASN1_IA5STRING(); -#endif - -X509V3_EXT_METHOD v3_ns_ia5_list[] = { +const X509V3_EXT_METHOD v3_ns_ia5_list[] = { EXT_IA5STRING(NID_netscape_base_url), EXT_IA5STRING(NID_netscape_revocation_url), EXT_IA5STRING(NID_netscape_ca_revocation_url), @@ -85,38 +75,37 @@ EXT_END }; -static ASN1_IA5STRING *ia5string_new(void) -{ - return ASN1_IA5STRING_new(); -} - -static char *i2s_ASN1_IA5STRING(method, ia5) -X509V3_EXT_METHOD *method; -ASN1_IA5STRING *ia5; +char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, + ASN1_IA5STRING *ia5) { char *tmp; if(!ia5 || !ia5->length) return NULL; - tmp = Malloc(ia5->length + 1); + if(!(tmp = OPENSSL_malloc(ia5->length + 1))) { + X509V3err(X509V3_F_I2S_ASN1_IA5STRING,ERR_R_MALLOC_FAILURE); + return NULL; + } memcpy(tmp, ia5->data, ia5->length); tmp[ia5->length] = 0; return tmp; } -static ASN1_IA5STRING *s2i_ASN1_IA5STRING(method, ctx, str) -X509V3_EXT_METHOD *method; -X509V3_CTX *ctx; -char *str; +ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, char *str) { ASN1_IA5STRING *ia5; if(!str) { X509V3err(X509V3_F_S2I_ASN1_IA5STRING,X509V3_R_INVALID_NULL_ARGUMENT); return NULL; } - if(!(ia5 = ASN1_IA5STRING_new())) goto err; - if(!ASN1_STRING_set((ASN1_STRING *)ia5, str, strlen(str))) { - ASN1_IA5STRING_free(ia5); + if(!(ia5 = M_ASN1_IA5STRING_new())) goto err; + if(!ASN1_STRING_set((ASN1_STRING *)ia5, (unsigned char*)str, + strlen(str))) { + M_ASN1_IA5STRING_free(ia5); goto err; } +#ifdef CHARSET_EBCDIC + ebcdic2ascii(ia5->data, ia5->data, ia5->length); +#endif /*CHARSET_EBCDIC*/ return ia5; err: X509V3err(X509V3_F_S2I_ASN1_IA5STRING,ERR_R_MALLOC_FAILURE);