Coverage Report

Created: 2026-09-12 06:55

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl41/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
12.3M
    {                                                          \
23
12.3M
        return ASN1_STRING_type_new(V_##sname);                \
24
12.3M
    }                                                          \
ASN1_OCTET_STRING_new
Line
Count
Source
22
113k
    {                                                          \
23
113k
        return ASN1_STRING_type_new(V_##sname);                \
24
113k
    }                                                          \
ASN1_INTEGER_new
Line
Count
Source
22
8.24M
    {                                                          \
23
8.24M
        return ASN1_STRING_type_new(V_##sname);                \
24
8.24M
    }                                                          \
Unexecuted instantiation: ASN1_ENUMERATED_new
ASN1_BIT_STRING_new
Line
Count
Source
22
3.72M
    {                                                          \
23
3.72M
        return ASN1_STRING_type_new(V_##sname);                \
24
3.72M
    }                                                          \
ASN1_UTF8STRING_new
Line
Count
Source
22
94.0k
    {                                                          \
23
94.0k
        return ASN1_STRING_type_new(V_##sname);                \
24
94.0k
    }                                                          \
Unexecuted instantiation: ASN1_PRINTABLESTRING_new
Unexecuted instantiation: ASN1_T61STRING_new
ASN1_IA5STRING_new
Line
Count
Source
22
95.8k
    {                                                          \
23
95.8k
        return ASN1_STRING_type_new(V_##sname);                \
24
95.8k
    }                                                          \
Unexecuted instantiation: ASN1_GENERALSTRING_new
Unexecuted instantiation: ASN1_UTCTIME_new
ASN1_GENERALIZEDTIME_new
Line
Count
Source
22
98.1k
    {                                                          \
23
98.1k
        return ASN1_STRING_type_new(V_##sname);                \
24
98.1k
    }                                                          \
Unexecuted instantiation: ASN1_VISIBLESTRING_new
Unexecuted instantiation: ASN1_UNIVERSALSTRING_new
Unexecuted instantiation: ASN1_BMPSTRING_new
25
    void sname##_free(sname *x)                                \
26
20.0M
    {                                                          \
27
20.0M
        ASN1_STRING_free(x);                                   \
28
20.0M
    }
ASN1_OCTET_STRING_free
Line
Count
Source
26
8.30M
    {                                                          \
27
8.30M
        ASN1_STRING_free(x);                                   \
28
8.30M
    }
ASN1_INTEGER_free
Line
Count
Source
26
5.49M
    {                                                          \
27
5.49M
        ASN1_STRING_free(x);                                   \
28
5.49M
    }
ASN1_ENUMERATED_free
Line
Count
Source
26
3.74M
    {                                                          \
27
3.74M
        ASN1_STRING_free(x);                                   \
28
3.74M
    }
ASN1_BIT_STRING_free
Line
Count
Source
26
2.49M
    {                                                          \
27
2.49M
        ASN1_STRING_free(x);                                   \
28
2.49M
    }
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
65.6k
    {                                                          \
27
65.6k
        ASN1_STRING_free(x);                                   \
28
65.6k
    }
Unexecuted instantiation: ASN1_VISIBLESTRING_free
Unexecuted instantiation: ASN1_UNIVERSALSTRING_free
Unexecuted instantiation: ASN1_BMPSTRING_free
29
30
65.6M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
31
80.8M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
32
80.8M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)
33
70.0M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BIT_STRING)
34
70.0M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UTF8STRING)
35
3.53M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_PRINTABLESTRING)
36
192k
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_T61STRING)
37
13.9M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_IA5STRING)
38
13.9M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALSTRING)
39
105k
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UTCTIME)
40
5.72M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALIZEDTIME)
41
5.72M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_VISIBLESTRING)
42
105k
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UNIVERSALSTRING)
43
105k
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BMPSTRING)
44
105k
45
853k
IMPLEMENT_ASN1_TYPE(ASN1_NULL)
46
853k
IMPLEMENT_ASN1_FUNCTIONS(ASN1_NULL)
47
853k
48
385M
IMPLEMENT_ASN1_TYPE(ASN1_OBJECT)
49
385M
50
460M
IMPLEMENT_ASN1_TYPE(ASN1_ANY)
51
460M
52
460M
/* Just swallow an ASN1_SEQUENCE in an ASN1_STRING */
53
460M
IMPLEMENT_ASN1_TYPE(ASN1_SEQUENCE)
54
8.06M
55
8.06M
IMPLEMENT_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)
56
8.06M
57
8.06M
/* Multistring types */
58
8.06M
59
147M
IMPLEMENT_ASN1_MSTRING(ASN1_PRINTABLE, B_ASN1_PRINTABLE)
60
IMPLEMENT_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE)
61
62
494k
IMPLEMENT_ASN1_MSTRING(DISPLAYTEXT, B_ASN1_DISPLAYTEXT)
63
IMPLEMENT_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT)
64
65
579k
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
52.5k
IMPLEMENT_ASN1_TYPE_ex(ASN1_BOOLEAN, ASN1_BOOLEAN, -1)
70
306k
IMPLEMENT_ASN1_TYPE_ex(ASN1_TBOOLEAN, ASN1_BOOLEAN, 1)
71
22.9M
IMPLEMENT_ASN1_TYPE_ex(ASN1_FBOOLEAN, ASN1_BOOLEAN, 0)
72
73
/* Special, OCTET STRING with indefinite length constructed support */
74
75
725k
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
98.7k
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)