| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/asn1/a_int.c | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | ASN1_INTEGER * | - | ||||||||||||||||||||||||
| 5 | ASN1_INTEGER_dup(const ASN1_INTEGER *x) | - | ||||||||||||||||||||||||
| 6 | { | - | ||||||||||||||||||||||||
| 7 | return never executed: ASN1_STRING_dup(x); return ASN1_STRING_dup(x);never executed:  return ASN1_STRING_dup(x); | 0 | ||||||||||||||||||||||||
| 8 | } | - | ||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||
| 10 | int | - | ||||||||||||||||||||||||
| 11 | ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y) | - | ||||||||||||||||||||||||
| 12 | { | - | ||||||||||||||||||||||||
| 13 | int neg, ret; | - | ||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||
| 15 | - | |||||||||||||||||||||||||
| 16 | neg = x->type & 0x100; | - | ||||||||||||||||||||||||
| 17 | if (neg != (y->type & 0x100) 
 | 0 | ||||||||||||||||||||||||
| 18 | if (neg 
 | 0 | ||||||||||||||||||||||||
| 19 | return never executed: -1; return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 20 | else | - | ||||||||||||||||||||||||
| 21 | return never executed: 1; return 1;never executed:  return 1; | 0 | ||||||||||||||||||||||||
| 22 | } | - | ||||||||||||||||||||||||
| 23 | - | |||||||||||||||||||||||||
| 24 | ret = ASN1_STRING_cmp(x, y); | - | ||||||||||||||||||||||||
| 25 | - | |||||||||||||||||||||||||
| 26 | if (neg 
 | 0 | ||||||||||||||||||||||||
| 27 | return never executed: -ret; return -ret;never executed:  return -ret; | 0 | ||||||||||||||||||||||||
| 28 | else | - | ||||||||||||||||||||||||
| 29 | return never executed: ret; return ret;never executed:  return ret; | 0 | ||||||||||||||||||||||||
| 30 | } | - | ||||||||||||||||||||||||
| 31 | int | - | ||||||||||||||||||||||||
| 32 | i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp) | - | ||||||||||||||||||||||||
| 33 | { | - | ||||||||||||||||||||||||
| 34 | int pad = 0, ret, i, neg; | - | ||||||||||||||||||||||||
| 35 | unsigned char *p, *n, pb = 0; | - | ||||||||||||||||||||||||
| 36 | - | |||||||||||||||||||||||||
| 37 | if (a == 
 | 0-206 | ||||||||||||||||||||||||
| 38 | ((void *)0) 
 | 0-206 | ||||||||||||||||||||||||
| 39 | ) | - | ||||||||||||||||||||||||
| 40 | return never executed: (0); return (0);never executed:  return (0); | 0 | ||||||||||||||||||||||||
| 41 | neg = a->type & 0x100; | - | ||||||||||||||||||||||||
| 42 | if (a->length == 0 
 | 18-188 | ||||||||||||||||||||||||
| 43 | ret = 1; executed 18 times by 2 tests:  ret = 1;Executed by: 
 | 18 | ||||||||||||||||||||||||
| 44 | else { | - | ||||||||||||||||||||||||
| 45 | ret = a->length; | - | ||||||||||||||||||||||||
| 46 | i = a->data[0]; | - | ||||||||||||||||||||||||
| 47 | if (!neg 
 
 
 | 0-188 | ||||||||||||||||||||||||
| 48 | pad = 1; | - | ||||||||||||||||||||||||
| 49 | pb = 0; | - | ||||||||||||||||||||||||
| 50 | } executed 133 times by 3 tests: else if (neg end of blockExecuted by: 
 
 | 0-133 | ||||||||||||||||||||||||
| 51 | if (i > 128 
 | 0 | ||||||||||||||||||||||||
| 52 | pad = 1; | - | ||||||||||||||||||||||||
| 53 | pb = 0xFF; | - | ||||||||||||||||||||||||
| 54 | } never executed: else if (i == 128 end of block
 | 0 | ||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||
| 56 | - | |||||||||||||||||||||||||
| 57 | - | |||||||||||||||||||||||||
| 58 | - | |||||||||||||||||||||||||
| 59 | for (i = 1; i < a->length 
 
 | 0 | ||||||||||||||||||||||||
| 60 | pad = 1; | - | ||||||||||||||||||||||||
| 61 | pb = 0xFF; | - | ||||||||||||||||||||||||
| 62 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 63 | } | - | ||||||||||||||||||||||||
| 64 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 65 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 66 | ret += pad; | - | ||||||||||||||||||||||||
| 67 | } executed 188 times by 4 tests:  end of blockExecuted by: 
 | 188 | ||||||||||||||||||||||||
| 68 | if (pp == 
 | 22-184 | ||||||||||||||||||||||||
| 69 | ((void *)0) 
 | 22-184 | ||||||||||||||||||||||||
| 70 | ) | - | ||||||||||||||||||||||||
| 71 | return executed 184 times by 4 tests: (ret); return (ret);Executed by: 
 executed 184 times by 4 tests:  return (ret);Executed by: 
 | 184 | ||||||||||||||||||||||||
| 72 | p= *pp; | - | ||||||||||||||||||||||||
| 73 | - | |||||||||||||||||||||||||
| 74 | if (pad 
 | 9-13 | ||||||||||||||||||||||||
| 75 | *( executed 9 times by 2 tests: p++) = pb; *(p++) = pb;Executed by: 
 executed 9 times by 2 tests:  *(p++) = pb;Executed by: 
 | 9 | ||||||||||||||||||||||||
| 76 | if (a->length == 0 
 | 3-19 | ||||||||||||||||||||||||
| 77 | *( executed 3 times by 2 tests: p++) = 0; *(p++) = 0;Executed by: 
 executed 3 times by 2 tests:  *(p++) = 0;Executed by: 
 | 3 | ||||||||||||||||||||||||
| 78 | else if (!neg 
 | 0-19 | ||||||||||||||||||||||||
| 79 | memcpy(p, a->data, a->length); executed 19 times by 3 tests:  memcpy(p, a->data, a->length);Executed by: 
 | 19 | ||||||||||||||||||||||||
| 80 | else { | - | ||||||||||||||||||||||||
| 81 | - | |||||||||||||||||||||||||
| 82 | n = a->data + a->length - 1; | - | ||||||||||||||||||||||||
| 83 | p += a->length - 1; | - | ||||||||||||||||||||||||
| 84 | i = a->length; | - | ||||||||||||||||||||||||
| 85 | - | |||||||||||||||||||||||||
| 86 | while (!*n 
 | 0 | ||||||||||||||||||||||||
| 87 | *(p--) = 0; | - | ||||||||||||||||||||||||
| 88 | n--; | - | ||||||||||||||||||||||||
| 89 | i--; | - | ||||||||||||||||||||||||
| 90 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 91 | - | |||||||||||||||||||||||||
| 92 | *(p--) = ((*(n--)) ^ 0xff) + 1; | - | ||||||||||||||||||||||||
| 93 | i--; | - | ||||||||||||||||||||||||
| 94 | - | |||||||||||||||||||||||||
| 95 | for (; i > 0 
 | 0 | ||||||||||||||||||||||||
| 96 | *( never executed: p--) = *(n--) ^ 0xff; *(p--) = *(n--) ^ 0xff;never executed:  *(p--) = *(n--) ^ 0xff; | 0 | ||||||||||||||||||||||||
| 97 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 98 | - | |||||||||||||||||||||||||
| 99 | *pp += ret; | - | ||||||||||||||||||||||||
| 100 | return executed 22 times by 3 tests: (ret); return (ret);Executed by: 
 executed 22 times by 3 tests:  return (ret);Executed by: 
 | 22 | ||||||||||||||||||||||||
| 101 | } | - | ||||||||||||||||||||||||
| 102 | - | |||||||||||||||||||||||||
| 103 | - | |||||||||||||||||||||||||
| 104 | - | |||||||||||||||||||||||||
| 105 | ASN1_INTEGER * | - | ||||||||||||||||||||||||
| 106 | c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, long len) | - | ||||||||||||||||||||||||
| 107 | { | - | ||||||||||||||||||||||||
| 108 | ASN1_INTEGER *ret = | - | ||||||||||||||||||||||||
| 109 | ((void *)0) | - | ||||||||||||||||||||||||
| 110 | ; | - | ||||||||||||||||||||||||
| 111 | const unsigned char *p, *pend; | - | ||||||||||||||||||||||||
| 112 | unsigned char *to, *s; | - | ||||||||||||||||||||||||
| 113 | int i; | - | ||||||||||||||||||||||||
| 114 | - | |||||||||||||||||||||||||
| 115 | if (( 
 
 | 0-449 | ||||||||||||||||||||||||
| 116 | ((void *)0) 
 | 0-449 | ||||||||||||||||||||||||
| 117 | ) 
 
 
 | 0-449 | ||||||||||||||||||||||||
| 118 | ((void *)0) 
 | 219-230 | ||||||||||||||||||||||||
| 119 | ) 
 | 219-230 | ||||||||||||||||||||||||
| 120 | if (( 
 
 | 0-219 | ||||||||||||||||||||||||
| 121 | ((void *)0) 
 | 0-219 | ||||||||||||||||||||||||
| 122 | ) | - | ||||||||||||||||||||||||
| 123 | return never executed: ( return ( ((void *)0) );never executed:  return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 124 | ((void *)0) never executed:  return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 125 | ); never executed:  return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 126 | } executed 219 times by 7 tests: else end of blockExecuted by: 
 | 219 | ||||||||||||||||||||||||
| 127 | ret = (*a); executed 230 times by 8 tests:  ret = (*a);Executed by: 
 | 230 | ||||||||||||||||||||||||
| 128 | - | |||||||||||||||||||||||||
| 129 | p = *pp; | - | ||||||||||||||||||||||||
| 130 | pend = p + len; | - | ||||||||||||||||||||||||
| 131 | - | |||||||||||||||||||||||||
| 132 | - | |||||||||||||||||||||||||
| 133 | - | |||||||||||||||||||||||||
| 134 | s = malloc(len + 1); | - | ||||||||||||||||||||||||
| 135 | if (s == 
 | 0-449 | ||||||||||||||||||||||||
| 136 | ((void *)0) 
 | 0-449 | ||||||||||||||||||||||||
| 137 | ) { | - | ||||||||||||||||||||||||
| 138 | i = (1|64); | - | ||||||||||||||||||||||||
| 139 | goto never executed: err; goto err;never executed:  goto err; | 0 | ||||||||||||||||||||||||
| 140 | } | - | ||||||||||||||||||||||||
| 141 | to = s; | - | ||||||||||||||||||||||||
| 142 | if (!len 
 | 0-449 | ||||||||||||||||||||||||
| 143 | - | |||||||||||||||||||||||||
| 144 | - | |||||||||||||||||||||||||
| 145 | - | |||||||||||||||||||||||||
| 146 | ret->type = 2; | - | ||||||||||||||||||||||||
| 147 | } never executed: else if (* end of block
 
 | 0-449 | ||||||||||||||||||||||||
| 148 | ret->type = (2 | 0x100); | - | ||||||||||||||||||||||||
| 149 | if ((* 
 
 
 
 | 0 | ||||||||||||||||||||||||
| 150 | p++; | - | ||||||||||||||||||||||||
| 151 | len--; | - | ||||||||||||||||||||||||
| 152 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 153 | i = len; | - | ||||||||||||||||||||||||
| 154 | p += i - 1; | - | ||||||||||||||||||||||||
| 155 | to += i - 1; | - | ||||||||||||||||||||||||
| 156 | while(( 
 
 
 | 0 | ||||||||||||||||||||||||
| 157 | *(to--) = 0; | - | ||||||||||||||||||||||||
| 158 | i--; | - | ||||||||||||||||||||||||
| 159 | p--; | - | ||||||||||||||||||||||||
| 160 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 161 | - | |||||||||||||||||||||||||
| 162 | - | |||||||||||||||||||||||||
| 163 | - | |||||||||||||||||||||||||
| 164 | - | |||||||||||||||||||||||||
| 165 | - | |||||||||||||||||||||||||
| 166 | - | |||||||||||||||||||||||||
| 167 | - | |||||||||||||||||||||||||
| 168 | if (!i 
 | 0 | ||||||||||||||||||||||||
| 169 | *s = 1; | - | ||||||||||||||||||||||||
| 170 | s[len] = 0; | - | ||||||||||||||||||||||||
| 171 | len++; | - | ||||||||||||||||||||||||
| 172 | } never executed: else { end of block | 0 | ||||||||||||||||||||||||
| 173 | *(to--) = (*(p--) ^ 0xff) + 1; | - | ||||||||||||||||||||||||
| 174 | i--; | - | ||||||||||||||||||||||||
| 175 | for (; i > 0 
 | 0 | ||||||||||||||||||||||||
| 176 | *( never executed: to--) = *(p--) ^ 0xff; *(to--) = *(p--) ^ 0xff;never executed:  *(to--) = *(p--) ^ 0xff; | 0 | ||||||||||||||||||||||||
| 177 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 178 | } else { | - | ||||||||||||||||||||||||
| 179 | ret->type = 2; | - | ||||||||||||||||||||||||
| 180 | if ((* 
 
 
 
 | 2-226 | ||||||||||||||||||||||||
| 181 | p++; | - | ||||||||||||||||||||||||
| 182 | len--; | - | ||||||||||||||||||||||||
| 183 | } executed 224 times by 7 tests:  end of blockExecuted by: 
 | 224 | ||||||||||||||||||||||||
| 184 | memcpy(s, p, len); | - | ||||||||||||||||||||||||
| 185 | } executed 449 times by 8 tests:  end of blockExecuted by: 
 | 449 | ||||||||||||||||||||||||
| 186 | - | |||||||||||||||||||||||||
| 187 | free(ret->data); | - | ||||||||||||||||||||||||
| 188 | ret->data = s; | - | ||||||||||||||||||||||||
| 189 | ret->length = (int)len; | - | ||||||||||||||||||||||||
| 190 | if (a != 
 | 0-449 | ||||||||||||||||||||||||
| 191 | ((void *)0) 
 | 0-449 | ||||||||||||||||||||||||
| 192 | ) | - | ||||||||||||||||||||||||
| 193 | (* executed 449 times by 8 tests: a) = ret; (*a) = ret;Executed by: 
 executed 449 times by 8 tests:  (*a) = ret;Executed by: 
 | 449 | ||||||||||||||||||||||||
| 194 | *pp = pend; | - | ||||||||||||||||||||||||
| 195 | return executed 449 times by 8 tests: (ret); return (ret);Executed by: 
 executed 449 times by 8 tests:  return (ret);Executed by: 
 | 449 | ||||||||||||||||||||||||
| 196 | - | |||||||||||||||||||||||||
| 197 | err: | - | ||||||||||||||||||||||||
| 198 | ERR_put_error(13,(0xfff),(i),__FILE__,269); | - | ||||||||||||||||||||||||
| 199 | if (a == 
 | 0 | ||||||||||||||||||||||||
| 200 | ((void *)0) 
 | 0 | ||||||||||||||||||||||||
| 201 | || * 
 
 | 0 | ||||||||||||||||||||||||
| 202 | ASN1_INTEGER_free(ret); never executed:  ASN1_INTEGER_free(ret); | 0 | ||||||||||||||||||||||||
| 203 | return never executed: ( return ( ((void *)0) );never executed:  return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 204 | ((void *)0) never executed:  return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 205 | ); never executed:  return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 206 | } | - | ||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||
| 208 | - | |||||||||||||||||||||||||
| 209 | - | |||||||||||||||||||||||||
| 210 | - | |||||||||||||||||||||||||
| 211 | - | |||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||
| 213 | - | |||||||||||||||||||||||||
| 214 | ASN1_INTEGER * | - | ||||||||||||||||||||||||
| 215 | d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, long length) | - | ||||||||||||||||||||||||
| 216 | { | - | ||||||||||||||||||||||||
| 217 | ASN1_INTEGER *ret = | - | ||||||||||||||||||||||||
| 218 | ((void *)0) | - | ||||||||||||||||||||||||
| 219 | ; | - | ||||||||||||||||||||||||
| 220 | const unsigned char *p; | - | ||||||||||||||||||||||||
| 221 | unsigned char *s; | - | ||||||||||||||||||||||||
| 222 | long len; | - | ||||||||||||||||||||||||
| 223 | int inf, tag, xclass; | - | ||||||||||||||||||||||||
| 224 | int i; | - | ||||||||||||||||||||||||
| 225 | - | |||||||||||||||||||||||||
| 226 | if (( 
 
 | 0 | ||||||||||||||||||||||||
| 227 | ((void *)0) 
 | 0 | ||||||||||||||||||||||||
| 228 | ) 
 
 
 | 0 | ||||||||||||||||||||||||
| 229 | ((void *)0) 
 | 0 | ||||||||||||||||||||||||
| 230 | ) 
 | 0 | ||||||||||||||||||||||||
| 231 | if (( 
 
 | 0 | ||||||||||||||||||||||||
| 232 | ((void *)0) 
 | 0 | ||||||||||||||||||||||||
| 233 | ) | - | ||||||||||||||||||||||||
| 234 | return never executed: ( return ( ((void *)0) );never executed:  return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 235 | ((void *)0) never executed:  return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 236 | ); never executed:  return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 237 | } never executed: else end of block | 0 | ||||||||||||||||||||||||
| 238 | ret = (*a); never executed:  ret = (*a); | 0 | ||||||||||||||||||||||||
| 239 | - | |||||||||||||||||||||||||
| 240 | p = *pp; | - | ||||||||||||||||||||||||
| 241 | inf = ASN1_get_object(&p, &len, &tag, &xclass, length); | - | ||||||||||||||||||||||||
| 242 | if (inf & 0x80 
 | 0 | ||||||||||||||||||||||||
| 243 | i = 102; | - | ||||||||||||||||||||||||
| 244 | goto never executed: err; goto err;never executed:  goto err; | 0 | ||||||||||||||||||||||||
| 245 | } | - | ||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||
| 247 | if (tag != 2 
 | 0 | ||||||||||||||||||||||||
| 248 | i = 115; | - | ||||||||||||||||||||||||
| 249 | goto never executed: err; goto err;never executed:  goto err; | 0 | ||||||||||||||||||||||||
| 250 | } | - | ||||||||||||||||||||||||
| 251 | - | |||||||||||||||||||||||||
| 252 | - | |||||||||||||||||||||||||
| 253 | - | |||||||||||||||||||||||||
| 254 | s = malloc(len + 1); | - | ||||||||||||||||||||||||
| 255 | if (s == 
 | 0 | ||||||||||||||||||||||||
| 256 | ((void *)0) 
 | 0 | ||||||||||||||||||||||||
| 257 | ) { | - | ||||||||||||||||||||||||
| 258 | i = (1|64); | - | ||||||||||||||||||||||||
| 259 | goto never executed: err; goto err;never executed:  goto err; | 0 | ||||||||||||||||||||||||
| 260 | } | - | ||||||||||||||||||||||||
| 261 | ret->type = 2; | - | ||||||||||||||||||||||||
| 262 | if (len 
 | 0 | ||||||||||||||||||||||||
| 263 | if ((* 
 
 
 
 | 0 | ||||||||||||||||||||||||
| 264 | p++; | - | ||||||||||||||||||||||||
| 265 | len--; | - | ||||||||||||||||||||||||
| 266 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 267 | memcpy(s, p, len); | - | ||||||||||||||||||||||||
| 268 | p += len; | - | ||||||||||||||||||||||||
| 269 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 270 | - | |||||||||||||||||||||||||
| 271 | free(ret->data); | - | ||||||||||||||||||||||||
| 272 | ret->data = s; | - | ||||||||||||||||||||||||
| 273 | ret->length = (int)len; | - | ||||||||||||||||||||||||
| 274 | if (a != 
 | 0 | ||||||||||||||||||||||||
| 275 | ((void *)0) 
 | 0 | ||||||||||||||||||||||||
| 276 | ) | - | ||||||||||||||||||||||||
| 277 | (* never executed: a) = ret; (*a) = ret;never executed:  (*a) = ret; | 0 | ||||||||||||||||||||||||
| 278 | *pp = p; | - | ||||||||||||||||||||||||
| 279 | return never executed: (ret); return (ret);never executed:  return (ret); | 0 | ||||||||||||||||||||||||
| 280 | - | |||||||||||||||||||||||||
| 281 | err: | - | ||||||||||||||||||||||||
| 282 | ERR_put_error(13,(0xfff),(i),__FILE__,335); | - | ||||||||||||||||||||||||
| 283 | if (a == 
 | 0 | ||||||||||||||||||||||||
| 284 | ((void *)0) 
 | 0 | ||||||||||||||||||||||||
| 285 | || * 
 
 | 0 | ||||||||||||||||||||||||
| 286 | ASN1_INTEGER_free(ret); never executed:  ASN1_INTEGER_free(ret); | 0 | ||||||||||||||||||||||||
| 287 | return never executed: ( return ( ((void *)0) );never executed:  return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 288 | ((void *)0) never executed:  return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 289 | ); never executed:  return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 290 | } | - | ||||||||||||||||||||||||
| 291 | - | |||||||||||||||||||||||||
| 292 | int | - | ||||||||||||||||||||||||
| 293 | ASN1_INTEGER_set(ASN1_INTEGER *a, long v) | - | ||||||||||||||||||||||||
| 294 | { | - | ||||||||||||||||||||||||
| 295 | int j, k; | - | ||||||||||||||||||||||||
| 296 | unsigned int i; | - | ||||||||||||||||||||||||
| 297 | unsigned char buf[sizeof(long) + 1]; | - | ||||||||||||||||||||||||
| 298 | long d; | - | ||||||||||||||||||||||||
| 299 | - | |||||||||||||||||||||||||
| 300 | a->type = 2; | - | ||||||||||||||||||||||||
| 301 | - | |||||||||||||||||||||||||
| 302 | if (a->length < (int)(sizeof(long) + 1) 
 | 0-16 | ||||||||||||||||||||||||
| 303 | free(a->data); | - | ||||||||||||||||||||||||
| 304 | a->data = calloc(1, sizeof(long) + 1); | - | ||||||||||||||||||||||||
| 305 | } executed 16 times by 3 tests:  end of blockExecuted by: 
 | 16 | ||||||||||||||||||||||||
| 306 | if (a->data == 
 | 0-16 | ||||||||||||||||||||||||
| 307 | ((void *)0) 
 | 0-16 | ||||||||||||||||||||||||
| 308 | ) { | - | ||||||||||||||||||||||||
| 309 | ERR_put_error(13,(0xfff),((1|64)),__FILE__,356); | - | ||||||||||||||||||||||||
| 310 | return never executed: (0); return (0);never executed:  return (0); | 0 | ||||||||||||||||||||||||
| 311 | } | - | ||||||||||||||||||||||||
| 312 | d = v; | - | ||||||||||||||||||||||||
| 313 | if (d < 0 
 | 0-16 | ||||||||||||||||||||||||
| 314 | d = -d; | - | ||||||||||||||||||||||||
| 315 | a->type = (2 | 0x100); | - | ||||||||||||||||||||||||
| 316 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 317 | - | |||||||||||||||||||||||||
| 318 | for (i = 0; i < sizeof(long) 
 | 0-30 | ||||||||||||||||||||||||
| 319 | if (d == 0 
 | 14-16 | ||||||||||||||||||||||||
| 320 | break; executed 16 times by 3 tests:  break;Executed by: 
 | 16 | ||||||||||||||||||||||||
| 321 | buf[i] = (int)d & 0xff; | - | ||||||||||||||||||||||||
| 322 | d >>= 8; | - | ||||||||||||||||||||||||
| 323 | } executed 14 times by 2 tests:  end of blockExecuted by: 
 | 14 | ||||||||||||||||||||||||
| 324 | j = 0; | - | ||||||||||||||||||||||||
| 325 | for (k = i - 1; k >= 0 
 | 14-16 | ||||||||||||||||||||||||
| 326 | a->data[j++] = buf[k]; executed 14 times by 2 tests:  a->data[j++] = buf[k];Executed by: 
 | 14 | ||||||||||||||||||||||||
| 327 | a->length = j; | - | ||||||||||||||||||||||||
| 328 | return executed 16 times by 3 tests: (1); return (1);Executed by: 
 executed 16 times by 3 tests:  return (1);Executed by: 
 | 16 | ||||||||||||||||||||||||
| 329 | } | - | ||||||||||||||||||||||||
| 330 | - | |||||||||||||||||||||||||
| 331 | long | - | ||||||||||||||||||||||||
| 332 | ASN1_INTEGER_get(const ASN1_INTEGER *a) | - | ||||||||||||||||||||||||
| 333 | { | - | ||||||||||||||||||||||||
| 334 | int neg = 0, i; | - | ||||||||||||||||||||||||
| 335 | long r = 0; | - | ||||||||||||||||||||||||
| 336 | - | |||||||||||||||||||||||||
| 337 | if (a == 
 | 2-204 | ||||||||||||||||||||||||
| 338 | ((void *)0) 
 | 2-204 | ||||||||||||||||||||||||
| 339 | ) | - | ||||||||||||||||||||||||
| 340 | return executed 2 times by 1 test: (0L); return (0L);Executed by: 
 executed 2 times by 1 test:  return (0L);Executed by: 
 | 2 | ||||||||||||||||||||||||
| 341 | i = a->type; | - | ||||||||||||||||||||||||
| 342 | if (i == (2 | 0x100) 
 | 0-204 | ||||||||||||||||||||||||
| 343 | neg = 1; never executed:  neg = 1; | 0 | ||||||||||||||||||||||||
| 344 | else if (i != 2 
 | 0-204 | ||||||||||||||||||||||||
| 345 | return never executed: -1; return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 346 | - | |||||||||||||||||||||||||
| 347 | if (a->length > (int)sizeof(long) 
 | 0-204 | ||||||||||||||||||||||||
| 348 | - | |||||||||||||||||||||||||
| 349 | return never executed: -1; return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 350 | } | - | ||||||||||||||||||||||||
| 351 | if (a->data == 
 | 0-204 | ||||||||||||||||||||||||
| 352 | ((void *)0) 
 | 0-204 | ||||||||||||||||||||||||
| 353 | ) | - | ||||||||||||||||||||||||
| 354 | return never executed: 0; return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 355 | - | |||||||||||||||||||||||||
| 356 | for (i = 0; i < a->length 
 | 204-231 | ||||||||||||||||||||||||
| 357 | r <<= 8; | - | ||||||||||||||||||||||||
| 358 | r |= (unsigned char)a->data[i]; | - | ||||||||||||||||||||||||
| 359 | } executed 231 times by 7 tests:  end of blockExecuted by: 
 | 231 | ||||||||||||||||||||||||
| 360 | if (neg 
 | 0-204 | ||||||||||||||||||||||||
| 361 | r = -r; never executed:  r = -r; | 0 | ||||||||||||||||||||||||
| 362 | return executed 204 times by 7 tests: (r); return (r);Executed by: 
 executed 204 times by 7 tests:  return (r);Executed by: 
 | 204 | ||||||||||||||||||||||||
| 363 | } | - | ||||||||||||||||||||||||
| 364 | - | |||||||||||||||||||||||||
| 365 | ASN1_INTEGER * | - | ||||||||||||||||||||||||
| 366 | BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai) | - | ||||||||||||||||||||||||
| 367 | { | - | ||||||||||||||||||||||||
| 368 | ASN1_INTEGER *ret; | - | ||||||||||||||||||||||||
| 369 | int len, j; | - | ||||||||||||||||||||||||
| 370 | - | |||||||||||||||||||||||||
| 371 | if (ai == 
 | 1-2 | ||||||||||||||||||||||||
| 372 | ((void *)0) 
 | 1-2 | ||||||||||||||||||||||||
| 373 | ) | - | ||||||||||||||||||||||||
| 374 | ret = ASN1_INTEGER_new(); executed 1 time by 1 test:  ret = ASN1_INTEGER_new();Executed by: 
 | 1 | ||||||||||||||||||||||||
| 375 | else | - | ||||||||||||||||||||||||
| 376 | ret = ai; executed 2 times by 1 test:  ret = ai;Executed by: 
 | 2 | ||||||||||||||||||||||||
| 377 | if (ret == 
 | 0-3 | ||||||||||||||||||||||||
| 378 | ((void *)0) 
 | 0-3 | ||||||||||||||||||||||||
| 379 | ) { | - | ||||||||||||||||||||||||
| 380 | ERR_put_error(13,(0xfff),(58),__FILE__,419); | - | ||||||||||||||||||||||||
| 381 | goto never executed: err; goto err;never executed:  goto err; | 0 | ||||||||||||||||||||||||
| 382 | } | - | ||||||||||||||||||||||||
| 383 | if ((( 
 
 | 0-3 | ||||||||||||||||||||||||
| 384 | ret->type = (2 | 0x100); never executed:  ret->type = (2 | 0x100); | 0 | ||||||||||||||||||||||||
| 385 | else | - | ||||||||||||||||||||||||
| 386 | ret->type = 2; executed 3 times by 1 test:  ret->type = 2;Executed by: 
 | 3 | ||||||||||||||||||||||||
| 387 | j = BN_num_bits(bn); | - | ||||||||||||||||||||||||
| 388 | len = (( 
 
 | 0-3 | ||||||||||||||||||||||||
| 389 | if (ret->length < len + 4 
 | 0-3 | ||||||||||||||||||||||||
| 390 | unsigned char *new_data = realloc(ret->data, len + 4); | - | ||||||||||||||||||||||||
| 391 | if (!new_data 
 | 0-3 | ||||||||||||||||||||||||
| 392 | ERR_put_error(13,(0xfff),((1|64)),__FILE__,431); | - | ||||||||||||||||||||||||
| 393 | goto never executed: err; goto err;never executed:  goto err; | 0 | ||||||||||||||||||||||||
| 394 | } | - | ||||||||||||||||||||||||
| 395 | ret->data = new_data; | - | ||||||||||||||||||||||||
| 396 | } executed 3 times by 1 test:  end of blockExecuted by: 
 | 3 | ||||||||||||||||||||||||
| 397 | ret->length = BN_bn2bin(bn, ret->data); | - | ||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||
| 399 | - | |||||||||||||||||||||||||
| 400 | if (!ret->length 
 | 0-3 | ||||||||||||||||||||||||
| 401 | ret->data[0] = 0; | - | ||||||||||||||||||||||||
| 402 | ret->length = 1; | - | ||||||||||||||||||||||||
| 403 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 404 | return executed 3 times by 1 test: (ret); return (ret);Executed by: 
 executed 3 times by 1 test:  return (ret);Executed by: 
 | 3 | ||||||||||||||||||||||||
| 405 | - | |||||||||||||||||||||||||
| 406 | err: | - | ||||||||||||||||||||||||
| 407 | if (ret != ai 
 | 0 | ||||||||||||||||||||||||
| 408 | ASN1_INTEGER_free(ret); never executed:  ASN1_INTEGER_free(ret); | 0 | ||||||||||||||||||||||||
| 409 | return never executed: ( return ( ((void *)0) );never executed:  return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 410 | ((void *)0) never executed:  return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 411 | ); never executed:  return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
| 412 | } | - | ||||||||||||||||||||||||
| 413 | - | |||||||||||||||||||||||||
| 414 | BIGNUM * | - | ||||||||||||||||||||||||
| 415 | ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn) | - | ||||||||||||||||||||||||
| 416 | { | - | ||||||||||||||||||||||||
| 417 | BIGNUM *ret; | - | ||||||||||||||||||||||||
| 418 | - | |||||||||||||||||||||||||
| 419 | if (( 
 
 | 0-2 | ||||||||||||||||||||||||
| 420 | ((void *)0) 
 | 0-2 | ||||||||||||||||||||||||
| 421 | ) | - | ||||||||||||||||||||||||
| 422 | ERR_put_error(13,(0xfff),(105),__FILE__,457); never executed:  ERR_put_error(13,(0xfff),(105),__FILE__,457); | 0 | ||||||||||||||||||||||||
| 423 | else if (ai->type == (2 | 0x100) 
 | 0-2 | ||||||||||||||||||||||||
| 424 | BN_set_negative(ret, 1); never executed:  BN_set_negative(ret, 1); | 0 | ||||||||||||||||||||||||
| 425 | return executed 2 times by 1 test: (ret); return (ret);Executed by: 
 executed 2 times by 1 test:  return (ret);Executed by: 
 | 2 | ||||||||||||||||||||||||
| 426 | } | - | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |