]>
Commit | Line | Data |
---|---|---|
0f113f3e | 1 | /* |
3c2bdd7d | 2 | * Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved. |
9aeaf1b4 | 3 | * |
4286ca47 | 4 | * Licensed under the Apache License 2.0 (the "License"). You may not use |
d2e9e320 RS |
5 | * this file except in compliance with the License. You can obtain a copy |
6 | * in the file LICENSE in the source distribution or at | |
7 | * https://www.openssl.org/source/license.html | |
9aeaf1b4 DSH |
8 | */ |
9 | ||
10 | #include <stdio.h> | |
b39fc560 | 11 | #include "internal/cryptlib.h" |
ec577822 BM |
12 | #include <openssl/asn1.h> |
13 | #include <openssl/conf.h> | |
14 | #include <openssl/x509v3.h> | |
df2ee0e2 | 15 | #include "ext_dat.h" |
9aeaf1b4 | 16 | |
47864aea | 17 | const X509V3_EXT_METHOD ossl_v3_ns_ia5_list[8] = { |
0f113f3e MC |
18 | EXT_IA5STRING(NID_netscape_base_url), |
19 | EXT_IA5STRING(NID_netscape_revocation_url), | |
20 | EXT_IA5STRING(NID_netscape_ca_revocation_url), | |
21 | EXT_IA5STRING(NID_netscape_renewal_url), | |
22 | EXT_IA5STRING(NID_netscape_ca_policy_url), | |
23 | EXT_IA5STRING(NID_netscape_ssl_server_name), | |
24 | EXT_IA5STRING(NID_netscape_comment), | |
25 | EXT_END | |
9aeaf1b4 DSH |
26 | }; |
27 | ||
0f113f3e | 28 | char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5) |
9aeaf1b4 | 29 | { |
0f113f3e | 30 | char *tmp; |
75ebbd9a | 31 | |
42e7d2f1 | 32 | if (ia5 == NULL || ia5->length <= 0) |
0f113f3e | 33 | return NULL; |
e077455e | 34 | if ((tmp = OPENSSL_malloc(ia5->length + 1)) == NULL) |
0f113f3e | 35 | return NULL; |
0f113f3e MC |
36 | memcpy(tmp, ia5->data, ia5->length); |
37 | tmp[ia5->length] = 0; | |
38 | return tmp; | |
9aeaf1b4 DSH |
39 | } |
40 | ||
6452a139 | 41 | ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, |
13f74c66 | 42 | X509V3_CTX *ctx, const char *str) |
9aeaf1b4 | 43 | { |
0f113f3e | 44 | ASN1_IA5STRING *ia5; |
75e8e225 | 45 | if (str == NULL) { |
9311d0c4 | 46 | ERR_raise(ERR_LIB_X509V3, X509V3_R_INVALID_NULL_ARGUMENT); |
0f113f3e MC |
47 | return NULL; |
48 | } | |
e077455e RL |
49 | if ((ia5 = ASN1_IA5STRING_new()) == NULL) { |
50 | ERR_raise(ERR_LIB_X509V3, ERR_R_ASN1_LIB); | |
51 | return NULL; | |
52 | } | |
13f74c66 | 53 | if (!ASN1_STRING_set((ASN1_STRING *)ia5, str, strlen(str))) { |
f422a514 | 54 | ASN1_IA5STRING_free(ia5); |
13f74c66 | 55 | return NULL; |
0f113f3e | 56 | } |
8efb6014 | 57 | #ifdef CHARSET_EBCDIC |
0f113f3e MC |
58 | ebcdic2ascii(ia5->data, ia5->data, ia5->length); |
59 | #endif /* CHARSET_EBCDIC */ | |
60 | return ia5; | |
9aeaf1b4 | 61 | } |