• Eric Biggers's avatar
    crypto: testmgr - add iv_out to all CTR test vectors · e674dbc0
    Eric Biggers authored
    Test that all CTR implementations update the IV buffer to contain the
    next counter block, aka the IV to continue the encryption/decryption of
    a larger message.  When the length processed is a multiple of the block
    size, users may rely on this for chaining.
    
    When the length processed is *not* a multiple of the block size, simple
    chaining doesn't work.  However, as noted in commit 88a3f582
    ("crypto: arm64/aes - don't use IV buffer to return final keystream
    block"), the generic CCM implementation assumes that the CTR IV is
    handled in some sane way, not e.g. overwritten with part of the
    keystream.  Since this was gotten wrong once already, it's desirable to
    test for it.  And, the most straightforward way to do this is to enforce
    that all CTR implementations have the same behavior as the generic
    implementation, which returns the *next* counter following the final
    partial block.  This behavior also has the advantage that if someone
    does misuse this case for chaining, then the keystream won't be
    repeated.  Thus, this patch makes the tests expect this behavior.
    Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    e674dbc0
testmgr.h 1.08 MB
The source could not be displayed because it is larger than 1 MB. You can load it anyway or download it instead.