| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/dh/dh_asn1.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | static int dh_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | - | ||||||||||||||||||
| 4 | void *exarg) | - | ||||||||||||||||||
| 5 | { | - | ||||||||||||||||||
| 6 | if (operation == 0
| 5953-12104 | ||||||||||||||||||
| 7 | *pval = (ASN1_VALUE *)DH_new(); | - | ||||||||||||||||||
| 8 | if (*
| 0-5953 | ||||||||||||||||||
| 9 | ((void *)0)
| 0-5953 | ||||||||||||||||||
| 10 | ) | - | ||||||||||||||||||
| 11 | return executed 5953 times by 1 test: 2;return 2;Executed by:
executed 5953 times by 1 test: return 2;Executed by:
| 5953 | ||||||||||||||||||
| 12 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 13 | } else if (operation == 2
| 5909-6195 | ||||||||||||||||||
| 14 | DH_free((DH *)*pval); | - | ||||||||||||||||||
| 15 | *pval = | - | ||||||||||||||||||
| 16 | ((void *)0) | - | ||||||||||||||||||
| 17 | ; | - | ||||||||||||||||||
| 18 | return executed 5909 times by 1 test: 2;return 2;Executed by:
executed 5909 times by 1 test: return 2;Executed by:
| 5909 | ||||||||||||||||||
| 19 | } | - | ||||||||||||||||||
| 20 | return executed 6195 times by 1 test: 1;return 1;Executed by:
executed 6195 times by 1 test: return 1;Executed by:
| 6195 | ||||||||||||||||||
| 21 | } | - | ||||||||||||||||||
| 22 | - | |||||||||||||||||||
| 23 | static const ASN1_AUX DHparams_aux = { | - | ||||||||||||||||||
| 24 | ((void *)0) | - | ||||||||||||||||||
| 25 | , 0, 0, 0, dh_cb, 0}; static const ASN1_TEMPLATE DHparams_seq_tt[] = { | - | ||||||||||||||||||
| 26 | { (0), (0), | - | ||||||||||||||||||
| 27 | __builtin_offsetof ( | - | ||||||||||||||||||
| 28 | DH | - | ||||||||||||||||||
| 29 | , | - | ||||||||||||||||||
| 30 | p | - | ||||||||||||||||||
| 31 | ) | - | ||||||||||||||||||
| 32 | , "p", (&(BIGNUM_it)) }, | - | ||||||||||||||||||
| 33 | { (0), (0), | - | ||||||||||||||||||
| 34 | __builtin_offsetof ( | - | ||||||||||||||||||
| 35 | DH | - | ||||||||||||||||||
| 36 | , | - | ||||||||||||||||||
| 37 | g | - | ||||||||||||||||||
| 38 | ) | - | ||||||||||||||||||
| 39 | , "g", (&(BIGNUM_it)) }, | - | ||||||||||||||||||
| 40 | { ((0x1)|(0x1 << 12)), (0), | - | ||||||||||||||||||
| 41 | __builtin_offsetof ( | - | ||||||||||||||||||
| 42 | DH | - | ||||||||||||||||||
| 43 | , | - | ||||||||||||||||||
| 44 | length | - | ||||||||||||||||||
| 45 | ) | - | ||||||||||||||||||
| 46 | , "length", (&(ZINT32_it)) }, | - | ||||||||||||||||||
| 47 | } ; const ASN1_ITEM DHparams_it = { 0x1, 16, DHparams_seq_tt, sizeof(DHparams_seq_tt) / sizeof(ASN1_TEMPLATE), &DHparams_aux, sizeof(DH), "DHparams" }; | - | ||||||||||||||||||
| 48 | - | |||||||||||||||||||
| 49 | DH *d2i_DHparams(DH **a, const unsigned char **in, long len) { return executed 3352 times by 1 test: (DH *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(DHparams_it)));return (DH *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(DHparams_it)));Executed by:
executed 3352 times by 1 test: } int i2d_DHparams(const DH *a, unsigned char **out) { returnreturn (DH *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(DHparams_it)));Executed by:
executed 22 times by 1 test: ASN1_item_i2d((ASN1_VALUE *)a, out, (&(DHparams_it)));return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(DHparams_it)));Executed by:
executed 22 times by 1 test: }return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(DHparams_it)));Executed by:
| 22-3352 | ||||||||||||||||||
| 50 | - | |||||||||||||||||||
| 51 | - | |||||||||||||||||||
| 52 | - | |||||||||||||||||||
| 53 | - | |||||||||||||||||||
| 54 | - | |||||||||||||||||||
| 55 | - | |||||||||||||||||||
| 56 | typedef struct { | - | ||||||||||||||||||
| 57 | ASN1_BIT_STRING *seed; | - | ||||||||||||||||||
| 58 | BIGNUM *counter; | - | ||||||||||||||||||
| 59 | } int_dhvparams; | - | ||||||||||||||||||
| 60 | - | |||||||||||||||||||
| 61 | typedef struct { | - | ||||||||||||||||||
| 62 | BIGNUM *p; | - | ||||||||||||||||||
| 63 | BIGNUM *q; | - | ||||||||||||||||||
| 64 | BIGNUM *g; | - | ||||||||||||||||||
| 65 | BIGNUM *j; | - | ||||||||||||||||||
| 66 | int_dhvparams *vparams; | - | ||||||||||||||||||
| 67 | } int_dhx942_dh; | - | ||||||||||||||||||
| 68 | - | |||||||||||||||||||
| 69 | static const ASN1_TEMPLATE DHvparams_seq_tt[] = { | - | ||||||||||||||||||
| 70 | { (0), (0), | - | ||||||||||||||||||
| 71 | __builtin_offsetof ( | - | ||||||||||||||||||
| 72 | int_dhvparams | - | ||||||||||||||||||
| 73 | , | - | ||||||||||||||||||
| 74 | seed | - | ||||||||||||||||||
| 75 | ) | - | ||||||||||||||||||
| 76 | , "seed", (&(ASN1_BIT_STRING_it)) }, | - | ||||||||||||||||||
| 77 | { (0), (0), | - | ||||||||||||||||||
| 78 | __builtin_offsetof ( | - | ||||||||||||||||||
| 79 | int_dhvparams | - | ||||||||||||||||||
| 80 | , | - | ||||||||||||||||||
| 81 | counter | - | ||||||||||||||||||
| 82 | ) | - | ||||||||||||||||||
| 83 | , "counter", (&(BIGNUM_it)) } | - | ||||||||||||||||||
| 84 | } ; static const ASN1_ITEM DHvparams_it = { 0x1, 16, DHvparams_seq_tt, sizeof(DHvparams_seq_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||||||||
| 85 | ((void *)0) | - | ||||||||||||||||||
| 86 | , sizeof(int_dhvparams), "int_dhvparams" }; | - | ||||||||||||||||||
| 87 | - | |||||||||||||||||||
| 88 | static const ASN1_TEMPLATE DHxparams_seq_tt[] = { | - | ||||||||||||||||||
| 89 | { (0), (0), | - | ||||||||||||||||||
| 90 | __builtin_offsetof ( | - | ||||||||||||||||||
| 91 | int_dhx942_dh | - | ||||||||||||||||||
| 92 | , | - | ||||||||||||||||||
| 93 | p | - | ||||||||||||||||||
| 94 | ) | - | ||||||||||||||||||
| 95 | , "p", (&(BIGNUM_it)) }, | - | ||||||||||||||||||
| 96 | { (0), (0), | - | ||||||||||||||||||
| 97 | __builtin_offsetof ( | - | ||||||||||||||||||
| 98 | int_dhx942_dh | - | ||||||||||||||||||
| 99 | , | - | ||||||||||||||||||
| 100 | g | - | ||||||||||||||||||
| 101 | ) | - | ||||||||||||||||||
| 102 | , "g", (&(BIGNUM_it)) }, | - | ||||||||||||||||||
| 103 | { (0), (0), | - | ||||||||||||||||||
| 104 | __builtin_offsetof ( | - | ||||||||||||||||||
| 105 | int_dhx942_dh | - | ||||||||||||||||||
| 106 | , | - | ||||||||||||||||||
| 107 | q | - | ||||||||||||||||||
| 108 | ) | - | ||||||||||||||||||
| 109 | , "q", (&(BIGNUM_it)) }, | - | ||||||||||||||||||
| 110 | { ((0x1)), (0), | - | ||||||||||||||||||
| 111 | __builtin_offsetof ( | - | ||||||||||||||||||
| 112 | int_dhx942_dh | - | ||||||||||||||||||
| 113 | , | - | ||||||||||||||||||
| 114 | j | - | ||||||||||||||||||
| 115 | ) | - | ||||||||||||||||||
| 116 | , "j", (&(BIGNUM_it)) }, | - | ||||||||||||||||||
| 117 | { ((0x1)), (0), | - | ||||||||||||||||||
| 118 | __builtin_offsetof ( | - | ||||||||||||||||||
| 119 | int_dhx942_dh | - | ||||||||||||||||||
| 120 | , | - | ||||||||||||||||||
| 121 | vparams | - | ||||||||||||||||||
| 122 | ) | - | ||||||||||||||||||
| 123 | , "vparams", (&(DHvparams_it)) }, | - | ||||||||||||||||||
| 124 | } ; static const ASN1_ITEM DHxparams_it = { 0x1, 16, DHxparams_seq_tt, sizeof(DHxparams_seq_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||||||||
| 125 | ((void *)0) | - | ||||||||||||||||||
| 126 | , sizeof(int_dhx942_dh), "int_dhx942_dh" }; | - | ||||||||||||||||||
| 127 | - | |||||||||||||||||||
| 128 | int_dhx942_dh *d2i_int_dhx(int_dhx942_dh **a, | - | ||||||||||||||||||
| 129 | const unsigned char **pp, long length); | - | ||||||||||||||||||
| 130 | int i2d_int_dhx(const int_dhx942_dh *a, unsigned char **pp); | - | ||||||||||||||||||
| 131 | - | |||||||||||||||||||
| 132 | int_dhx942_dh *d2i_int_dhx(int_dhx942_dh **a, const unsigned char **in, long len) { return executed 5506 times by 1 test: (int_dhx942_dh *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(DHxparams_it)));return (int_dhx942_dh *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(DHxparams_it)));Executed by:
executed 5506 times by 1 test: } int i2d_int_dhx(const int_dhx942_dh *a, unsigned char **out) { returnreturn (int_dhx942_dh *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(DHxparams_it)));Executed by:
executed 31 times by 1 test: ASN1_item_i2d((ASN1_VALUE *)a, out, (&(DHxparams_it)));return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(DHxparams_it)));Executed by:
executed 31 times by 1 test: }return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(DHxparams_it)));Executed by:
| 31-5506 | ||||||||||||||||||
| 133 | - | |||||||||||||||||||
| 134 | - | |||||||||||||||||||
| 135 | - | |||||||||||||||||||
| 136 | DH *d2i_DHxparams(DH **a, const unsigned char **pp, long length) | - | ||||||||||||||||||
| 137 | { | - | ||||||||||||||||||
| 138 | int_dhx942_dh *dhx = | - | ||||||||||||||||||
| 139 | ((void *)0) | - | ||||||||||||||||||
| 140 | ; | - | ||||||||||||||||||
| 141 | DH *dh = | - | ||||||||||||||||||
| 142 | ((void *)0) | - | ||||||||||||||||||
| 143 | ; | - | ||||||||||||||||||
| 144 | dh = DH_new(); | - | ||||||||||||||||||
| 145 | if (dh ==
| 0-5506 | ||||||||||||||||||
| 146 | ((void *)0)
| 0-5506 | ||||||||||||||||||
| 147 | ) | - | ||||||||||||||||||
| 148 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 149 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 150 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 151 | dhx = d2i_int_dhx( | - | ||||||||||||||||||
| 152 | ((void *)0) | - | ||||||||||||||||||
| 153 | , pp, length); | - | ||||||||||||||||||
| 154 | if (dhx ==
| 331-5175 | ||||||||||||||||||
| 155 | ((void *)0)
| 331-5175 | ||||||||||||||||||
| 156 | ) { | - | ||||||||||||||||||
| 157 | DH_free(dh); | - | ||||||||||||||||||
| 158 | return executed 5175 times by 1 test: return ((void *)0) ;Executed by:
executed 5175 times by 1 test: return ((void *)0) ;Executed by:
| 5175 | ||||||||||||||||||
| 159 | ((void *)0) executed 5175 times by 1 test: return ((void *)0) ;Executed by:
| 5175 | ||||||||||||||||||
| 160 | ; executed 5175 times by 1 test: return ((void *)0) ;Executed by:
| 5175 | ||||||||||||||||||
| 161 | } | - | ||||||||||||||||||
| 162 | - | |||||||||||||||||||
| 163 | if (a
| 0-331 | ||||||||||||||||||
| 164 | DH_free(*a); | - | ||||||||||||||||||
| 165 | *a = dh; | - | ||||||||||||||||||
| 166 | } never executed: end of block | 0 | ||||||||||||||||||
| 167 | - | |||||||||||||||||||
| 168 | dh->p = dhx->p; | - | ||||||||||||||||||
| 169 | dh->q = dhx->q; | - | ||||||||||||||||||
| 170 | dh->g = dhx->g; | - | ||||||||||||||||||
| 171 | dh->j = dhx->j; | - | ||||||||||||||||||
| 172 | - | |||||||||||||||||||
| 173 | if (dhx->vparams
| 15-316 | ||||||||||||||||||
| 174 | dh->seed = dhx->vparams->seed->data; | - | ||||||||||||||||||
| 175 | dh->seedlen = dhx->vparams->seed->length; | - | ||||||||||||||||||
| 176 | dh->counter = dhx->vparams->counter; | - | ||||||||||||||||||
| 177 | dhx->vparams->seed->data = | - | ||||||||||||||||||
| 178 | ((void *)0) | - | ||||||||||||||||||
| 179 | ; | - | ||||||||||||||||||
| 180 | ASN1_BIT_STRING_free(dhx->vparams->seed); | - | ||||||||||||||||||
| 181 | CRYPTO_free(dhx->vparams, __FILE__, 110); | - | ||||||||||||||||||
| 182 | dhx->vparams = | - | ||||||||||||||||||
| 183 | ((void *)0) | - | ||||||||||||||||||
| 184 | ; | - | ||||||||||||||||||
| 185 | } executed 15 times by 1 test: end of blockExecuted by:
| 15 | ||||||||||||||||||
| 186 | - | |||||||||||||||||||
| 187 | CRYPTO_free(dhx, __FILE__, 114); | - | ||||||||||||||||||
| 188 | return executed 331 times by 1 test: dh;return dh;Executed by:
executed 331 times by 1 test: return dh;Executed by:
| 331 | ||||||||||||||||||
| 189 | } | - | ||||||||||||||||||
| 190 | - | |||||||||||||||||||
| 191 | int i2d_DHxparams(const DH *dh, unsigned char **pp) | - | ||||||||||||||||||
| 192 | { | - | ||||||||||||||||||
| 193 | int_dhx942_dh dhx; | - | ||||||||||||||||||
| 194 | int_dhvparams dhv; | - | ||||||||||||||||||
| 195 | ASN1_BIT_STRING bs; | - | ||||||||||||||||||
| 196 | dhx.p = dh->p; | - | ||||||||||||||||||
| 197 | dhx.g = dh->g; | - | ||||||||||||||||||
| 198 | dhx.q = dh->q; | - | ||||||||||||||||||
| 199 | dhx.j = dh->j; | - | ||||||||||||||||||
| 200 | if (dh->counter
| 0-16 | ||||||||||||||||||
| 201 | bs.flags = 0x08; | - | ||||||||||||||||||
| 202 | bs.data = dh->seed; | - | ||||||||||||||||||
| 203 | bs.length = dh->seedlen; | - | ||||||||||||||||||
| 204 | dhv.seed = &bs; | - | ||||||||||||||||||
| 205 | dhv.counter = dh->counter; | - | ||||||||||||||||||
| 206 | dhx.vparams = &dhv; | - | ||||||||||||||||||
| 207 | } executed 13 times by 1 test: elseend of blockExecuted by:
| 13 | ||||||||||||||||||
| 208 | dhx.vparams = executed 18 times by 1 test: dhx.vparams = ((void *)0) ;Executed by:
| 18 | ||||||||||||||||||
| 209 | ((void *)0) executed 18 times by 1 test: dhx.vparams = ((void *)0) ;Executed by:
| 18 | ||||||||||||||||||
| 210 | ; executed 18 times by 1 test: dhx.vparams = ((void *)0) ;Executed by:
| 18 | ||||||||||||||||||
| 211 | - | |||||||||||||||||||
| 212 | return executed 31 times by 1 test: i2d_int_dhx(&dhx, pp);return i2d_int_dhx(&dhx, pp);Executed by:
executed 31 times by 1 test: return i2d_int_dhx(&dhx, pp);Executed by:
| 31 | ||||||||||||||||||
| 213 | } | - | ||||||||||||||||||
| Switch to Source code | Preprocessed file |