| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/x509v3/v3_ia5.c |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /* | - | ||||||||||||
| 2 | * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. | - | ||||||||||||
| 3 | * | - | ||||||||||||
| 4 | * Licensed under the OpenSSL license (the "License"). You may not use | - | ||||||||||||
| 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 | - | ||||||||||||
| 8 | */ | - | ||||||||||||
| 9 | - | |||||||||||||
| 10 | #include <stdio.h> | - | ||||||||||||
| 11 | #include "internal/cryptlib.h" | - | ||||||||||||
| 12 | #include <openssl/asn1.h> | - | ||||||||||||
| 13 | #include <openssl/conf.h> | - | ||||||||||||
| 14 | #include <openssl/x509v3.h> | - | ||||||||||||
| 15 | #include "ext_dat.h" | - | ||||||||||||
| 16 | - | |||||||||||||
| 17 | const X509V3_EXT_METHOD v3_ns_ia5_list[8] = { | - | ||||||||||||
| 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 | - | ||||||||||||
| 26 | }; | - | ||||||||||||
| 27 | - | |||||||||||||
| 28 | char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5) | - | ||||||||||||
| 29 | { | - | ||||||||||||
| 30 | char *tmp; | - | ||||||||||||
| 31 | - | |||||||||||||
| 32 | if (!ia5 || !ia5->length)
| 0-619 | ||||||||||||
| 33 | return NULL; executed 388 times by 1 test: return ((void *)0) ;Executed by:
| 388 | ||||||||||||
| 34 | if ((tmp = OPENSSL_malloc(ia5->length + 1)) == NULL) {
| 0-231 | ||||||||||||
| 35 | X509V3err(X509V3_F_I2S_ASN1_IA5STRING, ERR_R_MALLOC_FAILURE); | - | ||||||||||||
| 36 | return NULL; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 37 | } | - | ||||||||||||
| 38 | memcpy(tmp, ia5->data, ia5->length); | - | ||||||||||||
| 39 | tmp[ia5->length] = 0; | - | ||||||||||||
| 40 | return tmp; executed 231 times by 1 test: return tmp;Executed by:
| 231 | ||||||||||||
| 41 | } | - | ||||||||||||
| 42 | - | |||||||||||||
| 43 | ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, | - | ||||||||||||
| 44 | X509V3_CTX *ctx, const char *str) | - | ||||||||||||
| 45 | { | - | ||||||||||||
| 46 | ASN1_IA5STRING *ia5; | - | ||||||||||||
| 47 | if (!str) {
| 0-2 | ||||||||||||
| 48 | X509V3err(X509V3_F_S2I_ASN1_IA5STRING, | - | ||||||||||||
| 49 | X509V3_R_INVALID_NULL_ARGUMENT); | - | ||||||||||||
| 50 | return NULL; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 51 | } | - | ||||||||||||
| 52 | if ((ia5 = ASN1_IA5STRING_new()) == NULL)
| 0-2 | ||||||||||||
| 53 | goto err; never executed: goto err; | 0 | ||||||||||||
| 54 | if (!ASN1_STRING_set((ASN1_STRING *)ia5, str, strlen(str))) {
| 0-2 | ||||||||||||
| 55 | ASN1_IA5STRING_free(ia5); | - | ||||||||||||
| 56 | return NULL; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 57 | } | - | ||||||||||||
| 58 | #ifdef CHARSET_EBCDIC | - | ||||||||||||
| 59 | ebcdic2ascii(ia5->data, ia5->data, ia5->length); | - | ||||||||||||
| 60 | #endif /* CHARSET_EBCDIC */ | - | ||||||||||||
| 61 | return ia5; executed 2 times by 1 test: return ia5;Executed by:
| 2 | ||||||||||||
| 62 | err: | - | ||||||||||||
| 63 | X509V3err(X509V3_F_S2I_ASN1_IA5STRING, ERR_R_MALLOC_FAILURE); | - | ||||||||||||
| 64 | return NULL; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 65 | } | - | ||||||||||||
| Source code | Switch to Preprocessed file |