Add support for the noCheck OCSP extension. This is
[openssl.git] / crypto / x509v3 / v3_ia5.c
index 13a1137288e4d6fdc6a5463dfef7ce83648642f0..f3bba382693176d066656a7f95ad28f371f164ef 100644 (file)
  *
  */
 
+
 #include <stdio.h>
-#include <stdlib.h>
-#include <pem.h>
-#include <asn1_mac.h>
-#include <err.h>
-#include <objects.h>
-#include <conf.h>
-#include "x509v3.h"
+#include "cryptlib.h"
+#include <openssl/asn1.h>
+#include <openssl/conf.h>
+#include <openssl/x509v3.h>
 
-#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[] = { 
 EXT_IA5STRING(NID_netscape_base_url),
 EXT_IA5STRING(NID_netscape_revocation_url),
@@ -87,38 +77,34 @@ 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;
+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);
+       tmp = OPENSSL_malloc(ia5->length + 1);
        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;
+static 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);