| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/f_string.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | int i2a_ASN1_STRING(BIO *bp, const ASN1_STRING *a, int type) | - | ||||||||||||||||||||||||
| 4 | { | - | ||||||||||||||||||||||||
| 5 | int i, n = 0; | - | ||||||||||||||||||||||||
| 6 | static const char *h = "0123456789ABCDEF"; | - | ||||||||||||||||||||||||
| 7 | char buf[2]; | - | ||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||
| 9 | if (a ==
| 0-982 | ||||||||||||||||||||||||
| 10 | ((void *)0)
| 0-982 | ||||||||||||||||||||||||
| 11 | ) | - | ||||||||||||||||||||||||
| 12 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||
| 14 | if (a->length == 0
| 468-514 | ||||||||||||||||||||||||
| 15 | if (BIO_write(bp, "0", 1) != 1
| 0-514 | ||||||||||||||||||||||||
| 16 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 17 | n = 1; | - | ||||||||||||||||||||||||
| 18 | } executed 514 times by 1 test: else {end of blockExecuted by:
| 514 | ||||||||||||||||||||||||
| 19 | for (i = 0; i < a->length
| 468-16828 | ||||||||||||||||||||||||
| 20 | if ((
| 393-16360 | ||||||||||||||||||||||||
| 21 | if (BIO_write(bp, "\\\n", 2) != 2
| 0-393 | ||||||||||||||||||||||||
| 22 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 23 | n += 2; | - | ||||||||||||||||||||||||
| 24 | } executed 393 times by 1 test: end of blockExecuted by:
| 393 | ||||||||||||||||||||||||
| 25 | buf[0] = h[((unsigned char)a->data[i] >> 4) & 0x0f]; | - | ||||||||||||||||||||||||
| 26 | buf[1] = h[((unsigned char)a->data[i]) & 0x0f]; | - | ||||||||||||||||||||||||
| 27 | if (BIO_write(bp, buf, 2) != 2
| 0-16828 | ||||||||||||||||||||||||
| 28 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 29 | n += 2; | - | ||||||||||||||||||||||||
| 30 | } executed 16828 times by 1 test: end of blockExecuted by:
| 16828 | ||||||||||||||||||||||||
| 31 | } executed 468 times by 1 test: end of blockExecuted by:
| 468 | ||||||||||||||||||||||||
| 32 | return executed 982 times by 1 test: n;return n;Executed by:
executed 982 times by 1 test: return n;Executed by:
| 982 | ||||||||||||||||||||||||
| 33 | err: | - | ||||||||||||||||||||||||
| 34 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 35 | } | - | ||||||||||||||||||||||||
| 36 | - | |||||||||||||||||||||||||
| 37 | int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size) | - | ||||||||||||||||||||||||
| 38 | { | - | ||||||||||||||||||||||||
| 39 | int i, j, k, m, n, again, bufsize; | - | ||||||||||||||||||||||||
| 40 | unsigned char *s = | - | ||||||||||||||||||||||||
| 41 | ((void *)0) | - | ||||||||||||||||||||||||
| 42 | , *sp; | - | ||||||||||||||||||||||||
| 43 | unsigned char *bufp; | - | ||||||||||||||||||||||||
| 44 | int num = 0, slen = 0, first = 1; | - | ||||||||||||||||||||||||
| 45 | - | |||||||||||||||||||||||||
| 46 | bufsize = BIO_gets(bp, buf, size); | - | ||||||||||||||||||||||||
| 47 | for (;;) { | - | ||||||||||||||||||||||||
| 48 | if (bufsize < 1
| 0 | ||||||||||||||||||||||||
| 49 | if (first
| 0 | ||||||||||||||||||||||||
| 50 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 51 | else | - | ||||||||||||||||||||||||
| 52 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 53 | } | - | ||||||||||||||||||||||||
| 54 | first = 0; | - | ||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||
| 56 | i = bufsize; | - | ||||||||||||||||||||||||
| 57 | if (buf[i - 1] == '\n'
| 0 | ||||||||||||||||||||||||
| 58 | buf[--i] = '\0'; never executed: buf[--i] = '\0'; | 0 | ||||||||||||||||||||||||
| 59 | if (i == 0
| 0 | ||||||||||||||||||||||||
| 60 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 61 | if (buf[i - 1] == '\r'
| 0 | ||||||||||||||||||||||||
| 62 | buf[--i] = '\0'; never executed: buf[--i] = '\0'; | 0 | ||||||||||||||||||||||||
| 63 | if (i == 0
| 0 | ||||||||||||||||||||||||
| 64 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 65 | again = (buf[i - 1] == '\\'); | - | ||||||||||||||||||||||||
| 66 | - | |||||||||||||||||||||||||
| 67 | for (j = i - 1; j > 0
| 0 | ||||||||||||||||||||||||
| 68 | if (!(ossl_ctype_check((buf[j]), 0x10))
| 0 | ||||||||||||||||||||||||
| 69 | i = j; | - | ||||||||||||||||||||||||
| 70 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 71 | } | - | ||||||||||||||||||||||||
| 72 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 73 | buf[i] = '\0'; | - | ||||||||||||||||||||||||
| 74 | - | |||||||||||||||||||||||||
| 75 | - | |||||||||||||||||||||||||
| 76 | - | |||||||||||||||||||||||||
| 77 | if (i < 2
| 0 | ||||||||||||||||||||||||
| 78 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 79 | - | |||||||||||||||||||||||||
| 80 | bufp = (unsigned char *)buf; | - | ||||||||||||||||||||||||
| 81 | - | |||||||||||||||||||||||||
| 82 | k = 0; | - | ||||||||||||||||||||||||
| 83 | i -= again; | - | ||||||||||||||||||||||||
| 84 | if (i % 2 != 0
| 0 | ||||||||||||||||||||||||
| 85 | ERR_put_error(13,(103),(145),__FILE__,94); | - | ||||||||||||||||||||||||
| 86 | CRYPTO_free(s, __FILE__, 95); | - | ||||||||||||||||||||||||
| 87 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 88 | } | - | ||||||||||||||||||||||||
| 89 | i /= 2; | - | ||||||||||||||||||||||||
| 90 | if (num + i > slen
| 0 | ||||||||||||||||||||||||
| 91 | sp = CRYPTO_realloc(s, (unsigned int)num + i * 2, __FILE__, 100); | - | ||||||||||||||||||||||||
| 92 | if (sp ==
| 0 | ||||||||||||||||||||||||
| 93 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 94 | ) { | - | ||||||||||||||||||||||||
| 95 | ERR_put_error(13,(103),((1|64)),__FILE__,102); | - | ||||||||||||||||||||||||
| 96 | CRYPTO_free(s, __FILE__, 103); | - | ||||||||||||||||||||||||
| 97 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 98 | } | - | ||||||||||||||||||||||||
| 99 | s = sp; | - | ||||||||||||||||||||||||
| 100 | slen = num + i * 2; | - | ||||||||||||||||||||||||
| 101 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 102 | for (j = 0; j < i
| 0 | ||||||||||||||||||||||||
| 103 | for (n = 0; n < 2
| 0 | ||||||||||||||||||||||||
| 104 | m = OPENSSL_hexchar2int(bufp[k + n]); | - | ||||||||||||||||||||||||
| 105 | if (m < 0
| 0 | ||||||||||||||||||||||||
| 106 | ERR_put_error(13,(103),(141),__FILE__,114) | - | ||||||||||||||||||||||||
| 107 | ; | - | ||||||||||||||||||||||||
| 108 | CRYPTO_free(s, __FILE__, 115); | - | ||||||||||||||||||||||||
| 109 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 110 | } | - | ||||||||||||||||||||||||
| 111 | s[num + j] <<= 4; | - | ||||||||||||||||||||||||
| 112 | s[num + j] |= m; | - | ||||||||||||||||||||||||
| 113 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 114 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 115 | num += i; | - | ||||||||||||||||||||||||
| 116 | if (again
| 0 | ||||||||||||||||||||||||
| 117 | bufsize = BIO_gets(bp, buf, size); never executed: bufsize = BIO_gets(bp, buf, size); | 0 | ||||||||||||||||||||||||
| 118 | else | - | ||||||||||||||||||||||||
| 119 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 120 | } | - | ||||||||||||||||||||||||
| 121 | bs->length = num; | - | ||||||||||||||||||||||||
| 122 | bs->data = s; | - | ||||||||||||||||||||||||
| 123 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 124 | - | |||||||||||||||||||||||||
| 125 | err: | - | ||||||||||||||||||||||||
| 126 | ERR_put_error(13,(103),(150),__FILE__,133); | - | ||||||||||||||||||||||||
| 127 | CRYPTO_free(s, __FILE__, 134); | - | ||||||||||||||||||||||||
| 128 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 129 | } | - | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |