Coverage Report

Created: 2026-05-24 07:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl/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
16.6M
    {                                                          \
23
16.6M
        return ASN1_STRING_type_new(V_##sname);                \
24
16.6M
    }                                                          \
ASN1_OCTET_STRING_new
Line
Count
Source
22
141k
    {                                                          \
23
141k
        return ASN1_STRING_type_new(V_##sname);                \
24
141k
    }                                                          \
ASN1_INTEGER_new
Line
Count
Source
22
10.8M
    {                                                          \
23
10.8M
        return ASN1_STRING_type_new(V_##sname);                \
24
10.8M
    }                                                          \
Unexecuted instantiation: ASN1_ENUMERATED_new
ASN1_BIT_STRING_new
Line
Count
Source
22
5.34M
    {                                                          \
23
5.34M
        return ASN1_STRING_type_new(V_##sname);                \
24
5.34M
    }                                                          \
ASN1_UTF8STRING_new
Line
Count
Source
22
127k
    {                                                          \
23
127k
        return ASN1_STRING_type_new(V_##sname);                \
24
127k
    }                                                          \
Unexecuted instantiation: ASN1_PRINTABLESTRING_new
Unexecuted instantiation: ASN1_T61STRING_new
Unexecuted instantiation: ASN1_IA5STRING_new
Unexecuted instantiation: ASN1_GENERALSTRING_new
Unexecuted instantiation: ASN1_UTCTIME_new
ASN1_GENERALIZEDTIME_new
Line
Count
Source
22
137k
    {                                                          \
23
137k
        return ASN1_STRING_type_new(V_##sname);                \
24
137k
    }                                                          \
Unexecuted instantiation: ASN1_VISIBLESTRING_new
Unexecuted instantiation: ASN1_UNIVERSALSTRING_new
Unexecuted instantiation: ASN1_BMPSTRING_new
25
    void sname##_free(sname *x)                                \
26
27.3M
    {                                                          \
27
27.3M
        ASN1_STRING_free(x);                                   \
28
27.3M
    }
ASN1_OCTET_STRING_free
Line
Count
Source
26
11.3M
    {                                                          \
27
11.3M
        ASN1_STRING_free(x);                                   \
28
11.3M
    }
ASN1_INTEGER_free
Line
Count
Source
26
7.42M
    {                                                          \
27
7.42M
        ASN1_STRING_free(x);                                   \
28
7.42M
    }
ASN1_ENUMERATED_free
Line
Count
Source
26
5.00M
    {                                                          \
27
5.00M
        ASN1_STRING_free(x);                                   \
28
5.00M
    }
ASN1_BIT_STRING_free
Line
Count
Source
26
3.53M
    {                                                          \
27
3.53M
        ASN1_STRING_free(x);                                   \
28
3.53M
    }
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
92.3k
    {                                                          \
27
92.3k
        ASN1_STRING_free(x);                                   \
28
92.3k
    }
Unexecuted instantiation: ASN1_VISIBLESTRING_free
Unexecuted instantiation: ASN1_UNIVERSALSTRING_free
Unexecuted instantiation: ASN1_BMPSTRING_free
29
30
81.8M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
31
124M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
32
124M
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.56M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_PRINTABLESTRING)
36
261k
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_T61STRING)
37
16.6M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_IA5STRING)
38
16.6M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALSTRING)
39
143k
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UTCTIME)
40
7.37M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALIZEDTIME)
41
7.37M
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_VISIBLESTRING)
42
143k
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UNIVERSALSTRING)
43
143k
IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BMPSTRING)
44
143k
45
1.18M
IMPLEMENT_ASN1_TYPE(ASN1_NULL)
46
1.18M
IMPLEMENT_ASN1_FUNCTIONS(ASN1_NULL)
47
1.18M
48
531M
IMPLEMENT_ASN1_TYPE(ASN1_OBJECT)
49
531M
50
648M
IMPLEMENT_ASN1_TYPE(ASN1_ANY)
51
648M
52
648M
/* Just swallow an ASN1_SEQUENCE in an ASN1_STRING */
53
648M
IMPLEMENT_ASN1_TYPE(ASN1_SEQUENCE)
54
20.4M
55
20.4M
IMPLEMENT_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)
56
20.4M
57
20.4M
/* Multistring types */
58
20.4M
59
206M
IMPLEMENT_ASN1_MSTRING(ASN1_PRINTABLE, B_ASN1_PRINTABLE)
60
IMPLEMENT_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE)
61
62
642k
IMPLEMENT_ASN1_MSTRING(DISPLAYTEXT, B_ASN1_DISPLAYTEXT)
63
IMPLEMENT_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT)
64
65
758k
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
6.04M
IMPLEMENT_ASN1_TYPE_ex(ASN1_BOOLEAN, ASN1_BOOLEAN, -1)
70
316k
IMPLEMENT_ASN1_TYPE_ex(ASN1_TBOOLEAN, ASN1_BOOLEAN, 1)
71
23.3M
IMPLEMENT_ASN1_TYPE_ex(ASN1_FBOOLEAN, ASN1_BOOLEAN, 0)
72
73
/* Special, OCTET STRING with indefinite length constructed support */
74
75
980k
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
134k
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)