Coverage Report

Created: 2026-02-14 06:34

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/boringssl/crypto/x509/t_x509a.cc
Line
Count
Source
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
#include <openssl/bio.h>
17
#include <openssl/mem.h>
18
#include <openssl/obj.h>
19
#include <openssl/x509.h>
20
21
#include "internal.h"
22
23
24
using namespace bssl;
25
26
// X509_CERT_AUX and string set routines
27
28
2.74k
int bssl::X509_CERT_AUX_print(BIO *out, X509_CERT_AUX *aux, int indent) {
29
2.74k
  char oidstr[80], first;
30
2.74k
  size_t i;
31
2.74k
  int j;
32
2.74k
  if (!aux) {
33
2.74k
    return 1;
34
2.74k
  }
35
0
  if (aux->trust) {
36
0
    first = 1;
37
0
    BIO_printf(out, "%*sTrusted Uses:\n%*s", indent, "", indent + 2, "");
38
0
    for (i = 0; i < sk_ASN1_OBJECT_num(aux->trust); i++) {
39
0
      if (!first) {
40
0
        BIO_puts(out, ", ");
41
0
      } else {
42
0
        first = 0;
43
0
      }
44
0
      OBJ_obj2txt(oidstr, sizeof oidstr, sk_ASN1_OBJECT_value(aux->trust, i),
45
0
                  0);
46
0
      BIO_puts(out, oidstr);
47
0
    }
48
0
    BIO_puts(out, "\n");
49
0
  } else {
50
0
    BIO_printf(out, "%*sNo Trusted Uses.\n", indent, "");
51
0
  }
52
0
  if (aux->reject) {
53
0
    first = 1;
54
0
    BIO_printf(out, "%*sRejected Uses:\n%*s", indent, "", indent + 2, "");
55
0
    for (i = 0; i < sk_ASN1_OBJECT_num(aux->reject); i++) {
56
0
      if (!first) {
57
0
        BIO_puts(out, ", ");
58
0
      } else {
59
0
        first = 0;
60
0
      }
61
0
      OBJ_obj2txt(oidstr, sizeof oidstr, sk_ASN1_OBJECT_value(aux->reject, i),
62
0
                  0);
63
0
      BIO_puts(out, oidstr);
64
0
    }
65
0
    BIO_puts(out, "\n");
66
0
  } else {
67
0
    BIO_printf(out, "%*sNo Rejected Uses.\n", indent, "");
68
0
  }
69
0
  if (aux->alias) {
70
0
    BIO_printf(out, "%*sAlias: %.*s\n", indent, "", aux->alias->length,
71
0
               aux->alias->data);
72
0
  }
73
0
  if (aux->keyid) {
74
0
    BIO_printf(out, "%*sKey Id: ", indent, "");
75
0
    for (j = 0; j < aux->keyid->length; j++) {
76
0
      BIO_printf(out, "%s%02X", j ? ":" : "", aux->keyid->data[j]);
77
0
    }
78
0
    BIO_write(out, "\n", 1);
79
0
  }
80
0
  return 1;
81
2.74k
}