Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/des/ofb_enc.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | - | |||||||
5 | - | |||||||
6 | - | |||||||
7 | - | |||||||
8 | void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits, | - | ||||||
9 | long length, DES_key_schedule *schedule, | - | ||||||
10 | DES_cblock *ivec) | - | ||||||
11 | { | - | ||||||
12 | unsigned int d0,d1,vv0,vv1,v0,v1,n=(numbits+7)/8; | - | ||||||
13 | unsigned int mask0,mask1; | - | ||||||
14 | long l=length; | - | ||||||
15 | int num=numbits; | - | ||||||
16 | unsigned int ti[2]; | - | ||||||
17 | unsigned char *iv; | - | ||||||
18 | - | |||||||
19 | if (num > 64
never executed: return; | 0-2 | ||||||
20 | if (num > 32
| 0-2 | ||||||
21 | { | - | ||||||
22 | mask0=0xffffffffL; | - | ||||||
23 | if (num >= 64
| 0-2 | ||||||
24 | mask1=mask0; executed 2 times by 1 test: mask1=mask0; Executed by:
| 2 | ||||||
25 | else | - | ||||||
26 | mask1=(1L<<(num-32))-1; never executed: mask1=(1L<<(num-32))-1; | 0 | ||||||
27 | } | - | ||||||
28 | else | - | ||||||
29 | { | - | ||||||
30 | if (num == 32
| 0 | ||||||
31 | mask0=0xffffffffL; never executed: mask0=0xffffffffL; | 0 | ||||||
32 | else | - | ||||||
33 | mask0=(1L<<num)-1; never executed: mask0=(1L<<num)-1; | 0 | ||||||
34 | mask1=0x00000000L; | - | ||||||
35 | } never executed: end of block | 0 | ||||||
36 | - | |||||||
37 | iv = &(*ivec)[0]; | - | ||||||
38 | (v0 =((unsigned int)(*((iv)++))) , v0|=((unsigned int)(*((iv)++)))<< 8L, v0|=((unsigned int)(*((iv)++)))<<16L, v0|=((unsigned int)(*((iv)++)))<<24L); | - | ||||||
39 | (v1 =((unsigned int)(*((iv)++))) , v1|=((unsigned int)(*((iv)++)))<< 8L, v1|=((unsigned int)(*((iv)++)))<<16L, v1|=((unsigned int)(*((iv)++)))<<24L); | - | ||||||
40 | ti[0]=v0; | - | ||||||
41 | ti[1]=v1; | - | ||||||
42 | while (l-- > 0
| 2-6 | ||||||
43 | { | - | ||||||
44 | ti[0]=v0; | - | ||||||
45 | ti[1]=v1; | - | ||||||
46 | DES_encrypt1((unsigned int *)ti,schedule,1); | - | ||||||
47 | vv0=ti[0]; | - | ||||||
48 | vv1=ti[1]; | - | ||||||
49 | { in+=n; d0=d1=0; switch (n) { case executed 6 times by 1 test: 8:case 8: Executed by:
executed 6 times by 1 test: d1 =((unsigned int)(*(--(in))))<<24L; casecase 8: Executed by:
never executed: case 7: code before this statement executed 6 times by 1 test: case 7: Executed by:
never executed: 7:case 7: code before this statement executed 6 times by 1 test: case 7: Executed by:
never executed: d1|=((unsigned int)(*(--(in))))<<16L; casecase 7: never executed: case 6: code before this statement executed 6 times by 1 test: case 6: Executed by:
never executed: 6:case 6: code before this statement executed 6 times by 1 test: case 6: Executed by:
never executed: d1|=((unsigned int)(*(--(in))))<< 8L; casecase 6: never executed: case 5: code before this statement executed 6 times by 1 test: case 5: Executed by:
never executed: 5:case 5: code before this statement executed 6 times by 1 test: case 5: Executed by:
never executed: d1|=((unsigned int)(*(--(in)))); casecase 5: never executed: case 4: code before this statement executed 6 times by 1 test: case 4: Executed by:
never executed: 4:case 4: code before this statement executed 6 times by 1 test: case 4: Executed by:
never executed: d0 =((unsigned int)(*(--(in))))<<24L; casecase 4: never executed: case 3: code before this statement executed 6 times by 1 test: case 3: Executed by:
never executed: 3:case 3: code before this statement executed 6 times by 1 test: case 3: Executed by:
never executed: d0|=((unsigned int)(*(--(in))))<<16L; casecase 3: never executed: case 2: code before this statement executed 6 times by 1 test: case 2: Executed by:
never executed: 2:case 2: code before this statement executed 6 times by 1 test: case 2: Executed by:
never executed: d0|=((unsigned int)(*(--(in))))<< 8L; casecase 2: executed 6 times by 1 test: 1:case 1: Executed by:
executed 6 times by 1 test: case 1: Executed by:
code before this statement executed 6 times by 1 test: d0|=((unsigned int)(*(--(in)))); }case 1: Executed by:
executed 6 times by 1 test: };end of block Executed by:
| 0-6 | ||||||
50 | in+=n; | - | ||||||
51 | d0=(d0^vv0)&mask0; | - | ||||||
52 | d1=(d1^vv1)&mask1; | - | ||||||
53 | { out+=n; switch (n) { case executed 6 times by 1 test: 8:case 8: Executed by:
executed 6 times by 1 test: *(--(out))=(unsigned char)(((d1)>>24L)&0xff); casecase 8: Executed by:
never executed: case 7: code before this statement executed 6 times by 1 test: case 7: Executed by:
never executed: 7:case 7: code before this statement executed 6 times by 1 test: case 7: Executed by:
never executed: *(--(out))=(unsigned char)(((d1)>>16L)&0xff); casecase 7: never executed: case 6: code before this statement executed 6 times by 1 test: case 6: Executed by:
never executed: 6:case 6: code before this statement executed 6 times by 1 test: case 6: Executed by:
never executed: *(--(out))=(unsigned char)(((d1)>> 8L)&0xff); casecase 6: never executed: case 5: code before this statement executed 6 times by 1 test: case 5: Executed by:
never executed: 5:case 5: code before this statement executed 6 times by 1 test: case 5: Executed by:
never executed: *(--(out))=(unsigned char)(((d1) )&0xff); casecase 5: never executed: case 4: code before this statement executed 6 times by 1 test: case 4: Executed by:
never executed: 4:case 4: code before this statement executed 6 times by 1 test: case 4: Executed by:
never executed: *(--(out))=(unsigned char)(((d0)>>24L)&0xff); casecase 4: never executed: case 3: code before this statement executed 6 times by 1 test: case 3: Executed by:
never executed: 3:case 3: code before this statement executed 6 times by 1 test: case 3: Executed by:
never executed: *(--(out))=(unsigned char)(((d0)>>16L)&0xff); casecase 3: never executed: case 2: code before this statement executed 6 times by 1 test: case 2: Executed by:
never executed: 2:case 2: code before this statement executed 6 times by 1 test: case 2: Executed by:
never executed: *(--(out))=(unsigned char)(((d0)>> 8L)&0xff); casecase 2: executed 6 times by 1 test: 1:case 1: Executed by:
executed 6 times by 1 test: case 1: Executed by:
code before this statement executed 6 times by 1 test: *(--(out))=(unsigned char)(((d0) )&0xff); }case 1: Executed by:
executed 6 times by 1 test: };end of block Executed by:
| 0-6 | ||||||
54 | out+=n; | - | ||||||
55 | - | |||||||
56 | if (num == 32
| 0-6 | ||||||
57 | { v0=v1; v1=vv0; } never executed: end of block | 0 | ||||||
58 | else if (num == 64
| 0-6 | ||||||
59 | { v0=vv0; v1=vv1; } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||
60 | else if (num > 32
| 0 | ||||||
61 | { | - | ||||||
62 | v0=((v1>>(num-32))|(vv0<<(64-num)))&0xffffffffL; | - | ||||||
63 | v1=((vv0>>(num-32))|(vv1<<(64-num)))&0xffffffffL; | - | ||||||
64 | } never executed: end of block | 0 | ||||||
65 | else | - | ||||||
66 | { | - | ||||||
67 | v0=((v0>>num)|(v1<<(32-num)))&0xffffffffL; | - | ||||||
68 | v1=((v1>>num)|(vv0<<(32-num)))&0xffffffffL; | - | ||||||
69 | } never executed: end of block | 0 | ||||||
70 | } | - | ||||||
71 | iv = &(*ivec)[0]; | - | ||||||
72 | (*((iv)++)=(unsigned char)(((v0) )&0xff), *((iv)++)=(unsigned char)(((v0)>> 8L)&0xff), *((iv)++)=(unsigned char)(((v0)>>16L)&0xff), *((iv)++)=(unsigned char)(((v0)>>24L)&0xff)); | - | ||||||
73 | (*((iv)++)=(unsigned char)(((v1) )&0xff), *((iv)++)=(unsigned char)(((v1)>> 8L)&0xff), *((iv)++)=(unsigned char)(((v1)>>16L)&0xff), *((iv)++)=(unsigned char)(((v1)>>24L)&0xff)); | - | ||||||
74 | v0=v1=d0=d1=ti[0]=ti[1]=vv0=vv1=0; | - | ||||||
75 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||
Switch to Source code | Preprocessed file |