| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/asn1/x_algor.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | static const ASN1_TEMPLATE X509_ALGOR_seq_tt[] = { | - | ||||||||||||
| 4 | { | - | ||||||||||||
| 5 | .offset = | - | ||||||||||||
| 6 | __builtin_offsetof ( | - | ||||||||||||
| 7 | X509_ALGOR | - | ||||||||||||
| 8 | , | - | ||||||||||||
| 9 | algorithm | - | ||||||||||||
| 10 | ) | - | ||||||||||||
| 11 | , | - | ||||||||||||
| 12 | .field_name = "algorithm", | - | ||||||||||||
| 13 | .item = &ASN1_OBJECT_it, | - | ||||||||||||
| 14 | }, | - | ||||||||||||
| 15 | { | - | ||||||||||||
| 16 | .flags = (0x1), | - | ||||||||||||
| 17 | .offset = | - | ||||||||||||
| 18 | __builtin_offsetof ( | - | ||||||||||||
| 19 | X509_ALGOR | - | ||||||||||||
| 20 | , | - | ||||||||||||
| 21 | parameter | - | ||||||||||||
| 22 | ) | - | ||||||||||||
| 23 | , | - | ||||||||||||
| 24 | .field_name = "parameter", | - | ||||||||||||
| 25 | .item = &ASN1_ANY_it, | - | ||||||||||||
| 26 | }, | - | ||||||||||||
| 27 | }; | - | ||||||||||||
| 28 | - | |||||||||||||
| 29 | const ASN1_ITEM X509_ALGOR_it = { | - | ||||||||||||
| 30 | .itype = 0x1, | - | ||||||||||||
| 31 | .utype = 16, | - | ||||||||||||
| 32 | .templates = X509_ALGOR_seq_tt, | - | ||||||||||||
| 33 | .tcount = sizeof(X509_ALGOR_seq_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||
| 34 | .size = sizeof(X509_ALGOR), | - | ||||||||||||
| 35 | .sname = "X509_ALGOR", | - | ||||||||||||
| 36 | }; | - | ||||||||||||
| 37 | - | |||||||||||||
| 38 | static const ASN1_TEMPLATE X509_ALGORS_item_tt = { | - | ||||||||||||
| 39 | .flags = (0x2 << 1), | - | ||||||||||||
| 40 | .tag = 0, | - | ||||||||||||
| 41 | .offset = 0, | - | ||||||||||||
| 42 | .field_name = "algorithms", | - | ||||||||||||
| 43 | .item = &X509_ALGOR_it, | - | ||||||||||||
| 44 | }; | - | ||||||||||||
| 45 | - | |||||||||||||
| 46 | const ASN1_ITEM X509_ALGORS_it = { | - | ||||||||||||
| 47 | .itype = 0x0, | - | ||||||||||||
| 48 | .utype = -1, | - | ||||||||||||
| 49 | .templates = &X509_ALGORS_item_tt, | - | ||||||||||||
| 50 | .tcount = 0, | - | ||||||||||||
| 51 | .funcs = | - | ||||||||||||
| 52 | ((void *)0) | - | ||||||||||||
| 53 | , | - | ||||||||||||
| 54 | .size = 0, | - | ||||||||||||
| 55 | .sname = "X509_ALGORS", | - | ||||||||||||
| 56 | }; | - | ||||||||||||
| 57 | - | |||||||||||||
| 58 | - | |||||||||||||
| 59 | X509_ALGOR * | - | ||||||||||||
| 60 | d2i_X509_ALGOR(X509_ALGOR **a, const unsigned char **in, long len) | - | ||||||||||||
| 61 | { | - | ||||||||||||
| 62 | return never executed: (X509_ALGOR *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,return (X509_ALGOR *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_ALGOR_it);never executed: return (X509_ALGOR *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_ALGOR_it); | 0 | ||||||||||||
| 63 | &X509_ALGOR_it); never executed: return (X509_ALGOR *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_ALGOR_it); | 0 | ||||||||||||
| 64 | } | - | ||||||||||||
| 65 | - | |||||||||||||
| 66 | int | - | ||||||||||||
| 67 | i2d_X509_ALGOR(X509_ALGOR *a, unsigned char **out) | - | ||||||||||||
| 68 | { | - | ||||||||||||
| 69 | return never executed: ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_ALGOR_it);return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_ALGOR_it);never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_ALGOR_it); | 0 | ||||||||||||
| 70 | } | - | ||||||||||||
| 71 | - | |||||||||||||
| 72 | X509_ALGOR * | - | ||||||||||||
| 73 | X509_ALGOR_new(void) | - | ||||||||||||
| 74 | { | - | ||||||||||||
| 75 | return executed 26 times by 1 test: (X509_ALGOR *)ASN1_item_new(&X509_ALGOR_it);return (X509_ALGOR *)ASN1_item_new(&X509_ALGOR_it);Executed by:
executed 26 times by 1 test: return (X509_ALGOR *)ASN1_item_new(&X509_ALGOR_it);Executed by:
| 26 | ||||||||||||
| 76 | } | - | ||||||||||||
| 77 | - | |||||||||||||
| 78 | void | - | ||||||||||||
| 79 | X509_ALGOR_free(X509_ALGOR *a) | - | ||||||||||||
| 80 | { | - | ||||||||||||
| 81 | ASN1_item_free((ASN1_VALUE *)a, &X509_ALGOR_it); | - | ||||||||||||
| 82 | } executed 25 times by 2 tests: end of blockExecuted by:
| 25 | ||||||||||||
| 83 | - | |||||||||||||
| 84 | X509_ALGORS * | - | ||||||||||||
| 85 | d2i_X509_ALGORS(X509_ALGORS **a, const unsigned char **in, long len) | - | ||||||||||||
| 86 | { | - | ||||||||||||
| 87 | return never executed: (X509_ALGORS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,return (X509_ALGORS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_ALGORS_it);never executed: return (X509_ALGORS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_ALGORS_it); | 0 | ||||||||||||
| 88 | &X509_ALGORS_it); never executed: return (X509_ALGORS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &X509_ALGORS_it); | 0 | ||||||||||||
| 89 | } | - | ||||||||||||
| 90 | - | |||||||||||||
| 91 | int | - | ||||||||||||
| 92 | i2d_X509_ALGORS(X509_ALGORS *a, unsigned char **out) | - | ||||||||||||
| 93 | { | - | ||||||||||||
| 94 | return never executed: ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_ALGORS_it);return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_ALGORS_it);never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_ALGORS_it); | 0 | ||||||||||||
| 95 | } | - | ||||||||||||
| 96 | - | |||||||||||||
| 97 | X509_ALGOR * | - | ||||||||||||
| 98 | X509_ALGOR_dup(X509_ALGOR *x) | - | ||||||||||||
| 99 | { | - | ||||||||||||
| 100 | return never executed: ASN1_item_dup(&X509_ALGOR_it, x);return ASN1_item_dup(&X509_ALGOR_it, x);never executed: return ASN1_item_dup(&X509_ALGOR_it, x); | 0 | ||||||||||||
| 101 | } | - | ||||||||||||
| 102 | - | |||||||||||||
| 103 | int | - | ||||||||||||
| 104 | X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval) | - | ||||||||||||
| 105 | { | - | ||||||||||||
| 106 | if (!alg
| 0-14 | ||||||||||||
| 107 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 108 | if (ptype != -1
| 2-12 | ||||||||||||
| 109 | if (alg->parameter ==
| 0-12 | ||||||||||||
| 110 | ((void *)0)
| 0-12 | ||||||||||||
| 111 | ) | - | ||||||||||||
| 112 | alg->parameter = ASN1_TYPE_new(); executed 12 times by 2 tests: alg->parameter = ASN1_TYPE_new();Executed by:
| 12 | ||||||||||||
| 113 | if (alg->parameter ==
| 0-12 | ||||||||||||
| 114 | ((void *)0)
| 0-12 | ||||||||||||
| 115 | ) | - | ||||||||||||
| 116 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 117 | } executed 12 times by 2 tests: end of blockExecuted by:
| 12 | ||||||||||||
| 118 | if (alg
| 0-14 | ||||||||||||
| 119 | if (alg->algorithm
| 0-14 | ||||||||||||
| 120 | ASN1_OBJECT_free(alg->algorithm); executed 14 times by 2 tests: ASN1_OBJECT_free(alg->algorithm);Executed by:
| 14 | ||||||||||||
| 121 | alg->algorithm = aobj; | - | ||||||||||||
| 122 | } executed 14 times by 2 tests: end of blockExecuted by:
| 14 | ||||||||||||
| 123 | if (ptype == 0
| 0-14 | ||||||||||||
| 124 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||
| 125 | if (ptype == -1
| 2-12 | ||||||||||||
| 126 | if (alg->parameter
| 0-2 | ||||||||||||
| 127 | ASN1_TYPE_free(alg->parameter); | - | ||||||||||||
| 128 | alg->parameter = | - | ||||||||||||
| 129 | ((void *)0) | - | ||||||||||||
| 130 | ; | - | ||||||||||||
| 131 | } never executed: end of block | 0 | ||||||||||||
| 132 | } executed 2 times by 1 test: elseend of blockExecuted by:
| 2 | ||||||||||||
| 133 | ASN1_TYPE_set(alg->parameter, ptype, pval); executed 12 times by 2 tests: ASN1_TYPE_set(alg->parameter, ptype, pval);Executed by:
| 12 | ||||||||||||
| 134 | return executed 14 times by 2 tests: 1;return 1;Executed by:
executed 14 times by 2 tests: return 1;Executed by:
| 14 | ||||||||||||
| 135 | } | - | ||||||||||||
| 136 | - | |||||||||||||
| 137 | void | - | ||||||||||||
| 138 | X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype, const void **ppval, | - | ||||||||||||
| 139 | const X509_ALGOR *algor) | - | ||||||||||||
| 140 | { | - | ||||||||||||
| 141 | if (paobj
| 0-2 | ||||||||||||
| 142 | * never executed: paobj = algor->algorithm;*paobj = algor->algorithm;never executed: *paobj = algor->algorithm; | 0 | ||||||||||||
| 143 | if (pptype
| 0-2 | ||||||||||||
| 144 | if (algor->parameter ==
| 0-2 | ||||||||||||
| 145 | ((void *)0)
| 0-2 | ||||||||||||
| 146 | ) { | - | ||||||||||||
| 147 | *pptype = -1; | - | ||||||||||||
| 148 | return; never executed: return; | 0 | ||||||||||||
| 149 | } else | - | ||||||||||||
| 150 | * executed 2 times by 1 test: pptype = algor->parameter->type;*pptype = algor->parameter->type;Executed by:
executed 2 times by 1 test: *pptype = algor->parameter->type;Executed by:
| 2 | ||||||||||||
| 151 | if (ppval
| 0-2 | ||||||||||||
| 152 | * executed 2 times by 1 test: ppval = algor->parameter->value.ptr;*ppval = algor->parameter->value.ptr;Executed by:
executed 2 times by 1 test: *ppval = algor->parameter->value.ptr;Executed by:
| 2 | ||||||||||||
| 153 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 154 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 155 | - | |||||||||||||
| 156 | - | |||||||||||||
| 157 | - | |||||||||||||
| 158 | void | - | ||||||||||||
| 159 | X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md) | - | ||||||||||||
| 160 | { | - | ||||||||||||
| 161 | int param_type; | - | ||||||||||||
| 162 | - | |||||||||||||
| 163 | if (md->flags & 0x0008
| 0 | ||||||||||||
| 164 | param_type = -1; never executed: param_type = -1; | 0 | ||||||||||||
| 165 | else | - | ||||||||||||
| 166 | param_type = 5; never executed: param_type = 5; | 0 | ||||||||||||
| 167 | - | |||||||||||||
| 168 | X509_ALGOR_set0(alg, OBJ_nid2obj(EVP_MD_type(md)), param_type, | - | ||||||||||||
| 169 | ((void *)0) | - | ||||||||||||
| 170 | ); | - | ||||||||||||
| 171 | } never executed: end of block | 0 | ||||||||||||
| 172 | - | |||||||||||||
| 173 | - | |||||||||||||
| 174 | int | - | ||||||||||||
| 175 | X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b) | - | ||||||||||||
| 176 | { | - | ||||||||||||
| 177 | int rv = OBJ_cmp(a->algorithm, b->algorithm); | - | ||||||||||||
| 178 | if (!rv
| 0-72 | ||||||||||||
| 179 | if (!a->parameter
| 0-72 | ||||||||||||
| 180 | rv = 0; never executed: rv = 0; | 0 | ||||||||||||
| 181 | else | - | ||||||||||||
| 182 | rv = ASN1_TYPE_cmp(a->parameter, b->parameter); executed 72 times by 2 tests: rv = ASN1_TYPE_cmp(a->parameter, b->parameter);Executed by:
| 72 | ||||||||||||
| 183 | } | - | ||||||||||||
| 184 | return executed 72 times by 2 tests: (rv);return(rv);Executed by:
executed 72 times by 2 tests: return(rv);Executed by:
| 72 | ||||||||||||
| 185 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |