Moved weak key check to the end, and don't set the status
attribute.
(des_encrypt): Ignore status attribute.
(des_decrypt): Likewise.
Rev: nettle/des.c:1.3
uint32_t *method;
const uint8_t *k;
- ctx->status = des_weak_p(key) ? DES_WEAK_KEY : DES_OK;
-
- /* NOTE: We go on and expand the key, even if it was weak */
/* explode the bits */
n = 56;
b0 = bits0;
b1 = bits1;
+ k = key;
do {
- w = (256 | *key++) << 2;
+ w = (256 | *k++) << 2;
do {
--n;
b1[n] = 8 & w;
method += 2;
} while ( --n );
- return (ctx->status == DES_OK);
+ return !des_weak_p (key);
}
void
const uint8_t *src)
{
assert(!(length % DES_BLOCK_SIZE));
- assert(ctx->status == DES_OK);
while (length)
{
const uint8_t *src)
{
assert(!(length % DES_BLOCK_SIZE));
- assert(ctx->status == DES_OK);
while (length)
{