aboutsummaryrefslogtreecommitdiff
path: root/tests/test-crypto-cipher.c
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2016-02-10 17:07:42 +0000
committerDaniel P. Berrange <berrange@redhat.com>2016-03-17 14:41:15 +0000
commit50f6753e2787b60475c2c5c07c6be5d600aa84de (patch)
tree801156a50f55bef4e174ec7184317e59f03f5840 /tests/test-crypto-cipher.c
parent94318522ed7930863924b3191ea8fee1d8cbe506 (diff)
downloadqemu-50f6753e2787b60475c2c5c07c6be5d600aa84de.zip
qemu-50f6753e2787b60475c2c5c07c6be5d600aa84de.tar.gz
qemu-50f6753e2787b60475c2c5c07c6be5d600aa84de.tar.bz2
crypto: add support for the twofish cipher algorithm
New cipher algorithms 'twofish-128', 'twofish-192' and 'twofish-256' are defined for the Twofish algorithm. The gcrypt backend does not support 'twofish-192'. The nettle and gcrypt cipher backends are updated to support the new cipher and a test vector added to the cipher test suite. The new algorithm is enabled in the LUKS block encryption driver. Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'tests/test-crypto-cipher.c')
-rw-r--r--tests/test-crypto-cipher.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test-crypto-cipher.c b/tests/test-crypto-cipher.c
index 5268723..f18bcaa 100644
--- a/tests/test-crypto-cipher.c
+++ b/tests/test-crypto-cipher.c
@@ -213,6 +213,35 @@ static QCryptoCipherTestData test_data[] = {
.plaintext = "00000000010000000200000003000000",
.ciphertext = "2061a42782bd52ec691ec383b03ba77c",
},
+ {
+ /* Twofish paper "Known Answer Test" */
+ .path = "/crypto/cipher/twofish-128",
+ .alg = QCRYPTO_CIPHER_ALG_TWOFISH_128,
+ .mode = QCRYPTO_CIPHER_MODE_ECB,
+ .key = "d491db16e7b1c39e86cb086b789f5419",
+ .plaintext = "019f9809de1711858faac3a3ba20fbc3",
+ .ciphertext = "6363977de839486297e661c6c9d668eb",
+ },
+ {
+ /* Twofish paper "Known Answer Test", I=3 */
+ .path = "/crypto/cipher/twofish-192",
+ .alg = QCRYPTO_CIPHER_ALG_TWOFISH_192,
+ .mode = QCRYPTO_CIPHER_MODE_ECB,
+ .key = "88b2b2706b105e36b446bb6d731a1e88"
+ "efa71f788965bd44",
+ .plaintext = "39da69d6ba4997d585b6dc073ca341b2",
+ .ciphertext = "182b02d81497ea45f9daacdc29193a65",
+ },
+ {
+ /* Twofish paper "Known Answer Test", I=4 */
+ .path = "/crypto/cipher/twofish-256",
+ .alg = QCRYPTO_CIPHER_ALG_TWOFISH_256,
+ .mode = QCRYPTO_CIPHER_MODE_ECB,
+ .key = "d43bb7556ea32e46f2a282b7d45b4e0d"
+ "57ff739d4dc92c1bd7fc01700cc8216f",
+ .plaintext = "90afe91bb288544f2c32dc239b2635e6",
+ .ciphertext = "6cb4561c40bf0a9705931cb6d408e7fa",
+ },
};