Coverage Report

Created: 2026-10-28 06:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl40/crypto/asn1/tasn_typ.c
Line
Count
Source
1
/*
2
 * Copyright 2000-2026 The OpenSSL Project Authors. All Rights Reserved.
3
 *
4
 * Licensed under the Apache License 2.0 (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 <openssl/asn1.h>
12
#include <openssl/asn1t.h>
13
14
#include <crypto/asn1.h>
15
16
/* Declarations for string types */
17
18
#define IMPLEMENT_ASN1_STRING_FUNCTIONS(sname)                 \
19
    IMPLEMENT_ASN1_TYPE(sname)                                 \
20
    IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(sname, sname, sname) \
21
    sname *sname##_new(void)                                   \
22
17.9M
    {                                                          \
23
17.9M
        return ASN1_STRING_type_new(V_##sname);                \
24
17.9M
    }                                                          \
ASN1_OCTET_STRING_new
Line
Count
Source
22
151k
    {                                                          \
23
151k
        return ASN1_STRING_type_new(V_##sname);                \
24
151k
    }                                                          \
ASN1_INTEGER_new
Line
Count
Source
22
12.5M
    {                                                          \
23
12.5M
        return ASN1_STRING_type_new(V_##sname);                \
24
12.5M
    }                                                          \
Unexecuted instantiation: ASN1_ENUMERATED_new
ASN1_BIT_STRING_new
Line
Count
Source
22
4.67M
    {                                                          \
23
4.67M
        return ASN1_STRING_type_new(V_##sname);                \
24
4.67M
    }                                                          \
ASN1_UTF8STRING_new
Line
Count
Source
22
116k
    {                                                          \
23
116k
        return ASN1_STRING_type_new(V_##sname);                \
24
116k
    }                                                          \
Unexecuted instantiation: ASN1_PRINTABLESTRING_new
Unexecuted instantiation: ASN1_T61STRING_new
ASN1_IA5STRING_new
Line
Count
Source
22
292k
    {                                                          \
23
292k
        return ASN1_STRING_type_new(V_##sname);                \
24
292k
    }                                                          \
Unexecuted instantiation: ASN1_GENERALSTRING_new
Unexecuted instantiation: ASN1_UTCTIME_new
ASN1_GENERALIZEDTIME_new
Line
Count
Source
22
114k
    {                                                          \
23
114k
        return ASN1_STRING_type_new(V_##sname);                \
24
114k
    }                                                          \
Unexecuted instantiation: ASN1_VISIBLESTRING_new
Unexecuted instantiation: ASN1_UNIVERSALSTRING_new
Unexecuted instantiation: ASN1_BMPSTRING_new
25
    void sname##_free(sname *x)                                \
26
28.5M
    {                                                          \
27
28.5M
        ASN1_STRING_free(x);                                   \
28
28.5M
    }
ASN1_OCTET_STRING_free
Line
Count
Source
26
11.6M
    {                                                          \
27
11.6M
        ASN1_STRING_free(x);                                   \
28
11.6M
    }
ASN1_INTEGER_free
Line
Count
Source
26
8.04M
    {                                                          \
27
8.04M
        ASN1_STRING_free(x);                                   \
28
8.04M
    }
ASN1_ENUMERATED_free
Line
Count
Source
26
5.69M
    {                                                          \
27
5.69M
        ASN1_STRING_free(x);                                   \
28
5.69M
    }
ASN1_BIT_STRING_free
Line
Count
Source
26
3.13M
    {                                                          \
27
3.13M
        ASN1_STRING_free(x);                                   \
28
3.13M
    }
Unexecuted instantiation: ASN1_UTF8STRING_free
Unexecuted instantiation: ASN1_PRINTABLESTRING_free
Unexecuted instantiation: ASN1_T61STRING_free
Unexecuted instantiation: ASN1_IA5STRING_free
Unexecuted instantiation: ASN1_GENERALSTRING_free
Unexecuted instantiation: ASN1_UTCTIME_free
ASN1_GENERALIZEDTIME_free
Line
Count
Source
26
74.7k
    {                                                          \
27
74.7k
        ASN1_STRING_free(x);                                   \
28
74.7k
    }
Unexecuted instantiation: ASN1_VISIBLESTRING_free
Unexecuted instantiation: ASN1_UNIVERSALSTRING_free
Unexecuted instantiation: ASN1_BMPSTRING_free
29
30
79.2M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
31
127M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
32
127M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)
33
86.0M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BIT_STRING)
34
86.0M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UTF8STRING)
35
4.37M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_PRINTABLESTRING)
36
227k
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_T61STRING)
37
20.7M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_IA5STRING)
38
20.7M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALSTRING)
39
134k
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UTCTIME)
40
7.06M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALIZEDTIME)
41
7.06M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_VISIBLESTRING)
42
134k
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UNIVERSALSTRING)
43
134k
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BMPSTRING)
44
134k
45
1.06M
IMPLEMENT_ASN1_TYPE(ASN1_NULL)
46
1.06M
IMPLEMENT_ASN1_FUNCTIONS(ASN1_NULL)
47
1.06M
48
447M
IMPLEMENT_ASN1_TYPE(ASN1_OBJECT)
49
447M
50
611M
IMPLEMENT_ASN1_TYPE(ASN1_ANY)
51
611M
52
611M
/* Just swallow an ASN1_SEQUENCE in an ASN1_STRING */
53
611M
IMPLEMENT_ASN1_TYPE(ASN1_SEQUENCE)
54
13.9M
55
13.9M
IMPLEMENT_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)
56
13.9M
57
13.9M
/* Multistring types */
58
13.9M
59
163M
IMPLEMENT_ASN1_MSTRING(ASN1_PRINTABLE, B_ASN1_PRINTABLE)
60
IMPLEMENT_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE)
61
62
609k
IMPLEMENT_ASN1_MSTRING(DISPLAYTEXT, B_ASN1_DISPLAYTEXT)
63
IMPLEMENT_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT)
64
65
684k
IMPLEMENT_ASN1_MSTRING(DIRECTORYSTRING, B_ASN1_DIRECTORYSTRING)
66
IMPLEMENT_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING)
67
68
/* Three separate BOOLEAN type: normal, DEFAULT TRUE and DEFAULT FALSE */
69
67.3k
IMPLEMENT_ASN1_TYPE_ex(ASN1_BOOLEAN, ASN1_BOOLEAN, -1)
70
389k
IMPLEMENT_ASN1_TYPE_ex(ASN1_TBOOLEAN, ASN1_BOOLEAN, 1)
71
27.1M
IMPLEMENT_ASN1_TYPE_ex(ASN1_FBOOLEAN, ASN1_BOOLEAN, 0)
72
73
/* Special, OCTET STRING with indefinite length constructed support */
74
75
961k
IMPLEMENT_ASN1_TYPE_ex(ASN1_OCTET_STRING_NDEF, ASN1_OCTET_STRING, ASN1_TFLG_NDEF)
76
77
ASN1_ITEM_TEMPLATE(ASN1_SEQUENCE_ANY) = ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, ASN1_SEQUENCE_ANY, ASN1_ANY)
78
127k
ASN1_ITEM_TEMPLATE_END(ASN1_SEQUENCE_ANY)
79
80
ASN1_ITEM_TEMPLATE(ASN1_SET_ANY) = ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SET_OF, 0, ASN1_SET_ANY, ASN1_ANY)
81
ASN1_ITEM_TEMPLATE_END(ASN1_SET_ANY)
82
83
IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY)
84
IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(ASN1_SEQUENCE_ANY, ASN1_SET_ANY, ASN1_SET_ANY)