Coverage Report

Created: 2026-07-12 07:21

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl35/crypto/x509/v3_pku.c
Line
Count
Source
1
/*
2
 * Copyright 1999-2021 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 "internal/cryptlib.h"
12
#include <openssl/asn1.h>
13
#include <openssl/asn1t.h>
14
#include <openssl/x509v3.h>
15
#include "ext_dat.h"
16
17
static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method,
18
    PKEY_USAGE_PERIOD *usage, BIO *out,
19
    int indent);
20
21
const X509V3_EXT_METHOD ossl_v3_pkey_usage_period = {
22
    NID_private_key_usage_period, 0, ASN1_ITEM_ref(PKEY_USAGE_PERIOD),
23
    0, 0, 0, 0,
24
    0, 0, 0, 0,
25
    (X509V3_EXT_I2R)i2r_PKEY_USAGE_PERIOD, NULL,
26
    NULL
27
};
28
29
ASN1_SEQUENCE(PKEY_USAGE_PERIOD) = {
30
    ASN1_IMP_OPT(PKEY_USAGE_PERIOD, notBefore, ASN1_GENERALIZEDTIME, 0),
31
    ASN1_IMP_OPT(PKEY_USAGE_PERIOD, notAfter, ASN1_GENERALIZEDTIME, 1)
32
152k
} ASN1_SEQUENCE_END(PKEY_USAGE_PERIOD)
33
152k
34
152k
IMPLEMENT_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD)
35
152k
36
152k
static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method,
37
152k
    PKEY_USAGE_PERIOD *usage, BIO *out,
38
152k
    int indent)
39
152k
{
40
40.0k
    BIO_printf(out, "%*s", indent, "");
41
40.0k
    if (usage->notBefore) {
42
8.64k
        BIO_write(out, "Not Before: ", 12);
43
8.64k
        ASN1_GENERALIZEDTIME_print(out, usage->notBefore);
44
8.64k
        if (usage->notAfter)
45
6.20k
            BIO_write(out, ", ", 2);
46
8.64k
    }
47
40.0k
    if (usage->notAfter) {
48
11.5k
        BIO_write(out, "Not After: ", 11);
49
11.5k
        ASN1_GENERALIZEDTIME_print(out, usage->notAfter);
50
11.5k
    }
51
40.0k
    return 1;
52
40.0k
}