1. 15 Dec, 2023 33 commits
  2. 08 Dec, 2023 7 commits
    • Herbert Xu's avatar
      crypto: algif_skcipher - Fix stream cipher chaining · 99bd99d3
      Herbert Xu authored
      Unlike algif_aead which is always issued in one go (thus limiting
      the maximum size of the request), algif_skcipher has always allowed
      unlimited input data by cutting them up as necessary and feeding
      the fragments to the underlying algorithm one at a time.
      
      However, because of deficiencies in the API, this has been broken
      for most stream ciphers such as arc4 or chacha.  This is because
      they have an internal state in addition to the IV that must be
      preserved in order to continue processing.
      
      Fix this by using the new skcipher state API.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      99bd99d3
    • Herbert Xu's avatar
      crypto: arc4 - Add internal state · 47309ea1
      Herbert Xu authored
      The arc4 algorithm has always had internal state.  It's been buggy
      from day one in that the state has been stored in the shared tfm
      object.  That means two users sharing the same tfm will end up
      affecting each other's output, or worse, they may end up with the
      same output.
      
      Fix this by declaring an internal state and storing the state there
      instead of within the tfm context.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      47309ea1
    • Herbert Xu's avatar
      crypto: skcipher - Make use of internal state · 662ea18d
      Herbert Xu authored
      This patch adds code to the skcipher/lskcipher API to make use
      of the internal state if present.  In particular, the skcipher
      lskcipher wrapper will allocate a buffer for the IV/state and
      feed that to the underlying lskcipher algorithm.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      662ea18d
    • Herbert Xu's avatar
      crypto: skcipher - Add internal state support · 0ae4dcc1
      Herbert Xu authored
      Unlike chaining modes such as CBC, stream ciphers other than CTR
      usually hold an internal state that must be preserved if the
      operation is to be done piecemeal.  This has not been represented
      in the API, resulting in the inability to split up stream cipher
      operations.
      
      This patch adds the basic representation of an internal state to
      skcipher and lskcipher.  In the interest of backwards compatibility,
      the default has been set such that existing users are assumed to
      be operating in one go as opposed to piecemeal.
      
      With the new API, each lskcipher/skcipher algorithm has a new
      attribute called statesize.  For skcipher, this is the size of
      the buffer that can be exported or imported similar to ahash.
      For lskcipher, instead of providing a buffer of ivsize, the user
      now has to provide a buffer of ivsize + statesize.
      
      Each skcipher operation is assumed to be final as they are now,
      but this may be overridden with a request flag.  When the override
      occurs, the user may then export the partial state and reimport
      it later.
      
      For lskcipher operations this is reversed.  All operations are
      not final and the state will be exported unless the FINAL bit is
      set.  However, the CONT bit still has to be set for the state
      to be used.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      0ae4dcc1
    • Herbert Xu's avatar
      crypto: cfb,ofb - Remove cfb and ofb · 412ac51c
      Herbert Xu authored
          
      Remove the unused algorithms CFB/OFB.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      412ac51c
    • Herbert Xu's avatar
      crypto: testmgr - Remove cfb and ofb · d4bd2102
      Herbert Xu authored
          
      Remove test vectors for CFB/OFB.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      d4bd2102
    • Herbert Xu's avatar
      crypto: tcrypt - Remove cfb and ofb · 1c95b546
      Herbert Xu authored
          
      Remove tests for CFB/OFB.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      1c95b546