summaryrefslogtreecommitdiffstats
path: root/crypto/x509/v3_ia5.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2019-05-13 09:07:45 -0700
committerRichard Levitte <levitte@openssl.org>2019-05-29 09:32:50 +0200
commit878dc8dd9572a719d3b481e7f68af8bf17f4c68e (patch)
tree183f1438079fe7b423d374d8e2341099575ce06c /crypto/x509/v3_ia5.c
parentcdc5ae9c6597f5d7c5507645e6bc561858b91e3e (diff)
Join the x509 and x509v3 directories
This has been long overdue. Note that this does not join the X509 and X509V3 error modules, that will be too many macro changes at this stage. Fixes #8919 Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/8925)
Diffstat (limited to 'crypto/x509/v3_ia5.c')
-rw-r--r--crypto/x509/v3_ia5.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/crypto/x509/v3_ia5.c b/crypto/x509/v3_ia5.c
new file mode 100644
index 0000000000..23c24e03b2
--- /dev/null
+++ b/crypto/x509/v3_ia5.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#include <stdio.h>
+#include "internal/cryptlib.h"
+#include <openssl/asn1.h>
+#include <openssl/conf.h>
+#include <openssl/x509v3.h>
+#include "ext_dat.h"
+
+const X509V3_EXT_METHOD v3_ns_ia5_list[8] = {
+ EXT_IA5STRING(NID_netscape_base_url),
+ EXT_IA5STRING(NID_netscape_revocation_url),
+ EXT_IA5STRING(NID_netscape_ca_revocation_url),
+ EXT_IA5STRING(NID_netscape_renewal_url),
+ EXT_IA5STRING(NID_netscape_ca_policy_url),
+ EXT_IA5STRING(NID_netscape_ssl_server_name),
+ EXT_IA5STRING(NID_netscape_comment),
+ EXT_END
+};
+
+char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5)
+{
+ char *tmp;
+
+ if (!ia5 || !ia5->length)
+ return NULL;
+ if ((tmp = OPENSSL_malloc(ia5->length + 1)) == NULL) {
+ X509V3err(X509V3_F_I2S_ASN1_IA5STRING, ERR_R_MALLOC_FAILURE);
+ return NULL;
+ }
+ memcpy(tmp, ia5->data, ia5->length);
+ tmp[ia5->length] = 0;
+ return tmp;
+}
+
+ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method,
+ X509V3_CTX *ctx, const 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()) == NULL)
+ goto err;
+ if (!ASN1_STRING_set((ASN1_STRING *)ia5, str, strlen(str))) {
+ ASN1_IA5STRING_free(ia5);
+ return NULL;
+ }
+#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);
+ return NULL;
+}