| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | int DES_rw_mode = 1; | - |
| 7 | int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched, | - |
| 8 | DES_cblock *iv) | - |
| 9 | { | - |
| 10 | | - |
| 11 | int net_num=0; | - |
| 12 | static unsigned char *net= | - |
| 13 | ((void *)0) | - |
| 14 | ; | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | static unsigned char *unnet= | - |
| 19 | ((void *)0) | - |
| 20 | ; | - |
| 21 | static int unnet_start=0; | - |
| 22 | static int unnet_left=0; | - |
| 23 | static unsigned char *tmpbuf= | - |
| 24 | ((void *)0) | - |
| 25 | ; | - |
| 26 | int i; | - |
| 27 | long num=0,rnum; | - |
| 28 | unsigned char *p; | - |
| 29 | | - |
| 30 | if (tmpbuf == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 31 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 32 | ) | - |
| 33 | { | - |
| 34 | tmpbuf=malloc(((1024*16)+4)); | - |
| 35 | if (tmpbuf == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 36 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 37 | ) return never executed: return(-1); (-1);never executed: return(-1); | 0 |
| 38 | } never executed: end of block | 0 |
| 39 | if (net == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 40 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 41 | ) | - |
| 42 | { | - |
| 43 | net=malloc(((1024*16)+4)); | - |
| 44 | if (net == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 45 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 46 | ) return never executed: return(-1); (-1);never executed: return(-1); | 0 |
| 47 | } never executed: end of block | 0 |
| 48 | if (unnet == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 49 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 50 | ) | - |
| 51 | { | - |
| 52 | unnet=malloc(((1024*16)+4)); | - |
| 53 | if (unnet == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 54 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 55 | ) return never executed: return(-1); (-1);never executed: return(-1); | 0 |
| 56 | } never executed: end of block | 0 |
| 57 | | - |
| 58 | if (unnet_left != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 59 | { | - |
| 60 | if (unnet_left < len| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 61 | { | - |
| 62 | | - |
| 63 | | - |
| 64 | | - |
| 65 | memcpy(buf,&(unnet[unnet_start]), | - |
| 66 | unnet_left); | - |
| 67 | | - |
| 68 | | - |
| 69 | i=unnet_left; | - |
| 70 | unnet_start=unnet_left=0; | - |
| 71 | } never executed: end of block | 0 |
| 72 | else | - |
| 73 | { | - |
| 74 | memcpy(buf,&(unnet[unnet_start]),len); | - |
| 75 | unnet_start+=len; | - |
| 76 | unnet_left-=len; | - |
| 77 | i=len; | - |
| 78 | } never executed: end of block | 0 |
| 79 | return never executed: return(i); (i);never executed: return(i); | 0 |
| 80 | } | - |
| 81 | | - |
| 82 | | - |
| 83 | if (len > (1024*16)| TRUE | never evaluated | | FALSE | never evaluated |
) len=(1024*16);never executed: len=(1024*16); | 0 |
| 84 | | - |
| 85 | | - |
| 86 | while (net_num < 4| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 87 | { | - |
| 88 | i=read(fd,(void *)&(net[net_num]),4 -net_num); | - |
| 89 | | - |
| 90 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
i == -1)| TRUE | never evaluated | | FALSE | never evaluated |
&& (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 91 | (*__errno_location ()) | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 92 | == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 93 | 4| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 94 | )| TRUE | never evaluated | | FALSE | never evaluated |
) continue;never executed: continue; | 0 |
| 95 | | - |
| 96 | if (i <= 0| TRUE | never evaluated | | FALSE | never evaluated |
) returnnever executed: return(0); (0);never executed: return(0); | 0 |
| 97 | net_num+=i; | - |
| 98 | } never executed: end of block | 0 |
| 99 | | - |
| 100 | | - |
| 101 | p=net; | - |
| 102 | | - |
| 103 | (num =((unsigned int)(*((p)++)))<<24L, num|=((unsigned int)(*((p)++)))<<16L, num|=((unsigned int)(*((p)++)))<< 8L, num|=((unsigned int)(*((p)++)))); | - |
| 104 | | - |
| 105 | | - |
| 106 | | - |
| 107 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
num > (1024*16))| TRUE | never evaluated | | FALSE | never evaluated |
|| (| TRUE | never evaluated | | FALSE | never evaluated |
num < 0)| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 108 | return never executed: return(-1); (-1);never executed: return(-1); | 0 |
| 109 | rnum=(| TRUE | never evaluated | | FALSE | never evaluated |
num < 8)| TRUE | never evaluated | | FALSE | never evaluated |
?8:((num+7)/8*8); | 0 |
| 110 | | - |
| 111 | net_num=0; | - |
| 112 | while (net_num < rnum| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 113 | { | - |
| 114 | i=read(fd,(void *)&(net[net_num]),rnum-net_num); | - |
| 115 | | - |
| 116 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
i == -1)| TRUE | never evaluated | | FALSE | never evaluated |
&& (| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 117 | (*__errno_location ()) | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 118 | == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 119 | 4| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 120 | )| TRUE | never evaluated | | FALSE | never evaluated |
) continue;never executed: continue; | 0 |
| 121 | | - |
| 122 | if (i <= 0| TRUE | never evaluated | | FALSE | never evaluated |
) returnnever executed: return(0); (0);never executed: return(0); | 0 |
| 123 | net_num+=i; | - |
| 124 | } never executed: end of block | 0 |
| 125 | | - |
| 126 | | - |
| 127 | if (len < num| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 128 | { | - |
| 129 | if (DES_rw_mode & 1| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 130 | DES_pcbc_encrypt(net,unnet,num,sched,iv,0); never executed: DES_pcbc_encrypt(net,unnet,num,sched,iv,0); | 0 |
| 131 | else | - |
| 132 | DES_cbc_encrypt(net,unnet,num,sched,iv,0); never executed: DES_cbc_encrypt(net,unnet,num,sched,iv,0); | 0 |
| 133 | memcpy(buf,unnet,len); | - |
| 134 | unnet_start=len; | - |
| 135 | unnet_left=num-len; | - |
| 136 | | - |
| 137 | | - |
| 138 | | - |
| 139 | num=len; | - |
| 140 | } never executed: end of block | 0 |
| 141 | else | - |
| 142 | { | - |
| 143 | | - |
| 144 | | - |
| 145 | | - |
| 146 | | - |
| 147 | | - |
| 148 | if (len < rnum| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 149 | { | - |
| 150 | | - |
| 151 | if (DES_rw_mode & 1| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 152 | DES_pcbc_encrypt(net,tmpbuf,num,sched,iv, never executed: DES_pcbc_encrypt(net,tmpbuf,num,sched,iv, 0); | 0 |
| 153 | 0); never executed: DES_pcbc_encrypt(net,tmpbuf,num,sched,iv, 0); | 0 |
| 154 | else | - |
| 155 | DES_cbc_encrypt(net,tmpbuf,num,sched,iv, never executed: DES_cbc_encrypt(net,tmpbuf,num,sched,iv, 0); | 0 |
| 156 | 0); never executed: DES_cbc_encrypt(net,tmpbuf,num,sched,iv, 0); | 0 |
| 157 | | - |
| 158 | | - |
| 159 | | - |
| 160 | memcpy(buf,tmpbuf,num); | - |
| 161 | } never executed: end of block | 0 |
| 162 | else | - |
| 163 | { | - |
| 164 | if (DES_rw_mode & 1| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 165 | DES_pcbc_encrypt(net,buf,num,sched,iv, never executed: DES_pcbc_encrypt(net,buf,num,sched,iv, 0); | 0 |
| 166 | 0); never executed: DES_pcbc_encrypt(net,buf,num,sched,iv, 0); | 0 |
| 167 | else | - |
| 168 | DES_cbc_encrypt(net,buf,num,sched,iv, never executed: DES_cbc_encrypt(net,buf,num,sched,iv, 0); | 0 |
| 169 | 0); never executed: DES_cbc_encrypt(net,buf,num,sched,iv, 0); | 0 |
| 170 | } | - |
| 171 | } | - |
| 172 | return never executed: return num; num;never executed: return num; | 0 |
| 173 | } | - |
| | |