| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | int | - |
| 4 | i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a) | - |
| 5 | { | - |
| 6 | int i, n = 0; | - |
| 7 | static const char h[] = "0123456789ABCDEF"; | - |
| 8 | char buf[2]; | - |
| 9 | | - |
| 10 | if (a == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 11 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 12 | ) | - |
| 13 | return never executed: return (0); (0);never executed: return (0); | 0 |
| 14 | | - |
| 15 | if (a->type & 0x100| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 16 | if (BIO_write(bp, "-", 1) != 1| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 17 | goto never executed: goto err; err;never executed: goto err; | 0 |
| 18 | n = 1; | - |
| 19 | } never executed: end of block | 0 |
| 20 | | - |
| 21 | if (a->length == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 22 | if (BIO_write(bp, "00", 2) != 2| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 23 | goto never executed: goto err; err;never executed: goto err; | 0 |
| 24 | n += 2; | - |
| 25 | } never executed: end of block else { | 0 |
| 26 | for (i = 0; i < a->length| TRUE | never evaluated | | FALSE | never evaluated |
; i++) { | 0 |
| 27 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
i != 0)| TRUE | never evaluated | | FALSE | never evaluated |
&& (| TRUE | never evaluated | | FALSE | never evaluated |
i % 35 == 0)| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 28 | if (BIO_write(bp, "\\\n", 2) != 2| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 29 | goto never executed: goto err; err;never executed: goto err; | 0 |
| 30 | n += 2; | - |
| 31 | } never executed: end of block | 0 |
| 32 | buf[0] = h[((unsigned char)a->data[i] >> 4) & 0x0f]; | - |
| 33 | buf[1] = h[((unsigned char)a->data[i]) & 0x0f]; | - |
| 34 | if (BIO_write(bp, buf, 2) != 2| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 35 | goto never executed: goto err; err;never executed: goto err; | 0 |
| 36 | n += 2; | - |
| 37 | } never executed: end of block | 0 |
| 38 | } never executed: end of block | 0 |
| 39 | return never executed: return (n); (n);never executed: return (n); | 0 |
| 40 | | - |
| 41 | err: | - |
| 42 | return never executed: return (-1); (-1);never executed: return (-1); | 0 |
| 43 | } | - |
| 44 | | - |
| 45 | int | - |
| 46 | a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size) | - |
| 47 | { | - |
| 48 | int ret = 0; | - |
| 49 | int i, j,k, m,n, again, bufsize; | - |
| 50 | unsigned char *s = | - |
| 51 | ((void *)0) | - |
| 52 | , *sp; | - |
| 53 | unsigned char *bufp; | - |
| 54 | int num = 0, slen = 0, first = 1; | - |
| 55 | | - |
| 56 | bs->type = 2; | - |
| 57 | | - |
| 58 | bufsize = BIO_gets(bp, buf, size); | - |
| 59 | for (;;) { | - |
| 60 | if (bufsize < 1| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 61 | goto never executed: goto err_sl; err_sl;never executed: goto err_sl; | 0 |
| 62 | i = bufsize; | - |
| 63 | if (buf[i - 1] == '\n'| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 64 | buf[--i] = '\0'; never executed: buf[--i] = '\0'; | 0 |
| 65 | if (i == 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 66 | goto never executed: goto err_sl; err_sl;never executed: goto err_sl; | 0 |
| 67 | if (buf[i - 1] == '\r'| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 68 | buf[--i] = '\0'; never executed: buf[--i] = '\0'; | 0 |
| 69 | if (i == 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 70 | goto never executed: goto err_sl; err_sl;never executed: goto err_sl; | 0 |
| 71 | again = (buf[i - 1] == '\\'); | - |
| 72 | | - |
| 73 | for (j = 0; j < i| TRUE | never evaluated | | FALSE | never evaluated |
; j++) { | 0 |
| 74 | if (!(((| TRUE | never evaluated | | FALSE | never evaluated |
buf[j] >= '0')| TRUE | never evaluated | | FALSE | never evaluated |
&& (| TRUE | never evaluated | | FALSE | never evaluated |
buf[j] <= '9')| TRUE | never evaluated | | FALSE | never evaluated |
) || | 0 |
| 75 | ((| TRUE | never evaluated | | FALSE | never evaluated |
buf[j] >= 'a')| TRUE | never evaluated | | FALSE | never evaluated |
&& (| TRUE | never evaluated | | FALSE | never evaluated |
buf[j] <= 'f')| TRUE | never evaluated | | FALSE | never evaluated |
) || | 0 |
| 76 | ((| TRUE | never evaluated | | FALSE | never evaluated |
buf[j] >= 'A')| TRUE | never evaluated | | FALSE | never evaluated |
&& (| TRUE | never evaluated | | FALSE | never evaluated |
buf[j] <= 'F')| TRUE | never evaluated | | FALSE | never evaluated |
))) { | 0 |
| 77 | i = j; | - |
| 78 | break; never executed: break; | 0 |
| 79 | } | - |
| 80 | } never executed: end of block | 0 |
| 81 | buf[i] = '\0'; | - |
| 82 | | - |
| 83 | | - |
| 84 | if (i < 2| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 85 | goto never executed: goto err_sl; err_sl;never executed: goto err_sl; | 0 |
| 86 | | - |
| 87 | bufp = (unsigned char *)buf; | - |
| 88 | if (first| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 89 | first = 0; | - |
| 90 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
bufp[0] == '0')| TRUE | never evaluated | | FALSE | never evaluated |
&& (| TRUE | never evaluated | | FALSE | never evaluated |
buf[1] == '0')| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 91 | bufp += 2; | - |
| 92 | i -= 2; | - |
| 93 | } never executed: end of block | 0 |
| 94 | } never executed: end of block | 0 |
| 95 | k = 0; | - |
| 96 | i -= again; | - |
| 97 | if (i % 2 != 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 98 | ERR_put_error(13,(0xfff),(145),__FILE__,156); | - |
| 99 | goto never executed: goto err; err;never executed: goto err; | 0 |
| 100 | } | - |
| 101 | i /= 2; | - |
| 102 | if (num + i > slen| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 103 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
sp = recallocarray(s, slen, num + i, 1)) == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 104 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 105 | ) { | - |
| 106 | ERR_put_error(13,(0xfff),((1|64)),__FILE__,162); | - |
| 107 | goto never executed: goto err; err;never executed: goto err; | 0 |
| 108 | } | - |
| 109 | s = sp; | - |
| 110 | slen = num + i; | - |
| 111 | } never executed: end of block | 0 |
| 112 | for (j = 0; j < i| TRUE | never evaluated | | FALSE | never evaluated |
; j++, k += 2) { | 0 |
| 113 | for (n = 0; n < 2| TRUE | never evaluated | | FALSE | never evaluated |
; n++) { | 0 |
| 114 | m = bufp[k + n]; | - |
| 115 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
m >= '0')| TRUE | never evaluated | | FALSE | never evaluated |
&& (| TRUE | never evaluated | | FALSE | never evaluated |
m <= '9')| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 116 | m -= '0'; never executed: m -= '0'; | 0 |
| 117 | else if ((| TRUE | never evaluated | | FALSE | never evaluated |
m >= 'a')| TRUE | never evaluated | | FALSE | never evaluated |
&& (| TRUE | never evaluated | | FALSE | never evaluated |
m <= 'f')| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 118 | m = m - 'a' + 10; never executed: m = m - 'a' + 10; | 0 |
| 119 | else if ((| TRUE | never evaluated | | FALSE | never evaluated |
m >= 'A')| TRUE | never evaluated | | FALSE | never evaluated |
&& (| TRUE | never evaluated | | FALSE | never evaluated |
m <= 'F')| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 120 | m = m - 'A' + 10; never executed: m = m - 'A' + 10; | 0 |
| 121 | else { | - |
| 122 | ERR_put_error(13,(0xfff),(141),__FILE__,178); | - |
| 123 | goto never executed: goto err; err;never executed: goto err; | 0 |
| 124 | } | - |
| 125 | s[num + j] <<= 4; | - |
| 126 | s[num + j] |= m; | - |
| 127 | } never executed: end of block | 0 |
| 128 | } never executed: end of block | 0 |
| 129 | num += i; | - |
| 130 | if (again| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 131 | bufsize = BIO_gets(bp, buf, size); never executed: bufsize = BIO_gets(bp, buf, size); | 0 |
| 132 | else | - |
| 133 | break; never executed: break; | 0 |
| 134 | } | - |
| 135 | bs->length = num; | - |
| 136 | bs->data = s; | - |
| 137 | return never executed: return (1); (1);never executed: return (1); | 0 |
| 138 | | - |
| 139 | err_sl: | - |
| 140 | ERR_put_error(13,(0xfff),(150),__FILE__,196); | - |
| 141 | err: code before this statement never executed: err: | 0 |
| 142 | free(s); | - |
| 143 | return never executed: return (ret); (ret);never executed: return (ret); | 0 |
| 144 | } | - |
| | |