Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/bf/bf_cfb64.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | - | |||||||
5 | - | |||||||
6 | - | |||||||
7 | void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, | - | ||||||
8 | const BF_KEY *schedule, unsigned char *ivec, int *num, int encrypt) | - | ||||||
9 | { | - | ||||||
10 | unsigned int v0,v1,t; | - | ||||||
11 | int n= *num; | - | ||||||
12 | long l=length; | - | ||||||
13 | unsigned int ti[2]; | - | ||||||
14 | unsigned char *iv,c,cc; | - | ||||||
15 | - | |||||||
16 | iv=(unsigned char *)ivec; | - | ||||||
17 | if (encrypt
| 4 | ||||||
18 | { | - | ||||||
19 | while (l--
| 4-1805 | ||||||
20 | { | - | ||||||
21 | if (n == 0
| 226-1579 | ||||||
22 | { | - | ||||||
23 | (v0 =((unsigned long)(*((iv)++)))<<24L, v0|=((unsigned long)(*((iv)++)))<<16L, v0|=((unsigned long)(*((iv)++)))<< 8L, v0|=((unsigned long)(*((iv)++)))); ti[0]=v0; | - | ||||||
24 | (v1 =((unsigned long)(*((iv)++)))<<24L, v1|=((unsigned long)(*((iv)++)))<<16L, v1|=((unsigned long)(*((iv)++)))<< 8L, v1|=((unsigned long)(*((iv)++)))); ti[1]=v1; | - | ||||||
25 | BF_encrypt((unsigned int *)ti,schedule); | - | ||||||
26 | iv=(unsigned char *)ivec; | - | ||||||
27 | t=ti[0]; (*((iv)++)=(unsigned char)(((t)>>24L)&0xff), *((iv)++)=(unsigned char)(((t)>>16L)&0xff), *((iv)++)=(unsigned char)(((t)>> 8L)&0xff), *((iv)++)=(unsigned char)(((t) )&0xff)); | - | ||||||
28 | t=ti[1]; (*((iv)++)=(unsigned char)(((t)>>24L)&0xff), *((iv)++)=(unsigned char)(((t)>>16L)&0xff), *((iv)++)=(unsigned char)(((t)>> 8L)&0xff), *((iv)++)=(unsigned char)(((t) )&0xff)); | - | ||||||
29 | iv=(unsigned char *)ivec; | - | ||||||
30 | } executed 226 times by 2 tests: end of block Executed by:
| 226 | ||||||
31 | c= *(in++)^iv[n]; | - | ||||||
32 | *(out++)=c; | - | ||||||
33 | iv[n]=c; | - | ||||||
34 | n=(n+1)&0x07; | - | ||||||
35 | } executed 1805 times by 2 tests: end of block Executed by:
| 1805 | ||||||
36 | } executed 4 times by 2 tests: end of block Executed by:
| 4 | ||||||
37 | else | - | ||||||
38 | { | - | ||||||
39 | while (l--
| 4-1805 | ||||||
40 | { | - | ||||||
41 | if (n == 0
| 226-1579 | ||||||
42 | { | - | ||||||
43 | (v0 =((unsigned long)(*((iv)++)))<<24L, v0|=((unsigned long)(*((iv)++)))<<16L, v0|=((unsigned long)(*((iv)++)))<< 8L, v0|=((unsigned long)(*((iv)++)))); ti[0]=v0; | - | ||||||
44 | (v1 =((unsigned long)(*((iv)++)))<<24L, v1|=((unsigned long)(*((iv)++)))<<16L, v1|=((unsigned long)(*((iv)++)))<< 8L, v1|=((unsigned long)(*((iv)++)))); ti[1]=v1; | - | ||||||
45 | BF_encrypt((unsigned int *)ti,schedule); | - | ||||||
46 | iv=(unsigned char *)ivec; | - | ||||||
47 | t=ti[0]; (*((iv)++)=(unsigned char)(((t)>>24L)&0xff), *((iv)++)=(unsigned char)(((t)>>16L)&0xff), *((iv)++)=(unsigned char)(((t)>> 8L)&0xff), *((iv)++)=(unsigned char)(((t) )&0xff)); | - | ||||||
48 | t=ti[1]; (*((iv)++)=(unsigned char)(((t)>>24L)&0xff), *((iv)++)=(unsigned char)(((t)>>16L)&0xff), *((iv)++)=(unsigned char)(((t)>> 8L)&0xff), *((iv)++)=(unsigned char)(((t) )&0xff)); | - | ||||||
49 | iv=(unsigned char *)ivec; | - | ||||||
50 | } executed 226 times by 2 tests: end of block Executed by:
| 226 | ||||||
51 | cc= *(in++); | - | ||||||
52 | c=iv[n]; | - | ||||||
53 | iv[n]=cc; | - | ||||||
54 | *(out++)=c^cc; | - | ||||||
55 | n=(n+1)&0x07; | - | ||||||
56 | } executed 1805 times by 2 tests: end of block Executed by:
| 1805 | ||||||
57 | } executed 4 times by 2 tests: end of block Executed by:
| 4 | ||||||
58 | v0=v1=ti[0]=ti[1]=t=c=cc=0; | - | ||||||
59 | *num=n; | - | ||||||
60 | } executed 8 times by 2 tests: end of block Executed by:
| 8 | ||||||
Switch to Source code | Preprocessed file |