• Christian Lamparter's avatar
    crypto: crypto4xx - fix cfb and ofb "overran dst buffer" issues · 7e92e171
    Christian Lamparter authored
    Currently, crypto4xx CFB and OFB AES ciphers are
    failing testmgr's test vectors.
    
    |cfb-aes-ppc4xx encryption overran dst buffer on test vector 3, cfg="in-place"
    |ofb-aes-ppc4xx encryption overran dst buffer on test vector 1, cfg="in-place"
    
    This is because of a very subtile "bug" in the hardware that
    gets indirectly mentioned in 18.1.3.5 Encryption/Decryption
    of the hardware spec:
    
    the OFB and CFB modes for AES are listed there as operation
    modes for >>> "Block ciphers" <<<. Which kind of makes sense,
    but we would like them to be considered as stream ciphers just
    like the CTR mode.
    
    To workaround this issue and stop the hardware from causing
    "overran dst buffer" on crypttexts that are not a multiple
    of 16 (AES_BLOCK_SIZE), we force the driver to use the scatter
    buffers as the go-between.
    
    As a bonus this patch also kills redundant pd_uinfo->num_gd
    and pd_uinfo->num_sd setters since the value has already been
    set before.
    
    Cc: stable@vger.kernel.org
    Fixes: f2a13e7c ("crypto: crypto4xx - enable AES RFC3686, ECB, CFB and OFB offloads")
    Signed-off-by: default avatarChristian Lamparter <chunkeey@gmail.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    7e92e171
crypto4xx_core.c 41.8 KB