| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/asn1_lib.c | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||||||||
| 2 | static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, | - | ||||||||||||||||||||||||||||||||||||
| 3 | long max); | - | ||||||||||||||||||||||||||||||||||||
| 4 | static void asn1_put_length(unsigned char **pp, int length); | - | ||||||||||||||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||||||||||||||
| 6 | static int _asn1_check_infinite_end(const unsigned char **p, long len) | - | ||||||||||||||||||||||||||||||||||||
| 7 | { | - | ||||||||||||||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||||||||||||||
| 11 |     if (len <= 0
  | 0 | ||||||||||||||||||||||||||||||||||||
| 12 |         return never executed:   1;return 1;never executed:  return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 13 |     else if ((
 
 
 
 
 
  | 0 | ||||||||||||||||||||||||||||||||||||
| 14 | (*p) += 2; | - | ||||||||||||||||||||||||||||||||||||
| 15 |         return never executed:   1;return 1;never executed:  return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 16 | } | - | ||||||||||||||||||||||||||||||||||||
| 17 |     return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 18 | } | - | ||||||||||||||||||||||||||||||||||||
| 19 | - | |||||||||||||||||||||||||||||||||||||
| 20 | int ASN1_check_infinite_end(unsigned char **p, long len) | - | ||||||||||||||||||||||||||||||||||||
| 21 | { | - | ||||||||||||||||||||||||||||||||||||
| 22 |     return never executed:   _asn1_check_infinite_end((const unsigned char **)p, len);return _asn1_check_infinite_end((const unsigned char **)p, len);never executed:  return _asn1_check_infinite_end((const unsigned char **)p, len); | 0 | ||||||||||||||||||||||||||||||||||||
| 23 | } | - | ||||||||||||||||||||||||||||||||||||
| 24 | - | |||||||||||||||||||||||||||||||||||||
| 25 | int ASN1_const_check_infinite_end(const unsigned char **p, long len) | - | ||||||||||||||||||||||||||||||||||||
| 26 | { | - | ||||||||||||||||||||||||||||||||||||
| 27 |     return never executed:   _asn1_check_infinite_end(p, len);return _asn1_check_infinite_end(p, len);never executed:  return _asn1_check_infinite_end(p, len); | 0 | ||||||||||||||||||||||||||||||||||||
| 28 | } | - | ||||||||||||||||||||||||||||||||||||
| 29 | - | |||||||||||||||||||||||||||||||||||||
| 30 | int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, | - | ||||||||||||||||||||||||||||||||||||
| 31 | int *pclass, long omax) | - | ||||||||||||||||||||||||||||||||||||
| 32 | { | - | ||||||||||||||||||||||||||||||||||||
| 33 | int i, ret; | - | ||||||||||||||||||||||||||||||||||||
| 34 | long l; | - | ||||||||||||||||||||||||||||||||||||
| 35 | const unsigned char *p = *pp; | - | ||||||||||||||||||||||||||||||||||||
| 36 | int tag, xclass, inf; | - | ||||||||||||||||||||||||||||||||||||
| 37 | long max = omax; | - | ||||||||||||||||||||||||||||||||||||
| 38 | - | |||||||||||||||||||||||||||||||||||||
| 39 |     if (!max
  | 2805-12288196 | ||||||||||||||||||||||||||||||||||||
| 40 |         goto executed 2805 times by 1 test:   err;goto err;Executed by: 
 executed 2805 times by 1 test:  goto err;Executed by: 
  | 2805 | ||||||||||||||||||||||||||||||||||||
| 41 | ret = (*p & 0x20); | - | ||||||||||||||||||||||||||||||||||||
| 42 | xclass = (*p & 0xc0); | - | ||||||||||||||||||||||||||||||||||||
| 43 | i = *p & 0x1f; | - | ||||||||||||||||||||||||||||||||||||
| 44 |     if (i == 0x1f
  | 42636-12245560 | ||||||||||||||||||||||||||||||||||||
| 45 | p++; | - | ||||||||||||||||||||||||||||||||||||
| 46 |         if (--
 
  | 1080-41556 | ||||||||||||||||||||||||||||||||||||
| 47 |             goto executed 1080 times by 1 test:   err;goto err;Executed by: 
 executed 1080 times by 1 test:  goto err;Executed by: 
  | 1080 | ||||||||||||||||||||||||||||||||||||
| 48 | l = 0; | - | ||||||||||||||||||||||||||||||||||||
| 49 |         while (*
 
  | 19850-39885 | ||||||||||||||||||||||||||||||||||||
| 50 | l <<= 7L; | - | ||||||||||||||||||||||||||||||||||||
| 51 | l |= *(p++) & 0x7f; | - | ||||||||||||||||||||||||||||||||||||
| 52 |             if (--
 
  | 819-19031 | ||||||||||||||||||||||||||||||||||||
| 53 |                 goto executed 819 times by 1 test:   err;goto err;Executed by: 
 executed 819 times by 1 test:  goto err;Executed by: 
  | 819 | ||||||||||||||||||||||||||||||||||||
| 54 |             if (l > (0x7fffffff >> 7L)
  | 852-18179 | ||||||||||||||||||||||||||||||||||||
| 55 |                 goto executed 852 times by 1 test:   err;goto err;Executed by: 
 executed 852 times by 1 test:  goto err;Executed by: 
  | 852 | ||||||||||||||||||||||||||||||||||||
| 56 |         } executed 18179 times by 1 test:  end of blockExecuted by: 
  | 18179 | ||||||||||||||||||||||||||||||||||||
| 57 | l <<= 7L; | - | ||||||||||||||||||||||||||||||||||||
| 58 | l |= *(p++) & 0x7f; | - | ||||||||||||||||||||||||||||||||||||
| 59 | tag = (int)l; | - | ||||||||||||||||||||||||||||||||||||
| 60 |         if (--
 
  | 1219-38666 | ||||||||||||||||||||||||||||||||||||
| 61 |             goto executed 1219 times by 1 test:   err;goto err;Executed by: 
 executed 1219 times by 1 test:  goto err;Executed by: 
  | 1219 | ||||||||||||||||||||||||||||||||||||
| 62 |     } executed 38666 times by 1 test:   else {end of blockExecuted by: 
  | 38666 | ||||||||||||||||||||||||||||||||||||
| 63 | tag = i; | - | ||||||||||||||||||||||||||||||||||||
| 64 | p++; | - | ||||||||||||||||||||||||||||||||||||
| 65 |         if (--
 
  | 8459-12237101 | ||||||||||||||||||||||||||||||||||||
| 66 |             goto executed 8459 times by 1 test:   err;goto err;Executed by: 
 executed 8459 times by 1 test:  goto err;Executed by: 
  | 8459 | ||||||||||||||||||||||||||||||||||||
| 67 |     } executed 12237101 times by 2 tests:  end of blockExecuted by: 
  | 12237101 | ||||||||||||||||||||||||||||||||||||
| 68 | *ptag = tag; | - | ||||||||||||||||||||||||||||||||||||
| 69 | *pclass = xclass; | - | ||||||||||||||||||||||||||||||||||||
| 70 |     if (!asn1_get_length(&p, &inf, plength, max)
  | 9320-12266447 | ||||||||||||||||||||||||||||||||||||
| 71 |         goto executed 9320 times by 1 test:   err;goto err;Executed by: 
 executed 9320 times by 1 test:  goto err;Executed by: 
  | 9320 | ||||||||||||||||||||||||||||||||||||
| 72 | - | |||||||||||||||||||||||||||||||||||||
| 73 |     if (inf
 
  | 2136-8603460 | ||||||||||||||||||||||||||||||||||||
| 74 |         goto executed 2136 times by 1 test:   err;goto err;Executed by: 
 executed 2136 times by 1 test:  goto err;Executed by: 
  | 2136 | ||||||||||||||||||||||||||||||||||||
| 75 | - | |||||||||||||||||||||||||||||||||||||
| 76 |     if (*
 
  | 46553-12217758 | ||||||||||||||||||||||||||||||||||||
| 77 | ERR_put_error(13,(114),(155),__FILE__,91); | - | ||||||||||||||||||||||||||||||||||||
| 78 | - | |||||||||||||||||||||||||||||||||||||
| 79 | - | |||||||||||||||||||||||||||||||||||||
| 80 | - | |||||||||||||||||||||||||||||||||||||
| 81 | - | |||||||||||||||||||||||||||||||||||||
| 82 | ret |= 0x80; | - | ||||||||||||||||||||||||||||||||||||
| 83 |     } executed 46553 times by 1 test:  end of blockExecuted by: 
  | 46553 | ||||||||||||||||||||||||||||||||||||
| 84 | *pp = p; | - | ||||||||||||||||||||||||||||||||||||
| 85 |     return executed 12264311 times by 2 tests:   ret | inf;return ret | inf;Executed by: 
 executed 12264311 times by 2 tests:  return ret | inf;Executed by: 
  | 12264311 | ||||||||||||||||||||||||||||||||||||
| 86 | err: | - | ||||||||||||||||||||||||||||||||||||
| 87 | ERR_put_error(13,(114),(123),__FILE__,101); | - | ||||||||||||||||||||||||||||||||||||
| 88 |     return executed 26690 times by 1 test:   0x80;return 0x80;Executed by: 
 executed 26690 times by 1 test:  return 0x80;Executed by: 
  | 26690 | ||||||||||||||||||||||||||||||||||||
| 89 | } | - | ||||||||||||||||||||||||||||||||||||
| 90 | static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, | - | ||||||||||||||||||||||||||||||||||||
| 91 | long max) | - | ||||||||||||||||||||||||||||||||||||
| 92 | { | - | ||||||||||||||||||||||||||||||||||||
| 93 | const unsigned char *p = *pp; | - | ||||||||||||||||||||||||||||||||||||
| 94 | unsigned long ret = 0; | - | ||||||||||||||||||||||||||||||||||||
| 95 | int i; | - | ||||||||||||||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||||||||||||||
| 97 |     if (max-- < 1
  | 0-12275767 | ||||||||||||||||||||||||||||||||||||
| 98 |         return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 99 |     if (*
 
  | 3662987-8612780 | ||||||||||||||||||||||||||||||||||||
| 100 | *inf = 1; | - | ||||||||||||||||||||||||||||||||||||
| 101 | p++; | - | ||||||||||||||||||||||||||||||||||||
| 102 |     } executed 3662987 times by 1 test:   else {end of blockExecuted by: 
  | 3662987 | ||||||||||||||||||||||||||||||||||||
| 103 | *inf = 0; | - | ||||||||||||||||||||||||||||||||||||
| 104 | i = *p & 0x7f; | - | ||||||||||||||||||||||||||||||||||||
| 105 |         if (*
 
  | 376881-8235899 | ||||||||||||||||||||||||||||||||||||
| 106 |             if (max < i + 1
  | 7311-369570 | ||||||||||||||||||||||||||||||||||||
| 107 |                 return executed 7311 times by 1 test:   0;return 0;Executed by: 
 executed 7311 times by 1 test:  return 0;Executed by: 
  | 7311 | ||||||||||||||||||||||||||||||||||||
| 108 | - | |||||||||||||||||||||||||||||||||||||
| 109 |             while (i > 0
 
 
  | 66369-375212 | ||||||||||||||||||||||||||||||||||||
| 110 | p++; | - | ||||||||||||||||||||||||||||||||||||
| 111 | i--; | - | ||||||||||||||||||||||||||||||||||||
| 112 |             } executed 72011 times by 1 test:  end of blockExecuted by: 
  | 72011 | ||||||||||||||||||||||||||||||||||||
| 113 |             if (i > (int)sizeof(long)
  | 1099-368471 | ||||||||||||||||||||||||||||||||||||
| 114 |                 return executed 1099 times by 1 test:   0;return 0;Executed by: 
 executed 1099 times by 1 test:  return 0;Executed by: 
  | 1099 | ||||||||||||||||||||||||||||||||||||
| 115 |             while (i > 0
  | 368471-441726 | ||||||||||||||||||||||||||||||||||||
| 116 | ret <<= 8; | - | ||||||||||||||||||||||||||||||||||||
| 117 | ret |= *p++; | - | ||||||||||||||||||||||||||||||||||||
| 118 | i--; | - | ||||||||||||||||||||||||||||||||||||
| 119 |             } executed 441726 times by 1 test:  end of blockExecuted by: 
  | 441726 | ||||||||||||||||||||||||||||||||||||
| 120 |             if (ret > 0x7fffffffffffffffL
  | 910-367561 | ||||||||||||||||||||||||||||||||||||
| 121 |                 return executed 910 times by 1 test:   0;return 0;Executed by: 
 executed 910 times by 1 test:  return 0;Executed by: 
  | 910 | ||||||||||||||||||||||||||||||||||||
| 122 |         } executed 367561 times by 1 test:   elseend of blockExecuted by: 
  | 367561 | ||||||||||||||||||||||||||||||||||||
| 123 |             ret = i; executed 8235899 times by 2 tests:  ret = i;Executed by: 
  | 8235899 | ||||||||||||||||||||||||||||||||||||
| 124 | } | - | ||||||||||||||||||||||||||||||||||||
| 125 | *pp = p; | - | ||||||||||||||||||||||||||||||||||||
| 126 | *rl = (long)ret; | - | ||||||||||||||||||||||||||||||||||||
| 127 |     return executed 12266447 times by 2 tests:   1;return 1;Executed by: 
 executed 12266447 times by 2 tests:  return 1;Executed by: 
  | 12266447 | ||||||||||||||||||||||||||||||||||||
| 128 | } | - | ||||||||||||||||||||||||||||||||||||
| 129 | - | |||||||||||||||||||||||||||||||||||||
| 130 | - | |||||||||||||||||||||||||||||||||||||
| 131 | - | |||||||||||||||||||||||||||||||||||||
| 132 | - | |||||||||||||||||||||||||||||||||||||
| 133 | void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag, | - | ||||||||||||||||||||||||||||||||||||
| 134 | int xclass) | - | ||||||||||||||||||||||||||||||||||||
| 135 | { | - | ||||||||||||||||||||||||||||||||||||
| 136 | unsigned char *p = *pp; | - | ||||||||||||||||||||||||||||||||||||
| 137 | int i, ttag; | - | ||||||||||||||||||||||||||||||||||||
| 138 | - | |||||||||||||||||||||||||||||||||||||
| 139 |     i = (
 
  | 477168-661176 | ||||||||||||||||||||||||||||||||||||
| 140 | i |= (xclass & 0xc0); | - | ||||||||||||||||||||||||||||||||||||
| 141 |     if (tag < 31
  | 7688-1130656 | ||||||||||||||||||||||||||||||||||||
| 142 |         *( executed 1130656 times by 2 tests:  p++) = i | (tag & 0x1f);*(p++) = i | (tag & 0x1f);Executed by: 
 executed 1130656 times by 2 tests:  *(p++) = i | (tag & 0x1f);Executed by: 
  | 1130656 | ||||||||||||||||||||||||||||||||||||
| 143 | else { | - | ||||||||||||||||||||||||||||||||||||
| 144 | *(p++) = i | 0x1f; | - | ||||||||||||||||||||||||||||||||||||
| 145 |         for (i = 0, ttag = tag; ttag > 0
  | 7688-15736 | ||||||||||||||||||||||||||||||||||||
| 146 |             ttag >>= 7; executed 15736 times by 1 test:  ttag >>= 7;Executed by: 
  | 15736 | ||||||||||||||||||||||||||||||||||||
| 147 | ttag = i; | - | ||||||||||||||||||||||||||||||||||||
| 148 |         while (i-- > 0
  | 7688-15736 | ||||||||||||||||||||||||||||||||||||
| 149 | p[i] = tag & 0x7f; | - | ||||||||||||||||||||||||||||||||||||
| 150 |             if (i != (ttag - 1)
  | 7688-8048 | ||||||||||||||||||||||||||||||||||||
| 151 |                 p[i] |= 0x80; executed 8048 times by 1 test:  p[i] |= 0x80;Executed by: 
  | 8048 | ||||||||||||||||||||||||||||||||||||
| 152 | tag >>= 7; | - | ||||||||||||||||||||||||||||||||||||
| 153 |         } executed 15736 times by 1 test:  end of blockExecuted by: 
  | 15736 | ||||||||||||||||||||||||||||||||||||
| 154 | p += ttag; | - | ||||||||||||||||||||||||||||||||||||
| 155 |     } executed 7688 times by 1 test:  end of blockExecuted by: 
  | 7688 | ||||||||||||||||||||||||||||||||||||
| 156 |     if (constructed == 2
  | 480-1137864 | ||||||||||||||||||||||||||||||||||||
| 157 |         *( executed 480 times by 1 test:  p++) = 0x80;*(p++) = 0x80;Executed by: 
 executed 480 times by 1 test:  *(p++) = 0x80;Executed by: 
  | 480 | ||||||||||||||||||||||||||||||||||||
| 158 | else | - | ||||||||||||||||||||||||||||||||||||
| 159 |         asn1_put_length(&p, length); executed 1137864 times by 2 tests:  asn1_put_length(&p, length);Executed by: 
  | 1137864 | ||||||||||||||||||||||||||||||||||||
| 160 | *pp = p; | - | ||||||||||||||||||||||||||||||||||||
| 161 | } executed 1138344 times by 2 tests:  end of blockExecuted by: 
  | 1138344 | ||||||||||||||||||||||||||||||||||||
| 162 | - | |||||||||||||||||||||||||||||||||||||
| 163 | int ASN1_put_eoc(unsigned char **pp) | - | ||||||||||||||||||||||||||||||||||||
| 164 | { | - | ||||||||||||||||||||||||||||||||||||
| 165 | unsigned char *p = *pp; | - | ||||||||||||||||||||||||||||||||||||
| 166 | *p++ = 0; | - | ||||||||||||||||||||||||||||||||||||
| 167 | *p++ = 0; | - | ||||||||||||||||||||||||||||||||||||
| 168 | *pp = p; | - | ||||||||||||||||||||||||||||||||||||
| 169 |     return executed 480 times by 1 test:   2;return 2;Executed by: 
 executed 480 times by 1 test:  return 2;Executed by: 
  | 480 | ||||||||||||||||||||||||||||||||||||
| 170 | } | - | ||||||||||||||||||||||||||||||||||||
| 171 | - | |||||||||||||||||||||||||||||||||||||
| 172 | static void asn1_put_length(unsigned char **pp, int length) | - | ||||||||||||||||||||||||||||||||||||
| 173 | { | - | ||||||||||||||||||||||||||||||||||||
| 174 | unsigned char *p = *pp; | - | ||||||||||||||||||||||||||||||||||||
| 175 | int i, l; | - | ||||||||||||||||||||||||||||||||||||
| 176 |     if (length <= 127
  | 53486-1084378 | ||||||||||||||||||||||||||||||||||||
| 177 |         *( executed 1084378 times by 2 tests:  p++) = (unsigned char)length;*(p++) = (unsigned char)length;Executed by: 
 executed 1084378 times by 2 tests:  *(p++) = (unsigned char)length;Executed by: 
  | 1084378 | ||||||||||||||||||||||||||||||||||||
| 178 | else { | - | ||||||||||||||||||||||||||||||||||||
| 179 | l = length; | - | ||||||||||||||||||||||||||||||||||||
| 180 |         for (i = 0; l > 0
  | 53486-96912 | ||||||||||||||||||||||||||||||||||||
| 181 |             l >>= 8; executed 96912 times by 1 test:  l >>= 8;Executed by: 
  | 96912 | ||||||||||||||||||||||||||||||||||||
| 182 | *(p++) = i | 0x80; | - | ||||||||||||||||||||||||||||||||||||
| 183 | l = i; | - | ||||||||||||||||||||||||||||||||||||
| 184 |         while (i-- > 0
  | 53486-96912 | ||||||||||||||||||||||||||||||||||||
| 185 | p[i] = length & 0xff; | - | ||||||||||||||||||||||||||||||||||||
| 186 | length >>= 8; | - | ||||||||||||||||||||||||||||||||||||
| 187 |         } executed 96912 times by 1 test:  end of blockExecuted by: 
  | 96912 | ||||||||||||||||||||||||||||||||||||
| 188 | p += l; | - | ||||||||||||||||||||||||||||||||||||
| 189 |     } executed 53486 times by 1 test:  end of blockExecuted by: 
  | 53486 | ||||||||||||||||||||||||||||||||||||
| 190 | *pp = p; | - | ||||||||||||||||||||||||||||||||||||
| 191 | } executed 1137864 times by 2 tests:  end of blockExecuted by: 
  | 1137864 | ||||||||||||||||||||||||||||||||||||
| 192 | - | |||||||||||||||||||||||||||||||||||||
| 193 | int ASN1_object_size(int constructed, int length, int tag) | - | ||||||||||||||||||||||||||||||||||||
| 194 | { | - | ||||||||||||||||||||||||||||||||||||
| 195 | int ret = 1; | - | ||||||||||||||||||||||||||||||||||||
| 196 |     if (length < 0
  | 0-4202881 | ||||||||||||||||||||||||||||||||||||
| 197 |         return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||||||||||||||
| 198 |     if (tag >= 31
  | 32684-4170197 | ||||||||||||||||||||||||||||||||||||
| 199 |         while (tag > 0
  | 32684-68037 | ||||||||||||||||||||||||||||||||||||
| 200 | tag >>= 7; | - | ||||||||||||||||||||||||||||||||||||
| 201 | ret++; | - | ||||||||||||||||||||||||||||||||||||
| 202 |         } executed 68037 times by 1 test:  end of blockExecuted by: 
  | 68037 | ||||||||||||||||||||||||||||||||||||
| 203 |     } executed 32684 times by 1 test:  end of blockExecuted by: 
  | 32684 | ||||||||||||||||||||||||||||||||||||
| 204 |     if (constructed == 2
  | 2016-4200865 | ||||||||||||||||||||||||||||||||||||
| 205 | ret += 3; | - | ||||||||||||||||||||||||||||||||||||
| 206 |     } executed 2016 times by 1 test:   else {end of blockExecuted by: 
  | 2016 | ||||||||||||||||||||||||||||||||||||
| 207 | ret++; | - | ||||||||||||||||||||||||||||||||||||
| 208 |         if (length > 127
  | 139698-4061167 | ||||||||||||||||||||||||||||||||||||
| 209 | int tmplen = length; | - | ||||||||||||||||||||||||||||||||||||
| 210 |             while (tmplen > 0
  | 139698-252444 | ||||||||||||||||||||||||||||||||||||
| 211 | tmplen >>= 8; | - | ||||||||||||||||||||||||||||||||||||
| 212 | ret++; | - | ||||||||||||||||||||||||||||||||||||
| 213 |             } executed 252444 times by 1 test:  end of blockExecuted by: 
  | 252444 | ||||||||||||||||||||||||||||||||||||
| 214 |         } executed 139698 times by 1 test:  end of blockExecuted by: 
  | 139698 | ||||||||||||||||||||||||||||||||||||
| 215 |     } executed 4200865 times by 2 tests:  end of blockExecuted by: 
  | 4200865 | ||||||||||||||||||||||||||||||||||||
| 216 |     if (ret >= 0x7fffffff - length
  | 0-4202881 | ||||||||||||||||||||||||||||||||||||
| 217 |         return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||||||||||||||
| 218 |     return executed 4202881 times by 2 tests:   ret + length;return ret + length;Executed by: 
 executed 4202881 times by 2 tests:  return ret + length;Executed by: 
  | 4202881 | ||||||||||||||||||||||||||||||||||||
| 219 | } | - | ||||||||||||||||||||||||||||||||||||
| 220 | - | |||||||||||||||||||||||||||||||||||||
| 221 | int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str) | - | ||||||||||||||||||||||||||||||||||||
| 222 | { | - | ||||||||||||||||||||||||||||||||||||
| 223 |     if (str == 
  | 0-25360 | ||||||||||||||||||||||||||||||||||||
| 224 |               ((void *)0)
  | 0-25360 | ||||||||||||||||||||||||||||||||||||
| 225 | ) | - | ||||||||||||||||||||||||||||||||||||
| 226 |         return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 227 | dst->type = str->type; | - | ||||||||||||||||||||||||||||||||||||
| 228 |     if (!ASN1_STRING_set(dst, str->data, str->length)
  | 0-25360 | ||||||||||||||||||||||||||||||||||||
| 229 |         return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 230 | - | |||||||||||||||||||||||||||||||||||||
| 231 | dst->flags &= 0x080; | - | ||||||||||||||||||||||||||||||||||||
| 232 | dst->flags |= str->flags & ~0x080; | - | ||||||||||||||||||||||||||||||||||||
| 233 |     return executed 25360 times by 1 test:   1;return 1;Executed by: 
 executed 25360 times by 1 test:  return 1;Executed by: 
  | 25360 | ||||||||||||||||||||||||||||||||||||
| 234 | } | - | ||||||||||||||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||||||||||||||
| 236 | ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *str) | - | ||||||||||||||||||||||||||||||||||||
| 237 | { | - | ||||||||||||||||||||||||||||||||||||
| 238 | ASN1_STRING *ret; | - | ||||||||||||||||||||||||||||||||||||
| 239 |     if (!str
  | 0-2849 | ||||||||||||||||||||||||||||||||||||
| 240 |         return never executed:   return ((void *)0) ;never executed:  return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||
| 241 |               ((void *)0) never executed:  return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||
| 242 |                   ; never executed:  return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||
| 243 | ret = ASN1_STRING_new(); | - | ||||||||||||||||||||||||||||||||||||
| 244 |     if (ret == 
  | 0-2849 | ||||||||||||||||||||||||||||||||||||
| 245 |               ((void *)0)
  | 0-2849 | ||||||||||||||||||||||||||||||||||||
| 246 | ) | - | ||||||||||||||||||||||||||||||||||||
| 247 |         return never executed:   return ((void *)0) ;never executed:  return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||
| 248 |               ((void *)0) never executed:  return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||
| 249 |                   ; never executed:  return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||
| 250 |     if (!ASN1_STRING_copy(ret, str)
  | 0-2849 | ||||||||||||||||||||||||||||||||||||
| 251 | ASN1_STRING_free(ret); | - | ||||||||||||||||||||||||||||||||||||
| 252 |         return never executed:   return ((void *)0) ;never executed:  return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||
| 253 |               ((void *)0) never executed:  return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||
| 254 |                   ; never executed:  return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||
| 255 | } | - | ||||||||||||||||||||||||||||||||||||
| 256 |     return executed 2849 times by 1 test:   ret;return ret;Executed by: 
 executed 2849 times by 1 test:  return ret;Executed by: 
  | 2849 | ||||||||||||||||||||||||||||||||||||
| 257 | } | - | ||||||||||||||||||||||||||||||||||||
| 258 | - | |||||||||||||||||||||||||||||||||||||
| 259 | int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) | - | ||||||||||||||||||||||||||||||||||||
| 260 | { | - | ||||||||||||||||||||||||||||||||||||
| 261 | unsigned char *c; | - | ||||||||||||||||||||||||||||||||||||
| 262 | const char *data = _data; | - | ||||||||||||||||||||||||||||||||||||
| 263 | - | |||||||||||||||||||||||||||||||||||||
| 264 |     if (len < 0
  | 102-1135926 | ||||||||||||||||||||||||||||||||||||
| 265 |         if (data == 
  | 0-102 | ||||||||||||||||||||||||||||||||||||
| 266 |                    ((void *)0)
  | 0-102 | ||||||||||||||||||||||||||||||||||||
| 267 | ) | - | ||||||||||||||||||||||||||||||||||||
| 268 |             return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 269 | else | - | ||||||||||||||||||||||||||||||||||||
| 270 |             len = strlen(data); executed 102 times by 1 test:  len = strlen(data);Executed by: 
  | 102 | ||||||||||||||||||||||||||||||||||||
| 271 | } | - | ||||||||||||||||||||||||||||||||||||
| 272 |     if ((
 
 
 
  | 0-1136028 | ||||||||||||||||||||||||||||||||||||
| 273 |                                              ((void *)0)
  | 0 | ||||||||||||||||||||||||||||||||||||
| 274 |                                                  )
  | 0 | ||||||||||||||||||||||||||||||||||||
| 275 | c = str->data; | - | ||||||||||||||||||||||||||||||||||||
| 276 | str->data = CRYPTO_realloc(c, len + 1, __FILE__, 284); | - | ||||||||||||||||||||||||||||||||||||
| 277 |         if (str->data == 
  | 0-1136028 | ||||||||||||||||||||||||||||||||||||
| 278 |                         ((void *)0)
  | 0-1136028 | ||||||||||||||||||||||||||||||||||||
| 279 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 280 | ERR_put_error(13,(186),((1|64)),__FILE__,286); | - | ||||||||||||||||||||||||||||||||||||
| 281 | str->data = c; | - | ||||||||||||||||||||||||||||||||||||
| 282 |             return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 283 | } | - | ||||||||||||||||||||||||||||||||||||
| 284 |     } executed 1136028 times by 2 tests:  end of blockExecuted by: 
  | 1136028 | ||||||||||||||||||||||||||||||||||||
| 285 | str->length = len; | - | ||||||||||||||||||||||||||||||||||||
| 286 |     if (data != 
  | 277887-858141 | ||||||||||||||||||||||||||||||||||||
| 287 |                ((void *)0)
  | 277887-858141 | ||||||||||||||||||||||||||||||||||||
| 288 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 289 | memcpy(str->data, data, len); | - | ||||||||||||||||||||||||||||||||||||
| 290 | - | |||||||||||||||||||||||||||||||||||||
| 291 | str->data[len] = '\0'; | - | ||||||||||||||||||||||||||||||||||||
| 292 |     } executed 858141 times by 2 tests:  end of blockExecuted by: 
  | 858141 | ||||||||||||||||||||||||||||||||||||
| 293 |     return executed 1136028 times by 2 tests:   1;return 1;Executed by: 
 executed 1136028 times by 2 tests:  return 1;Executed by: 
  | 1136028 | ||||||||||||||||||||||||||||||||||||
| 294 | } | - | ||||||||||||||||||||||||||||||||||||
| 295 | - | |||||||||||||||||||||||||||||||||||||
| 296 | void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len) | - | ||||||||||||||||||||||||||||||||||||
| 297 | { | - | ||||||||||||||||||||||||||||||||||||
| 298 | CRYPTO_free(str->data, __FILE__, 302); | - | ||||||||||||||||||||||||||||||||||||
| 299 | str->data = data; | - | ||||||||||||||||||||||||||||||||||||
| 300 | str->length = len; | - | ||||||||||||||||||||||||||||||||||||
| 301 | } executed 483 times by 1 test:  end of blockExecuted by: 
  | 483 | ||||||||||||||||||||||||||||||||||||
| 302 | - | |||||||||||||||||||||||||||||||||||||
| 303 | ASN1_STRING *ASN1_STRING_new(void) | - | ||||||||||||||||||||||||||||||||||||
| 304 | { | - | ||||||||||||||||||||||||||||||||||||
| 305 |     return executed 11214 times by 1 test:   ASN1_STRING_type_new(4);return ASN1_STRING_type_new(4);Executed by: 
 executed 11214 times by 1 test:  return ASN1_STRING_type_new(4);Executed by: 
  | 11214 | ||||||||||||||||||||||||||||||||||||
| 306 | } | - | ||||||||||||||||||||||||||||||||||||
| 307 | - | |||||||||||||||||||||||||||||||||||||
| 308 | ASN1_STRING *ASN1_STRING_type_new(int type) | - | ||||||||||||||||||||||||||||||||||||
| 309 | { | - | ||||||||||||||||||||||||||||||||||||
| 310 | ASN1_STRING *ret; | - | ||||||||||||||||||||||||||||||||||||
| 311 | - | |||||||||||||||||||||||||||||||||||||
| 312 | ret = CRYPTO_zalloc(sizeof(*ret), __FILE__, 316); | - | ||||||||||||||||||||||||||||||||||||
| 313 |     if (ret == 
  | 0-1331089 | ||||||||||||||||||||||||||||||||||||
| 314 |               ((void *)0)
  | 0-1331089 | ||||||||||||||||||||||||||||||||||||
| 315 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 316 | ERR_put_error(13,(130),((1|64)),__FILE__,318); | - | ||||||||||||||||||||||||||||||||||||
| 317 |         return never executed:   return ((void *)0) ;never executed:  return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||
| 318 |               ((void *)0) never executed:  return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||
| 319 |                   ; never executed:  return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||
| 320 | } | - | ||||||||||||||||||||||||||||||||||||
| 321 | ret->type = type; | - | ||||||||||||||||||||||||||||||||||||
| 322 |     return executed 1331089 times by 2 tests:   ret;return ret;Executed by: 
 executed 1331089 times by 2 tests:  return ret;Executed by: 
  | 1331089 | ||||||||||||||||||||||||||||||||||||
| 323 | } | - | ||||||||||||||||||||||||||||||||||||
| 324 | - | |||||||||||||||||||||||||||||||||||||
| 325 | void asn1_string_embed_free(ASN1_STRING *a, int embed) | - | ||||||||||||||||||||||||||||||||||||
| 326 | { | - | ||||||||||||||||||||||||||||||||||||
| 327 |     if (a == 
  | 0-1704197 | ||||||||||||||||||||||||||||||||||||
| 328 |             ((void *)0)
  | 0-1704197 | ||||||||||||||||||||||||||||||||||||
| 329 | ) | - | ||||||||||||||||||||||||||||||||||||
| 330 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||||||||||||||
| 331 |     if (!(a->flags & 0x010)
  | 45-1704152 | ||||||||||||||||||||||||||||||||||||
| 332 |         CRYPTO_free(a->data, __FILE__, 330); executed 1704152 times by 2 tests:  CRYPTO_free(a->data, __FILE__, 330);Executed by: 
  | 1704152 | ||||||||||||||||||||||||||||||||||||
| 333 |     if (embed == 0
  | 373108-1331089 | ||||||||||||||||||||||||||||||||||||
| 334 |         CRYPTO_free(a, __FILE__, 332); executed 1331089 times by 2 tests:  CRYPTO_free(a, __FILE__, 332);Executed by: 
  | 1331089 | ||||||||||||||||||||||||||||||||||||
| 335 | } executed 1704197 times by 2 tests:  end of blockExecuted by: 
  | 1704197 | ||||||||||||||||||||||||||||||||||||
| 336 | - | |||||||||||||||||||||||||||||||||||||
| 337 | void ASN1_STRING_free(ASN1_STRING *a) | - | ||||||||||||||||||||||||||||||||||||
| 338 | { | - | ||||||||||||||||||||||||||||||||||||
| 339 |     if (a == 
  | 258109-541406 | ||||||||||||||||||||||||||||||||||||
| 340 |             ((void *)0)
  | 258109-541406 | ||||||||||||||||||||||||||||||||||||
| 341 | ) | - | ||||||||||||||||||||||||||||||||||||
| 342 |         return; executed 541406 times by 1 test:  return;Executed by: 
  | 541406 | ||||||||||||||||||||||||||||||||||||
| 343 | asn1_string_embed_free(a, a->flags & 0x080); | - | ||||||||||||||||||||||||||||||||||||
| 344 | } executed 258109 times by 2 tests:  end of blockExecuted by: 
  | 258109 | ||||||||||||||||||||||||||||||||||||
| 345 | - | |||||||||||||||||||||||||||||||||||||
| 346 | void ASN1_STRING_clear_free(ASN1_STRING *a) | - | ||||||||||||||||||||||||||||||||||||
| 347 | { | - | ||||||||||||||||||||||||||||||||||||
| 348 |     if (a == 
  | 3-65 | ||||||||||||||||||||||||||||||||||||
| 349 |             ((void *)0)
  | 3-65 | ||||||||||||||||||||||||||||||||||||
| 350 | ) | - | ||||||||||||||||||||||||||||||||||||
| 351 |         return; executed 3 times by 1 test:  return;Executed by: 
  | 3 | ||||||||||||||||||||||||||||||||||||
| 352 |     if (a->data
 
  | 0-65 | ||||||||||||||||||||||||||||||||||||
| 353 |         OPENSSL_cleanse(a->data, a->length); executed 65 times by 1 test:  OPENSSL_cleanse(a->data, a->length);Executed by: 
  | 65 | ||||||||||||||||||||||||||||||||||||
| 354 | ASN1_STRING_free(a); | - | ||||||||||||||||||||||||||||||||||||
| 355 | } executed 65 times by 1 test:  end of blockExecuted by: 
  | 65 | ||||||||||||||||||||||||||||||||||||
| 356 | - | |||||||||||||||||||||||||||||||||||||
| 357 | int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b) | - | ||||||||||||||||||||||||||||||||||||
| 358 | { | - | ||||||||||||||||||||||||||||||||||||
| 359 | int i; | - | ||||||||||||||||||||||||||||||||||||
| 360 | - | |||||||||||||||||||||||||||||||||||||
| 361 | i = (a->length - b->length); | - | ||||||||||||||||||||||||||||||||||||
| 362 |     if (i == 0
  | 9-2878 | ||||||||||||||||||||||||||||||||||||
| 363 | i = memcmp(a->data, b->data, a->length); | - | ||||||||||||||||||||||||||||||||||||
| 364 |         if (i == 0
  | 142-2736 | ||||||||||||||||||||||||||||||||||||
| 365 |             return executed 2736 times by 1 test:   a->type - b->type;return a->type - b->type;Executed by: 
 executed 2736 times by 1 test:  return a->type - b->type;Executed by: 
  | 2736 | ||||||||||||||||||||||||||||||||||||
| 366 | else | - | ||||||||||||||||||||||||||||||||||||
| 367 |             return executed 142 times by 1 test:   i;return i;Executed by: 
 executed 142 times by 1 test:  return i;Executed by: 
  | 142 | ||||||||||||||||||||||||||||||||||||
| 368 | } else | - | ||||||||||||||||||||||||||||||||||||
| 369 |         return executed 9 times by 1 test:   i;return i;Executed by: 
 executed 9 times by 1 test:  return i;Executed by: 
  | 9 | ||||||||||||||||||||||||||||||||||||
| 370 | } | - | ||||||||||||||||||||||||||||||||||||
| 371 | - | |||||||||||||||||||||||||||||||||||||
| 372 | int ASN1_STRING_length(const ASN1_STRING *x) | - | ||||||||||||||||||||||||||||||||||||
| 373 | { | - | ||||||||||||||||||||||||||||||||||||
| 374 |     return executed 208482 times by 1 test:   x->length;return x->length;Executed by: 
 executed 208482 times by 1 test:  return x->length;Executed by: 
  | 208482 | ||||||||||||||||||||||||||||||||||||
| 375 | } | - | ||||||||||||||||||||||||||||||||||||
| 376 | - | |||||||||||||||||||||||||||||||||||||
| 377 | void ASN1_STRING_length_set(ASN1_STRING *x, int len) | - | ||||||||||||||||||||||||||||||||||||
| 378 | { | - | ||||||||||||||||||||||||||||||||||||
| 379 | x->length = len; | - | ||||||||||||||||||||||||||||||||||||
| 380 | } never executed:  end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 381 | - | |||||||||||||||||||||||||||||||||||||
| 382 | int ASN1_STRING_type(const ASN1_STRING *x) | - | ||||||||||||||||||||||||||||||||||||
| 383 | { | - | ||||||||||||||||||||||||||||||||||||
| 384 |     return never executed:   x->type;return x->type;never executed:  return x->type; | 0 | ||||||||||||||||||||||||||||||||||||
| 385 | } | - | ||||||||||||||||||||||||||||||||||||
| 386 | - | |||||||||||||||||||||||||||||||||||||
| 387 | const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x) | - | ||||||||||||||||||||||||||||||||||||
| 388 | { | - | ||||||||||||||||||||||||||||||||||||
| 389 |     return executed 210900 times by 1 test:   x->data;return x->data;Executed by: 
 executed 210900 times by 1 test:  return x->data;Executed by: 
  | 210900 | ||||||||||||||||||||||||||||||||||||
| 390 | } | - | ||||||||||||||||||||||||||||||||||||
| 391 | - | |||||||||||||||||||||||||||||||||||||
| 392 | - | |||||||||||||||||||||||||||||||||||||
| 393 | unsigned char *ASN1_STRING_data(ASN1_STRING *x) | - | ||||||||||||||||||||||||||||||||||||
| 394 | { | - | ||||||||||||||||||||||||||||||||||||
| 395 |     return never executed:   x->data;return x->data;never executed:  return x->data; | 0 | ||||||||||||||||||||||||||||||||||||
| 396 | } | - | ||||||||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |