OpenCoverage

ts_lib.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/ts/ts_lib.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2 * Copyright 2006-2018 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 <openssl/objects.h>-
13#include <openssl/bn.h>-
14#include <openssl/x509.h>-
15#include <openssl/x509v3.h>-
16#include <openssl/ts.h>-
17#include "ts_lcl.h"-
18-
19int TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num)-
20{-
21 BIGNUM *num_bn;-
22 int result = 0;-
23 char *hex;-
24-
25 num_bn = ASN1_INTEGER_to_BN(num, NULL);-
26 if (num_bn == NULL)
num_bn == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 223 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-223
27 return -1;
never executed: return -1;
0
28 if ((hex = BN_bn2hex(num_bn))) {
(hex = BN_bn2hex(num_bn))Description
TRUEevaluated 223 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-223
29 result = BIO_write(bio, "0x", 2) > 0;-
30 result = result && BIO_write(bio, hex, strlen(hex)) > 0;
resultDescription
TRUEevaluated 223 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
BIO_write(bio,...rlen(hex)) > 0Description
TRUEevaluated 223 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-223
31 OPENSSL_free(hex);-
32 }
executed 223 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
223
33 BN_free(num_bn);-
34-
35 return result;
executed 223 times by 1 test: return result;
Executed by:
  • libcrypto.so.1.1
223
36}-
37-
38int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj)-
39{-
40 char obj_txt[128];-
41-
42 OBJ_obj2txt(obj_txt, sizeof(obj_txt), obj, 0);-
43 BIO_printf(bio, "%s\n", obj_txt);-
44-
45 return 1;
executed 1 time by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1
46}-
47-
48int TS_ext_print_bio(BIO *bio, const STACK_OF(X509_EXTENSION) *extensions)-
49{-
50 int i, critical, n;-
51 X509_EXTENSION *ex;-
52 ASN1_OBJECT *obj;-
53-
54 BIO_printf(bio, "Extensions:\n");-
55 n = X509v3_get_ext_count(extensions);-
56 for (i = 0; i < n; i++) {
i < nDescription
TRUEevaluated 15994 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 446 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
446-15994
57 ex = X509v3_get_ext(extensions, i);-
58 obj = X509_EXTENSION_get_object(ex);-
59 if (i2a_ASN1_OBJECT(bio, obj) < 0)
i2a_ASN1_OBJECT(bio, obj) < 0Description
TRUEnever evaluated
FALSEevaluated 15994 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15994
60 return 0;
never executed: return 0;
0
61 critical = X509_EXTENSION_get_critical(ex);-
62 BIO_printf(bio, ":%s\n", critical ? " critical" : "");-
63 if (!X509V3_EXT_print(bio, ex, 0, 4)) {
!X509V3_EXT_pr...bio, ex, 0, 4)Description
TRUEevaluated 5701 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 10293 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
5701-10293
64 BIO_printf(bio, "%4s", "");-
65 ASN1_STRING_print(bio, X509_EXTENSION_get_data(ex));-
66 }
executed 5701 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
5701
67 BIO_write(bio, "\n", 1);-
68 }
executed 15994 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
15994
69-
70 return 1;
executed 446 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
446
71}-
72-
73int TS_X509_ALGOR_print_bio(BIO *bio, const X509_ALGOR *alg)-
74{-
75 int i = OBJ_obj2nid(alg->algorithm);-
76 return BIO_printf(bio, "Hash Algorithm: %s\n",
executed 448 times by 1 test: return BIO_printf(bio, "Hash Algorithm: %s\n", (i == 0) ? "UNKNOWN" : OBJ_nid2ln(i));
Executed by:
  • libcrypto.so.1.1
448
77 (i == NID_undef) ? "UNKNOWN" : OBJ_nid2ln(i));
executed 448 times by 1 test: return BIO_printf(bio, "Hash Algorithm: %s\n", (i == 0) ? "UNKNOWN" : OBJ_nid2ln(i));
Executed by:
  • libcrypto.so.1.1
448
78}-
79-
80int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *a)-
81{-
82 ASN1_OCTET_STRING *msg;-
83-
84 TS_X509_ALGOR_print_bio(bio, a->hash_algo);-
85-
86 BIO_printf(bio, "Message data:\n");-
87 msg = a->hashed_msg;-
88 BIO_dump_indent(bio, (const char *)ASN1_STRING_get0_data(msg),-
89 ASN1_STRING_length(msg), 4);-
90-
91 return 1;
executed 448 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
448
92}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2