Coverage Report

Created: 2025-08-28 06:59

/src/boringssl/crypto/asn1/asn1_par.cc
Line
Count
Source (jump to first uncovered line)
1
// Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     https://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#include <openssl/asn1.h>
16
17
18
0
const char *ASN1_tag2str(int tag) {
19
0
  static const char *const tag2str[] = {
20
0
      "EOC",
21
0
      "BOOLEAN",
22
0
      "INTEGER",
23
0
      "BIT STRING",
24
0
      "OCTET STRING",
25
0
      "NULL",
26
0
      "OBJECT",
27
0
      "OBJECT DESCRIPTOR",
28
0
      "EXTERNAL",
29
0
      "REAL",
30
0
      "ENUMERATED",
31
0
      "<ASN1 11>",
32
0
      "UTF8STRING",
33
0
      "<ASN1 13>",
34
0
      "<ASN1 14>",
35
0
      "<ASN1 15>",
36
0
      "SEQUENCE",
37
0
      "SET",
38
0
      "NUMERICSTRING",
39
0
      "PRINTABLESTRING",
40
0
      "T61STRING",
41
0
      "VIDEOTEXSTRING",
42
0
      "IA5STRING",
43
0
      "UTCTIME",
44
0
      "GENERALIZEDTIME",
45
0
      "GRAPHICSTRING",
46
0
      "VISIBLESTRING",
47
0
      "GENERALSTRING",
48
0
      "UNIVERSALSTRING",
49
0
      "<ASN1 29>",
50
0
      "BMPSTRING",
51
0
  };
52
53
0
  if ((tag == V_ASN1_NEG_INTEGER) || (tag == V_ASN1_NEG_ENUMERATED)) {
54
0
    tag &= ~V_ASN1_NEG;
55
0
  }
56
57
0
  if (tag < 0 || tag > 30) {
58
0
    return "(unknown)";
59
0
  }
60
0
  return tag2str[tag];
61
0
}