symm/*-def.h: Overhaul encryption mode testing.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 29 Oct 2018 22:48:49 +0000 (22:48 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 25 Nov 2018 11:38:04 +0000 (11:38 +0000)
commit57f459eb156e56404ac41ed0fed9f4066e9f1c1d
tree58d90dd73613db49583b45f32a0745579fe73559
parent6001a9ffafa1e77b2d192938d79e6da80febdc43
symm/*-def.h: Overhaul encryption mode testing.

Introduce a new source file (not part of the library proper) containing
the main code.  The old version only checked that the modes supported
round trips.  This is an improvement in several respects:

  * The per-mode code is now nearly trivial, and specific to the mode in
    question.

  * The new code checks that block-aligned (at least, in the case of ECB
    and CBC) or arbitrarily misaligned (in the case of CFB, OFB,
    counter, and MGF1, which are resumable) splits result in identical
    ciphertexts.

  * The new code can generate and/or check against regression-test
    data (in a binary format, because these can be big for non-resumable
    modes) to prevent cross-version interoperability bugs.  This data is
    generated automatically by `make distdir', and version controlled.
143 files changed:
symm/Makefile.am
symm/cbc-def.h
symm/cfb-def.h
symm/counter-def.h
symm/daftstory.h [deleted file]
symm/ecb-def.h
symm/mgf-def.h
symm/modes-test.c [new file with mode: 0644]
symm/modes-test.h [new file with mode: 0644]
symm/modes.am.in
symm/ofb-def.h
symm/t/modes/blowfish-cbc.regress [new file with mode: 0644]
symm/t/modes/blowfish-cfb.regress [new file with mode: 0644]
symm/t/modes/blowfish-counter.regress [new file with mode: 0644]
symm/t/modes/blowfish-ecb.regress [new file with mode: 0644]
symm/t/modes/blowfish-ofb.regress [new file with mode: 0644]
symm/t/modes/cast128-cbc.regress [new file with mode: 0644]
symm/t/modes/cast128-cfb.regress [new file with mode: 0644]
symm/t/modes/cast128-counter.regress [new file with mode: 0644]
symm/t/modes/cast128-ecb.regress [new file with mode: 0644]
symm/t/modes/cast128-ofb.regress [new file with mode: 0644]
symm/t/modes/cast256-cbc.regress [new file with mode: 0644]
symm/t/modes/cast256-cfb.regress [new file with mode: 0644]
symm/t/modes/cast256-counter.regress [new file with mode: 0644]
symm/t/modes/cast256-ecb.regress [new file with mode: 0644]
symm/t/modes/cast256-ofb.regress [new file with mode: 0644]
symm/t/modes/des-cbc.regress [new file with mode: 0644]
symm/t/modes/des-cfb.regress [new file with mode: 0644]
symm/t/modes/des-counter.regress [new file with mode: 0644]
symm/t/modes/des-ecb.regress [new file with mode: 0644]
symm/t/modes/des-ofb.regress [new file with mode: 0644]
symm/t/modes/des3-cbc.regress [new file with mode: 0644]
symm/t/modes/des3-cfb.regress [new file with mode: 0644]
symm/t/modes/des3-counter.regress [new file with mode: 0644]
symm/t/modes/des3-ecb.regress [new file with mode: 0644]
symm/t/modes/des3-ofb.regress [new file with mode: 0644]
symm/t/modes/desx-cbc.regress [new file with mode: 0644]
symm/t/modes/desx-cfb.regress [new file with mode: 0644]
symm/t/modes/desx-counter.regress [new file with mode: 0644]
symm/t/modes/desx-ecb.regress [new file with mode: 0644]
symm/t/modes/desx-ofb.regress [new file with mode: 0644]
symm/t/modes/has160-mgf.regress [new file with mode: 0644]
symm/t/modes/idea-cbc.regress [new file with mode: 0644]
symm/t/modes/idea-cfb.regress [new file with mode: 0644]
symm/t/modes/idea-counter.regress [new file with mode: 0644]
symm/t/modes/idea-ecb.regress [new file with mode: 0644]
symm/t/modes/idea-ofb.regress [new file with mode: 0644]
symm/t/modes/mars-cbc.regress [new file with mode: 0644]
symm/t/modes/mars-cfb.regress [new file with mode: 0644]
symm/t/modes/mars-counter.regress [new file with mode: 0644]
symm/t/modes/mars-ecb.regress [new file with mode: 0644]
symm/t/modes/mars-ofb.regress [new file with mode: 0644]
symm/t/modes/md2-mgf.regress [new file with mode: 0644]
symm/t/modes/md4-mgf.regress [new file with mode: 0644]
symm/t/modes/md5-mgf.regress [new file with mode: 0644]
symm/t/modes/noekeon-cbc.regress [new file with mode: 0644]
symm/t/modes/noekeon-cfb.regress [new file with mode: 0644]
symm/t/modes/noekeon-counter.regress [new file with mode: 0644]
symm/t/modes/noekeon-ecb.regress [new file with mode: 0644]
symm/t/modes/noekeon-ofb.regress [new file with mode: 0644]
symm/t/modes/rc2-cbc.regress [new file with mode: 0644]
symm/t/modes/rc2-cfb.regress [new file with mode: 0644]
symm/t/modes/rc2-counter.regress [new file with mode: 0644]
symm/t/modes/rc2-ecb.regress [new file with mode: 0644]
symm/t/modes/rc2-ofb.regress [new file with mode: 0644]
symm/t/modes/rc5-cbc.regress [new file with mode: 0644]
symm/t/modes/rc5-cfb.regress [new file with mode: 0644]
symm/t/modes/rc5-counter.regress [new file with mode: 0644]
symm/t/modes/rc5-ecb.regress [new file with mode: 0644]
symm/t/modes/rc5-ofb.regress [new file with mode: 0644]
symm/t/modes/rijndael-cbc.regress [new file with mode: 0644]
symm/t/modes/rijndael-cfb.regress [new file with mode: 0644]
symm/t/modes/rijndael-counter.regress [new file with mode: 0644]
symm/t/modes/rijndael-ecb.regress [new file with mode: 0644]
symm/t/modes/rijndael-ofb.regress [new file with mode: 0644]
symm/t/modes/rijndael192-cbc.regress [new file with mode: 0644]
symm/t/modes/rijndael192-cfb.regress [new file with mode: 0644]
symm/t/modes/rijndael192-counter.regress [new file with mode: 0644]
symm/t/modes/rijndael192-ecb.regress [new file with mode: 0644]
symm/t/modes/rijndael192-ofb.regress [new file with mode: 0644]
symm/t/modes/rijndael256-cbc.regress [new file with mode: 0644]
symm/t/modes/rijndael256-cfb.regress [new file with mode: 0644]
symm/t/modes/rijndael256-counter.regress [new file with mode: 0644]
symm/t/modes/rijndael256-ecb.regress [new file with mode: 0644]
symm/t/modes/rijndael256-ofb.regress [new file with mode: 0644]
symm/t/modes/rmd128-mgf.regress [new file with mode: 0644]
symm/t/modes/rmd160-mgf.regress [new file with mode: 0644]
symm/t/modes/rmd256-mgf.regress [new file with mode: 0644]
symm/t/modes/rmd320-mgf.regress [new file with mode: 0644]
symm/t/modes/safer-cbc.regress [new file with mode: 0644]
symm/t/modes/safer-cfb.regress [new file with mode: 0644]
symm/t/modes/safer-counter.regress [new file with mode: 0644]
symm/t/modes/safer-ecb.regress [new file with mode: 0644]
symm/t/modes/safer-ofb.regress [new file with mode: 0644]
symm/t/modes/safersk-cbc.regress [new file with mode: 0644]
symm/t/modes/safersk-cfb.regress [new file with mode: 0644]
symm/t/modes/safersk-counter.regress [new file with mode: 0644]
symm/t/modes/safersk-ecb.regress [new file with mode: 0644]
symm/t/modes/safersk-ofb.regress [new file with mode: 0644]
symm/t/modes/serpent-cbc.regress [new file with mode: 0644]
symm/t/modes/serpent-cfb.regress [new file with mode: 0644]
symm/t/modes/serpent-counter.regress [new file with mode: 0644]
symm/t/modes/serpent-ecb.regress [new file with mode: 0644]
symm/t/modes/serpent-ofb.regress [new file with mode: 0644]
symm/t/modes/sha-mgf.regress [new file with mode: 0644]
symm/t/modes/sha224-mgf.regress [new file with mode: 0644]
symm/t/modes/sha256-mgf.regress [new file with mode: 0644]
symm/t/modes/sha3-224-mgf.regress [new file with mode: 0644]
symm/t/modes/sha3-256-mgf.regress [new file with mode: 0644]
symm/t/modes/sha3-384-mgf.regress [new file with mode: 0644]
symm/t/modes/sha3-512-mgf.regress [new file with mode: 0644]
symm/t/modes/sha384-mgf.regress [new file with mode: 0644]
symm/t/modes/sha512-224-mgf.regress [new file with mode: 0644]
symm/t/modes/sha512-256-mgf.regress [new file with mode: 0644]
symm/t/modes/sha512-mgf.regress [new file with mode: 0644]
symm/t/modes/skipjack-cbc.regress [new file with mode: 0644]
symm/t/modes/skipjack-cfb.regress [new file with mode: 0644]
symm/t/modes/skipjack-counter.regress [new file with mode: 0644]
symm/t/modes/skipjack-ecb.regress [new file with mode: 0644]
symm/t/modes/skipjack-ofb.regress [new file with mode: 0644]
symm/t/modes/square-cbc.regress [new file with mode: 0644]
symm/t/modes/square-cfb.regress [new file with mode: 0644]
symm/t/modes/square-counter.regress [new file with mode: 0644]
symm/t/modes/square-ecb.regress [new file with mode: 0644]
symm/t/modes/square-ofb.regress [new file with mode: 0644]
symm/t/modes/tea-cbc.regress [new file with mode: 0644]
symm/t/modes/tea-cfb.regress [new file with mode: 0644]
symm/t/modes/tea-counter.regress [new file with mode: 0644]
symm/t/modes/tea-ecb.regress [new file with mode: 0644]
symm/t/modes/tea-ofb.regress [new file with mode: 0644]
symm/t/modes/tiger-mgf.regress [new file with mode: 0644]
symm/t/modes/twofish-cbc.regress [new file with mode: 0644]
symm/t/modes/twofish-cfb.regress [new file with mode: 0644]
symm/t/modes/twofish-counter.regress [new file with mode: 0644]
symm/t/modes/twofish-ecb.regress [new file with mode: 0644]
symm/t/modes/twofish-ofb.regress [new file with mode: 0644]
symm/t/modes/whirlpool-mgf.regress [new file with mode: 0644]
symm/t/modes/whirlpool256-mgf.regress [new file with mode: 0644]
symm/t/modes/xtea-cbc.regress [new file with mode: 0644]
symm/t/modes/xtea-cfb.regress [new file with mode: 0644]
symm/t/modes/xtea-counter.regress [new file with mode: 0644]
symm/t/modes/xtea-ecb.regress [new file with mode: 0644]
symm/t/modes/xtea-ofb.regress [new file with mode: 0644]