]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
(initial_ctx): Deleted status value.
authorNiels Möller <nisse@lysator.liu.se>
Mon, 5 Jul 2010 19:46:03 +0000 (21:46 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Mon, 5 Jul 2010 19:46:03 +0000 (21:46 +0200)
(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

blowfish.c

index 3cfb76c3172ffe726e750a5d02156025b973d529..b8f7ca5815ac0edd1f9b52193ffe3b5f942aab89 100644 (file)
@@ -230,8 +230,6 @@ initial_ctx =
     0x082EFA98,0xEC4E6C89,0x452821E6,0x38D01377,0xBE5466CF,0x34E90C6C,
     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
@@ -318,8 +316,6 @@ blowfish_encrypt(struct blowfish_ctx *bc, unsigned length,
 {
     uint32_t d1, d2;
 
-    assert(!bc->status);
-
     FOR_BLOCKS(length, outbuf, inbuf, BLOWFISH_BLOCK_SIZE)
       {
        d1 = READ_UINT32(inbuf);
@@ -339,8 +335,6 @@ blowfish_decrypt(struct blowfish_ctx *bc, unsigned length,
 {
     uint32_t d1, d2;
 
-    assert(!bc->status);
-
     FOR_BLOCKS(length, outbuf, inbuf, BLOWFISH_BLOCK_SIZE)
       {
        d1 = READ_UINT32(inbuf);
@@ -360,15 +354,6 @@ blowfish_set_key(struct blowfish_ctx *ctx,
     int i, j;
     uint32_t data, datal, datar;
 
-#if 0
-    static int initialized = 0;
-
-    if( !initialized ) {
-       initialized = 1;
-       assert(selftest());
-    }
-#endif
-
     *ctx = initial_ctx;
 
     for(i=j=0; i < _BLOWFISH_ROUNDS+2; i++ )
@@ -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]) )
          return 0;
     
-    ctx->status = BLOWFISH_OK;
     return 1;
 }