Commit 3fb24d9f authored by Niels Möller's avatar Niels Möller
Browse files

(initial_ctx): Deleted status value.

(blowfish_encrypt): Ignore status attribute.
(blowfish_decrypt): Likewise.
(blowfish_set_key): return result from weak key check, without
setting the status attribute.

Rev: nettle/blowfish.c:1.2
parent 994af7ed
...@@ -230,8 +230,6 @@ initial_ctx = ...@@ -230,8 +230,6 @@ initial_ctx =
0x082EFA98,0xEC4E6C89,0x452821E6,0x38D01377,0xBE5466CF,0x34E90C6C, 0x082EFA98,0xEC4E6C89,0x452821E6,0x38D01377,0xBE5466CF,0x34E90C6C,
0xC0AC29B7,0xC97C50DD,0x3F84D5B5,0xB5470917,0x9216D5D9,0x8979FB1B 0xC0AC29B7,0xC97C50DD,0x3F84D5B5,0xB5470917,0x9216D5D9,0x8979FB1B
}, },
/* Initial value, reset after key is checked. */
BLOWFISH_WEAK_KEY
}; };
/* It's unfortunate to have to pick the bytes apart in the round /* It's unfortunate to have to pick the bytes apart in the round
...@@ -318,8 +316,6 @@ blowfish_encrypt(struct blowfish_ctx *bc, unsigned length, ...@@ -318,8 +316,6 @@ blowfish_encrypt(struct blowfish_ctx *bc, unsigned length,
{ {
uint32_t d1, d2; uint32_t d1, d2;
assert(!bc->status);
FOR_BLOCKS(length, outbuf, inbuf, BLOWFISH_BLOCK_SIZE) FOR_BLOCKS(length, outbuf, inbuf, BLOWFISH_BLOCK_SIZE)
{ {
d1 = READ_UINT32(inbuf); d1 = READ_UINT32(inbuf);
...@@ -339,8 +335,6 @@ blowfish_decrypt(struct blowfish_ctx *bc, unsigned length, ...@@ -339,8 +335,6 @@ blowfish_decrypt(struct blowfish_ctx *bc, unsigned length,
{ {
uint32_t d1, d2; uint32_t d1, d2;
assert(!bc->status);
FOR_BLOCKS(length, outbuf, inbuf, BLOWFISH_BLOCK_SIZE) FOR_BLOCKS(length, outbuf, inbuf, BLOWFISH_BLOCK_SIZE)
{ {
d1 = READ_UINT32(inbuf); d1 = READ_UINT32(inbuf);
...@@ -360,15 +354,6 @@ blowfish_set_key(struct blowfish_ctx *ctx, ...@@ -360,15 +354,6 @@ blowfish_set_key(struct blowfish_ctx *ctx,
int i, j; int i, j;
uint32_t data, datal, datar; uint32_t data, datal, datar;
#if 0
static int initialized = 0;
if( !initialized ) {
initialized = 1;
assert(selftest());
}
#endif
*ctx = initial_ctx; *ctx = initial_ctx;
for(i=j=0; i < _BLOWFISH_ROUNDS+2; i++ ) for(i=j=0; i < _BLOWFISH_ROUNDS+2; i++ )
...@@ -420,6 +405,5 @@ blowfish_set_key(struct blowfish_ctx *ctx, ...@@ -420,6 +405,5 @@ blowfish_set_key(struct blowfish_ctx *ctx,
(ctx->s[2][i] == ctx->s[2][j]) || (ctx->s[3][i] == ctx->s[3][j]) ) (ctx->s[2][i] == ctx->s[2][j]) || (ctx->s[3][i] == ctx->s[3][j]) )
return 0; return 0;
ctx->status = BLOWFISH_OK;
return 1; return 1;
} }
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