| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/x509/x509cset.c |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | /* | - | ||||||
| 2 | * Copyright 2001-2017 The OpenSSL Project Authors. All Rights Reserved. | - | ||||||
| 3 | * | - | ||||||
| 4 | * Licensed under the OpenSSL license (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 "internal/refcount.h" | - | ||||||
| 13 | #include <openssl/asn1.h> | - | ||||||
| 14 | #include <openssl/objects.h> | - | ||||||
| 15 | #include <openssl/evp.h> | - | ||||||
| 16 | #include <openssl/x509.h> | - | ||||||
| 17 | #include "internal/x509_int.h" | - | ||||||
| 18 | - | |||||||
| 19 | int X509_CRL_set_version(X509_CRL *x, long version) | - | ||||||
| 20 | { | - | ||||||
| 21 | if (x == NULL)
| 0 | ||||||
| 22 | return 0; never executed: return 0; | 0 | ||||||
| 23 | if (x->crl.version == NULL) {
| 0 | ||||||
| 24 | if ((x->crl.version = ASN1_INTEGER_new()) == NULL)
| 0 | ||||||
| 25 | return 0; never executed: return 0; | 0 | ||||||
| 26 | } never executed: end of block | 0 | ||||||
| 27 | return ASN1_INTEGER_set(x->crl.version, version); never executed: return ASN1_INTEGER_set(x->crl.version, version); | 0 | ||||||
| 28 | } | - | ||||||
| 29 | - | |||||||
| 30 | int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name) | - | ||||||
| 31 | { | - | ||||||
| 32 | if (x == NULL)
| 0 | ||||||
| 33 | return 0; never executed: return 0; | 0 | ||||||
| 34 | return X509_NAME_set(&x->crl.issuer, name); never executed: return X509_NAME_set(&x->crl.issuer, name); | 0 | ||||||
| 35 | } | - | ||||||
| 36 | - | |||||||
| 37 | int X509_CRL_set1_lastUpdate(X509_CRL *x, const ASN1_TIME *tm) | - | ||||||
| 38 | { | - | ||||||
| 39 | if (x == NULL)
| 0 | ||||||
| 40 | return 0; never executed: return 0; | 0 | ||||||
| 41 | return x509_set1_time(&x->crl.lastUpdate, tm); never executed: return x509_set1_time(&x->crl.lastUpdate, tm); | 0 | ||||||
| 42 | } | - | ||||||
| 43 | - | |||||||
| 44 | int X509_CRL_set1_nextUpdate(X509_CRL *x, const ASN1_TIME *tm) | - | ||||||
| 45 | { | - | ||||||
| 46 | if (x == NULL)
| 0 | ||||||
| 47 | return 0; never executed: return 0; | 0 | ||||||
| 48 | return x509_set1_time(&x->crl.nextUpdate, tm); never executed: return x509_set1_time(&x->crl.nextUpdate, tm); | 0 | ||||||
| 49 | } | - | ||||||
| 50 | - | |||||||
| 51 | int X509_CRL_sort(X509_CRL *c) | - | ||||||
| 52 | { | - | ||||||
| 53 | int i; | - | ||||||
| 54 | X509_REVOKED *r; | - | ||||||
| 55 | /* | - | ||||||
| 56 | * sort the data so it will be written in serial number order | - | ||||||
| 57 | */ | - | ||||||
| 58 | sk_X509_REVOKED_sort(c->crl.revoked); | - | ||||||
| 59 | for (i = 0; i < sk_X509_REVOKED_num(c->crl.revoked); i++) {
| 0 | ||||||
| 60 | r = sk_X509_REVOKED_value(c->crl.revoked, i); | - | ||||||
| 61 | r->sequence = i; | - | ||||||
| 62 | } never executed: end of block | 0 | ||||||
| 63 | c->crl.enc.modified = 1; | - | ||||||
| 64 | return 1; never executed: return 1; | 0 | ||||||
| 65 | } | - | ||||||
| 66 | - | |||||||
| 67 | int X509_CRL_up_ref(X509_CRL *crl) | - | ||||||
| 68 | { | - | ||||||
| 69 | int i; | - | ||||||
| 70 | - | |||||||
| 71 | if (CRYPTO_UP_REF(&crl->references, &i, crl->lock) <= 0)
| 0-12 | ||||||
| 72 | return 0; never executed: return 0; | 0 | ||||||
| 73 | - | |||||||
| 74 | REF_PRINT_COUNT("X509_CRL", crl); | - | ||||||
| 75 | REF_ASSERT_ISNT(i < 2); | - | ||||||
| 76 | return ((i > 1) ? 1 : 0); executed 12 times by 1 test: return ((i > 1) ? 1 : 0);Executed by:
| 0-12 | ||||||
| 77 | } | - | ||||||
| 78 | - | |||||||
| 79 | long X509_CRL_get_version(const X509_CRL *crl) | - | ||||||
| 80 | { | - | ||||||
| 81 | return ASN1_INTEGER_get(crl->crl.version); executed 1839 times by 1 test: return ASN1_INTEGER_get(crl->crl.version);Executed by:
| 1839 | ||||||
| 82 | } | - | ||||||
| 83 | - | |||||||
| 84 | const ASN1_TIME *X509_CRL_get0_lastUpdate(const X509_CRL *crl) | - | ||||||
| 85 | { | - | ||||||
| 86 | return crl->crl.lastUpdate; executed 1847 times by 1 test: return crl->crl.lastUpdate;Executed by:
| 1847 | ||||||
| 87 | } | - | ||||||
| 88 | - | |||||||
| 89 | const ASN1_TIME *X509_CRL_get0_nextUpdate(const X509_CRL *crl) | - | ||||||
| 90 | { | - | ||||||
| 91 | return crl->crl.nextUpdate; executed 1962 times by 1 test: return crl->crl.nextUpdate;Executed by:
| 1962 | ||||||
| 92 | } | - | ||||||
| 93 | - | |||||||
| 94 | #if OPENSSL_API_COMPAT < 0x10100000L | - | ||||||
| 95 | ASN1_TIME *X509_CRL_get_lastUpdate(X509_CRL *crl) | - | ||||||
| 96 | { | - | ||||||
| 97 | return crl->crl.lastUpdate; never executed: return crl->crl.lastUpdate; | 0 | ||||||
| 98 | } | - | ||||||
| 99 | - | |||||||
| 100 | ASN1_TIME *X509_CRL_get_nextUpdate(X509_CRL *crl) | - | ||||||
| 101 | { | - | ||||||
| 102 | return crl->crl.nextUpdate; never executed: return crl->crl.nextUpdate; | 0 | ||||||
| 103 | } | - | ||||||
| 104 | #endif | - | ||||||
| 105 | - | |||||||
| 106 | X509_NAME *X509_CRL_get_issuer(const X509_CRL *crl) | - | ||||||
| 107 | { | - | ||||||
| 108 | return crl->crl.issuer; executed 11462 times by 1 test: return crl->crl.issuer;Executed by:
| 11462 | ||||||
| 109 | } | - | ||||||
| 110 | - | |||||||
| 111 | const STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(const X509_CRL *crl) | - | ||||||
| 112 | { | - | ||||||
| 113 | return crl->crl.extensions; executed 1839 times by 1 test: return crl->crl.extensions;Executed by:
| 1839 | ||||||
| 114 | } | - | ||||||
| 115 | - | |||||||
| 116 | STACK_OF(X509_REVOKED) *X509_CRL_get_REVOKED(X509_CRL *crl) | - | ||||||
| 117 | { | - | ||||||
| 118 | return crl->crl.revoked; executed 36193 times by 1 test: return crl->crl.revoked;Executed by:
| 36193 | ||||||
| 119 | } | - | ||||||
| 120 | - | |||||||
| 121 | void X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig, | - | ||||||
| 122 | const X509_ALGOR **palg) | - | ||||||
| 123 | { | - | ||||||
| 124 | if (psig != NULL)
| 0-1839 | ||||||
| 125 | *psig = &crl->signature; executed 1839 times by 1 test: *psig = &crl->signature;Executed by:
| 1839 | ||||||
| 126 | if (palg != NULL)
| 0-1839 | ||||||
| 127 | *palg = &crl->sig_alg; executed 1839 times by 1 test: *palg = &crl->sig_alg;Executed by:
| 1839 | ||||||
| 128 | } executed 1839 times by 1 test: end of blockExecuted by:
| 1839 | ||||||
| 129 | - | |||||||
| 130 | int X509_CRL_get_signature_nid(const X509_CRL *crl) | - | ||||||
| 131 | { | - | ||||||
| 132 | return OBJ_obj2nid(crl->sig_alg.algorithm); never executed: return OBJ_obj2nid(crl->sig_alg.algorithm); | 0 | ||||||
| 133 | } | - | ||||||
| 134 | - | |||||||
| 135 | const ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *x) | - | ||||||
| 136 | { | - | ||||||
| 137 | return x->revocationDate; executed 8472 times by 1 test: return x->revocationDate;Executed by:
| 8472 | ||||||
| 138 | } | - | ||||||
| 139 | - | |||||||
| 140 | int X509_REVOKED_set_revocationDate(X509_REVOKED *x, ASN1_TIME *tm) | - | ||||||
| 141 | { | - | ||||||
| 142 | ASN1_TIME *in; | - | ||||||
| 143 | - | |||||||
| 144 | if (x == NULL)
| 0 | ||||||
| 145 | return 0; never executed: return 0; | 0 | ||||||
| 146 | in = x->revocationDate; | - | ||||||
| 147 | if (in != tm) {
| 0 | ||||||
| 148 | in = ASN1_STRING_dup(tm); | - | ||||||
| 149 | if (in != NULL) {
| 0 | ||||||
| 150 | ASN1_TIME_free(x->revocationDate); | - | ||||||
| 151 | x->revocationDate = in; | - | ||||||
| 152 | } never executed: end of block | 0 | ||||||
| 153 | } never executed: end of block | 0 | ||||||
| 154 | return (in != NULL); never executed: return (in != ((void *)0) ); | 0 | ||||||
| 155 | } | - | ||||||
| 156 | - | |||||||
| 157 | const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *x) | - | ||||||
| 158 | { | - | ||||||
| 159 | return &x->serialNumber; executed 8472 times by 1 test: return &x->serialNumber;Executed by:
| 8472 | ||||||
| 160 | } | - | ||||||
| 161 | - | |||||||
| 162 | int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial) | - | ||||||
| 163 | { | - | ||||||
| 164 | ASN1_INTEGER *in; | - | ||||||
| 165 | - | |||||||
| 166 | if (x == NULL)
| 0 | ||||||
| 167 | return 0; never executed: return 0; | 0 | ||||||
| 168 | in = &x->serialNumber; | - | ||||||
| 169 | if (in != serial)
| 0 | ||||||
| 170 | return ASN1_STRING_copy(in, serial); never executed: return ASN1_STRING_copy(in, serial); | 0 | ||||||
| 171 | return 1; never executed: return 1; | 0 | ||||||
| 172 | } | - | ||||||
| 173 | - | |||||||
| 174 | const STACK_OF(X509_EXTENSION) *X509_REVOKED_get0_extensions(const X509_REVOKED *r) | - | ||||||
| 175 | { | - | ||||||
| 176 | return r->extensions; executed 8472 times by 1 test: return r->extensions;Executed by:
| 8472 | ||||||
| 177 | } | - | ||||||
| 178 | - | |||||||
| 179 | int i2d_re_X509_CRL_tbs(X509_CRL *crl, unsigned char **pp) | - | ||||||
| 180 | { | - | ||||||
| 181 | crl->crl.enc.modified = 1; | - | ||||||
| 182 | return i2d_X509_CRL_INFO(&crl->crl, pp); never executed: return i2d_X509_CRL_INFO(&crl->crl, pp); | 0 | ||||||
| 183 | } | - | ||||||
| Source code | Switch to Preprocessed file |