version 1.1.1.1, 2013/07/22 08:44:29
|
version 1.1.1.3, 2021/03/17 00:39:23
|
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 105 DesConfigure(Bund b)
|
Line 104 DesConfigure(Bund b)
|
static int |
static int |
DesSubtractBloat(Bund b, int size) |
DesSubtractBloat(Bund b, int size) |
{ |
{ |
|
(void)b; |
size -= DES_OVERHEAD; /* reserve space for header */ |
size -= DES_OVERHEAD; /* reserve space for header */ |
size &= ~0x7; |
size &= ~0x7; |
return(size); |
return(size); |
Line 191 DesEncrypt(Bund b, Mbuf plain)
|
Line 191 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 258 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); |
} |
} |
|
|
Line 303 DesBuildConfigReq(Bund b, u_char *cp)
|
Line 303 DesBuildConfigReq(Bund b, u_char *cp)
|
EcpState const ecp = &b->ecp; |
EcpState const ecp = &b->ecp; |
DesInfo const des = &ecp->des; |
DesInfo const des = &ecp->des; |
|
|
((u_int32_t *) des->xmit_ivec)[0] = random(); | ((u_int32_t *)(void *) des->xmit_ivec)[0] = random(); |
((u_int32_t *) des->xmit_ivec)[1] = random(); | ((u_int32_t *)(void *) des->xmit_ivec)[1] = random(); |
return(FsmConfValue(cp, ECP_TY_DESE, 8, des->xmit_ivec)); |
return(FsmConfValue(cp, ECP_TY_DESE, 8, des->xmit_ivec)); |
} |
} |
|
|