Skip to content
Snippets Groups Projects
  1. Jan 11, 2019
    • Eric Biggers's avatar
      crypto: cfb - convert to skcipher_alloc_instance_simple() · 03b8302d
      Eric Biggers authored
      
      The CFB template just wraps a single block cipher algorithm, so simplify
      it by converting it to use skcipher_alloc_instance_simple().
      
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      03b8302d
    • Eric Biggers's avatar
      crypto: cfb - remove bogus memcpy() with src == dest · 6c2e322b
      Eric Biggers authored
      
      The memcpy() in crypto_cfb_decrypt_inplace() uses walk->iv as both the
      source and destination, which has undefined behavior.  It is unneeded
      because walk->iv is already used to hold the previous ciphertext block;
      thus, walk->iv is already updated to its final value.  So, remove it.
      
      Also, note that in-place decryption is the only case where the previous
      ciphertext block is not directly available.  Therefore, as a related
      cleanup I also updated crypto_cfb_encrypt_segment() to directly use the
      previous ciphertext block rather than save it into walk->iv.  This makes
      it consistent with in-place encryption and out-of-place decryption; now
      only in-place decryption is different, because it has to be.
      
      Fixes: a7d85e06 ("crypto: cfb - add support for Cipher FeedBack mode")
      Cc: <stable@vger.kernel.org> # v4.17+
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      6c2e322b
    • Eric Biggers's avatar
      crypto: cfb - add missing 'chunksize' property · 394a9e04
      Eric Biggers authored
      
      Like some other block cipher mode implementations, the CFB
      implementation assumes that while walking through the scatterlist, a
      partial block does not occur until the end.  But the walk is incorrectly
      being done with a blocksize of 1, as 'cra_blocksize' is set to 1 (since
      CFB is a stream cipher) but no 'chunksize' is set.  This bug causes
      incorrect encryption/decryption for some scatterlist layouts.
      
      Fix it by setting the 'chunksize'.  Also extend the CFB test vectors to
      cover this bug as well as cases where the message length is not a
      multiple of the block size.
      
      Fixes: a7d85e06 ("crypto: cfb - add support for Cipher FeedBack mode")
      Cc: <stable@vger.kernel.org> # v4.17+
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      394a9e04
  2. Nov 29, 2018
  3. Nov 09, 2018
  4. Apr 20, 2018
  5. Mar 09, 2018
Loading