| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/evp/e_rc2.c | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | static int rc2_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | const unsigned char *iv, int enc); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | static int rc2_meth_to_magic(EVP_CIPHER_CTX *ctx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | static int rc2_magic_to_meth(int i); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | static int rc2_set_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | static int rc2_get_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | static int rc2_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | typedef struct { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | int key_bits; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | RC2_KEY ks; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | } EVP_RC2_KEY; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | static int rc2_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { while(inl>=((size_t)1<<(sizeof(long)*8-2)) 
 never executed: if (inl end of block
 executed 18 times by 1 test: return RC2_cbc_encrypt(in, out, (long)inl, &((EVP_RC2_KEY *)ctx->cipher_data)->ks, ctx->iv, ctx->encrypt);Executed by: 
 executed 18 times by 1 test: 1; return 1;Executed by: 
 executed 18 times by 1 test: } static int rc2_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { size_t chunk=((size_t)1<<(sizeof(long)*8-2)); if (64==1 return 1;Executed by: 
 
 never executed: if (inl<chunk chunk>>=3;
 executed 4 times by 1 test: while(inl chunk=inl;Executed by: 
 
 
 
 executed 4 times by 1 test: } chunk=inl;Executed by: 
 executed 4 times by 1 test: return end of blockExecuted by: 
 executed 4 times by 1 test: 1; return 1;Executed by: 
 executed 4 times by 1 test: } static int rc2_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { size_t i, bl; bl = ctx->cipher->block_size; if(inl < bl return 1;Executed by: 
 
 never executed: 1; return 1;never executed: inl -= bl; for(i=0; i <= inl return 1;
 executed 448 times by 1 test: return RC2_ecb_encrypt(in + i, out + i, &((EVP_RC2_KEY *)ctx->cipher_data)->ks, ctx->encrypt);Executed by: 
 executed 6 times by 1 test: 1; return 1;Executed by: 
 executed 6 times by 1 test: } static int rc2_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { while(inl>=((size_t)1<<(sizeof(long)*8-2)) return 1;Executed by: 
 
 never executed: if (inl end of block
 executed 4 times by 1 test: return RC2_ofb64_encrypt(in, out, (long)inl, &((EVP_RC2_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num);Executed by: 
 executed 4 times by 1 test: 1; return 1;Executed by: 
 executed 4 times by 1 test: } static const EVP_CIPHER rc2_cbc = { 37, 8, 16, 8, 0x8 | 0x40 | 0x2, rc2_init_key, rc2_cbc_cipher, return 1;Executed by: 
 | 0-448 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | , sizeof(EVP_RC2_KEY), rc2_set_asn1_type_and_iv, rc2_get_asn1_type_and_iv, rc2_ctrl, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | }; const EVP_CIPHER *EVP_rc2_cbc(void) { return executed 625 times by 33 tests: &rc2_cbc; return &rc2_cbc;Executed by: 
 executed 625 times by 33 tests: } static const EVP_CIPHER rc2_cfb64 = { 39, 1, 16, 8, 0x8 | 0x40 | 0x3, rc2_init_key, rc2_cfb64_cipher, return &rc2_cbc;Executed by: 
 | 625 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | , sizeof(EVP_RC2_KEY), rc2_set_asn1_type_and_iv, rc2_get_asn1_type_and_iv, rc2_ctrl, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | }; const EVP_CIPHER *EVP_rc2_cfb64(void) { return executed 292 times by 33 tests: &rc2_cfb64; return &rc2_cfb64;Executed by: 
 executed 292 times by 33 tests: } static const EVP_CIPHER rc2_ofb = { 40, 1, 16, 8, 0x8 | 0x40 | 0x4, rc2_init_key, rc2_ofb_cipher, return &rc2_cfb64;Executed by: 
 | 292 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | , sizeof(EVP_RC2_KEY), rc2_set_asn1_type_and_iv, rc2_get_asn1_type_and_iv, rc2_ctrl, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | }; const EVP_CIPHER *EVP_rc2_ofb(void) { return executed 292 times by 33 tests: &rc2_ofb; return &rc2_ofb;Executed by: 
 executed 292 times by 33 tests: } static const EVP_CIPHER rc2_ecb = { 38, 8, 16, 0, 0x8 | 0x40 | 0x1, rc2_init_key, rc2_ecb_cipher, return &rc2_ofb;Executed by: 
 | 292 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | , sizeof(EVP_RC2_KEY), rc2_set_asn1_type_and_iv, rc2_get_asn1_type_and_iv, rc2_ctrl, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | }; const EVP_CIPHER *EVP_rc2_ecb(void) { return executed 292 times by 33 tests: &rc2_ecb; return &rc2_ecb;Executed by: 
 executed 292 times by 33 tests: } return &rc2_ecb;Executed by: 
 | 292 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | static const EVP_CIPHER r2_64_cbc_cipher = { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 166, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 8, 8 , 8, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0x2 | 0x8 | 0x40, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | rc2_init_key, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | rc2_cbc_cipher, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | , | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | sizeof(EVP_RC2_KEY), | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | rc2_set_asn1_type_and_iv, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | rc2_get_asn1_type_and_iv, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | rc2_ctrl, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | }; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | static const EVP_CIPHER r2_40_cbc_cipher = { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 98, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 8, 5 , 8, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0x2 | 0x8 | 0x40, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | rc2_init_key, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | rc2_cbc_cipher, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | , | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | sizeof(EVP_RC2_KEY), | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | rc2_set_asn1_type_and_iv, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | rc2_get_asn1_type_and_iv, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | rc2_ctrl, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | }; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | const EVP_CIPHER * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | EVP_rc2_64_cbc(void) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | return executed 292 times by 33 tests: (&r2_64_cbc_cipher); return (&r2_64_cbc_cipher);Executed by: 
 executed 292 times by 33 tests:  return (&r2_64_cbc_cipher);Executed by: 
 | 292 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | const EVP_CIPHER * | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | EVP_rc2_40_cbc(void) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | return executed 625 times by 33 tests: (&r2_40_cbc_cipher); return (&r2_40_cbc_cipher);Executed by: 
 executed 625 times by 33 tests:  return (&r2_40_cbc_cipher);Executed by: 
 | 625 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | rc2_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | const unsigned char *iv, int enc) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | RC2_set_key(&((EVP_RC2_KEY *)(ctx)->cipher_data)->ks, EVP_CIPHER_CTX_key_length(ctx), | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | key, ((EVP_RC2_KEY *)(ctx)->cipher_data)->key_bits); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | return executed 24 times by 1 test: 1; return 1;Executed by: 
 executed 24 times by 1 test:  return 1;Executed by: 
 | 24 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | rc2_meth_to_magic(EVP_CIPHER_CTX *e) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | int i; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | EVP_CIPHER_CTX_ctrl(e, 0x2, 0, &i); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | if (i == 128 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | return never executed: (0x3a); return (0x3a);never executed:  return (0x3a); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | else if (i == 64 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | return never executed: (0x78); return (0x78);never executed:  return (0x78); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | else if (i == 40 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | return never executed: (0xa0); return (0xa0);never executed:  return (0xa0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | return never executed: (0); return (0);never executed:  return (0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | rc2_magic_to_meth(int i) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | if (i == 0x3a 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | return never executed: 128; return 128;never executed:  return 128; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | else if (i == 0x78 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | return never executed: 64; return 64;never executed:  return 64; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | else if (i == 0xa0 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | return never executed: 40; return 40;never executed:  return 40; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | else { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | ERR_put_error(6,(0xfff),(108),__FILE__,174); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | return never executed: (0); return (0);never executed:  return (0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | rc2_get_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | long num = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | int i = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | int key_bits; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | unsigned int l; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | unsigned char iv[16]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | if (type != 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | ((void *)0) 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | l = EVP_CIPHER_CTX_iv_length(c); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | if (l > sizeof(iv) 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | ERR_put_error(6,(0xfff),(102),__FILE__,191); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | return never executed: -1; return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | i = ASN1_TYPE_get_int_octetstring(type, &num, iv, l); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | if (i != (int)l 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | return never executed: (-1); return (-1);never executed:  return (-1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | key_bits = rc2_magic_to_meth((int)num); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | if (!key_bits 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | return never executed: (-1); return (-1);never executed:  return (-1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | if (i > 0 
 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | ((void *)0) 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | , 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | ((void *)0) 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | , 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | ((void *)0) 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | , iv, -1) 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | return never executed: -1; return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | EVP_CIPHER_CTX_ctrl(c, 0x3, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | key_bits, | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | ); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | EVP_CIPHER_CTX_set_key_length(c, key_bits / 8); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } never executed:  end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | return never executed: (i); return (i);never executed:  return (i); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | rc2_set_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | long num; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | int i = 0, j; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | if (type != 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | ((void *)0) 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | ) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | num = rc2_meth_to_magic(c); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | j = EVP_CIPHER_CTX_iv_length(c); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | i = ASN1_TYPE_set_int_octetstring(type, num, c->oiv, j); | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } never executed:  end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | return never executed: (i); return (i);never executed:  return (i); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | rc2_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | switch (type) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | case executed 24 times by 1 test: 0x0: case 0x0:Executed by: 
 executed 24 times by 1 test:  case 0x0:Executed by: 
 | 24 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | ((EVP_RC2_KEY *)(c)->cipher_data)->key_bits = EVP_CIPHER_CTX_key_length(c) * 8; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | return executed 24 times by 1 test: 1; return 1;Executed by: 
 executed 24 times by 1 test:  return 1;Executed by: 
 | 24 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | case never executed: 0x2: case 0x2:never executed:  case 0x2: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | *(int *)ptr = ((EVP_RC2_KEY *)(c)->cipher_data)->key_bits; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | return never executed: 1; return 1;never executed:  return 1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | case never executed: 0x3: case 0x3:never executed:  case 0x3: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | if (arg > 0 
 | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | ((EVP_RC2_KEY *)(c)->cipher_data)->key_bits = arg; | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | return never executed: 1; return 1;never executed:  return 1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | return never executed: 0; return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | default never executed: : default:never executed:  default: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | return never executed: -1; return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |