Commit 3930058d authored by Niels Möller's avatar Niels Möller
Browse files

* src/des.c (make_des_instance): Use the des_fix_parity function

in nettle.

Rev: src/des.c:1.11
parent a8ec306a
......@@ -62,24 +62,10 @@ make_des_instance(struct crypto_algorithm *algorithm UNUSED, int mode,
{
NEW(des_instance, self);
UINT8 pkey[DES_KEY_SIZE];
unsigned i;
/* Fix odd parity */
for (i=0; i<DES_KEY_SIZE; i++)
{
UINT8 p = key[i];
p ^= (p >> 4);
p ^= (p >> 2);
p ^= (p >> 1);
pkey[i] = key[i] ^ (p & 1) ^ 1;
#if 0
debug("make_des_instance: computing parity: key[%i] = %xi,\n"
" pkey[%i] = %xi,\n"
" parity = %xi\n",
i, key[i], i, pkey[i], p);
#endif
}
des_fix_parity(DES_KEY_SIZE, pkey, key);
self->super.block_size = DES_BLOCK_SIZE;
self->super.crypt = ( (mode == CRYPTO_ENCRYPT)
? do_des_encrypt
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment