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