OpenCoverage

x_algor.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/x_algor.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2 * Copyright 1998-2016 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 <stddef.h>-
11#include <openssl/x509.h>-
12#include <openssl/asn1.h>-
13#include <openssl/asn1t.h>-
14#include "internal/evp_int.h"-
15-
16ASN1_SEQUENCE(X509_ALGOR) = {-
17 ASN1_SIMPLE(X509_ALGOR, algorithm, ASN1_OBJECT),-
18 ASN1_OPT(X509_ALGOR, parameter, ASN1_ANY)-
19} ASN1_SEQUENCE_END(X509_ALGOR)-
20-
21ASN1_ITEM_TEMPLATE(X509_ALGORS) =-
22 ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, algorithms, X509_ALGOR)-
23ASN1_ITEM_TEMPLATE_END(X509_ALGORS)-
24-
25IMPLEMENT_ASN1_FUNCTIONS(X509_ALGOR)
executed 6758 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
executed 6 times by 1 test: return (X509_ALGOR *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(X509_ALGOR_it)));
Executed by:
  • libcrypto.so.1.1
executed 7 times by 1 test: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(X509_ALGOR_it)));
Executed by:
  • libcrypto.so.1.1
executed 642 times by 1 test: return (X509_ALGOR *)ASN1_item_new((&(X509_ALGOR_it)));
Executed by:
  • libcrypto.so.1.1
6-6758
26IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(X509_ALGORS, X509_ALGORS, X509_ALGORS)
never executed: return (X509_ALGORS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(X509_ALGORS_it)));
executed 52 times by 1 test: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(X509_ALGORS_it)));
Executed by:
  • libcrypto.so.1.1
0-52
27IMPLEMENT_ASN1_DUP_FUNCTION(X509_ALGOR)
never executed: return ASN1_item_dup((&(X509_ALGOR_it)), x);
0
28-
29int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval)-
30{-
31 if (alg == NULL)
alg == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 15533 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15533
32 return 0;
never executed: return 0;
0
33-
34 if (ptype != V_ASN1_UNDEF) {
ptype != -1Description
TRUEevaluated 15117 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 416 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
416-15117
35 if (alg->parameter == NULL)
alg->parameter == ((void *)0)Description
TRUEevaluated 15117 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-15117
36 alg->parameter = ASN1_TYPE_new();
executed 15117 times by 1 test: alg->parameter = ASN1_TYPE_new();
Executed by:
  • libcrypto.so.1.1
15117
37 if (alg->parameter == NULL)
alg->parameter == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 15117 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15117
38 return 0;
never executed: return 0;
0
39 }
executed 15117 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
15117
40-
41 ASN1_OBJECT_free(alg->algorithm);-
42 alg->algorithm = aobj;-
43-
44 if (ptype == 0)
ptype == 0Description
TRUEnever evaluated
FALSEevaluated 15533 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15533
45 return 1;
never executed: return 1;
0
46 if (ptype == V_ASN1_UNDEF) {
ptype == -1Description
TRUEevaluated 416 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 15117 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
416-15117
47 ASN1_TYPE_free(alg->parameter);-
48 alg->parameter = NULL;-
49 } else
executed 416 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
416
50 ASN1_TYPE_set(alg->parameter, ptype, pval);
executed 15117 times by 1 test: ASN1_TYPE_set(alg->parameter, ptype, pval);
Executed by:
  • libcrypto.so.1.1
15117
51 return 1;
executed 15533 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
15533
52}-
53-
54void X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype,-
55 const void **ppval, const X509_ALGOR *algor)-
56{-
57 if (paobj)
paobjDescription
TRUEevaluated 12592 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 41023 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
12592-41023
58 *paobj = algor->algorithm;
executed 12592 times by 1 test: *paobj = algor->algorithm;
Executed by:
  • libcrypto.so.1.1
12592
59 if (pptype) {
pptypeDescription
TRUEevaluated 53393 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 222 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
222-53393
60 if (algor->parameter == NULL) {
algor->paramet...== ((void *)0)Description
TRUEevaluated 269 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 53124 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
269-53124
61 *pptype = V_ASN1_UNDEF;-
62 return;
executed 269 times by 1 test: return;
Executed by:
  • libcrypto.so.1.1
269
63 } else-
64 *pptype = algor->parameter->type;
executed 53124 times by 1 test: *pptype = algor->parameter->type;
Executed by:
  • libcrypto.so.1.1
53124
65 if (ppval)
ppvalDescription
TRUEevaluated 53120 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4-53120
66 *ppval = algor->parameter->value.ptr;
executed 53120 times by 1 test: *ppval = algor->parameter->value.ptr;
Executed by:
  • libcrypto.so.1.1
53120
67 }
executed 53124 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
53124
68}
executed 53346 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
53346
69-
70/* Set up an X509_ALGOR DigestAlgorithmIdentifier from an EVP_MD */-
71-
72void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md)-
73{-
74 int param_type;-
75-
76 if (md->flags & EVP_MD_FLAG_DIGALGID_ABSENT)
md->flags & 0x0008Description
TRUEevaluated 104 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-104
77 param_type = V_ASN1_UNDEF;
executed 104 times by 1 test: param_type = -1;
Executed by:
  • libcrypto.so.1.1
104
78 else-
79 param_type = V_ASN1_NULL;
never executed: param_type = 5;
0
80-
81 X509_ALGOR_set0(alg, OBJ_nid2obj(EVP_MD_type(md)), param_type, NULL);-
82-
83}
executed 104 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
104
84-
85int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b)-
86{-
87 int rv;-
88 rv = OBJ_cmp(a->algorithm, b->algorithm);-
89 if (rv)
rvDescription
TRUEnever evaluated
FALSEevaluated 1310 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1310
90 return rv;
never executed: return rv;
0
91 if (!a->parameter && !b->parameter)
!a->parameterDescription
TRUEevaluated 52 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1258 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
!b->parameterDescription
TRUEevaluated 52 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1258
92 return 0;
executed 52 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
52
93 return ASN1_TYPE_cmp(a->parameter, b->parameter);
executed 1258 times by 1 test: return ASN1_TYPE_cmp(a->parameter, b->parameter);
Executed by:
  • libcrypto.so.1.1
1258
94}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2