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