version 1.1.1.1, 2013/07/22 08:44:29
|
version 1.1.1.2, 2016/11/01 09:56:12
|
Line 89 DesConfigure(Bund b)
|
Line 89 DesConfigure(Bund b)
|
{ |
{ |
EcpState const ecp = &b->ecp; |
EcpState const ecp = &b->ecp; |
DesInfo const des = &ecp->des; |
DesInfo const des = &ecp->des; |
des_cblock key; | DES_cblock key; |
|
|
des_check_key = FALSE; | DES_string_to_key(ecp->key, &key); |
des_string_to_key(ecp->key, &key); | DES_set_key(&key, &des->ks); |
des_set_key(&key, des->ks); | |
des->xmit_seq = 0; |
des->xmit_seq = 0; |
des->recv_seq = 0; |
des->recv_seq = 0; |
} |
} |
Line 191 DesEncrypt(Bund b, Mbuf plain)
|
Line 190 DesEncrypt(Bund b, Mbuf plain)
|
{ |
{ |
u_char *const block = MBDATA(cypher) + DES_OVERHEAD + k; |
u_char *const block = MBDATA(cypher) + DES_OVERHEAD + k; |
|
|
des_cbc_encrypt(block, block, 8, des->ks, &des->xmit_ivec, TRUE); | DES_cbc_encrypt(block, block, 8, &des->ks, &des->xmit_ivec, TRUE); |
memcpy(des->xmit_ivec, block, 8); |
memcpy(des->xmit_ivec, block, 8); |
} |
} |
|
|
Line 258 DesDecrypt(Bund b, Mbuf cypher)
|
Line 257 DesDecrypt(Bund b, Mbuf cypher)
|
for (k = 0; k < clen; k += 8) |
for (k = 0; k < clen; k += 8) |
{ |
{ |
u_char *const block = MBDATA(plain) + k; |
u_char *const block = MBDATA(plain) + k; |
des_cblock next_ivec; | DES_cblock next_ivec; |
|
|
memcpy(next_ivec, block, 8); |
memcpy(next_ivec, block, 8); |
des_cbc_encrypt(block, block, 8, des->ks, &des->recv_ivec, FALSE); | DES_cbc_encrypt(block, block, 8, &des->ks, &des->recv_ivec, FALSE); |
memcpy(des->recv_ivec, next_ivec, 8); |
memcpy(des->recv_ivec, next_ivec, 8); |
} |
} |
|
|