| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/evp/e_xcbc_d.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | - | |||||||
| 4 | - | |||||||
| 5 | - | |||||||
| 6 | - | |||||||
| 7 | - | |||||||
| 8 | static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||
| 9 | const unsigned char *iv, int enc); | - | ||||||
| 10 | static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||
| 11 | const unsigned char *in, size_t inl); | - | ||||||
| 12 | - | |||||||
| 13 | - | |||||||
| 14 | typedef struct { | - | ||||||
| 15 | DES_key_schedule ks; | - | ||||||
| 16 | DES_cblock inw; | - | ||||||
| 17 | DES_cblock outw; | - | ||||||
| 18 | } DESX_CBC_KEY; | - | ||||||
| 19 | - | |||||||
| 20 | - | |||||||
| 21 | - | |||||||
| 22 | static const EVP_CIPHER d_xcbc_cipher = { | - | ||||||
| 23 | 80, | - | ||||||
| 24 | 8, 24, 8, | - | ||||||
| 25 | 0x2, | - | ||||||
| 26 | desx_cbc_init_key, | - | ||||||
| 27 | desx_cbc_cipher, | - | ||||||
| 28 | - | |||||||
| 29 | ((void *)0) | - | ||||||
| 30 | , | - | ||||||
| 31 | sizeof(DESX_CBC_KEY), | - | ||||||
| 32 | EVP_CIPHER_set_asn1_iv, | - | ||||||
| 33 | EVP_CIPHER_get_asn1_iv, | - | ||||||
| 34 | - | |||||||
| 35 | ((void *)0) | - | ||||||
| 36 | , | - | ||||||
| 37 | - | |||||||
| 38 | ((void *)0) | - | ||||||
| 39 | - | |||||||
| 40 | }; | - | ||||||
| 41 | - | |||||||
| 42 | const EVP_CIPHER * | - | ||||||
| 43 | EVP_desx_cbc(void) | - | ||||||
| 44 | { | - | ||||||
| 45 | return executed 292 times by 33 tests: (&d_xcbc_cipher);return (&d_xcbc_cipher);Executed by:
executed 292 times by 33 tests: return (&d_xcbc_cipher);Executed by:
| 292 | ||||||
| 46 | } | - | ||||||
| 47 | - | |||||||
| 48 | static int | - | ||||||
| 49 | desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||
| 50 | const unsigned char *iv, int enc) | - | ||||||
| 51 | { | - | ||||||
| 52 | DES_cblock *deskey = (DES_cblock *)key; | - | ||||||
| 53 | - | |||||||
| 54 | DES_set_key_unchecked(deskey, &((DESX_CBC_KEY *)(ctx)->cipher_data)->ks); | - | ||||||
| 55 | memcpy(&((DESX_CBC_KEY *)(ctx)->cipher_data)->inw[0], &key[8], 8); | - | ||||||
| 56 | memcpy(&((DESX_CBC_KEY *)(ctx)->cipher_data)->outw[0], &key[16], 8); | - | ||||||
| 57 | - | |||||||
| 58 | return executed 6 times by 2 tests: 1;return 1;Executed by:
executed 6 times by 2 tests: return 1;Executed by:
| 6 | ||||||
| 59 | } | - | ||||||
| 60 | - | |||||||
| 61 | static int | - | ||||||
| 62 | desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||
| 63 | const unsigned char *in, size_t inl) | - | ||||||
| 64 | { | - | ||||||
| 65 | while (inl >= ((size_t)1<<(sizeof(long)*8-2))
| 0-8 | ||||||
| 66 | DES_xcbc_encrypt(in, out, (long)((size_t)1<<(sizeof(long)*8-2)), &((DESX_CBC_KEY *)(ctx)->cipher_data)->ks, | - | ||||||
| 67 | (DES_cblock *)&(ctx->iv[0]), &((DESX_CBC_KEY *)(ctx)->cipher_data)->inw, | - | ||||||
| 68 | &((DESX_CBC_KEY *)(ctx)->cipher_data)->outw, ctx->encrypt); | - | ||||||
| 69 | inl -= ((size_t)1<<(sizeof(long)*8-2)); | - | ||||||
| 70 | in += ((size_t)1<<(sizeof(long)*8-2)); | - | ||||||
| 71 | out += ((size_t)1<<(sizeof(long)*8-2)); | - | ||||||
| 72 | } never executed: end of block | 0 | ||||||
| 73 | if (inl
| 0-8 | ||||||
| 74 | DES_xcbc_encrypt(in, out, (long)inl, &((DESX_CBC_KEY *)(ctx)->cipher_data)->ks, executed 8 times by 2 tests: DES_xcbc_encrypt(in, out, (long)inl, &((DESX_CBC_KEY *)(ctx)->cipher_data)->ks, (DES_cblock *)&(ctx->iv[0]), &((DESX_CBC_KEY *)(ctx)->cipher_data)->inw, &((DESX_CBC_KEY *)(ctx)->cipher_data)->outw, ctx->encrypt);Executed by:
| 8 | ||||||
| 75 | (DES_cblock *)&(ctx->iv[0]), &((DESX_CBC_KEY *)(ctx)->cipher_data)->inw, executed 8 times by 2 tests: DES_xcbc_encrypt(in, out, (long)inl, &((DESX_CBC_KEY *)(ctx)->cipher_data)->ks, (DES_cblock *)&(ctx->iv[0]), &((DESX_CBC_KEY *)(ctx)->cipher_data)->inw, &((DESX_CBC_KEY *)(ctx)->cipher_data)->outw, ctx->encrypt);Executed by:
| 8 | ||||||
| 76 | &((DESX_CBC_KEY *)(ctx)->cipher_data)->outw, ctx->encrypt); executed 8 times by 2 tests: DES_xcbc_encrypt(in, out, (long)inl, &((DESX_CBC_KEY *)(ctx)->cipher_data)->ks, (DES_cblock *)&(ctx->iv[0]), &((DESX_CBC_KEY *)(ctx)->cipher_data)->inw, &((DESX_CBC_KEY *)(ctx)->cipher_data)->outw, ctx->encrypt);Executed by:
| 8 | ||||||
| 77 | return executed 8 times by 2 tests: 1;return 1;Executed by:
executed 8 times by 2 tests: return 1;Executed by:
| 8 | ||||||
| 78 | } | - | ||||||
| Switch to Source code | Preprocessed file |