X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fx509v3%2Fv3_ia5.c;h=4ff12b52b54c5cdcdcf658dd86606b0e85555048;hb=bcf9cf89e70a6d15898e25e972e1234729add189;hp=d590bef0ac4c71b33da9f25fcaa8ac8190845d39;hpb=95dc05bc6d0dfe0f3f3681f5e27afbc3f7a35eea;p=oweals%2Fopenssl.git diff --git a/crypto/x509v3/v3_ia5.c b/crypto/x509v3/v3_ia5.c index d590bef0ac..4ff12b52b5 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,13 @@ #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,17 +77,15 @@ EXT_END }; -static ASN1_IA5STRING *ia5string_new(void) -{ - return ASN1_IA5STRING_new(); -} - static 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; @@ -109,12 +99,15 @@ static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, X509V3err(X509V3_F_S2I_ASN1_IA5STRING,X509V3_R_INVALID_NULL_ARGUMENT); return NULL; } - if(!(ia5 = ASN1_IA5STRING_new())) goto err; + if(!(ia5 = M_ASN1_IA5STRING_new())) goto err; if(!ASN1_STRING_set((ASN1_STRING *)ia5, (unsigned char*)str, strlen(str))) { - ASN1_IA5STRING_free(ia5); + 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);