diff options
Diffstat (limited to 'crypto')
38 files changed, 1230 insertions, 1465 deletions
diff --git a/crypto/Kconfig b/crypto/Kconfig index 160f08e721cc..f37e9cca50e1 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig | |||
| @@ -263,6 +263,7 @@ comment "Authenticated Encryption with Associated Data" | |||
| 263 | config CRYPTO_CCM | 263 | config CRYPTO_CCM |
| 264 | tristate "CCM support" | 264 | tristate "CCM support" |
| 265 | select CRYPTO_CTR | 265 | select CRYPTO_CTR |
| 266 | select CRYPTO_HASH | ||
| 266 | select CRYPTO_AEAD | 267 | select CRYPTO_AEAD |
| 267 | help | 268 | help |
| 268 | Support for Counter with CBC MAC. Required for IPsec. | 269 | Support for Counter with CBC MAC. Required for IPsec. |
| @@ -374,6 +375,7 @@ config CRYPTO_XTS | |||
| 374 | select CRYPTO_BLKCIPHER | 375 | select CRYPTO_BLKCIPHER |
| 375 | select CRYPTO_MANAGER | 376 | select CRYPTO_MANAGER |
| 376 | select CRYPTO_GF128MUL | 377 | select CRYPTO_GF128MUL |
| 378 | select CRYPTO_ECB | ||
| 377 | help | 379 | help |
| 378 | XTS: IEEE1619/D16 narrow block cipher use with aes-xts-plain, | 380 | XTS: IEEE1619/D16 narrow block cipher use with aes-xts-plain, |
| 379 | key size 256, 384 or 512 bits. This implementation currently | 381 | key size 256, 384 or 512 bits. This implementation currently |
| @@ -895,6 +897,23 @@ config CRYPTO_AES | |||
| 895 | 897 | ||
| 896 | See <http://csrc.nist.gov/CryptoToolkit/aes/> for more information. | 898 | See <http://csrc.nist.gov/CryptoToolkit/aes/> for more information. |
| 897 | 899 | ||
| 900 | config CRYPTO_AES_TI | ||
| 901 | tristate "Fixed time AES cipher" | ||
| 902 | select CRYPTO_ALGAPI | ||
| 903 | help | ||
| 904 | This is a generic implementation of AES that attempts to eliminate | ||
| 905 | data dependent latencies as much as possible without affecting | ||
| 906 | performance too much. It is intended for use by the generic CCM | ||
| 907 | and GCM drivers, and other CTR or CMAC/XCBC based modes that rely | ||
| 908 | solely on encryption (although decryption is supported as well, but | ||
| 909 | with a more dramatic performance hit) | ||
| 910 | |||
| 911 | Instead of using 16 lookup tables of 1 KB each, (8 for encryption and | ||
| 912 | 8 for decryption), this implementation only uses just two S-boxes of | ||
| 913 | 256 bytes each, and attempts to eliminate data dependent latencies by | ||
| 914 | prefetching the entire table into the cache at the start of each | ||
| 915 | block. | ||
| 916 | |||
| 898 | config CRYPTO_AES_586 | 917 | config CRYPTO_AES_586 |
| 899 | tristate "AES cipher algorithms (i586)" | 918 | tristate "AES cipher algorithms (i586)" |
| 900 | depends on (X86 || UML_X86) && !64BIT | 919 | depends on (X86 || UML_X86) && !64BIT |
diff --git a/crypto/Makefile b/crypto/Makefile index b8f0e3eb0791..8a44057240d5 100644 --- a/crypto/Makefile +++ b/crypto/Makefile | |||
| @@ -75,6 +75,7 @@ obj-$(CONFIG_CRYPTO_SHA256) += sha256_generic.o | |||
| 75 | obj-$(CONFIG_CRYPTO_SHA512) += sha512_generic.o | 75 | obj-$(CONFIG_CRYPTO_SHA512) += sha512_generic.o |
| 76 | obj-$(CONFIG_CRYPTO_SHA3) += sha3_generic.o | 76 | obj-$(CONFIG_CRYPTO_SHA3) += sha3_generic.o |
| 77 | obj-$(CONFIG_CRYPTO_WP512) += wp512.o | 77 | obj-$(CONFIG_CRYPTO_WP512) += wp512.o |
| 78 | CFLAGS_wp512.o := $(call cc-option,-fno-schedule-insns) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149 | ||
| 78 | obj-$(CONFIG_CRYPTO_TGR192) += tgr192.o | 79 | obj-$(CONFIG_CRYPTO_TGR192) += tgr192.o |
| 79 | obj-$(CONFIG_CRYPTO_GF128MUL) += gf128mul.o | 80 | obj-$(CONFIG_CRYPTO_GF128MUL) += gf128mul.o |
| 80 | obj-$(CONFIG_CRYPTO_ECB) += ecb.o | 81 | obj-$(CONFIG_CRYPTO_ECB) += ecb.o |
| @@ -98,7 +99,9 @@ obj-$(CONFIG_CRYPTO_BLOWFISH_COMMON) += blowfish_common.o | |||
| 98 | obj-$(CONFIG_CRYPTO_TWOFISH) += twofish_generic.o | 99 | obj-$(CONFIG_CRYPTO_TWOFISH) += twofish_generic.o |
| 99 | obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o | 100 | obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o |
| 100 | obj-$(CONFIG_CRYPTO_SERPENT) += serpent_generic.o | 101 | obj-$(CONFIG_CRYPTO_SERPENT) += serpent_generic.o |
| 102 | CFLAGS_serpent_generic.o := $(call cc-option,-fsched-pressure) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149 | ||
| 101 | obj-$(CONFIG_CRYPTO_AES) += aes_generic.o | 103 | obj-$(CONFIG_CRYPTO_AES) += aes_generic.o |
| 104 | obj-$(CONFIG_CRYPTO_AES_TI) += aes_ti.o | ||
| 102 | obj-$(CONFIG_CRYPTO_CAMELLIA) += camellia_generic.o | 105 | obj-$(CONFIG_CRYPTO_CAMELLIA) += camellia_generic.o |
| 103 | obj-$(CONFIG_CRYPTO_CAST_COMMON) += cast_common.o | 106 | obj-$(CONFIG_CRYPTO_CAST_COMMON) += cast_common.o |
| 104 | obj-$(CONFIG_CRYPTO_CAST5) += cast5_generic.o | 107 | obj-$(CONFIG_CRYPTO_CAST5) += cast5_generic.o |
diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c index d676fc59521a..d880a4897159 100644 --- a/crypto/ablkcipher.c +++ b/crypto/ablkcipher.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
| 20 | #include <linux/seq_file.h> | 20 | #include <linux/seq_file.h> |
| 21 | #include <linux/cryptouser.h> | 21 | #include <linux/cryptouser.h> |
| 22 | #include <linux/compiler.h> | ||
| 22 | #include <net/netlink.h> | 23 | #include <net/netlink.h> |
| 23 | 24 | ||
| 24 | #include <crypto/scatterwalk.h> | 25 | #include <crypto/scatterwalk.h> |
| @@ -394,7 +395,7 @@ static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
| 394 | #endif | 395 | #endif |
| 395 | 396 | ||
| 396 | static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg) | 397 | static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg) |
| 397 | __attribute__ ((unused)); | 398 | __maybe_unused; |
| 398 | static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg) | 399 | static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg) |
| 399 | { | 400 | { |
| 400 | struct ablkcipher_alg *ablkcipher = &alg->cra_ablkcipher; | 401 | struct ablkcipher_alg *ablkcipher = &alg->cra_ablkcipher; |
| @@ -468,7 +469,7 @@ static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
| 468 | #endif | 469 | #endif |
| 469 | 470 | ||
| 470 | static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg) | 471 | static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg) |
| 471 | __attribute__ ((unused)); | 472 | __maybe_unused; |
| 472 | static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg) | 473 | static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg) |
| 473 | { | 474 | { |
| 474 | struct ablkcipher_alg *ablkcipher = &alg->cra_ablkcipher; | 475 | struct ablkcipher_alg *ablkcipher = &alg->cra_ablkcipher; |
diff --git a/crypto/acompress.c b/crypto/acompress.c index 887783d8e9a9..47d11627cd20 100644 --- a/crypto/acompress.c +++ b/crypto/acompress.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/crypto.h> | 20 | #include <linux/crypto.h> |
| 21 | #include <crypto/algapi.h> | 21 | #include <crypto/algapi.h> |
| 22 | #include <linux/cryptouser.h> | 22 | #include <linux/cryptouser.h> |
| 23 | #include <linux/compiler.h> | ||
| 23 | #include <net/netlink.h> | 24 | #include <net/netlink.h> |
| 24 | #include <crypto/internal/acompress.h> | 25 | #include <crypto/internal/acompress.h> |
| 25 | #include <crypto/internal/scompress.h> | 26 | #include <crypto/internal/scompress.h> |
| @@ -50,7 +51,7 @@ static int crypto_acomp_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
| 50 | #endif | 51 | #endif |
| 51 | 52 | ||
| 52 | static void crypto_acomp_show(struct seq_file *m, struct crypto_alg *alg) | 53 | static void crypto_acomp_show(struct seq_file *m, struct crypto_alg *alg) |
| 53 | __attribute__ ((unused)); | 54 | __maybe_unused; |
| 54 | 55 | ||
| 55 | static void crypto_acomp_show(struct seq_file *m, struct crypto_alg *alg) | 56 | static void crypto_acomp_show(struct seq_file *m, struct crypto_alg *alg) |
| 56 | { | 57 | { |
diff --git a/crypto/aead.c b/crypto/aead.c index 3f5c5ff004ab..f794b30a9407 100644 --- a/crypto/aead.c +++ b/crypto/aead.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
| 25 | #include <linux/seq_file.h> | 25 | #include <linux/seq_file.h> |
| 26 | #include <linux/cryptouser.h> | 26 | #include <linux/cryptouser.h> |
| 27 | #include <linux/compiler.h> | ||
| 27 | #include <net/netlink.h> | 28 | #include <net/netlink.h> |
| 28 | 29 | ||
| 29 | #include "internal.h" | 30 | #include "internal.h" |
| @@ -132,7 +133,7 @@ static int crypto_aead_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
| 132 | #endif | 133 | #endif |
| 133 | 134 | ||
| 134 | static void crypto_aead_show(struct seq_file *m, struct crypto_alg *alg) | 135 | static void crypto_aead_show(struct seq_file *m, struct crypto_alg *alg) |
| 135 | __attribute__ ((unused)); | 136 | __maybe_unused; |
| 136 | static void crypto_aead_show(struct seq_file *m, struct crypto_alg *alg) | 137 | static void crypto_aead_show(struct seq_file *m, struct crypto_alg *alg) |
| 137 | { | 138 | { |
| 138 | struct aead_alg *aead = container_of(alg, struct aead_alg, base); | 139 | struct aead_alg *aead = container_of(alg, struct aead_alg, base); |
diff --git a/crypto/aes_generic.c b/crypto/aes_generic.c index 3dd101144a58..ca554d57d01e 100644 --- a/crypto/aes_generic.c +++ b/crypto/aes_generic.c | |||
| @@ -54,6 +54,7 @@ | |||
| 54 | #include <linux/errno.h> | 54 | #include <linux/errno.h> |
| 55 | #include <linux/crypto.h> | 55 | #include <linux/crypto.h> |
| 56 | #include <asm/byteorder.h> | 56 | #include <asm/byteorder.h> |
| 57 | #include <asm/unaligned.h> | ||
| 57 | 58 | ||
| 58 | static inline u8 byte(const u32 x, const unsigned n) | 59 | static inline u8 byte(const u32 x, const unsigned n) |
| 59 | { | 60 | { |
| @@ -1216,7 +1217,6 @@ EXPORT_SYMBOL_GPL(crypto_il_tab); | |||
| 1216 | int crypto_aes_expand_key(struct crypto_aes_ctx *ctx, const u8 *in_key, | 1217 | int crypto_aes_expand_key(struct crypto_aes_ctx *ctx, const u8 *in_key, |
| 1217 | unsigned int key_len) | 1218 | unsigned int key_len) |
| 1218 | { | 1219 | { |
| 1219 | const __le32 *key = (const __le32 *)in_key; | ||
| 1220 | u32 i, t, u, v, w, j; | 1220 | u32 i, t, u, v, w, j; |
| 1221 | 1221 | ||
| 1222 | if (key_len != AES_KEYSIZE_128 && key_len != AES_KEYSIZE_192 && | 1222 | if (key_len != AES_KEYSIZE_128 && key_len != AES_KEYSIZE_192 && |
| @@ -1225,10 +1225,15 @@ int crypto_aes_expand_key(struct crypto_aes_ctx *ctx, const u8 *in_key, | |||
| 1225 | 1225 | ||
| 1226 | ctx->key_length = key_len; | 1226 | ctx->key_length = key_len; |
| 1227 | 1227 | ||
| 1228 | ctx->key_dec[key_len + 24] = ctx->key_enc[0] = le32_to_cpu(key[0]); | 1228 | ctx->key_enc[0] = get_unaligned_le32(in_key); |
| 1229 | ctx->key_dec[key_len + 25] = ctx->key_enc[1] = le32_to_cpu(key[1]); | 1229 | ctx->key_enc[1] = get_unaligned_le32(in_key + 4); |
| 1230 | ctx->key_dec[key_len + 26] = ctx->key_enc[2] = le32_to_cpu(key[2]); | 1230 | ctx->key_enc[2] = get_unaligned_le32(in_key + 8); |
| 1231 | ctx->key_dec[key_len + 27] = ctx->key_enc[3] = le32_to_cpu(key[3]); | 1231 | ctx->key_enc[3] = get_unaligned_le32(in_key + 12); |
| 1232 | |||
| 1233 | ctx->key_dec[key_len + 24] = ctx->key_enc[0]; | ||
| 1234 | ctx->key_dec[key_len + 25] = ctx->key_enc[1]; | ||
| 1235 | ctx->key_dec[key_len + 26] = ctx->key_enc[2]; | ||
| 1236 | ctx->key_dec[key_len + 27] = ctx->key_enc[3]; | ||
| 1232 | 1237 | ||
| 1233 | switch (key_len) { | 1238 | switch (key_len) { |
| 1234 | case AES_KEYSIZE_128: | 1239 | case AES_KEYSIZE_128: |
| @@ -1238,17 +1243,17 @@ int crypto_aes_expand_key(struct crypto_aes_ctx *ctx, const u8 *in_key, | |||
| 1238 | break; | 1243 | break; |
| 1239 | 1244 | ||
| 1240 | case AES_KEYSIZE_192: | 1245 | case AES_KEYSIZE_192: |
| 1241 | ctx->key_enc[4] = le32_to_cpu(key[4]); | 1246 | ctx->key_enc[4] = get_unaligned_le32(in_key + 16); |
| 1242 | t = ctx->key_enc[5] = le32_to_cpu(key[5]); | 1247 | t = ctx->key_enc[5] = get_unaligned_le32(in_key + 20); |
| 1243 | for (i = 0; i < 8; ++i) | 1248 | for (i = 0; i < 8; ++i) |
| 1244 | loop6(i); | 1249 | loop6(i); |
| 1245 | break; | 1250 | break; |
| 1246 | 1251 | ||
| 1247 | case AES_KEYSIZE_256: | 1252 | case AES_KEYSIZE_256: |
| 1248 | ctx->key_enc[4] = le32_to_cpu(key[4]); | 1253 | ctx->key_enc[4] = get_unaligned_le32(in_key + 16); |
| 1249 | ctx->key_enc[5] = le32_to_cpu(key[5]); | 1254 | ctx->key_enc[5] = get_unaligned_le32(in_key + 20); |
| 1250 | ctx->key_enc[6] = le32_to_cpu(key[6]); | 1255 | ctx->key_enc[6] = get_unaligned_le32(in_key + 24); |
| 1251 | t = ctx->key_enc[7] = le32_to_cpu(key[7]); | 1256 | t = ctx->key_enc[7] = get_unaligned_le32(in_key + 28); |
| 1252 | for (i = 0; i < 6; ++i) | 1257 | for (i = 0; i < 6; ++i) |
| 1253 | loop8(i); | 1258 | loop8(i); |
| 1254 | loop8tophalf(i); | 1259 | loop8tophalf(i); |
| @@ -1329,16 +1334,14 @@ EXPORT_SYMBOL_GPL(crypto_aes_set_key); | |||
| 1329 | static void aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) | 1334 | static void aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) |
| 1330 | { | 1335 | { |
| 1331 | const struct crypto_aes_ctx *ctx = crypto_tfm_ctx(tfm); | 1336 | const struct crypto_aes_ctx *ctx = crypto_tfm_ctx(tfm); |
| 1332 | const __le32 *src = (const __le32 *)in; | ||
| 1333 | __le32 *dst = (__le32 *)out; | ||
| 1334 | u32 b0[4], b1[4]; | 1337 | u32 b0[4], b1[4]; |
| 1335 | const u32 *kp = ctx->key_enc + 4; | 1338 | const u32 *kp = ctx->key_enc + 4; |
| 1336 | const int key_len = ctx->key_length; | 1339 | const int key_len = ctx->key_length; |
| 1337 | 1340 | ||
| 1338 | b0[0] = le32_to_cpu(src[0]) ^ ctx->key_enc[0]; | 1341 | b0[0] = ctx->key_enc[0] ^ get_unaligned_le32(in); |
| 1339 | b0[1] = le32_to_cpu(src[1]) ^ ctx->key_enc[1]; | 1342 | b0[1] = ctx->key_enc[1] ^ get_unaligned_le32(in + 4); |
| 1340 | b0[2] = le32_to_cpu(src[2]) ^ ctx->key_enc[2]; | 1343 | b0[2] = ctx->key_enc[2] ^ get_unaligned_le32(in + 8); |
| 1341 | b0[3] = le32_to_cpu(src[3]) ^ ctx->key_enc[3]; | 1344 | b0[3] = ctx->key_enc[3] ^ get_unaligned_le32(in + 12); |
| 1342 | 1345 | ||
| 1343 | if (key_len > 24) { | 1346 | if (key_len > 24) { |
| 1344 | f_nround(b1, b0, kp); | 1347 | f_nround(b1, b0, kp); |
| @@ -1361,10 +1364,10 @@ static void aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) | |||
| 1361 | f_nround(b1, b0, kp); | 1364 | f_nround(b1, b0, kp); |
| 1362 | f_lround(b0, b1, kp); | 1365 | f_lround(b0, b1, kp); |
| 1363 | 1366 | ||
| 1364 | dst[0] = cpu_to_le32(b0[0]); | 1367 | put_unaligned_le32(b0[0], out); |
| 1365 | dst[1] = cpu_to_le32(b0[1]); | 1368 | put_unaligned_le32(b0[1], out + 4); |
| 1366 | dst[2] = cpu_to_le32(b0[2]); | 1369 | put_unaligned_le32(b0[2], out + 8); |
| 1367 | dst[3] = cpu_to_le32(b0[3]); | 1370 | put_unaligned_le32(b0[3], out + 12); |
| 1368 | } | 1371 | } |
| 1369 | 1372 | ||
| 1370 | /* decrypt a block of text */ | 1373 | /* decrypt a block of text */ |
| @@ -1401,16 +1404,14 @@ static void aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) | |||
| 1401 | static void aes_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) | 1404 | static void aes_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) |
| 1402 | { | 1405 | { |
| 1403 | const struct crypto_aes_ctx *ctx = crypto_tfm_ctx(tfm); | 1406 | const struct crypto_aes_ctx *ctx = crypto_tfm_ctx(tfm); |
| 1404 | const __le32 *src = (const __le32 *)in; | ||
| 1405 | __le32 *dst = (__le32 *)out; | ||
| 1406 | u32 b0[4], b1[4]; | 1407 | u32 b0[4], b1[4]; |
| 1407 | const int key_len = ctx->key_length; | 1408 | const int key_len = ctx->key_length; |
| 1408 | const u32 *kp = ctx->key_dec + 4; | 1409 | const u32 *kp = ctx->key_dec + 4; |
| 1409 | 1410 | ||
| 1410 | b0[0] = le32_to_cpu(src[0]) ^ ctx->key_dec[0]; | 1411 | b0[0] = ctx->key_dec[0] ^ get_unaligned_le32(in); |
| 1411 | b0[1] = le32_to_cpu(src[1]) ^ ctx->key_dec[1]; | 1412 | b0[1] = ctx->key_dec[1] ^ get_unaligned_le32(in + 4); |
| 1412 | b0[2] = le32_to_cpu(src[2]) ^ ctx->key_dec[2]; | 1413 | b0[2] = ctx->key_dec[2] ^ get_unaligned_le32(in + 8); |
| 1413 | b0[3] = le32_to_cpu(src[3]) ^ ctx->key_dec[3]; | 1414 | b0[3] = ctx->key_dec[3] ^ get_unaligned_le32(in + 12); |
| 1414 | 1415 | ||
| 1415 | if (key_len > 24) { | 1416 | if (key_len > 24) { |
| 1416 | i_nround(b1, b0, kp); | 1417 | i_nround(b1, b0, kp); |
| @@ -1433,10 +1434,10 @@ static void aes_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) | |||
| 1433 | i_nround(b1, b0, kp); | 1434 | i_nround(b1, b0, kp); |
| 1434 | i_lround(b0, b1, kp); | 1435 | i_lround(b0, b1, kp); |
| 1435 | 1436 | ||
| 1436 | dst[0] = cpu_to_le32(b0[0]); | 1437 | put_unaligned_le32(b0[0], out); |
| 1437 | dst[1] = cpu_to_le32(b0[1]); | 1438 | put_unaligned_le32(b0[1], out + 4); |
| 1438 | dst[2] = cpu_to_le32(b0[2]); | 1439 | put_unaligned_le32(b0[2], out + 8); |
| 1439 | dst[3] = cpu_to_le32(b0[3]); | 1440 | put_unaligned_le32(b0[3], out + 12); |
| 1440 | } | 1441 | } |
| 1441 | 1442 | ||
| 1442 | static struct crypto_alg aes_alg = { | 1443 | static struct crypto_alg aes_alg = { |
| @@ -1446,7 +1447,6 @@ static struct crypto_alg aes_alg = { | |||
| 1446 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | 1447 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, |
| 1447 | .cra_blocksize = AES_BLOCK_SIZE, | 1448 | .cra_blocksize = AES_BLOCK_SIZE, |
| 1448 | .cra_ctxsize = sizeof(struct crypto_aes_ctx), | 1449 | .cra_ctxsize = sizeof(struct crypto_aes_ctx), |
| 1449 | .cra_alignmask = 3, | ||
| 1450 | .cra_module = THIS_MODULE, | 1450 | .cra_module = THIS_MODULE, |
| 1451 | .cra_u = { | 1451 | .cra_u = { |
| 1452 | .cipher = { | 1452 | .cipher = { |
diff --git a/crypto/aes_ti.c b/crypto/aes_ti.c new file mode 100644 index 000000000000..92644fd1ac19 --- /dev/null +++ b/crypto/aes_ti.c | |||
| @@ -0,0 +1,375 @@ | |||
| 1 | /* | ||
| 2 | * Scalar fixed time AES core transform | ||
| 3 | * | ||
| 4 | * Copyright (C) 2017 Linaro Ltd <ard.biesheuvel@linaro.org> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #include <crypto/aes.h> | ||
| 12 | #include <linux/crypto.h> | ||
| 13 | #include <linux/module.h> | ||
| 14 | #include <asm/unaligned.h> | ||
| 15 | |||
| 16 | /* | ||
| 17 | * Emit the sbox as volatile const to prevent the compiler from doing | ||
| 18 | * constant folding on sbox references involving fixed indexes. | ||
| 19 | */ | ||
| 20 | static volatile const u8 __cacheline_aligned __aesti_sbox[] = { | ||
| 21 | 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, | ||
| 22 | 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, | ||
| 23 | 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, | ||
| 24 | 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, | ||
| 25 | 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, | ||
| 26 | 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, | ||
| 27 | 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, | ||
| 28 | 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, | ||
| 29 | 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, | ||
| 30 | 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, | ||
| 31 | 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, | ||
| 32 | 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, | ||
| 33 | 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, | ||
| 34 | 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, | ||
| 35 | 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, | ||
| 36 | 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, | ||
| 37 | 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, | ||
| 38 | 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, | ||
| 39 | 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, | ||
| 40 | 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, | ||
| 41 | 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, | ||
| 42 | 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, | ||
| 43 | 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, | ||
| 44 | 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, | ||
| 45 | 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, | ||
| 46 | 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, | ||
| 47 | 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, | ||
| 48 | 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, | ||
| 49 | 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, | ||
| 50 | 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, | ||
| 51 | 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, | ||
| 52 | 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16, | ||
| 53 | }; | ||
| 54 | |||
| 55 | static volatile const u8 __cacheline_aligned __aesti_inv_sbox[] = { | ||
| 56 | 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, | ||
| 57 | 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, | ||
| 58 | 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, | ||
| 59 | 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, | ||
| 60 | 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, | ||
| 61 | 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, | ||
| 62 | 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, | ||
| 63 | 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, | ||
| 64 | 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, | ||
| 65 | 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, | ||
| 66 | 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, | ||
| 67 | 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, | ||
| 68 | 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, | ||
| 69 | 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, | ||
| 70 | 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, | ||
| 71 | 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, | ||
| 72 | 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, | ||
| 73 | 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, | ||
| 74 | 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, | ||
| 75 | 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, | ||
| 76 | 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, | ||
| 77 | 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, | ||
| 78 | 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, | ||
| 79 | 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, | ||
| 80 | 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, | ||
| 81 | 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, | ||
| 82 | 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, | ||
| 83 | 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, | ||
| 84 | 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, | ||
| 85 | 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, | ||
| 86 | 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, | ||
| 87 | 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d, | ||
| 88 | }; | ||
| 89 | |||
| 90 | static u32 mul_by_x(u32 w) | ||
| 91 | { | ||
| 92 | u32 x = w & 0x7f7f7f7f; | ||
| 93 | u32 y = w & 0x80808080; | ||
| 94 | |||
| 95 | /* multiply by polynomial 'x' (0b10) in GF(2^8) */ | ||
| 96 | return (x << 1) ^ (y >> 7) * 0x1b; | ||
| 97 | } | ||
| 98 | |||
| 99 | static u32 mul_by_x2(u32 w) | ||
| 100 | { | ||
| 101 | u32 x = w & 0x3f3f3f3f; | ||
| 102 | u32 y = w & 0x80808080; | ||
| 103 | u32 z = w & 0x40404040; | ||
| 104 | |||
| 105 | /* multiply by polynomial 'x^2' (0b100) in GF(2^8) */ | ||
| 106 | return (x << 2) ^ (y >> 7) * 0x36 ^ (z >> 6) * 0x1b; | ||
| 107 | } | ||
| 108 | |||
| 109 | static u32 mix_columns(u32 x) | ||
| 110 | { | ||
| 111 | /* | ||
| 112 | * Perform the following matrix multiplication in GF(2^8) | ||
| 113 | * | ||
| 114 | * | 0x2 0x3 0x1 0x1 | | x[0] | | ||
| 115 | * | 0x1 0x2 0x3 0x1 | | x[1] | | ||
| 116 | * | 0x1 0x1 0x2 0x3 | x | x[2] | | ||
| 117 | * | 0x3 0x1 0x1 0x3 | | x[3] | | ||
| 118 | */ | ||
| 119 | u32 y = mul_by_x(x) ^ ror32(x, 16); | ||
| 120 | |||
| 121 | return y ^ ror32(x ^ y, 8); | ||
| 122 | } | ||
| 123 | |||
| 124 | static u32 inv_mix_columns(u32 x) | ||
| 125 | { | ||
| 126 | /* | ||
| 127 | * Perform the following matrix multiplication in GF(2^8) | ||
| 128 | * | ||
| 129 | * | 0xe 0xb 0xd 0x9 | | x[0] | | ||
| 130 | * | 0x9 0xe 0xb 0xd | | x[1] | | ||
| 131 | * | 0xd 0x9 0xe 0xb | x | x[2] | | ||
| 132 | * | 0xb 0xd 0x9 0xe | | x[3] | | ||
| 133 | * | ||
| 134 | * which can conveniently be reduced to | ||
| 135 | * | ||
| 136 | * | 0x2 0x3 0x1 0x1 | | 0x5 0x0 0x4 0x0 | | x[0] | | ||
| 137 | * | 0x1 0x2 0x3 0x1 | | 0x0 0x5 0x0 0x4 | | x[1] | | ||
| 138 | * | 0x1 0x1 0x2 0x3 | x | 0x4 0x0 0x5 0x0 | x | x[2] | | ||
| 139 | * | 0x3 0x1 0x1 0x2 | | 0x0 0x4 0x0 0x5 | | x[3] | | ||
| 140 | */ | ||
| 141 | u32 y = mul_by_x2(x); | ||
| 142 | |||
| 143 | return mix_columns(x ^ y ^ ror32(y, 16)); | ||
| 144 | } | ||
| 145 | |||
| 146 | static __always_inline u32 subshift(u32 in[], int pos) | ||
| 147 | { | ||
| 148 | return (__aesti_sbox[in[pos] & 0xff]) ^ | ||
| 149 | (__aesti_sbox[(in[(pos + 1) % 4] >> 8) & 0xff] << 8) ^ | ||
| 150 | (__aesti_sbox[(in[(pos + 2) % 4] >> 16) & 0xff] << 16) ^ | ||
| 151 | (__aesti_sbox[(in[(pos + 3) % 4] >> 24) & 0xff] << 24); | ||
| 152 | } | ||
| 153 | |||
| 154 | static __always_inline u32 inv_subshift(u32 in[], int pos) | ||
| 155 | { | ||
| 156 | return (__aesti_inv_sbox[in[pos] & 0xff]) ^ | ||
| 157 | (__aesti_inv_sbox[(in[(pos + 3) % 4] >> 8) & 0xff] << 8) ^ | ||
| 158 | (__aesti_inv_sbox[(in[(pos + 2) % 4] >> 16) & 0xff] << 16) ^ | ||
| 159 | (__aesti_inv_sbox[(in[(pos + 1) % 4] >> 24) & 0xff] << 24); | ||
| 160 | } | ||
| 161 | |||
| 162 | static u32 subw(u32 in) | ||
| 163 | { | ||
| 164 | return (__aesti_sbox[in & 0xff]) ^ | ||
| 165 | (__aesti_sbox[(in >> 8) & 0xff] << 8) ^ | ||
| 166 | (__aesti_sbox[(in >> 16) & 0xff] << 16) ^ | ||
| 167 | (__aesti_sbox[(in >> 24) & 0xff] << 24); | ||
| 168 | } | ||
| 169 | |||
| 170 | static int aesti_expand_key(struct crypto_aes_ctx *ctx, const u8 *in_key, | ||
| 171 | unsigned int key_len) | ||
| 172 | { | ||
| 173 | u32 kwords = key_len / sizeof(u32); | ||
| 174 | u32 rc, i, j; | ||
| 175 | |||
| 176 | if (key_len != AES_KEYSIZE_128 && | ||
| 177 | key_len != AES_KEYSIZE_192 && | ||
| 178 | key_len != AES_KEYSIZE_256) | ||
| 179 | return -EINVAL; | ||
| 180 | |||
| 181 | ctx->key_length = key_len; | ||
| 182 | |||
| 183 | for (i = 0; i < kwords; i++) | ||
| 184 | ctx->key_enc[i] = get_unaligned_le32(in_key + i * sizeof(u32)); | ||
| 185 | |||
| 186 | for (i = 0, rc = 1; i < 10; i++, rc = mul_by_x(rc)) { | ||
| 187 | u32 *rki = ctx->key_enc + (i * kwords); | ||
| 188 | u32 *rko = rki + kwords; | ||
| 189 | |||
| 190 | rko[0] = ror32(subw(rki[kwords - 1]), 8) ^ rc ^ rki[0]; | ||
| 191 | rko[1] = rko[0] ^ rki[1]; | ||
| 192 | rko[2] = rko[1] ^ rki[2]; | ||
| 193 | rko[3] = rko[2] ^ rki[3]; | ||
| 194 | |||
| 195 | if (key_len == 24) { | ||
| 196 | if (i >= 7) | ||
| 197 | break; | ||
| 198 | rko[4] = rko[3] ^ rki[4]; | ||
| 199 | rko[5] = rko[4] ^ rki[5]; | ||
| 200 | } else if (key_len == 32) { | ||
| 201 | if (i >= 6) | ||
| 202 | break; | ||
| 203 | rko[4] = subw(rko[3]) ^ rki[4]; | ||
| 204 | rko[5] = rko[4] ^ rki[5]; | ||
| 205 | rko[6] = rko[5] ^ rki[6]; | ||
| 206 | rko[7] = rko[6] ^ rki[7]; | ||
| 207 | } | ||
| 208 | } | ||
| 209 | |||
| 210 | /* | ||
| 211 | * Generate the decryption keys for the Equivalent Inverse Cipher. | ||
| 212 | * This involves reversing the order of the round keys, and applying | ||
| 213 | * the Inverse Mix Columns transformation to all but the first and | ||
| 214 | * the last one. | ||
| 215 | */ | ||
| 216 | ctx->key_dec[0] = ctx->key_enc[key_len + 24]; | ||
| 217 | ctx->key_dec[1] = ctx->key_enc[key_len + 25]; | ||
| 218 | ctx->key_dec[2] = ctx->key_enc[key_len + 26]; | ||
| 219 | ctx->key_dec[3] = ctx->key_enc[key_len + 27]; | ||
| 220 | |||
| 221 | for (i = 4, j = key_len + 20; j > 0; i += 4, j -= 4) { | ||
| 222 | ctx->key_dec[i] = inv_mix_columns(ctx->key_enc[j]); | ||
| 223 | ctx->key_dec[i + 1] = inv_mix_columns(ctx->key_enc[j + 1]); | ||
| 224 | ctx->key_dec[i + 2] = inv_mix_columns(ctx->key_enc[j + 2]); | ||
| 225 | ctx->key_dec[i + 3] = inv_mix_columns(ctx->key_enc[j + 3]); | ||
| 226 | } | ||
| 227 | |||
| 228 | ctx->key_dec[i] = ctx->key_enc[0]; | ||
| 229 | ctx->key_dec[i + 1] = ctx->key_enc[1]; | ||
| 230 | ctx->key_dec[i + 2] = ctx->key_enc[2]; | ||
| 231 | ctx->key_dec[i + 3] = ctx->key_enc[3]; | ||
| 232 | |||
| 233 | return 0; | ||
| 234 | } | ||
| 235 | |||
| 236 | static int aesti_set_key(struct crypto_tfm *tfm, const u8 *in_key, | ||
| 237 | unsigned int key_len) | ||
| 238 | { | ||
| 239 | struct crypto_aes_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 240 | int err; | ||
| 241 | |||
| 242 | err = aesti_expand_key(ctx, in_key, key_len); | ||
| 243 | if (err) | ||
| 244 | return err; | ||
| 245 | |||
| 246 | /* | ||
| 247 | * In order to force the compiler to emit data independent Sbox lookups | ||
| 248 | * at the start of each block, xor the first round key with values at | ||
| 249 | * fixed indexes in the Sbox. This will need to be repeated each time | ||
| 250 | * the key is used, which will pull the entire Sbox into the D-cache | ||
| 251 | * before any data dependent Sbox lookups are performed. | ||
| 252 | */ | ||
| 253 | ctx->key_enc[0] ^= __aesti_sbox[ 0] ^ __aesti_sbox[128]; | ||
| 254 | ctx->key_enc[1] ^= __aesti_sbox[32] ^ __aesti_sbox[160]; | ||
| 255 | ctx->key_enc[2] ^= __aesti_sbox[64] ^ __aesti_sbox[192]; | ||
| 256 | ctx->key_enc[3] ^= __aesti_sbox[96] ^ __aesti_sbox[224]; | ||
| 257 | |||
| 258 | ctx->key_dec[0] ^= __aesti_inv_sbox[ 0] ^ __aesti_inv_sbox[128]; | ||
| 259 | ctx->key_dec[1] ^= __aesti_inv_sbox[32] ^ __aesti_inv_sbox[160]; | ||
| 260 | ctx->key_dec[2] ^= __aesti_inv_sbox[64] ^ __aesti_inv_sbox[192]; | ||
| 261 | ctx->key_dec[3] ^= __aesti_inv_sbox[96] ^ __aesti_inv_sbox[224]; | ||
| 262 | |||
| 263 | return 0; | ||
| 264 | } | ||
| 265 | |||
| 266 | static void aesti_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) | ||
| 267 | { | ||
| 268 | const struct crypto_aes_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 269 | const u32 *rkp = ctx->key_enc + 4; | ||
| 270 | int rounds = 6 + ctx->key_length / 4; | ||
| 271 | u32 st0[4], st1[4]; | ||
| 272 | int round; | ||
| 273 | |||
| 274 | st0[0] = ctx->key_enc[0] ^ get_unaligned_le32(in); | ||
| 275 | st0[1] = ctx->key_enc[1] ^ get_unaligned_le32(in + 4); | ||
| 276 | st0[2] = ctx->key_enc[2] ^ get_unaligned_le32(in + 8); | ||
| 277 | st0[3] = ctx->key_enc[3] ^ get_unaligned_le32(in + 12); | ||
| 278 | |||
| 279 | st0[0] ^= __aesti_sbox[ 0] ^ __aesti_sbox[128]; | ||
| 280 | st0[1] ^= __aesti_sbox[32] ^ __aesti_sbox[160]; | ||
| 281 | st0[2] ^= __aesti_sbox[64] ^ __aesti_sbox[192]; | ||
| 282 | st0[3] ^= __aesti_sbox[96] ^ __aesti_sbox[224]; | ||
| 283 | |||
| 284 | for (round = 0;; round += 2, rkp += 8) { | ||
| 285 | st1[0] = mix_columns(subshift(st0, 0)) ^ rkp[0]; | ||
| 286 | st1[1] = mix_columns(subshift(st0, 1)) ^ rkp[1]; | ||
| 287 | st1[2] = mix_columns(subshift(st0, 2)) ^ rkp[2]; | ||
| 288 | st1[3] = mix_columns(subshift(st0, 3)) ^ rkp[3]; | ||
| 289 | |||
| 290 | if (round == rounds - 2) | ||
| 291 | break; | ||
| 292 | |||
| 293 | st0[0] = mix_columns(subshift(st1, 0)) ^ rkp[4]; | ||
| 294 | st0[1] = mix_columns(subshift(st1, 1)) ^ rkp[5]; | ||
| 295 | st0[2] = mix_columns(subshift(st1, 2)) ^ rkp[6]; | ||
| 296 | st0[3] = mix_columns(subshift(st1, 3)) ^ rkp[7]; | ||
| 297 | } | ||
| 298 | |||
| 299 | put_unaligned_le32(subshift(st1, 0) ^ rkp[4], out); | ||
| 300 | put_unaligned_le32(subshift(st1, 1) ^ rkp[5], out + 4); | ||
| 301 | put_unaligned_le32(subshift(st1, 2) ^ rkp[6], out + 8); | ||
| 302 | put_unaligned_le32(subshift(st1, 3) ^ rkp[7], out + 12); | ||
| 303 | } | ||
| 304 | |||
| 305 | static void aesti_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) | ||
| 306 | { | ||
| 307 | const struct crypto_aes_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 308 | const u32 *rkp = ctx->key_dec + 4; | ||
| 309 | int rounds = 6 + ctx->key_length / 4; | ||
| 310 | u32 st0[4], st1[4]; | ||
| 311 | int round; | ||
| 312 | |||
| 313 | st0[0] = ctx->key_dec[0] ^ get_unaligned_le32(in); | ||
| 314 | st0[1] = ctx->key_dec[1] ^ get_unaligned_le32(in + 4); | ||
| 315 | st0[2] = ctx->key_dec[2] ^ get_unaligned_le32(in + 8); | ||
| 316 | st0[3] = ctx->key_dec[3] ^ get_unaligned_le32(in + 12); | ||
| 317 | |||
| 318 | st0[0] ^= __aesti_inv_sbox[ 0] ^ __aesti_inv_sbox[128]; | ||
| 319 | st0[1] ^= __aesti_inv_sbox[32] ^ __aesti_inv_sbox[160]; | ||
| 320 | st0[2] ^= __aesti_inv_sbox[64] ^ __aesti_inv_sbox[192]; | ||
| 321 | st0[3] ^= __aesti_inv_sbox[96] ^ __aesti_inv_sbox[224]; | ||
| 322 | |||
| 323 | for (round = 0;; round += 2, rkp += 8) { | ||
| 324 | st1[0] = inv_mix_columns(inv_subshift(st0, 0)) ^ rkp[0]; | ||
| 325 | st1[1] = inv_mix_columns(inv_subshift(st0, 1)) ^ rkp[1]; | ||
| 326 | st1[2] = inv_mix_columns(inv_subshift(st0, 2)) ^ rkp[2]; | ||
| 327 | st1[3] = inv_mix_columns(inv_subshift(st0, 3)) ^ rkp[3]; | ||
| 328 | |||
| 329 | if (round == rounds - 2) | ||
| 330 | break; | ||
| 331 | |||
| 332 | st0[0] = inv_mix_columns(inv_subshift(st1, 0)) ^ rkp[4]; | ||
| 333 | st0[1] = inv_mix_columns(inv_subshift(st1, 1)) ^ rkp[5]; | ||
| 334 | st0[2] = inv_mix_columns(inv_subshift(st1, 2)) ^ rkp[6]; | ||
| 335 | st0[3] = inv_mix_columns(inv_subshift(st1, 3)) ^ rkp[7]; | ||
| 336 | } | ||
| 337 | |||
| 338 | put_unaligned_le32(inv_subshift(st1, 0) ^ rkp[4], out); | ||
| 339 | put_unaligned_le32(inv_subshift(st1, 1) ^ rkp[5], out + 4); | ||
| 340 | put_unaligned_le32(inv_subshift(st1, 2) ^ rkp[6], out + 8); | ||
| 341 | put_unaligned_le32(inv_subshift(st1, 3) ^ rkp[7], out + 12); | ||
| 342 | } | ||
| 343 | |||
| 344 | static struct crypto_alg aes_alg = { | ||
| 345 | .cra_name = "aes", | ||
| 346 | .cra_driver_name = "aes-fixed-time", | ||
| 347 | .cra_priority = 100 + 1, | ||
| 348 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | ||
| 349 | .cra_blocksize = AES_BLOCK_SIZE, | ||
| 350 | .cra_ctxsize = sizeof(struct crypto_aes_ctx), | ||
| 351 | .cra_module = THIS_MODULE, | ||
| 352 | |||
| 353 | .cra_cipher.cia_min_keysize = AES_MIN_KEY_SIZE, | ||
| 354 | .cra_cipher.cia_max_keysize = AES_MAX_KEY_SIZE, | ||
| 355 | .cra_cipher.cia_setkey = aesti_set_key, | ||
| 356 | .cra_cipher.cia_encrypt = aesti_encrypt, | ||
| 357 | .cra_cipher.cia_decrypt = aesti_decrypt | ||
| 358 | }; | ||
| 359 | |||
| 360 | static int __init aes_init(void) | ||
| 361 | { | ||
| 362 | return crypto_register_alg(&aes_alg); | ||
| 363 | } | ||
| 364 | |||
| 365 | static void __exit aes_fini(void) | ||
| 366 | { | ||
| 367 | crypto_unregister_alg(&aes_alg); | ||
| 368 | } | ||
| 369 | |||
| 370 | module_init(aes_init); | ||
| 371 | module_exit(aes_fini); | ||
| 372 | |||
| 373 | MODULE_DESCRIPTION("Generic fixed time AES"); | ||
| 374 | MODULE_AUTHOR("Ard Biesheuvel <ard.biesheuvel@linaro.org>"); | ||
| 375 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/crypto/af_alg.c b/crypto/af_alg.c index f5e18c2a4852..690deca17c35 100644 --- a/crypto/af_alg.c +++ b/crypto/af_alg.c | |||
| @@ -266,7 +266,7 @@ unlock: | |||
| 266 | return err; | 266 | return err; |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | int af_alg_accept(struct sock *sk, struct socket *newsock) | 269 | int af_alg_accept(struct sock *sk, struct socket *newsock, bool kern) |
| 270 | { | 270 | { |
| 271 | struct alg_sock *ask = alg_sk(sk); | 271 | struct alg_sock *ask = alg_sk(sk); |
| 272 | const struct af_alg_type *type; | 272 | const struct af_alg_type *type; |
| @@ -281,7 +281,7 @@ int af_alg_accept(struct sock *sk, struct socket *newsock) | |||
| 281 | if (!type) | 281 | if (!type) |
| 282 | goto unlock; | 282 | goto unlock; |
| 283 | 283 | ||
| 284 | sk2 = sk_alloc(sock_net(sk), PF_ALG, GFP_KERNEL, &alg_proto, 0); | 284 | sk2 = sk_alloc(sock_net(sk), PF_ALG, GFP_KERNEL, &alg_proto, kern); |
| 285 | err = -ENOMEM; | 285 | err = -ENOMEM; |
| 286 | if (!sk2) | 286 | if (!sk2) |
| 287 | goto unlock; | 287 | goto unlock; |
| @@ -323,9 +323,10 @@ unlock: | |||
| 323 | } | 323 | } |
| 324 | EXPORT_SYMBOL_GPL(af_alg_accept); | 324 | EXPORT_SYMBOL_GPL(af_alg_accept); |
| 325 | 325 | ||
| 326 | static int alg_accept(struct socket *sock, struct socket *newsock, int flags) | 326 | static int alg_accept(struct socket *sock, struct socket *newsock, int flags, |
| 327 | bool kern) | ||
| 327 | { | 328 | { |
| 328 | return af_alg_accept(sock->sk, newsock); | 329 | return af_alg_accept(sock->sk, newsock, kern); |
| 329 | } | 330 | } |
| 330 | 331 | ||
| 331 | static const struct proto_ops alg_proto_ops = { | 332 | static const struct proto_ops alg_proto_ops = { |
diff --git a/crypto/ahash.c b/crypto/ahash.c index 2ce8bcb9049c..e58c4970c22b 100644 --- a/crypto/ahash.c +++ b/crypto/ahash.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
| 24 | #include <linux/seq_file.h> | 24 | #include <linux/seq_file.h> |
| 25 | #include <linux/cryptouser.h> | 25 | #include <linux/cryptouser.h> |
| 26 | #include <linux/compiler.h> | ||
| 26 | #include <net/netlink.h> | 27 | #include <net/netlink.h> |
| 27 | 28 | ||
| 28 | #include "internal.h" | 29 | #include "internal.h" |
| @@ -493,7 +494,7 @@ static int crypto_ahash_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
| 493 | #endif | 494 | #endif |
| 494 | 495 | ||
| 495 | static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg) | 496 | static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg) |
| 496 | __attribute__ ((unused)); | 497 | __maybe_unused; |
| 497 | static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg) | 498 | static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg) |
| 498 | { | 499 | { |
| 499 | seq_printf(m, "type : ahash\n"); | 500 | seq_printf(m, "type : ahash\n"); |
diff --git a/crypto/akcipher.c b/crypto/akcipher.c index def301ed1288..cfbdb06d8ca8 100644 --- a/crypto/akcipher.c +++ b/crypto/akcipher.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
| 18 | #include <linux/string.h> | 18 | #include <linux/string.h> |
| 19 | #include <linux/crypto.h> | 19 | #include <linux/crypto.h> |
| 20 | #include <linux/compiler.h> | ||
| 20 | #include <crypto/algapi.h> | 21 | #include <crypto/algapi.h> |
| 21 | #include <linux/cryptouser.h> | 22 | #include <linux/cryptouser.h> |
| 22 | #include <net/netlink.h> | 23 | #include <net/netlink.h> |
| @@ -47,7 +48,7 @@ static int crypto_akcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
| 47 | #endif | 48 | #endif |
| 48 | 49 | ||
| 49 | static void crypto_akcipher_show(struct seq_file *m, struct crypto_alg *alg) | 50 | static void crypto_akcipher_show(struct seq_file *m, struct crypto_alg *alg) |
| 50 | __attribute__ ((unused)); | 51 | __maybe_unused; |
| 51 | 52 | ||
| 52 | static void crypto_akcipher_show(struct seq_file *m, struct crypto_alg *alg) | 53 | static void crypto_akcipher_show(struct seq_file *m, struct crypto_alg *alg) |
| 53 | { | 54 | { |
diff --git a/crypto/algapi.c b/crypto/algapi.c index 1fad2a6b3bbb..6b52e8f0b95f 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c | |||
| @@ -962,34 +962,66 @@ void crypto_inc(u8 *a, unsigned int size) | |||
| 962 | __be32 *b = (__be32 *)(a + size); | 962 | __be32 *b = (__be32 *)(a + size); |
| 963 | u32 c; | 963 | u32 c; |
| 964 | 964 | ||
| 965 | for (; size >= 4; size -= 4) { | 965 | if (IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) || |
| 966 | c = be32_to_cpu(*--b) + 1; | 966 | !((unsigned long)b & (__alignof__(*b) - 1))) |
| 967 | *b = cpu_to_be32(c); | 967 | for (; size >= 4; size -= 4) { |
| 968 | if (c) | 968 | c = be32_to_cpu(*--b) + 1; |
| 969 | return; | 969 | *b = cpu_to_be32(c); |
| 970 | } | 970 | if (c) |
| 971 | return; | ||
| 972 | } | ||
| 971 | 973 | ||
| 972 | crypto_inc_byte(a, size); | 974 | crypto_inc_byte(a, size); |
| 973 | } | 975 | } |
| 974 | EXPORT_SYMBOL_GPL(crypto_inc); | 976 | EXPORT_SYMBOL_GPL(crypto_inc); |
| 975 | 977 | ||
| 976 | static inline void crypto_xor_byte(u8 *a, const u8 *b, unsigned int size) | 978 | void __crypto_xor(u8 *dst, const u8 *src, unsigned int len) |
| 977 | { | 979 | { |
| 978 | for (; size; size--) | 980 | int relalign = 0; |
| 979 | *a++ ^= *b++; | 981 | |
| 980 | } | 982 | if (!IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)) { |
| 983 | int size = sizeof(unsigned long); | ||
| 984 | int d = ((unsigned long)dst ^ (unsigned long)src) & (size - 1); | ||
| 985 | |||
| 986 | relalign = d ? 1 << __ffs(d) : size; | ||
| 987 | |||
| 988 | /* | ||
| 989 | * If we care about alignment, process as many bytes as | ||
| 990 | * needed to advance dst and src to values whose alignments | ||
| 991 | * equal their relative alignment. This will allow us to | ||
| 992 | * process the remainder of the input using optimal strides. | ||
| 993 | */ | ||
| 994 | while (((unsigned long)dst & (relalign - 1)) && len > 0) { | ||
| 995 | *dst++ ^= *src++; | ||
| 996 | len--; | ||
| 997 | } | ||
| 998 | } | ||
| 981 | 999 | ||
| 982 | void crypto_xor(u8 *dst, const u8 *src, unsigned int size) | 1000 | while (IS_ENABLED(CONFIG_64BIT) && len >= 8 && !(relalign & 7)) { |
| 983 | { | 1001 | *(u64 *)dst ^= *(u64 *)src; |
| 984 | u32 *a = (u32 *)dst; | 1002 | dst += 8; |
| 985 | u32 *b = (u32 *)src; | 1003 | src += 8; |
| 1004 | len -= 8; | ||
| 1005 | } | ||
| 986 | 1006 | ||
| 987 | for (; size >= 4; size -= 4) | 1007 | while (len >= 4 && !(relalign & 3)) { |
| 988 | *a++ ^= *b++; | 1008 | *(u32 *)dst ^= *(u32 *)src; |
| 1009 | dst += 4; | ||
| 1010 | src += 4; | ||
| 1011 | len -= 4; | ||
| 1012 | } | ||
| 1013 | |||
| 1014 | while (len >= 2 && !(relalign & 1)) { | ||
| 1015 | *(u16 *)dst ^= *(u16 *)src; | ||
| 1016 | dst += 2; | ||
| 1017 | src += 2; | ||
| 1018 | len -= 2; | ||
| 1019 | } | ||
| 989 | 1020 | ||
| 990 | crypto_xor_byte((u8 *)a, (u8 *)b, size); | 1021 | while (len--) |
| 1022 | *dst++ ^= *src++; | ||
| 991 | } | 1023 | } |
| 992 | EXPORT_SYMBOL_GPL(crypto_xor); | 1024 | EXPORT_SYMBOL_GPL(__crypto_xor); |
| 993 | 1025 | ||
| 994 | unsigned int crypto_alg_extsize(struct crypto_alg *alg) | 1026 | unsigned int crypto_alg_extsize(struct crypto_alg *alg) |
| 995 | { | 1027 | { |
diff --git a/crypto/algboss.c b/crypto/algboss.c index ccb85e1798f2..960d8548171b 100644 --- a/crypto/algboss.c +++ b/crypto/algboss.c | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
| 20 | #include <linux/notifier.h> | 20 | #include <linux/notifier.h> |
| 21 | #include <linux/rtnetlink.h> | 21 | #include <linux/rtnetlink.h> |
| 22 | #include <linux/sched.h> | 22 | #include <linux/sched/signal.h> |
| 23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
| 24 | #include <linux/string.h> | 24 | #include <linux/string.h> |
| 25 | 25 | ||
diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c index 533265f110e0..5a8053758657 100644 --- a/crypto/algif_aead.c +++ b/crypto/algif_aead.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
| 20 | #include <linux/list.h> | 20 | #include <linux/list.h> |
| 21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
| 22 | #include <linux/sched/signal.h> | ||
| 22 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
| 23 | #include <linux/module.h> | 24 | #include <linux/module.h> |
| 24 | #include <linux/net.h> | 25 | #include <linux/net.h> |
diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c index d19b09cdf284..5e92bd275ef3 100644 --- a/crypto/algif_hash.c +++ b/crypto/algif_hash.c | |||
| @@ -239,13 +239,14 @@ unlock: | |||
| 239 | return err ?: len; | 239 | return err ?: len; |
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | static int hash_accept(struct socket *sock, struct socket *newsock, int flags) | 242 | static int hash_accept(struct socket *sock, struct socket *newsock, int flags, |
| 243 | bool kern) | ||
| 243 | { | 244 | { |
| 244 | struct sock *sk = sock->sk; | 245 | struct sock *sk = sock->sk; |
| 245 | struct alg_sock *ask = alg_sk(sk); | 246 | struct alg_sock *ask = alg_sk(sk); |
| 246 | struct hash_ctx *ctx = ask->private; | 247 | struct hash_ctx *ctx = ask->private; |
| 247 | struct ahash_request *req = &ctx->req; | 248 | struct ahash_request *req = &ctx->req; |
| 248 | char state[crypto_ahash_statesize(crypto_ahash_reqtfm(req))]; | 249 | char state[crypto_ahash_statesize(crypto_ahash_reqtfm(req)) ? : 1]; |
| 249 | struct sock *sk2; | 250 | struct sock *sk2; |
| 250 | struct alg_sock *ask2; | 251 | struct alg_sock *ask2; |
| 251 | struct hash_ctx *ctx2; | 252 | struct hash_ctx *ctx2; |
| @@ -260,7 +261,7 @@ static int hash_accept(struct socket *sock, struct socket *newsock, int flags) | |||
| 260 | if (err) | 261 | if (err) |
| 261 | return err; | 262 | return err; |
| 262 | 263 | ||
| 263 | err = af_alg_accept(ask->parent, newsock); | 264 | err = af_alg_accept(ask->parent, newsock, kern); |
| 264 | if (err) | 265 | if (err) |
| 265 | return err; | 266 | return err; |
| 266 | 267 | ||
| @@ -378,7 +379,7 @@ static int hash_recvmsg_nokey(struct socket *sock, struct msghdr *msg, | |||
| 378 | } | 379 | } |
| 379 | 380 | ||
| 380 | static int hash_accept_nokey(struct socket *sock, struct socket *newsock, | 381 | static int hash_accept_nokey(struct socket *sock, struct socket *newsock, |
| 381 | int flags) | 382 | int flags, bool kern) |
| 382 | { | 383 | { |
| 383 | int err; | 384 | int err; |
| 384 | 385 | ||
| @@ -386,7 +387,7 @@ static int hash_accept_nokey(struct socket *sock, struct socket *newsock, | |||
| 386 | if (err) | 387 | if (err) |
| 387 | return err; | 388 | return err; |
| 388 | 389 | ||
| 389 | return hash_accept(sock, newsock, flags); | 390 | return hash_accept(sock, newsock, flags, kern); |
| 390 | } | 391 | } |
| 391 | 392 | ||
| 392 | static struct proto_ops algif_hash_ops_nokey = { | 393 | static struct proto_ops algif_hash_ops_nokey = { |
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c index a9e79d8eff87..43839b00fe6c 100644 --- a/crypto/algif_skcipher.c +++ b/crypto/algif_skcipher.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
| 19 | #include <linux/list.h> | 19 | #include <linux/list.h> |
| 20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
| 21 | #include <linux/sched/signal.h> | ||
| 21 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
| 22 | #include <linux/module.h> | 23 | #include <linux/module.h> |
| 23 | #include <linux/net.h> | 24 | #include <linux/net.h> |
diff --git a/crypto/api.c b/crypto/api.c index b16ce1653284..941cd4c6c7ec 100644 --- a/crypto/api.c +++ b/crypto/api.c | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | #include <linux/kmod.h> | 21 | #include <linux/kmod.h> |
| 22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
| 23 | #include <linux/param.h> | 23 | #include <linux/param.h> |
| 24 | #include <linux/sched.h> | 24 | #include <linux/sched/signal.h> |
| 25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
| 26 | #include <linux/string.h> | 26 | #include <linux/string.h> |
| 27 | #include "internal.h" | 27 | #include "internal.h" |
diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c index a832426820e8..6c43a0a17a55 100644 --- a/crypto/blkcipher.c +++ b/crypto/blkcipher.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Block chaining cipher operations. | 2 | * Block chaining cipher operations. |
| 3 | * | 3 | * |
| 4 | * Generic encrypt/decrypt wrapper for ciphers, handles operations across | 4 | * Generic encrypt/decrypt wrapper for ciphers, handles operations across |
| 5 | * multiple page boundaries by using temporary blocks. In user context, | 5 | * multiple page boundaries by using temporary blocks. In user context, |
| 6 | * the kernel is given a chance to schedule us once per page. | 6 | * the kernel is given a chance to schedule us once per page. |
| @@ -9,7 +9,7 @@ | |||
| 9 | * | 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify it | 10 | * This program is free software; you can redistribute it and/or modify it |
| 11 | * under the terms of the GNU General Public License as published by the Free | 11 | * under the terms of the GNU General Public License as published by the Free |
| 12 | * Software Foundation; either version 2 of the License, or (at your option) | 12 | * Software Foundation; either version 2 of the License, or (at your option) |
| 13 | * any later version. | 13 | * any later version. |
| 14 | * | 14 | * |
| 15 | */ | 15 | */ |
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
| 26 | #include <linux/string.h> | 26 | #include <linux/string.h> |
| 27 | #include <linux/cryptouser.h> | 27 | #include <linux/cryptouser.h> |
| 28 | #include <linux/compiler.h> | ||
| 28 | #include <net/netlink.h> | 29 | #include <net/netlink.h> |
| 29 | 30 | ||
| 30 | #include "internal.h" | 31 | #include "internal.h" |
| @@ -534,7 +535,7 @@ static int crypto_blkcipher_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
| 534 | #endif | 535 | #endif |
| 535 | 536 | ||
| 536 | static void crypto_blkcipher_show(struct seq_file *m, struct crypto_alg *alg) | 537 | static void crypto_blkcipher_show(struct seq_file *m, struct crypto_alg *alg) |
| 537 | __attribute__ ((unused)); | 538 | __maybe_unused; |
| 538 | static void crypto_blkcipher_show(struct seq_file *m, struct crypto_alg *alg) | 539 | static void crypto_blkcipher_show(struct seq_file *m, struct crypto_alg *alg) |
| 539 | { | 540 | { |
| 540 | seq_printf(m, "type : blkcipher\n"); | 541 | seq_printf(m, "type : blkcipher\n"); |
diff --git a/crypto/cbc.c b/crypto/cbc.c index 68f751a41a84..bc160a3186dc 100644 --- a/crypto/cbc.c +++ b/crypto/cbc.c | |||
| @@ -145,9 +145,6 @@ static int crypto_cbc_create(struct crypto_template *tmpl, struct rtattr **tb) | |||
| 145 | inst->alg.base.cra_blocksize = alg->cra_blocksize; | 145 | inst->alg.base.cra_blocksize = alg->cra_blocksize; |
| 146 | inst->alg.base.cra_alignmask = alg->cra_alignmask; | 146 | inst->alg.base.cra_alignmask = alg->cra_alignmask; |
| 147 | 147 | ||
| 148 | /* We access the data as u32s when xoring. */ | ||
| 149 | inst->alg.base.cra_alignmask |= __alignof__(u32) - 1; | ||
| 150 | |||
| 151 | inst->alg.ivsize = alg->cra_blocksize; | 148 | inst->alg.ivsize = alg->cra_blocksize; |
| 152 | inst->alg.min_keysize = alg->cra_cipher.cia_min_keysize; | 149 | inst->alg.min_keysize = alg->cra_cipher.cia_min_keysize; |
| 153 | inst->alg.max_keysize = alg->cra_cipher.cia_max_keysize; | 150 | inst->alg.max_keysize = alg->cra_cipher.cia_max_keysize; |
diff --git a/crypto/ccm.c b/crypto/ccm.c index 26b924d1e582..1ce37ae0ce56 100644 --- a/crypto/ccm.c +++ b/crypto/ccm.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #include <crypto/internal/aead.h> | 13 | #include <crypto/internal/aead.h> |
| 14 | #include <crypto/internal/hash.h> | ||
| 14 | #include <crypto/internal/skcipher.h> | 15 | #include <crypto/internal/skcipher.h> |
| 15 | #include <crypto/scatterwalk.h> | 16 | #include <crypto/scatterwalk.h> |
| 16 | #include <linux/err.h> | 17 | #include <linux/err.h> |
| @@ -23,11 +24,11 @@ | |||
| 23 | 24 | ||
| 24 | struct ccm_instance_ctx { | 25 | struct ccm_instance_ctx { |
| 25 | struct crypto_skcipher_spawn ctr; | 26 | struct crypto_skcipher_spawn ctr; |
| 26 | struct crypto_spawn cipher; | 27 | struct crypto_ahash_spawn mac; |
| 27 | }; | 28 | }; |
| 28 | 29 | ||
| 29 | struct crypto_ccm_ctx { | 30 | struct crypto_ccm_ctx { |
| 30 | struct crypto_cipher *cipher; | 31 | struct crypto_ahash *mac; |
| 31 | struct crypto_skcipher *ctr; | 32 | struct crypto_skcipher *ctr; |
| 32 | }; | 33 | }; |
| 33 | 34 | ||
| @@ -46,13 +47,20 @@ struct crypto_ccm_req_priv_ctx { | |||
| 46 | u8 odata[16]; | 47 | u8 odata[16]; |
| 47 | u8 idata[16]; | 48 | u8 idata[16]; |
| 48 | u8 auth_tag[16]; | 49 | u8 auth_tag[16]; |
| 49 | u32 ilen; | ||
| 50 | u32 flags; | 50 | u32 flags; |
| 51 | struct scatterlist src[3]; | 51 | struct scatterlist src[3]; |
| 52 | struct scatterlist dst[3]; | 52 | struct scatterlist dst[3]; |
| 53 | struct skcipher_request skreq; | 53 | struct skcipher_request skreq; |
| 54 | }; | 54 | }; |
| 55 | 55 | ||
| 56 | struct cbcmac_tfm_ctx { | ||
| 57 | struct crypto_cipher *child; | ||
| 58 | }; | ||
| 59 | |||
| 60 | struct cbcmac_desc_ctx { | ||
| 61 | unsigned int len; | ||
| 62 | }; | ||
| 63 | |||
| 56 | static inline struct crypto_ccm_req_priv_ctx *crypto_ccm_reqctx( | 64 | static inline struct crypto_ccm_req_priv_ctx *crypto_ccm_reqctx( |
| 57 | struct aead_request *req) | 65 | struct aead_request *req) |
| 58 | { | 66 | { |
| @@ -84,7 +92,7 @@ static int crypto_ccm_setkey(struct crypto_aead *aead, const u8 *key, | |||
| 84 | { | 92 | { |
| 85 | struct crypto_ccm_ctx *ctx = crypto_aead_ctx(aead); | 93 | struct crypto_ccm_ctx *ctx = crypto_aead_ctx(aead); |
| 86 | struct crypto_skcipher *ctr = ctx->ctr; | 94 | struct crypto_skcipher *ctr = ctx->ctr; |
| 87 | struct crypto_cipher *tfm = ctx->cipher; | 95 | struct crypto_ahash *mac = ctx->mac; |
| 88 | int err = 0; | 96 | int err = 0; |
| 89 | 97 | ||
| 90 | crypto_skcipher_clear_flags(ctr, CRYPTO_TFM_REQ_MASK); | 98 | crypto_skcipher_clear_flags(ctr, CRYPTO_TFM_REQ_MASK); |
| @@ -96,11 +104,11 @@ static int crypto_ccm_setkey(struct crypto_aead *aead, const u8 *key, | |||
| 96 | if (err) | 104 | if (err) |
| 97 | goto out; | 105 | goto out; |
| 98 | 106 | ||
| 99 | crypto_cipher_clear_flags(tfm, CRYPTO_TFM_REQ_MASK); | 107 | crypto_ahash_clear_flags(mac, CRYPTO_TFM_REQ_MASK); |
| 100 | crypto_cipher_set_flags(tfm, crypto_aead_get_flags(aead) & | 108 | crypto_ahash_set_flags(mac, crypto_aead_get_flags(aead) & |
| 101 | CRYPTO_TFM_REQ_MASK); | 109 | CRYPTO_TFM_REQ_MASK); |
| 102 | err = crypto_cipher_setkey(tfm, key, keylen); | 110 | err = crypto_ahash_setkey(mac, key, keylen); |
| 103 | crypto_aead_set_flags(aead, crypto_cipher_get_flags(tfm) & | 111 | crypto_aead_set_flags(aead, crypto_ahash_get_flags(mac) & |
| 104 | CRYPTO_TFM_RES_MASK); | 112 | CRYPTO_TFM_RES_MASK); |
| 105 | 113 | ||
| 106 | out: | 114 | out: |
| @@ -167,119 +175,61 @@ static int format_adata(u8 *adata, unsigned int a) | |||
| 167 | return len; | 175 | return len; |
| 168 | } | 176 | } |
| 169 | 177 | ||
| 170 | static void compute_mac(struct crypto_cipher *tfm, u8 *data, int n, | ||
| 171 | struct crypto_ccm_req_priv_ctx *pctx) | ||
| 172 | { | ||
| 173 | unsigned int bs = 16; | ||
| 174 | u8 *odata = pctx->odata; | ||
| 175 | u8 *idata = pctx->idata; | ||
| 176 | int datalen, getlen; | ||
| 177 | |||
| 178 | datalen = n; | ||
| 179 | |||
| 180 | /* first time in here, block may be partially filled. */ | ||
| 181 | getlen = bs - pctx->ilen; | ||
| 182 | if (datalen >= getlen) { | ||
| 183 | memcpy(idata + pctx->ilen, data, getlen); | ||
| 184 | crypto_xor(odata, idata, bs); | ||
| 185 | crypto_cipher_encrypt_one(tfm, odata, odata); | ||
| 186 | datalen -= getlen; | ||
| 187 | data += getlen; | ||
| 188 | pctx->ilen = 0; | ||
| 189 | } | ||
| 190 | |||
| 191 | /* now encrypt rest of data */ | ||
| 192 | while (datalen >= bs) { | ||
| 193 | crypto_xor(odata, data, bs); | ||
| 194 | crypto_cipher_encrypt_one(tfm, odata, odata); | ||
| 195 | |||
| 196 | datalen -= bs; | ||
| 197 | data += bs; | ||
| 198 | } | ||
| 199 | |||
| 200 | /* check and see if there's leftover data that wasn't | ||
| 201 | * enough to fill a block. | ||
| 202 | */ | ||
| 203 | if (datalen) { | ||
| 204 | memcpy(idata + pctx->ilen, data, datalen); | ||
| 205 | pctx->ilen += datalen; | ||
| 206 | } | ||
| 207 | } | ||
| 208 | |||
| 209 | static void get_data_to_compute(struct crypto_cipher *tfm, | ||
| 210 | struct crypto_ccm_req_priv_ctx *pctx, | ||
| 211 | struct scatterlist *sg, unsigned int len) | ||
| 212 | { | ||
| 213 | struct scatter_walk walk; | ||
| 214 | u8 *data_src; | ||
| 215 | int n; | ||
| 216 | |||
| 217 | scatterwalk_start(&walk, sg); | ||
| 218 | |||
| 219 | while (len) { | ||
| 220 | n = scatterwalk_clamp(&walk, len); | ||
| 221 | if (!n) { | ||
| 222 | scatterwalk_start(&walk, sg_next(walk.sg)); | ||
| 223 | n = scatterwalk_clamp(&walk, len); | ||
| 224 | } | ||
| 225 | data_src = scatterwalk_map(&walk); | ||
| 226 | |||
| 227 | compute_mac(tfm, data_src, n, pctx); | ||
| 228 | len -= n; | ||
| 229 | |||
| 230 | scatterwalk_unmap(data_src); | ||
| 231 | scatterwalk_advance(&walk, n); | ||
| 232 | scatterwalk_done(&walk, 0, len); | ||
| 233 | if (len) | ||
| 234 | crypto_yield(pctx->flags); | ||
| 235 | } | ||
| 236 | |||
| 237 | /* any leftover needs padding and then encrypted */ | ||
| 238 | if (pctx->ilen) { | ||
| 239 | int padlen; | ||
| 240 | u8 *odata = pctx->odata; | ||
| 241 | u8 *idata = pctx->idata; | ||
| 242 | |||
| 243 | padlen = 16 - pctx->ilen; | ||
| 244 | memset(idata + pctx->ilen, 0, padlen); | ||
| 245 | crypto_xor(odata, idata, 16); | ||
| 246 | crypto_cipher_encrypt_one(tfm, odata, odata); | ||
| 247 | pctx->ilen = 0; | ||
| 248 | } | ||
| 249 | } | ||
| 250 | |||
| 251 | static int crypto_ccm_auth(struct aead_request *req, struct scatterlist *plain, | 178 | static int crypto_ccm_auth(struct aead_request *req, struct scatterlist *plain, |
| 252 | unsigned int cryptlen) | 179 | unsigned int cryptlen) |
| 253 | { | 180 | { |
| 181 | struct crypto_ccm_req_priv_ctx *pctx = crypto_ccm_reqctx(req); | ||
| 254 | struct crypto_aead *aead = crypto_aead_reqtfm(req); | 182 | struct crypto_aead *aead = crypto_aead_reqtfm(req); |
| 255 | struct crypto_ccm_ctx *ctx = crypto_aead_ctx(aead); | 183 | struct crypto_ccm_ctx *ctx = crypto_aead_ctx(aead); |
| 256 | struct crypto_ccm_req_priv_ctx *pctx = crypto_ccm_reqctx(req); | 184 | AHASH_REQUEST_ON_STACK(ahreq, ctx->mac); |
| 257 | struct crypto_cipher *cipher = ctx->cipher; | ||
| 258 | unsigned int assoclen = req->assoclen; | 185 | unsigned int assoclen = req->assoclen; |
| 186 | struct scatterlist sg[3]; | ||
| 259 | u8 *odata = pctx->odata; | 187 | u8 *odata = pctx->odata; |
| 260 | u8 *idata = pctx->idata; | 188 | u8 *idata = pctx->idata; |
| 261 | int err; | 189 | int ilen, err; |
| 262 | 190 | ||
| 263 | /* format control data for input */ | 191 | /* format control data for input */ |
| 264 | err = format_input(odata, req, cryptlen); | 192 | err = format_input(odata, req, cryptlen); |
| 265 | if (err) | 193 | if (err) |
| 266 | goto out; | 194 | goto out; |
| 267 | 195 | ||
| 268 | /* encrypt first block to use as start in computing mac */ | 196 | sg_init_table(sg, 3); |
| 269 | crypto_cipher_encrypt_one(cipher, odata, odata); | 197 | sg_set_buf(&sg[0], odata, 16); |
| 270 | 198 | ||
| 271 | /* format associated data and compute into mac */ | 199 | /* format associated data and compute into mac */ |
| 272 | if (assoclen) { | 200 | if (assoclen) { |
| 273 | pctx->ilen = format_adata(idata, assoclen); | 201 | ilen = format_adata(idata, assoclen); |
| 274 | get_data_to_compute(cipher, pctx, req->src, req->assoclen); | 202 | sg_set_buf(&sg[1], idata, ilen); |
| 203 | sg_chain(sg, 3, req->src); | ||
| 275 | } else { | 204 | } else { |
| 276 | pctx->ilen = 0; | 205 | ilen = 0; |
| 206 | sg_chain(sg, 2, req->src); | ||
| 277 | } | 207 | } |
| 278 | 208 | ||
| 279 | /* compute plaintext into mac */ | 209 | ahash_request_set_tfm(ahreq, ctx->mac); |
| 280 | if (cryptlen) | 210 | ahash_request_set_callback(ahreq, pctx->flags, NULL, NULL); |
| 281 | get_data_to_compute(cipher, pctx, plain, cryptlen); | 211 | ahash_request_set_crypt(ahreq, sg, NULL, assoclen + ilen + 16); |
| 212 | err = crypto_ahash_init(ahreq); | ||
| 213 | if (err) | ||
| 214 | goto out; | ||
| 215 | err = crypto_ahash_update(ahreq); | ||
| 216 | if (err) | ||
| 217 | goto out; | ||
| 218 | |||
| 219 | /* we need to pad the MAC input to a round multiple of the block size */ | ||
| 220 | ilen = 16 - (assoclen + ilen) % 16; | ||
| 221 | if (ilen < 16) { | ||
| 222 | memset(idata, 0, ilen); | ||
| 223 | sg_init_table(sg, 2); | ||
| 224 | sg_set_buf(&sg[0], idata, ilen); | ||
| 225 | if (plain) | ||
| 226 | sg_chain(sg, 2, plain); | ||
| 227 | plain = sg; | ||
| 228 | cryptlen += ilen; | ||
| 229 | } | ||
| 282 | 230 | ||
| 231 | ahash_request_set_crypt(ahreq, plain, pctx->odata, cryptlen); | ||
| 232 | err = crypto_ahash_finup(ahreq); | ||
| 283 | out: | 233 | out: |
| 284 | return err; | 234 | return err; |
| 285 | } | 235 | } |
| @@ -453,21 +403,21 @@ static int crypto_ccm_init_tfm(struct crypto_aead *tfm) | |||
| 453 | struct aead_instance *inst = aead_alg_instance(tfm); | 403 | struct aead_instance *inst = aead_alg_instance(tfm); |
| 454 | struct ccm_instance_ctx *ictx = aead_instance_ctx(inst); | 404 | struct ccm_instance_ctx *ictx = aead_instance_ctx(inst); |
| 455 | struct crypto_ccm_ctx *ctx = crypto_aead_ctx(tfm); | 405 | struct crypto_ccm_ctx *ctx = crypto_aead_ctx(tfm); |
| 456 | struct crypto_cipher *cipher; | 406 | struct crypto_ahash *mac; |
| 457 | struct crypto_skcipher *ctr; | 407 | struct crypto_skcipher *ctr; |
| 458 | unsigned long align; | 408 | unsigned long align; |
| 459 | int err; | 409 | int err; |
| 460 | 410 | ||
| 461 | cipher = crypto_spawn_cipher(&ictx->cipher); | 411 | mac = crypto_spawn_ahash(&ictx->mac); |
| 462 | if (IS_ERR(cipher)) | 412 | if (IS_ERR(mac)) |
| 463 | return PTR_ERR(cipher); | 413 | return PTR_ERR(mac); |
| 464 | 414 | ||
| 465 | ctr = crypto_spawn_skcipher(&ictx->ctr); | 415 | ctr = crypto_spawn_skcipher(&ictx->ctr); |
| 466 | err = PTR_ERR(ctr); | 416 | err = PTR_ERR(ctr); |
| 467 | if (IS_ERR(ctr)) | 417 | if (IS_ERR(ctr)) |
| 468 | goto err_free_cipher; | 418 | goto err_free_mac; |
| 469 | 419 | ||
| 470 | ctx->cipher = cipher; | 420 | ctx->mac = mac; |
| 471 | ctx->ctr = ctr; | 421 | ctx->ctr = ctr; |
| 472 | 422 | ||
| 473 | align = crypto_aead_alignmask(tfm); | 423 | align = crypto_aead_alignmask(tfm); |
| @@ -479,8 +429,8 @@ static int crypto_ccm_init_tfm(struct crypto_aead *tfm) | |||
| 479 | 429 | ||
| 480 | return 0; | 430 | return 0; |
| 481 | 431 | ||
| 482 | err_free_cipher: | 432 | err_free_mac: |
| 483 | crypto_free_cipher(cipher); | 433 | crypto_free_ahash(mac); |
| 484 | return err; | 434 | return err; |
| 485 | } | 435 | } |
| 486 | 436 | ||
| @@ -488,7 +438,7 @@ static void crypto_ccm_exit_tfm(struct crypto_aead *tfm) | |||
| 488 | { | 438 | { |
| 489 | struct crypto_ccm_ctx *ctx = crypto_aead_ctx(tfm); | 439 | struct crypto_ccm_ctx *ctx = crypto_aead_ctx(tfm); |
| 490 | 440 | ||
| 491 | crypto_free_cipher(ctx->cipher); | 441 | crypto_free_ahash(ctx->mac); |
| 492 | crypto_free_skcipher(ctx->ctr); | 442 | crypto_free_skcipher(ctx->ctr); |
| 493 | } | 443 | } |
| 494 | 444 | ||
| @@ -496,7 +446,7 @@ static void crypto_ccm_free(struct aead_instance *inst) | |||
| 496 | { | 446 | { |
| 497 | struct ccm_instance_ctx *ctx = aead_instance_ctx(inst); | 447 | struct ccm_instance_ctx *ctx = aead_instance_ctx(inst); |
| 498 | 448 | ||
| 499 | crypto_drop_spawn(&ctx->cipher); | 449 | crypto_drop_ahash(&ctx->mac); |
| 500 | crypto_drop_skcipher(&ctx->ctr); | 450 | crypto_drop_skcipher(&ctx->ctr); |
| 501 | kfree(inst); | 451 | kfree(inst); |
| 502 | } | 452 | } |
| @@ -505,12 +455,13 @@ static int crypto_ccm_create_common(struct crypto_template *tmpl, | |||
| 505 | struct rtattr **tb, | 455 | struct rtattr **tb, |
| 506 | const char *full_name, | 456 | const char *full_name, |
| 507 | const char *ctr_name, | 457 | const char *ctr_name, |
| 508 | const char *cipher_name) | 458 | const char *mac_name) |
| 509 | { | 459 | { |
| 510 | struct crypto_attr_type *algt; | 460 | struct crypto_attr_type *algt; |
| 511 | struct aead_instance *inst; | 461 | struct aead_instance *inst; |
| 512 | struct skcipher_alg *ctr; | 462 | struct skcipher_alg *ctr; |
| 513 | struct crypto_alg *cipher; | 463 | struct crypto_alg *mac_alg; |
| 464 | struct hash_alg_common *mac; | ||
| 514 | struct ccm_instance_ctx *ictx; | 465 | struct ccm_instance_ctx *ictx; |
| 515 | int err; | 466 | int err; |
| 516 | 467 | ||
| @@ -521,25 +472,26 @@ static int crypto_ccm_create_common(struct crypto_template *tmpl, | |||
| 521 | if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask) | 472 | if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask) |
| 522 | return -EINVAL; | 473 | return -EINVAL; |
| 523 | 474 | ||
| 524 | cipher = crypto_alg_mod_lookup(cipher_name, CRYPTO_ALG_TYPE_CIPHER, | 475 | mac_alg = crypto_find_alg(mac_name, &crypto_ahash_type, |
| 525 | CRYPTO_ALG_TYPE_MASK); | 476 | CRYPTO_ALG_TYPE_HASH, |
| 526 | if (IS_ERR(cipher)) | 477 | CRYPTO_ALG_TYPE_AHASH_MASK | |
| 527 | return PTR_ERR(cipher); | 478 | CRYPTO_ALG_ASYNC); |
| 479 | if (IS_ERR(mac_alg)) | ||
| 480 | return PTR_ERR(mac_alg); | ||
| 528 | 481 | ||
| 482 | mac = __crypto_hash_alg_common(mac_alg); | ||
| 529 | err = -EINVAL; | 483 | err = -EINVAL; |
| 530 | if (cipher->cra_blocksize != 16) | 484 | if (mac->digestsize != 16) |
| 531 | goto out_put_cipher; | 485 | goto out_put_mac; |
| 532 | 486 | ||
| 533 | inst = kzalloc(sizeof(*inst) + sizeof(*ictx), GFP_KERNEL); | 487 | inst = kzalloc(sizeof(*inst) + sizeof(*ictx), GFP_KERNEL); |
| 534 | err = -ENOMEM; | 488 | err = -ENOMEM; |
| 535 | if (!inst) | 489 | if (!inst) |
| 536 | goto out_put_cipher; | 490 | goto out_put_mac; |
| 537 | 491 | ||
| 538 | ictx = aead_instance_ctx(inst); | 492 | ictx = aead_instance_ctx(inst); |
| 539 | 493 | err = crypto_init_ahash_spawn(&ictx->mac, mac, | |
| 540 | err = crypto_init_spawn(&ictx->cipher, cipher, | 494 | aead_crypto_instance(inst)); |
| 541 | aead_crypto_instance(inst), | ||
| 542 | CRYPTO_ALG_TYPE_MASK); | ||
| 543 | if (err) | 495 | if (err) |
| 544 | goto err_free_inst; | 496 | goto err_free_inst; |
| 545 | 497 | ||
| @@ -548,7 +500,7 @@ static int crypto_ccm_create_common(struct crypto_template *tmpl, | |||
| 548 | crypto_requires_sync(algt->type, | 500 | crypto_requires_sync(algt->type, |
| 549 | algt->mask)); | 501 | algt->mask)); |
| 550 | if (err) | 502 | if (err) |
| 551 | goto err_drop_cipher; | 503 | goto err_drop_mac; |
| 552 | 504 | ||
| 553 | ctr = crypto_spawn_skcipher_alg(&ictx->ctr); | 505 | ctr = crypto_spawn_skcipher_alg(&ictx->ctr); |
| 554 | 506 | ||
| @@ -564,18 +516,17 @@ static int crypto_ccm_create_common(struct crypto_template *tmpl, | |||
| 564 | err = -ENAMETOOLONG; | 516 | err = -ENAMETOOLONG; |
| 565 | if (snprintf(inst->alg.base.cra_driver_name, CRYPTO_MAX_ALG_NAME, | 517 | if (snprintf(inst->alg.base.cra_driver_name, CRYPTO_MAX_ALG_NAME, |
| 566 | "ccm_base(%s,%s)", ctr->base.cra_driver_name, | 518 | "ccm_base(%s,%s)", ctr->base.cra_driver_name, |
| 567 | cipher->cra_driver_name) >= CRYPTO_MAX_ALG_NAME) | 519 | mac->base.cra_driver_name) >= CRYPTO_MAX_ALG_NAME) |
| 568 | goto err_drop_ctr; | 520 | goto err_drop_ctr; |
| 569 | 521 | ||
| 570 | memcpy(inst->alg.base.cra_name, full_name, CRYPTO_MAX_ALG_NAME); | 522 | memcpy(inst->alg.base.cra_name, full_name, CRYPTO_MAX_ALG_NAME); |
| 571 | 523 | ||
| 572 | inst->alg.base.cra_flags = ctr->base.cra_flags & CRYPTO_ALG_ASYNC; | 524 | inst->alg.base.cra_flags = ctr->base.cra_flags & CRYPTO_ALG_ASYNC; |
| 573 | inst->alg.base.cra_priority = (cipher->cra_priority + | 525 | inst->alg.base.cra_priority = (mac->base.cra_priority + |
| 574 | ctr->base.cra_priority) / 2; | 526 | ctr->base.cra_priority) / 2; |
| 575 | inst->alg.base.cra_blocksize = 1; | 527 | inst->alg.base.cra_blocksize = 1; |
| 576 | inst->alg.base.cra_alignmask = cipher->cra_alignmask | | 528 | inst->alg.base.cra_alignmask = mac->base.cra_alignmask | |
| 577 | ctr->base.cra_alignmask | | 529 | ctr->base.cra_alignmask; |
| 578 | (__alignof__(u32) - 1); | ||
| 579 | inst->alg.ivsize = 16; | 530 | inst->alg.ivsize = 16; |
| 580 | inst->alg.chunksize = crypto_skcipher_alg_chunksize(ctr); | 531 | inst->alg.chunksize = crypto_skcipher_alg_chunksize(ctr); |
| 581 | inst->alg.maxauthsize = 16; | 532 | inst->alg.maxauthsize = 16; |
| @@ -593,23 +544,24 @@ static int crypto_ccm_create_common(struct crypto_template *tmpl, | |||
| 593 | if (err) | 544 | if (err) |
| 594 | goto err_drop_ctr; | 545 | goto err_drop_ctr; |
| 595 | 546 | ||
| 596 | out_put_cipher: | 547 | out_put_mac: |
| 597 | crypto_mod_put(cipher); | 548 | crypto_mod_put(mac_alg); |
| 598 | return err; | 549 | return err; |
| 599 | 550 | ||
| 600 | err_drop_ctr: | 551 | err_drop_ctr: |
| 601 | crypto_drop_skcipher(&ictx->ctr); | 552 | crypto_drop_skcipher(&ictx->ctr); |
| 602 | err_drop_cipher: | 553 | err_drop_mac: |
| 603 | crypto_drop_spawn(&ictx->cipher); | 554 | crypto_drop_ahash(&ictx->mac); |
| 604 | err_free_inst: | 555 | err_free_inst: |
| 605 | kfree(inst); | 556 | kfree(inst); |
| 606 | goto out_put_cipher; | 557 | goto out_put_mac; |
| 607 | } | 558 | } |
| 608 | 559 | ||
| 609 | static int crypto_ccm_create(struct crypto_template *tmpl, struct rtattr **tb) | 560 | static int crypto_ccm_create(struct crypto_template *tmpl, struct rtattr **tb) |
| 610 | { | 561 | { |
| 611 | const char *cipher_name; | 562 | const char *cipher_name; |
| 612 | char ctr_name[CRYPTO_MAX_ALG_NAME]; | 563 | char ctr_name[CRYPTO_MAX_ALG_NAME]; |
| 564 | char mac_name[CRYPTO_MAX_ALG_NAME]; | ||
| 613 | char full_name[CRYPTO_MAX_ALG_NAME]; | 565 | char full_name[CRYPTO_MAX_ALG_NAME]; |
| 614 | 566 | ||
| 615 | cipher_name = crypto_attr_alg_name(tb[1]); | 567 | cipher_name = crypto_attr_alg_name(tb[1]); |
| @@ -620,12 +572,16 @@ static int crypto_ccm_create(struct crypto_template *tmpl, struct rtattr **tb) | |||
| 620 | cipher_name) >= CRYPTO_MAX_ALG_NAME) | 572 | cipher_name) >= CRYPTO_MAX_ALG_NAME) |
| 621 | return -ENAMETOOLONG; | 573 | return -ENAMETOOLONG; |
| 622 | 574 | ||
| 575 | if (snprintf(mac_name, CRYPTO_MAX_ALG_NAME, "cbcmac(%s)", | ||
| 576 | cipher_name) >= CRYPTO_MAX_ALG_NAME) | ||
| 577 | return -ENAMETOOLONG; | ||
| 578 | |||
| 623 | if (snprintf(full_name, CRYPTO_MAX_ALG_NAME, "ccm(%s)", cipher_name) >= | 579 | if (snprintf(full_name, CRYPTO_MAX_ALG_NAME, "ccm(%s)", cipher_name) >= |
| 624 | CRYPTO_MAX_ALG_NAME) | 580 | CRYPTO_MAX_ALG_NAME) |
| 625 | return -ENAMETOOLONG; | 581 | return -ENAMETOOLONG; |
| 626 | 582 | ||
| 627 | return crypto_ccm_create_common(tmpl, tb, full_name, ctr_name, | 583 | return crypto_ccm_create_common(tmpl, tb, full_name, ctr_name, |
| 628 | cipher_name); | 584 | mac_name); |
| 629 | } | 585 | } |
| 630 | 586 | ||
| 631 | static struct crypto_template crypto_ccm_tmpl = { | 587 | static struct crypto_template crypto_ccm_tmpl = { |
| @@ -899,14 +855,164 @@ static struct crypto_template crypto_rfc4309_tmpl = { | |||
| 899 | .module = THIS_MODULE, | 855 | .module = THIS_MODULE, |
| 900 | }; | 856 | }; |
| 901 | 857 | ||
| 858 | static int crypto_cbcmac_digest_setkey(struct crypto_shash *parent, | ||
| 859 | const u8 *inkey, unsigned int keylen) | ||
| 860 | { | ||
| 861 | struct cbcmac_tfm_ctx *ctx = crypto_shash_ctx(parent); | ||
| 862 | |||
| 863 | return crypto_cipher_setkey(ctx->child, inkey, keylen); | ||
| 864 | } | ||
| 865 | |||
| 866 | static int crypto_cbcmac_digest_init(struct shash_desc *pdesc) | ||
| 867 | { | ||
| 868 | struct cbcmac_desc_ctx *ctx = shash_desc_ctx(pdesc); | ||
| 869 | int bs = crypto_shash_digestsize(pdesc->tfm); | ||
| 870 | u8 *dg = (u8 *)ctx + crypto_shash_descsize(pdesc->tfm) - bs; | ||
| 871 | |||
| 872 | ctx->len = 0; | ||
| 873 | memset(dg, 0, bs); | ||
| 874 | |||
| 875 | return 0; | ||
| 876 | } | ||
| 877 | |||
| 878 | static int crypto_cbcmac_digest_update(struct shash_desc *pdesc, const u8 *p, | ||
| 879 | unsigned int len) | ||
| 880 | { | ||
| 881 | struct crypto_shash *parent = pdesc->tfm; | ||
| 882 | struct cbcmac_tfm_ctx *tctx = crypto_shash_ctx(parent); | ||
| 883 | struct cbcmac_desc_ctx *ctx = shash_desc_ctx(pdesc); | ||
| 884 | struct crypto_cipher *tfm = tctx->child; | ||
| 885 | int bs = crypto_shash_digestsize(parent); | ||
| 886 | u8 *dg = (u8 *)ctx + crypto_shash_descsize(parent) - bs; | ||
| 887 | |||
| 888 | while (len > 0) { | ||
| 889 | unsigned int l = min(len, bs - ctx->len); | ||
| 890 | |||
| 891 | crypto_xor(dg + ctx->len, p, l); | ||
| 892 | ctx->len +=l; | ||
| 893 | len -= l; | ||
| 894 | p += l; | ||
| 895 | |||
| 896 | if (ctx->len == bs) { | ||
| 897 | crypto_cipher_encrypt_one(tfm, dg, dg); | ||
| 898 | ctx->len = 0; | ||
| 899 | } | ||
| 900 | } | ||
| 901 | |||
| 902 | return 0; | ||
| 903 | } | ||
| 904 | |||
| 905 | static int crypto_cbcmac_digest_final(struct shash_desc *pdesc, u8 *out) | ||
| 906 | { | ||
| 907 | struct crypto_shash *parent = pdesc->tfm; | ||
| 908 | struct cbcmac_tfm_ctx *tctx = crypto_shash_ctx(parent); | ||
| 909 | struct cbcmac_desc_ctx *ctx = shash_desc_ctx(pdesc); | ||
| 910 | struct crypto_cipher *tfm = tctx->child; | ||
| 911 | int bs = crypto_shash_digestsize(parent); | ||
| 912 | u8 *dg = (u8 *)ctx + crypto_shash_descsize(parent) - bs; | ||
| 913 | |||
| 914 | if (ctx->len) | ||
| 915 | crypto_cipher_encrypt_one(tfm, dg, dg); | ||
| 916 | |||
| 917 | memcpy(out, dg, bs); | ||
| 918 | return 0; | ||
| 919 | } | ||
| 920 | |||
| 921 | static int cbcmac_init_tfm(struct crypto_tfm *tfm) | ||
| 922 | { | ||
| 923 | struct crypto_cipher *cipher; | ||
| 924 | struct crypto_instance *inst = (void *)tfm->__crt_alg; | ||
| 925 | struct crypto_spawn *spawn = crypto_instance_ctx(inst); | ||
| 926 | struct cbcmac_tfm_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 927 | |||
| 928 | cipher = crypto_spawn_cipher(spawn); | ||
| 929 | if (IS_ERR(cipher)) | ||
| 930 | return PTR_ERR(cipher); | ||
| 931 | |||
| 932 | ctx->child = cipher; | ||
| 933 | |||
| 934 | return 0; | ||
| 935 | }; | ||
| 936 | |||
| 937 | static void cbcmac_exit_tfm(struct crypto_tfm *tfm) | ||
| 938 | { | ||
| 939 | struct cbcmac_tfm_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 940 | crypto_free_cipher(ctx->child); | ||
| 941 | } | ||
| 942 | |||
| 943 | static int cbcmac_create(struct crypto_template *tmpl, struct rtattr **tb) | ||
| 944 | { | ||
| 945 | struct shash_instance *inst; | ||
| 946 | struct crypto_alg *alg; | ||
| 947 | int err; | ||
| 948 | |||
| 949 | err = crypto_check_attr_type(tb, CRYPTO_ALG_TYPE_SHASH); | ||
| 950 | if (err) | ||
| 951 | return err; | ||
| 952 | |||
| 953 | alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_CIPHER, | ||
| 954 | CRYPTO_ALG_TYPE_MASK); | ||
| 955 | if (IS_ERR(alg)) | ||
| 956 | return PTR_ERR(alg); | ||
| 957 | |||
| 958 | inst = shash_alloc_instance("cbcmac", alg); | ||
| 959 | err = PTR_ERR(inst); | ||
| 960 | if (IS_ERR(inst)) | ||
| 961 | goto out_put_alg; | ||
| 962 | |||
| 963 | err = crypto_init_spawn(shash_instance_ctx(inst), alg, | ||
| 964 | shash_crypto_instance(inst), | ||
| 965 | CRYPTO_ALG_TYPE_MASK); | ||
| 966 | if (err) | ||
| 967 | goto out_free_inst; | ||
| 968 | |||
| 969 | inst->alg.base.cra_priority = alg->cra_priority; | ||
| 970 | inst->alg.base.cra_blocksize = 1; | ||
| 971 | |||
| 972 | inst->alg.digestsize = alg->cra_blocksize; | ||
| 973 | inst->alg.descsize = ALIGN(sizeof(struct cbcmac_desc_ctx), | ||
| 974 | alg->cra_alignmask + 1) + | ||
| 975 | alg->cra_blocksize; | ||
| 976 | |||
| 977 | inst->alg.base.cra_ctxsize = sizeof(struct cbcmac_tfm_ctx); | ||
| 978 | inst->alg.base.cra_init = cbcmac_init_tfm; | ||
| 979 | inst->alg.base.cra_exit = cbcmac_exit_tfm; | ||
| 980 | |||
| 981 | inst->alg.init = crypto_cbcmac_digest_init; | ||
| 982 | inst->alg.update = crypto_cbcmac_digest_update; | ||
| 983 | inst->alg.final = crypto_cbcmac_digest_final; | ||
| 984 | inst->alg.setkey = crypto_cbcmac_digest_setkey; | ||
| 985 | |||
| 986 | err = shash_register_instance(tmpl, inst); | ||
| 987 | |||
| 988 | out_free_inst: | ||
| 989 | if (err) | ||
| 990 | shash_free_instance(shash_crypto_instance(inst)); | ||
| 991 | |||
| 992 | out_put_alg: | ||
| 993 | crypto_mod_put(alg); | ||
| 994 | return err; | ||
| 995 | } | ||
| 996 | |||
| 997 | static struct crypto_template crypto_cbcmac_tmpl = { | ||
| 998 | .name = "cbcmac", | ||
| 999 | .create = cbcmac_create, | ||
| 1000 | .free = shash_free_instance, | ||
| 1001 | .module = THIS_MODULE, | ||
| 1002 | }; | ||
| 1003 | |||
| 902 | static int __init crypto_ccm_module_init(void) | 1004 | static int __init crypto_ccm_module_init(void) |
| 903 | { | 1005 | { |
| 904 | int err; | 1006 | int err; |
| 905 | 1007 | ||
| 906 | err = crypto_register_template(&crypto_ccm_base_tmpl); | 1008 | err = crypto_register_template(&crypto_cbcmac_tmpl); |
| 907 | if (err) | 1009 | if (err) |
| 908 | goto out; | 1010 | goto out; |
| 909 | 1011 | ||
| 1012 | err = crypto_register_template(&crypto_ccm_base_tmpl); | ||
| 1013 | if (err) | ||
| 1014 | goto out_undo_cbcmac; | ||
| 1015 | |||
| 910 | err = crypto_register_template(&crypto_ccm_tmpl); | 1016 | err = crypto_register_template(&crypto_ccm_tmpl); |
| 911 | if (err) | 1017 | if (err) |
| 912 | goto out_undo_base; | 1018 | goto out_undo_base; |
| @@ -922,6 +1028,8 @@ out_undo_ccm: | |||
| 922 | crypto_unregister_template(&crypto_ccm_tmpl); | 1028 | crypto_unregister_template(&crypto_ccm_tmpl); |
| 923 | out_undo_base: | 1029 | out_undo_base: |
| 924 | crypto_unregister_template(&crypto_ccm_base_tmpl); | 1030 | crypto_unregister_template(&crypto_ccm_base_tmpl); |
| 1031 | out_undo_cbcmac: | ||
| 1032 | crypto_register_template(&crypto_cbcmac_tmpl); | ||
| 925 | goto out; | 1033 | goto out; |
| 926 | } | 1034 | } |
| 927 | 1035 | ||
| @@ -930,6 +1038,7 @@ static void __exit crypto_ccm_module_exit(void) | |||
| 930 | crypto_unregister_template(&crypto_rfc4309_tmpl); | 1038 | crypto_unregister_template(&crypto_rfc4309_tmpl); |
| 931 | crypto_unregister_template(&crypto_ccm_tmpl); | 1039 | crypto_unregister_template(&crypto_ccm_tmpl); |
| 932 | crypto_unregister_template(&crypto_ccm_base_tmpl); | 1040 | crypto_unregister_template(&crypto_ccm_base_tmpl); |
| 1041 | crypto_unregister_template(&crypto_cbcmac_tmpl); | ||
| 933 | } | 1042 | } |
| 934 | 1043 | ||
| 935 | module_init(crypto_ccm_module_init); | 1044 | module_init(crypto_ccm_module_init); |
diff --git a/crypto/chacha20_generic.c b/crypto/chacha20_generic.c index 1cab83146e33..8b3c04d625c3 100644 --- a/crypto/chacha20_generic.c +++ b/crypto/chacha20_generic.c | |||
| @@ -10,10 +10,9 @@ | |||
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #include <crypto/algapi.h> | 12 | #include <crypto/algapi.h> |
| 13 | #include <linux/crypto.h> | ||
| 14 | #include <linux/kernel.h> | ||
| 15 | #include <linux/module.h> | ||
| 16 | #include <crypto/chacha20.h> | 13 | #include <crypto/chacha20.h> |
| 14 | #include <crypto/internal/skcipher.h> | ||
| 15 | #include <linux/module.h> | ||
| 17 | 16 | ||
| 18 | static inline u32 le32_to_cpuvp(const void *p) | 17 | static inline u32 le32_to_cpuvp(const void *p) |
| 19 | { | 18 | { |
| @@ -63,10 +62,10 @@ void crypto_chacha20_init(u32 *state, struct chacha20_ctx *ctx, u8 *iv) | |||
| 63 | } | 62 | } |
| 64 | EXPORT_SYMBOL_GPL(crypto_chacha20_init); | 63 | EXPORT_SYMBOL_GPL(crypto_chacha20_init); |
| 65 | 64 | ||
| 66 | int crypto_chacha20_setkey(struct crypto_tfm *tfm, const u8 *key, | 65 | int crypto_chacha20_setkey(struct crypto_skcipher *tfm, const u8 *key, |
| 67 | unsigned int keysize) | 66 | unsigned int keysize) |
| 68 | { | 67 | { |
| 69 | struct chacha20_ctx *ctx = crypto_tfm_ctx(tfm); | 68 | struct chacha20_ctx *ctx = crypto_skcipher_ctx(tfm); |
| 70 | int i; | 69 | int i; |
| 71 | 70 | ||
| 72 | if (keysize != CHACHA20_KEY_SIZE) | 71 | if (keysize != CHACHA20_KEY_SIZE) |
| @@ -79,66 +78,54 @@ int crypto_chacha20_setkey(struct crypto_tfm *tfm, const u8 *key, | |||
| 79 | } | 78 | } |
| 80 | EXPORT_SYMBOL_GPL(crypto_chacha20_setkey); | 79 | EXPORT_SYMBOL_GPL(crypto_chacha20_setkey); |
| 81 | 80 | ||
| 82 | int crypto_chacha20_crypt(struct blkcipher_desc *desc, struct scatterlist *dst, | 81 | int crypto_chacha20_crypt(struct skcipher_request *req) |
| 83 | struct scatterlist *src, unsigned int nbytes) | ||
| 84 | { | 82 | { |
| 85 | struct blkcipher_walk walk; | 83 | struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); |
| 84 | struct chacha20_ctx *ctx = crypto_skcipher_ctx(tfm); | ||
| 85 | struct skcipher_walk walk; | ||
| 86 | u32 state[16]; | 86 | u32 state[16]; |
| 87 | int err; | 87 | int err; |
| 88 | 88 | ||
| 89 | blkcipher_walk_init(&walk, dst, src, nbytes); | 89 | err = skcipher_walk_virt(&walk, req, true); |
| 90 | err = blkcipher_walk_virt_block(desc, &walk, CHACHA20_BLOCK_SIZE); | ||
| 91 | |||
| 92 | crypto_chacha20_init(state, crypto_blkcipher_ctx(desc->tfm), walk.iv); | ||
| 93 | 90 | ||
| 94 | while (walk.nbytes >= CHACHA20_BLOCK_SIZE) { | 91 | crypto_chacha20_init(state, ctx, walk.iv); |
| 95 | chacha20_docrypt(state, walk.dst.virt.addr, walk.src.virt.addr, | ||
| 96 | rounddown(walk.nbytes, CHACHA20_BLOCK_SIZE)); | ||
| 97 | err = blkcipher_walk_done(desc, &walk, | ||
| 98 | walk.nbytes % CHACHA20_BLOCK_SIZE); | ||
| 99 | } | ||
| 100 | 92 | ||
| 101 | if (walk.nbytes) { | 93 | while (walk.nbytes > 0) { |
| 102 | chacha20_docrypt(state, walk.dst.virt.addr, walk.src.virt.addr, | 94 | chacha20_docrypt(state, walk.dst.virt.addr, walk.src.virt.addr, |
| 103 | walk.nbytes); | 95 | walk.nbytes); |
| 104 | err = blkcipher_walk_done(desc, &walk, 0); | 96 | err = skcipher_walk_done(&walk, 0); |
| 105 | } | 97 | } |
| 106 | 98 | ||
| 107 | return err; | 99 | return err; |
| 108 | } | 100 | } |
| 109 | EXPORT_SYMBOL_GPL(crypto_chacha20_crypt); | 101 | EXPORT_SYMBOL_GPL(crypto_chacha20_crypt); |
| 110 | 102 | ||
| 111 | static struct crypto_alg alg = { | 103 | static struct skcipher_alg alg = { |
| 112 | .cra_name = "chacha20", | 104 | .base.cra_name = "chacha20", |
| 113 | .cra_driver_name = "chacha20-generic", | 105 | .base.cra_driver_name = "chacha20-generic", |
| 114 | .cra_priority = 100, | 106 | .base.cra_priority = 100, |
| 115 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, | 107 | .base.cra_blocksize = 1, |
| 116 | .cra_blocksize = 1, | 108 | .base.cra_ctxsize = sizeof(struct chacha20_ctx), |
| 117 | .cra_type = &crypto_blkcipher_type, | 109 | .base.cra_alignmask = sizeof(u32) - 1, |
| 118 | .cra_ctxsize = sizeof(struct chacha20_ctx), | 110 | .base.cra_module = THIS_MODULE, |
| 119 | .cra_alignmask = sizeof(u32) - 1, | 111 | |
| 120 | .cra_module = THIS_MODULE, | 112 | .min_keysize = CHACHA20_KEY_SIZE, |
| 121 | .cra_u = { | 113 | .max_keysize = CHACHA20_KEY_SIZE, |
| 122 | .blkcipher = { | 114 | .ivsize = CHACHA20_IV_SIZE, |
| 123 | .min_keysize = CHACHA20_KEY_SIZE, | 115 | .chunksize = CHACHA20_BLOCK_SIZE, |
| 124 | .max_keysize = CHACHA20_KEY_SIZE, | 116 | .setkey = crypto_chacha20_setkey, |
| 125 | .ivsize = CHACHA20_IV_SIZE, | 117 | .encrypt = crypto_chacha20_crypt, |
| 126 | .geniv = "seqiv", | 118 | .decrypt = crypto_chacha20_crypt, |
| 127 | .setkey = crypto_chacha20_setkey, | ||
| 128 | .encrypt = crypto_chacha20_crypt, | ||
| 129 | .decrypt = crypto_chacha20_crypt, | ||
| 130 | }, | ||
| 131 | }, | ||
| 132 | }; | 119 | }; |
| 133 | 120 | ||
| 134 | static int __init chacha20_generic_mod_init(void) | 121 | static int __init chacha20_generic_mod_init(void) |
| 135 | { | 122 | { |
| 136 | return crypto_register_alg(&alg); | 123 | return crypto_register_skcipher(&alg); |
| 137 | } | 124 | } |
| 138 | 125 | ||
| 139 | static void __exit chacha20_generic_mod_fini(void) | 126 | static void __exit chacha20_generic_mod_fini(void) |
| 140 | { | 127 | { |
| 141 | crypto_unregister_alg(&alg); | 128 | crypto_unregister_skcipher(&alg); |
| 142 | } | 129 | } |
| 143 | 130 | ||
| 144 | module_init(chacha20_generic_mod_init); | 131 | module_init(chacha20_generic_mod_init); |
diff --git a/crypto/cmac.c b/crypto/cmac.c index 04080dca8f0c..16301f52858c 100644 --- a/crypto/cmac.c +++ b/crypto/cmac.c | |||
| @@ -260,8 +260,7 @@ static int cmac_create(struct crypto_template *tmpl, struct rtattr **tb) | |||
| 260 | if (err) | 260 | if (err) |
| 261 | goto out_free_inst; | 261 | goto out_free_inst; |
| 262 | 262 | ||
| 263 | /* We access the data as u32s when xoring. */ | 263 | alignmask = alg->cra_alignmask; |
| 264 | alignmask = alg->cra_alignmask | (__alignof__(u32) - 1); | ||
| 265 | inst->alg.base.cra_alignmask = alignmask; | 264 | inst->alg.base.cra_alignmask = alignmask; |
| 266 | inst->alg.base.cra_priority = alg->cra_priority; | 265 | inst->alg.base.cra_priority = alg->cra_priority; |
| 267 | inst->alg.base.cra_blocksize = alg->cra_blocksize; | 266 | inst->alg.base.cra_blocksize = alg->cra_blocksize; |
diff --git a/crypto/crypto_engine.c b/crypto/crypto_engine.c index f1bf3418d968..727bd5c3569e 100644 --- a/crypto/crypto_engine.c +++ b/crypto/crypto_engine.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
| 17 | #include <crypto/engine.h> | 17 | #include <crypto/engine.h> |
| 18 | #include <crypto/internal/hash.h> | 18 | #include <crypto/internal/hash.h> |
| 19 | #include <uapi/linux/sched/types.h> | ||
| 19 | #include "internal.h" | 20 | #include "internal.h" |
| 20 | 21 | ||
| 21 | #define CRYPTO_ENGINE_MAX_QLEN 10 | 22 | #define CRYPTO_ENGINE_MAX_QLEN 10 |
diff --git a/crypto/ctr.c b/crypto/ctr.c index a9a7a44f2783..a4f4a8983169 100644 --- a/crypto/ctr.c +++ b/crypto/ctr.c | |||
| @@ -209,7 +209,7 @@ static struct crypto_instance *crypto_ctr_alloc(struct rtattr **tb) | |||
| 209 | inst->alg.cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER; | 209 | inst->alg.cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER; |
| 210 | inst->alg.cra_priority = alg->cra_priority; | 210 | inst->alg.cra_priority = alg->cra_priority; |
| 211 | inst->alg.cra_blocksize = 1; | 211 | inst->alg.cra_blocksize = 1; |
| 212 | inst->alg.cra_alignmask = alg->cra_alignmask | (__alignof__(u32) - 1); | 212 | inst->alg.cra_alignmask = alg->cra_alignmask; |
| 213 | inst->alg.cra_type = &crypto_blkcipher_type; | 213 | inst->alg.cra_type = &crypto_blkcipher_type; |
| 214 | 214 | ||
| 215 | inst->alg.cra_blkcipher.ivsize = alg->cra_blocksize; | 215 | inst->alg.cra_blkcipher.ivsize = alg->cra_blocksize; |
diff --git a/crypto/cts.c b/crypto/cts.c index 00254d76b21b..243f591dc409 100644 --- a/crypto/cts.c +++ b/crypto/cts.c | |||
| @@ -49,6 +49,7 @@ | |||
| 49 | #include <linux/scatterlist.h> | 49 | #include <linux/scatterlist.h> |
| 50 | #include <crypto/scatterwalk.h> | 50 | #include <crypto/scatterwalk.h> |
| 51 | #include <linux/slab.h> | 51 | #include <linux/slab.h> |
| 52 | #include <linux/compiler.h> | ||
| 52 | 53 | ||
| 53 | struct crypto_cts_ctx { | 54 | struct crypto_cts_ctx { |
| 54 | struct crypto_skcipher *child; | 55 | struct crypto_skcipher *child; |
| @@ -103,7 +104,7 @@ static int cts_cbc_encrypt(struct skcipher_request *req) | |||
| 103 | struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); | 104 | struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); |
| 104 | struct skcipher_request *subreq = &rctx->subreq; | 105 | struct skcipher_request *subreq = &rctx->subreq; |
| 105 | int bsize = crypto_skcipher_blocksize(tfm); | 106 | int bsize = crypto_skcipher_blocksize(tfm); |
| 106 | u8 d[bsize * 2] __attribute__ ((aligned(__alignof__(u32)))); | 107 | u8 d[bsize * 2] __aligned(__alignof__(u32)); |
| 107 | struct scatterlist *sg; | 108 | struct scatterlist *sg; |
| 108 | unsigned int offset; | 109 | unsigned int offset; |
| 109 | int lastn; | 110 | int lastn; |
| @@ -183,7 +184,7 @@ static int cts_cbc_decrypt(struct skcipher_request *req) | |||
| 183 | struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); | 184 | struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); |
| 184 | struct skcipher_request *subreq = &rctx->subreq; | 185 | struct skcipher_request *subreq = &rctx->subreq; |
| 185 | int bsize = crypto_skcipher_blocksize(tfm); | 186 | int bsize = crypto_skcipher_blocksize(tfm); |
| 186 | u8 d[bsize * 2] __attribute__ ((aligned(__alignof__(u32)))); | 187 | u8 d[bsize * 2] __aligned(__alignof__(u32)); |
| 187 | struct scatterlist *sg; | 188 | struct scatterlist *sg; |
| 188 | unsigned int offset; | 189 | unsigned int offset; |
| 189 | u8 *space; | 190 | u8 *space; |
| @@ -373,9 +374,6 @@ static int crypto_cts_create(struct crypto_template *tmpl, struct rtattr **tb) | |||
| 373 | inst->alg.base.cra_blocksize = alg->base.cra_blocksize; | 374 | inst->alg.base.cra_blocksize = alg->base.cra_blocksize; |
| 374 | inst->alg.base.cra_alignmask = alg->base.cra_alignmask; | 375 | inst->alg.base.cra_alignmask = alg->base.cra_alignmask; |
| 375 | 376 | ||
| 376 | /* We access the data as u32s when xoring. */ | ||
| 377 | inst->alg.base.cra_alignmask |= __alignof__(u32) - 1; | ||
| 378 | |||
| 379 | inst->alg.ivsize = alg->base.cra_blocksize; | 377 | inst->alg.ivsize = alg->base.cra_blocksize; |
| 380 | inst->alg.chunksize = crypto_skcipher_alg_chunksize(alg); | 378 | inst->alg.chunksize = crypto_skcipher_alg_chunksize(alg); |
| 381 | inst->alg.min_keysize = crypto_skcipher_alg_min_keysize(alg); | 379 | inst->alg.min_keysize = crypto_skcipher_alg_min_keysize(alg); |
diff --git a/crypto/kpp.c b/crypto/kpp.c index d36ce05eee43..a90edc27af77 100644 --- a/crypto/kpp.c +++ b/crypto/kpp.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/crypto.h> | 19 | #include <linux/crypto.h> |
| 20 | #include <crypto/algapi.h> | 20 | #include <crypto/algapi.h> |
| 21 | #include <linux/cryptouser.h> | 21 | #include <linux/cryptouser.h> |
| 22 | #include <linux/compiler.h> | ||
| 22 | #include <net/netlink.h> | 23 | #include <net/netlink.h> |
| 23 | #include <crypto/kpp.h> | 24 | #include <crypto/kpp.h> |
| 24 | #include <crypto/internal/kpp.h> | 25 | #include <crypto/internal/kpp.h> |
| @@ -47,7 +48,7 @@ static int crypto_kpp_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
| 47 | #endif | 48 | #endif |
| 48 | 49 | ||
| 49 | static void crypto_kpp_show(struct seq_file *m, struct crypto_alg *alg) | 50 | static void crypto_kpp_show(struct seq_file *m, struct crypto_alg *alg) |
| 50 | __attribute__ ((unused)); | 51 | __maybe_unused; |
| 51 | 52 | ||
| 52 | static void crypto_kpp_show(struct seq_file *m, struct crypto_alg *alg) | 53 | static void crypto_kpp_show(struct seq_file *m, struct crypto_alg *alg) |
| 53 | { | 54 | { |
diff --git a/crypto/lz4.c b/crypto/lz4.c index 99c1b2cc2976..71eff9b01b12 100644 --- a/crypto/lz4.c +++ b/crypto/lz4.c | |||
| @@ -66,15 +66,13 @@ static void lz4_exit(struct crypto_tfm *tfm) | |||
| 66 | static int __lz4_compress_crypto(const u8 *src, unsigned int slen, | 66 | static int __lz4_compress_crypto(const u8 *src, unsigned int slen, |
| 67 | u8 *dst, unsigned int *dlen, void *ctx) | 67 | u8 *dst, unsigned int *dlen, void *ctx) |
| 68 | { | 68 | { |
| 69 | size_t tmp_len = *dlen; | 69 | int out_len = LZ4_compress_default(src, dst, |
| 70 | int err; | 70 | slen, *dlen, ctx); |
| 71 | 71 | ||
| 72 | err = lz4_compress(src, slen, dst, &tmp_len, ctx); | 72 | if (!out_len) |
| 73 | |||
| 74 | if (err < 0) | ||
| 75 | return -EINVAL; | 73 | return -EINVAL; |
| 76 | 74 | ||
| 77 | *dlen = tmp_len; | 75 | *dlen = out_len; |
| 78 | return 0; | 76 | return 0; |
| 79 | } | 77 | } |
| 80 | 78 | ||
| @@ -96,16 +94,13 @@ static int lz4_compress_crypto(struct crypto_tfm *tfm, const u8 *src, | |||
| 96 | static int __lz4_decompress_crypto(const u8 *src, unsigned int slen, | 94 | static int __lz4_decompress_crypto(const u8 *src, unsigned int slen, |
| 97 | u8 *dst, unsigned int *dlen, void *ctx) | 95 | u8 *dst, unsigned int *dlen, void *ctx) |
| 98 | { | 96 | { |
| 99 | int err; | 97 | int out_len = LZ4_decompress_safe(src, dst, slen, *dlen); |
| 100 | size_t tmp_len = *dlen; | ||
| 101 | size_t __slen = slen; | ||
| 102 | 98 | ||
| 103 | err = lz4_decompress_unknownoutputsize(src, __slen, dst, &tmp_len); | 99 | if (out_len < 0) |
| 104 | if (err < 0) | 100 | return out_len; |
| 105 | return -EINVAL; | ||
| 106 | 101 | ||
| 107 | *dlen = tmp_len; | 102 | *dlen = out_len; |
| 108 | return err; | 103 | return 0; |
| 109 | } | 104 | } |
| 110 | 105 | ||
| 111 | static int lz4_sdecompress(struct crypto_scomp *tfm, const u8 *src, | 106 | static int lz4_sdecompress(struct crypto_scomp *tfm, const u8 *src, |
diff --git a/crypto/lz4hc.c b/crypto/lz4hc.c index 75ffc4a3f786..03a34a8109c0 100644 --- a/crypto/lz4hc.c +++ b/crypto/lz4hc.c | |||
| @@ -65,15 +65,13 @@ static void lz4hc_exit(struct crypto_tfm *tfm) | |||
| 65 | static int __lz4hc_compress_crypto(const u8 *src, unsigned int slen, | 65 | static int __lz4hc_compress_crypto(const u8 *src, unsigned int slen, |
| 66 | u8 *dst, unsigned int *dlen, void *ctx) | 66 | u8 *dst, unsigned int *dlen, void *ctx) |
| 67 | { | 67 | { |
| 68 | size_t tmp_len = *dlen; | 68 | int out_len = LZ4_compress_HC(src, dst, slen, |
| 69 | int err; | 69 | *dlen, LZ4HC_DEFAULT_CLEVEL, ctx); |
| 70 | 70 | ||
| 71 | err = lz4hc_compress(src, slen, dst, &tmp_len, ctx); | 71 | if (!out_len) |
| 72 | |||
| 73 | if (err < 0) | ||
| 74 | return -EINVAL; | 72 | return -EINVAL; |
| 75 | 73 | ||
| 76 | *dlen = tmp_len; | 74 | *dlen = out_len; |
| 77 | return 0; | 75 | return 0; |
| 78 | } | 76 | } |
| 79 | 77 | ||
| @@ -97,16 +95,13 @@ static int lz4hc_compress_crypto(struct crypto_tfm *tfm, const u8 *src, | |||
| 97 | static int __lz4hc_decompress_crypto(const u8 *src, unsigned int slen, | 95 | static int __lz4hc_decompress_crypto(const u8 *src, unsigned int slen, |
| 98 | u8 *dst, unsigned int *dlen, void *ctx) | 96 | u8 *dst, unsigned int *dlen, void *ctx) |
| 99 | { | 97 | { |
| 100 | int err; | 98 | int out_len = LZ4_decompress_safe(src, dst, slen, *dlen); |
| 101 | size_t tmp_len = *dlen; | ||
| 102 | size_t __slen = slen; | ||
| 103 | 99 | ||
| 104 | err = lz4_decompress_unknownoutputsize(src, __slen, dst, &tmp_len); | 100 | if (out_len < 0) |
| 105 | if (err < 0) | 101 | return out_len; |
| 106 | return -EINVAL; | ||
| 107 | 102 | ||
| 108 | *dlen = tmp_len; | 103 | *dlen = out_len; |
| 109 | return err; | 104 | return 0; |
| 110 | } | 105 | } |
| 111 | 106 | ||
| 112 | static int lz4hc_sdecompress(struct crypto_scomp *tfm, const u8 *src, | 107 | static int lz4hc_sdecompress(struct crypto_scomp *tfm, const u8 *src, |
diff --git a/crypto/mcryptd.c b/crypto/mcryptd.c index c207458d6299..4e6472658852 100644 --- a/crypto/mcryptd.c +++ b/crypto/mcryptd.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
| 25 | #include <linux/scatterlist.h> | 25 | #include <linux/scatterlist.h> |
| 26 | #include <linux/sched.h> | 26 | #include <linux/sched.h> |
| 27 | #include <linux/sched/stat.h> | ||
| 27 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
| 28 | #include <linux/hardirq.h> | 29 | #include <linux/hardirq.h> |
| 29 | 30 | ||
diff --git a/crypto/pcbc.c b/crypto/pcbc.c index e4538e07f7ca..29dd2b4a3b85 100644 --- a/crypto/pcbc.c +++ b/crypto/pcbc.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
| 21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
| 22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| 23 | #include <linux/compiler.h> | ||
| 23 | 24 | ||
| 24 | struct crypto_pcbc_ctx { | 25 | struct crypto_pcbc_ctx { |
| 25 | struct crypto_cipher *child; | 26 | struct crypto_cipher *child; |
| @@ -146,7 +147,7 @@ static int crypto_pcbc_decrypt_inplace(struct skcipher_request *req, | |||
| 146 | unsigned int nbytes = walk->nbytes; | 147 | unsigned int nbytes = walk->nbytes; |
| 147 | u8 *src = walk->src.virt.addr; | 148 | u8 *src = walk->src.virt.addr; |
| 148 | u8 *iv = walk->iv; | 149 | u8 *iv = walk->iv; |
| 149 | u8 tmpbuf[bsize] __attribute__ ((aligned(__alignof__(u32)))); | 150 | u8 tmpbuf[bsize] __aligned(__alignof__(u32)); |
| 150 | 151 | ||
| 151 | do { | 152 | do { |
| 152 | memcpy(tmpbuf, src, bsize); | 153 | memcpy(tmpbuf, src, bsize); |
| @@ -259,9 +260,6 @@ static int crypto_pcbc_create(struct crypto_template *tmpl, struct rtattr **tb) | |||
| 259 | inst->alg.base.cra_blocksize = alg->cra_blocksize; | 260 | inst->alg.base.cra_blocksize = alg->cra_blocksize; |
| 260 | inst->alg.base.cra_alignmask = alg->cra_alignmask; | 261 | inst->alg.base.cra_alignmask = alg->cra_alignmask; |
| 261 | 262 | ||
| 262 | /* We access the data as u32s when xoring. */ | ||
| 263 | inst->alg.base.cra_alignmask |= __alignof__(u32) - 1; | ||
| 264 | |||
| 265 | inst->alg.ivsize = alg->cra_blocksize; | 263 | inst->alg.ivsize = alg->cra_blocksize; |
| 266 | inst->alg.min_keysize = alg->cra_cipher.cia_min_keysize; | 264 | inst->alg.min_keysize = alg->cra_cipher.cia_min_keysize; |
| 267 | inst->alg.max_keysize = alg->cra_cipher.cia_max_keysize; | 265 | inst->alg.max_keysize = alg->cra_cipher.cia_max_keysize; |
diff --git a/crypto/rng.c b/crypto/rng.c index b81cffb13bab..f46dac5288b9 100644 --- a/crypto/rng.c +++ b/crypto/rng.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
| 24 | #include <linux/string.h> | 24 | #include <linux/string.h> |
| 25 | #include <linux/cryptouser.h> | 25 | #include <linux/cryptouser.h> |
| 26 | #include <linux/compiler.h> | ||
| 26 | #include <net/netlink.h> | 27 | #include <net/netlink.h> |
| 27 | 28 | ||
| 28 | #include "internal.h" | 29 | #include "internal.h" |
| @@ -95,7 +96,7 @@ static int crypto_rng_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
| 95 | #endif | 96 | #endif |
| 96 | 97 | ||
| 97 | static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg) | 98 | static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg) |
| 98 | __attribute__ ((unused)); | 99 | __maybe_unused; |
| 99 | static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg) | 100 | static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg) |
| 100 | { | 101 | { |
| 101 | seq_printf(m, "type : rng\n"); | 102 | seq_printf(m, "type : rng\n"); |
diff --git a/crypto/scompress.c b/crypto/scompress.c index 35e396d154b7..6b048b36312d 100644 --- a/crypto/scompress.c +++ b/crypto/scompress.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
| 19 | #include <linux/string.h> | 19 | #include <linux/string.h> |
| 20 | #include <linux/crypto.h> | 20 | #include <linux/crypto.h> |
| 21 | #include <linux/compiler.h> | ||
| 21 | #include <linux/vmalloc.h> | 22 | #include <linux/vmalloc.h> |
| 22 | #include <crypto/algapi.h> | 23 | #include <crypto/algapi.h> |
| 23 | #include <linux/cryptouser.h> | 24 | #include <linux/cryptouser.h> |
| @@ -57,7 +58,7 @@ static int crypto_scomp_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
| 57 | #endif | 58 | #endif |
| 58 | 59 | ||
| 59 | static void crypto_scomp_show(struct seq_file *m, struct crypto_alg *alg) | 60 | static void crypto_scomp_show(struct seq_file *m, struct crypto_alg *alg) |
| 60 | __attribute__ ((unused)); | 61 | __maybe_unused; |
| 61 | 62 | ||
| 62 | static void crypto_scomp_show(struct seq_file *m, struct crypto_alg *alg) | 63 | static void crypto_scomp_show(struct seq_file *m, struct crypto_alg *alg) |
| 63 | { | 64 | { |
diff --git a/crypto/seqiv.c b/crypto/seqiv.c index c7049231861f..570b7d1aa0ca 100644 --- a/crypto/seqiv.c +++ b/crypto/seqiv.c | |||
| @@ -153,8 +153,6 @@ static int seqiv_aead_create(struct crypto_template *tmpl, struct rtattr **tb) | |||
| 153 | if (IS_ERR(inst)) | 153 | if (IS_ERR(inst)) |
| 154 | return PTR_ERR(inst); | 154 | return PTR_ERR(inst); |
| 155 | 155 | ||
| 156 | inst->alg.base.cra_alignmask |= __alignof__(u32) - 1; | ||
| 157 | |||
| 158 | spawn = aead_instance_ctx(inst); | 156 | spawn = aead_instance_ctx(inst); |
| 159 | alg = crypto_spawn_aead_alg(spawn); | 157 | alg = crypto_spawn_aead_alg(spawn); |
| 160 | 158 | ||
diff --git a/crypto/shash.c b/crypto/shash.c index a051541a4a17..5e31c8d776df 100644 --- a/crypto/shash.c +++ b/crypto/shash.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/seq_file.h> | 19 | #include <linux/seq_file.h> |
| 20 | #include <linux/cryptouser.h> | 20 | #include <linux/cryptouser.h> |
| 21 | #include <net/netlink.h> | 21 | #include <net/netlink.h> |
| 22 | #include <linux/compiler.h> | ||
| 22 | 23 | ||
| 23 | #include "internal.h" | 24 | #include "internal.h" |
| 24 | 25 | ||
| @@ -67,7 +68,7 @@ EXPORT_SYMBOL_GPL(crypto_shash_setkey); | |||
| 67 | static inline unsigned int shash_align_buffer_size(unsigned len, | 68 | static inline unsigned int shash_align_buffer_size(unsigned len, |
| 68 | unsigned long mask) | 69 | unsigned long mask) |
| 69 | { | 70 | { |
| 70 | typedef u8 __attribute__ ((aligned)) u8_aligned; | 71 | typedef u8 __aligned_largest u8_aligned; |
| 71 | return len + (mask & ~(__alignof__(u8_aligned) - 1)); | 72 | return len + (mask & ~(__alignof__(u8_aligned) - 1)); |
| 72 | } | 73 | } |
| 73 | 74 | ||
| @@ -80,7 +81,7 @@ static int shash_update_unaligned(struct shash_desc *desc, const u8 *data, | |||
| 80 | unsigned int unaligned_len = alignmask + 1 - | 81 | unsigned int unaligned_len = alignmask + 1 - |
| 81 | ((unsigned long)data & alignmask); | 82 | ((unsigned long)data & alignmask); |
| 82 | u8 ubuf[shash_align_buffer_size(unaligned_len, alignmask)] | 83 | u8 ubuf[shash_align_buffer_size(unaligned_len, alignmask)] |
| 83 | __attribute__ ((aligned)); | 84 | __aligned_largest; |
| 84 | u8 *buf = PTR_ALIGN(&ubuf[0], alignmask + 1); | 85 | u8 *buf = PTR_ALIGN(&ubuf[0], alignmask + 1); |
| 85 | int err; | 86 | int err; |
| 86 | 87 | ||
| @@ -116,7 +117,7 @@ static int shash_final_unaligned(struct shash_desc *desc, u8 *out) | |||
| 116 | struct shash_alg *shash = crypto_shash_alg(tfm); | 117 | struct shash_alg *shash = crypto_shash_alg(tfm); |
| 117 | unsigned int ds = crypto_shash_digestsize(tfm); | 118 | unsigned int ds = crypto_shash_digestsize(tfm); |
| 118 | u8 ubuf[shash_align_buffer_size(ds, alignmask)] | 119 | u8 ubuf[shash_align_buffer_size(ds, alignmask)] |
| 119 | __attribute__ ((aligned)); | 120 | __aligned_largest; |
| 120 | u8 *buf = PTR_ALIGN(&ubuf[0], alignmask + 1); | 121 | u8 *buf = PTR_ALIGN(&ubuf[0], alignmask + 1); |
| 121 | int err; | 122 | int err; |
| 122 | 123 | ||
| @@ -403,7 +404,7 @@ static int crypto_shash_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
| 403 | #endif | 404 | #endif |
| 404 | 405 | ||
| 405 | static void crypto_shash_show(struct seq_file *m, struct crypto_alg *alg) | 406 | static void crypto_shash_show(struct seq_file *m, struct crypto_alg *alg) |
| 406 | __attribute__ ((unused)); | 407 | __maybe_unused; |
| 407 | static void crypto_shash_show(struct seq_file *m, struct crypto_alg *alg) | 408 | static void crypto_shash_show(struct seq_file *m, struct crypto_alg *alg) |
| 408 | { | 409 | { |
| 409 | struct shash_alg *salg = __crypto_shash_alg(alg); | 410 | struct shash_alg *salg = __crypto_shash_alg(alg); |
diff --git a/crypto/skcipher.c b/crypto/skcipher.c index 0e1e6c35188e..014af741fc6a 100644 --- a/crypto/skcipher.c +++ b/crypto/skcipher.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <crypto/scatterwalk.h> | 19 | #include <crypto/scatterwalk.h> |
| 20 | #include <linux/bug.h> | 20 | #include <linux/bug.h> |
| 21 | #include <linux/cryptouser.h> | 21 | #include <linux/cryptouser.h> |
| 22 | #include <linux/compiler.h> | ||
| 22 | #include <linux/list.h> | 23 | #include <linux/list.h> |
| 23 | #include <linux/module.h> | 24 | #include <linux/module.h> |
| 24 | #include <linux/rtnetlink.h> | 25 | #include <linux/rtnetlink.h> |
| @@ -185,12 +186,12 @@ void skcipher_walk_complete(struct skcipher_walk *walk, int err) | |||
| 185 | data = p->data; | 186 | data = p->data; |
| 186 | if (!data) { | 187 | if (!data) { |
| 187 | data = PTR_ALIGN(&p->buffer[0], walk->alignmask + 1); | 188 | data = PTR_ALIGN(&p->buffer[0], walk->alignmask + 1); |
| 188 | data = skcipher_get_spot(data, walk->chunksize); | 189 | data = skcipher_get_spot(data, walk->stride); |
| 189 | } | 190 | } |
| 190 | 191 | ||
| 191 | scatterwalk_copychunks(data, &p->dst, p->len, 1); | 192 | scatterwalk_copychunks(data, &p->dst, p->len, 1); |
| 192 | 193 | ||
| 193 | if (offset_in_page(p->data) + p->len + walk->chunksize > | 194 | if (offset_in_page(p->data) + p->len + walk->stride > |
| 194 | PAGE_SIZE) | 195 | PAGE_SIZE) |
| 195 | free_page((unsigned long)p->data); | 196 | free_page((unsigned long)p->data); |
| 196 | 197 | ||
| @@ -299,7 +300,7 @@ static int skcipher_next_copy(struct skcipher_walk *walk) | |||
| 299 | p->len = walk->nbytes; | 300 | p->len = walk->nbytes; |
| 300 | skcipher_queue_write(walk, p); | 301 | skcipher_queue_write(walk, p); |
| 301 | 302 | ||
| 302 | if (offset_in_page(walk->page) + walk->nbytes + walk->chunksize > | 303 | if (offset_in_page(walk->page) + walk->nbytes + walk->stride > |
| 303 | PAGE_SIZE) | 304 | PAGE_SIZE) |
| 304 | walk->page = NULL; | 305 | walk->page = NULL; |
| 305 | else | 306 | else |
| @@ -344,7 +345,7 @@ static int skcipher_walk_next(struct skcipher_walk *walk) | |||
| 344 | SKCIPHER_WALK_DIFF); | 345 | SKCIPHER_WALK_DIFF); |
| 345 | 346 | ||
| 346 | n = walk->total; | 347 | n = walk->total; |
| 347 | bsize = min(walk->chunksize, max(n, walk->blocksize)); | 348 | bsize = min(walk->stride, max(n, walk->blocksize)); |
| 348 | n = scatterwalk_clamp(&walk->in, n); | 349 | n = scatterwalk_clamp(&walk->in, n); |
| 349 | n = scatterwalk_clamp(&walk->out, n); | 350 | n = scatterwalk_clamp(&walk->out, n); |
| 350 | 351 | ||
| @@ -393,7 +394,7 @@ static int skcipher_copy_iv(struct skcipher_walk *walk) | |||
| 393 | unsigned a = crypto_tfm_ctx_alignment() - 1; | 394 | unsigned a = crypto_tfm_ctx_alignment() - 1; |
| 394 | unsigned alignmask = walk->alignmask; | 395 | unsigned alignmask = walk->alignmask; |
| 395 | unsigned ivsize = walk->ivsize; | 396 | unsigned ivsize = walk->ivsize; |
| 396 | unsigned bs = walk->chunksize; | 397 | unsigned bs = walk->stride; |
| 397 | unsigned aligned_bs; | 398 | unsigned aligned_bs; |
| 398 | unsigned size; | 399 | unsigned size; |
| 399 | u8 *iv; | 400 | u8 *iv; |
| @@ -463,7 +464,7 @@ static int skcipher_walk_skcipher(struct skcipher_walk *walk, | |||
| 463 | SKCIPHER_WALK_SLEEP : 0; | 464 | SKCIPHER_WALK_SLEEP : 0; |
| 464 | 465 | ||
| 465 | walk->blocksize = crypto_skcipher_blocksize(tfm); | 466 | walk->blocksize = crypto_skcipher_blocksize(tfm); |
| 466 | walk->chunksize = crypto_skcipher_chunksize(tfm); | 467 | walk->stride = crypto_skcipher_walksize(tfm); |
| 467 | walk->ivsize = crypto_skcipher_ivsize(tfm); | 468 | walk->ivsize = crypto_skcipher_ivsize(tfm); |
| 468 | walk->alignmask = crypto_skcipher_alignmask(tfm); | 469 | walk->alignmask = crypto_skcipher_alignmask(tfm); |
| 469 | 470 | ||
| @@ -525,7 +526,7 @@ static int skcipher_walk_aead_common(struct skcipher_walk *walk, | |||
| 525 | walk->flags &= ~SKCIPHER_WALK_SLEEP; | 526 | walk->flags &= ~SKCIPHER_WALK_SLEEP; |
| 526 | 527 | ||
| 527 | walk->blocksize = crypto_aead_blocksize(tfm); | 528 | walk->blocksize = crypto_aead_blocksize(tfm); |
| 528 | walk->chunksize = crypto_aead_chunksize(tfm); | 529 | walk->stride = crypto_aead_chunksize(tfm); |
| 529 | walk->ivsize = crypto_aead_ivsize(tfm); | 530 | walk->ivsize = crypto_aead_ivsize(tfm); |
| 530 | walk->alignmask = crypto_aead_alignmask(tfm); | 531 | walk->alignmask = crypto_aead_alignmask(tfm); |
| 531 | 532 | ||
| @@ -807,7 +808,7 @@ static void crypto_skcipher_free_instance(struct crypto_instance *inst) | |||
| 807 | } | 808 | } |
| 808 | 809 | ||
| 809 | static void crypto_skcipher_show(struct seq_file *m, struct crypto_alg *alg) | 810 | static void crypto_skcipher_show(struct seq_file *m, struct crypto_alg *alg) |
| 810 | __attribute__ ((unused)); | 811 | __maybe_unused; |
| 811 | static void crypto_skcipher_show(struct seq_file *m, struct crypto_alg *alg) | 812 | static void crypto_skcipher_show(struct seq_file *m, struct crypto_alg *alg) |
| 812 | { | 813 | { |
| 813 | struct skcipher_alg *skcipher = container_of(alg, struct skcipher_alg, | 814 | struct skcipher_alg *skcipher = container_of(alg, struct skcipher_alg, |
| @@ -821,6 +822,7 @@ static void crypto_skcipher_show(struct seq_file *m, struct crypto_alg *alg) | |||
| 821 | seq_printf(m, "max keysize : %u\n", skcipher->max_keysize); | 822 | seq_printf(m, "max keysize : %u\n", skcipher->max_keysize); |
| 822 | seq_printf(m, "ivsize : %u\n", skcipher->ivsize); | 823 | seq_printf(m, "ivsize : %u\n", skcipher->ivsize); |
| 823 | seq_printf(m, "chunksize : %u\n", skcipher->chunksize); | 824 | seq_printf(m, "chunksize : %u\n", skcipher->chunksize); |
| 825 | seq_printf(m, "walksize : %u\n", skcipher->walksize); | ||
| 824 | } | 826 | } |
| 825 | 827 | ||
| 826 | #ifdef CONFIG_NET | 828 | #ifdef CONFIG_NET |
| @@ -893,11 +895,14 @@ static int skcipher_prepare_alg(struct skcipher_alg *alg) | |||
| 893 | { | 895 | { |
| 894 | struct crypto_alg *base = &alg->base; | 896 | struct crypto_alg *base = &alg->base; |
| 895 | 897 | ||
| 896 | if (alg->ivsize > PAGE_SIZE / 8 || alg->chunksize > PAGE_SIZE / 8) | 898 | if (alg->ivsize > PAGE_SIZE / 8 || alg->chunksize > PAGE_SIZE / 8 || |
| 899 | alg->walksize > PAGE_SIZE / 8) | ||
| 897 | return -EINVAL; | 900 | return -EINVAL; |
| 898 | 901 | ||
| 899 | if (!alg->chunksize) | 902 | if (!alg->chunksize) |
| 900 | alg->chunksize = base->cra_blocksize; | 903 | alg->chunksize = base->cra_blocksize; |
| 904 | if (!alg->walksize) | ||
| 905 | alg->walksize = alg->chunksize; | ||
| 901 | 906 | ||
| 902 | base->cra_type = &crypto_skcipher_type2; | 907 | base->cra_type = &crypto_skcipher_type2; |
| 903 | base->cra_flags &= ~CRYPTO_ALG_TYPE_MASK; | 908 | base->cra_flags &= ~CRYPTO_ALG_TYPE_MASK; |
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index ae22f05d5936..9a11f3c2bf98 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c | |||
| @@ -22,6 +22,8 @@ | |||
| 22 | * | 22 | * |
| 23 | */ | 23 | */ |
| 24 | 24 | ||
| 25 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
| 26 | |||
| 25 | #include <crypto/aead.h> | 27 | #include <crypto/aead.h> |
| 26 | #include <crypto/hash.h> | 28 | #include <crypto/hash.h> |
| 27 | #include <crypto/skcipher.h> | 29 | #include <crypto/skcipher.h> |
| @@ -1010,6 +1012,8 @@ static inline int tcrypt_test(const char *alg) | |||
| 1010 | { | 1012 | { |
| 1011 | int ret; | 1013 | int ret; |
| 1012 | 1014 | ||
| 1015 | pr_debug("testing %s\n", alg); | ||
| 1016 | |||
| 1013 | ret = alg_test(alg, alg, 0, 0); | 1017 | ret = alg_test(alg, alg, 0, 0); |
| 1014 | /* non-fips algs return -EINVAL in fips mode */ | 1018 | /* non-fips algs return -EINVAL in fips mode */ |
| 1015 | if (fips_enabled && ret == -EINVAL) | 1019 | if (fips_enabled && ret == -EINVAL) |
| @@ -2059,6 +2063,8 @@ static int __init tcrypt_mod_init(void) | |||
| 2059 | if (err) { | 2063 | if (err) { |
| 2060 | printk(KERN_ERR "tcrypt: one or more tests failed!\n"); | 2064 | printk(KERN_ERR "tcrypt: one or more tests failed!\n"); |
| 2061 | goto err_free_tv; | 2065 | goto err_free_tv; |
| 2066 | } else { | ||
| 2067 | pr_debug("all tests passed\n"); | ||
| 2062 | } | 2068 | } |
| 2063 | 2069 | ||
| 2064 | /* We intentionaly return -EAGAIN to prevent keeping the module, | 2070 | /* We intentionaly return -EAGAIN to prevent keeping the module, |
diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 44e888b0b041..f9c378af3907 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c | |||
| @@ -265,6 +265,7 @@ static int __test_hash(struct crypto_ahash *tfm, struct hash_testvec *template, | |||
| 265 | const int align_offset) | 265 | const int align_offset) |
| 266 | { | 266 | { |
| 267 | const char *algo = crypto_tfm_alg_driver_name(crypto_ahash_tfm(tfm)); | 267 | const char *algo = crypto_tfm_alg_driver_name(crypto_ahash_tfm(tfm)); |
| 268 | size_t digest_size = crypto_ahash_digestsize(tfm); | ||
| 268 | unsigned int i, j, k, temp; | 269 | unsigned int i, j, k, temp; |
| 269 | struct scatterlist sg[8]; | 270 | struct scatterlist sg[8]; |
| 270 | char *result; | 271 | char *result; |
| @@ -275,7 +276,7 @@ static int __test_hash(struct crypto_ahash *tfm, struct hash_testvec *template, | |||
| 275 | char *xbuf[XBUFSIZE]; | 276 | char *xbuf[XBUFSIZE]; |
| 276 | int ret = -ENOMEM; | 277 | int ret = -ENOMEM; |
| 277 | 278 | ||
| 278 | result = kmalloc(MAX_DIGEST_SIZE, GFP_KERNEL); | 279 | result = kmalloc(digest_size, GFP_KERNEL); |
| 279 | if (!result) | 280 | if (!result) |
| 280 | return ret; | 281 | return ret; |
| 281 | key = kmalloc(MAX_KEYLEN, GFP_KERNEL); | 282 | key = kmalloc(MAX_KEYLEN, GFP_KERNEL); |
| @@ -305,7 +306,7 @@ static int __test_hash(struct crypto_ahash *tfm, struct hash_testvec *template, | |||
| 305 | goto out; | 306 | goto out; |
| 306 | 307 | ||
| 307 | j++; | 308 | j++; |
| 308 | memset(result, 0, MAX_DIGEST_SIZE); | 309 | memset(result, 0, digest_size); |
| 309 | 310 | ||
| 310 | hash_buff = xbuf[0]; | 311 | hash_buff = xbuf[0]; |
| 311 | hash_buff += align_offset; | 312 | hash_buff += align_offset; |
| @@ -380,7 +381,7 @@ static int __test_hash(struct crypto_ahash *tfm, struct hash_testvec *template, | |||
| 380 | continue; | 381 | continue; |
| 381 | 382 | ||
| 382 | j++; | 383 | j++; |
| 383 | memset(result, 0, MAX_DIGEST_SIZE); | 384 | memset(result, 0, digest_size); |
| 384 | 385 | ||
| 385 | temp = 0; | 386 | temp = 0; |
| 386 | sg_init_table(sg, template[i].np); | 387 | sg_init_table(sg, template[i].np); |
| @@ -458,7 +459,7 @@ static int __test_hash(struct crypto_ahash *tfm, struct hash_testvec *template, | |||
| 458 | continue; | 459 | continue; |
| 459 | 460 | ||
| 460 | j++; | 461 | j++; |
| 461 | memset(result, 0, MAX_DIGEST_SIZE); | 462 | memset(result, 0, digest_size); |
| 462 | 463 | ||
| 463 | ret = -EINVAL; | 464 | ret = -EINVAL; |
| 464 | hash_buff = xbuf[0]; | 465 | hash_buff = xbuf[0]; |
| @@ -1463,13 +1464,12 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate, | |||
| 1463 | int ilen = ctemplate[i].inlen; | 1464 | int ilen = ctemplate[i].inlen; |
| 1464 | void *input_vec; | 1465 | void *input_vec; |
| 1465 | 1466 | ||
| 1466 | input_vec = kmalloc(ilen, GFP_KERNEL); | 1467 | input_vec = kmemdup(ctemplate[i].input, ilen, GFP_KERNEL); |
| 1467 | if (!input_vec) { | 1468 | if (!input_vec) { |
| 1468 | ret = -ENOMEM; | 1469 | ret = -ENOMEM; |
| 1469 | goto out; | 1470 | goto out; |
| 1470 | } | 1471 | } |
| 1471 | 1472 | ||
| 1472 | memcpy(input_vec, ctemplate[i].input, ilen); | ||
| 1473 | memset(output, 0, dlen); | 1473 | memset(output, 0, dlen); |
| 1474 | init_completion(&result.completion); | 1474 | init_completion(&result.completion); |
| 1475 | sg_init_one(&src, input_vec, ilen); | 1475 | sg_init_one(&src, input_vec, ilen); |
| @@ -1525,13 +1525,12 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate, | |||
| 1525 | int ilen = dtemplate[i].inlen; | 1525 | int ilen = dtemplate[i].inlen; |
| 1526 | void *input_vec; | 1526 | void *input_vec; |
| 1527 | 1527 | ||
| 1528 | input_vec = kmalloc(ilen, GFP_KERNEL); | 1528 | input_vec = kmemdup(dtemplate[i].input, ilen, GFP_KERNEL); |
| 1529 | if (!input_vec) { | 1529 | if (!input_vec) { |
| 1530 | ret = -ENOMEM; | 1530 | ret = -ENOMEM; |
| 1531 | goto out; | 1531 | goto out; |
| 1532 | } | 1532 | } |
| 1533 | 1533 | ||
| 1534 | memcpy(input_vec, dtemplate[i].input, ilen); | ||
| 1535 | memset(output, 0, dlen); | 1534 | memset(output, 0, dlen); |
| 1536 | init_completion(&result.completion); | 1535 | init_completion(&result.completion); |
| 1537 | sg_init_one(&src, input_vec, ilen); | 1536 | sg_init_one(&src, input_vec, ilen); |
| @@ -2251,30 +2250,23 @@ static int alg_test_null(const struct alg_test_desc *desc, | |||
| 2251 | return 0; | 2250 | return 0; |
| 2252 | } | 2251 | } |
| 2253 | 2252 | ||
| 2253 | #define __VECS(tv) { .vecs = tv, .count = ARRAY_SIZE(tv) } | ||
| 2254 | |||
| 2254 | /* Please keep this list sorted by algorithm name. */ | 2255 | /* Please keep this list sorted by algorithm name. */ |
| 2255 | static const struct alg_test_desc alg_test_descs[] = { | 2256 | static const struct alg_test_desc alg_test_descs[] = { |
| 2256 | { | 2257 | { |
| 2257 | .alg = "ansi_cprng", | 2258 | .alg = "ansi_cprng", |
| 2258 | .test = alg_test_cprng, | 2259 | .test = alg_test_cprng, |
| 2259 | .suite = { | 2260 | .suite = { |
| 2260 | .cprng = { | 2261 | .cprng = __VECS(ansi_cprng_aes_tv_template) |
| 2261 | .vecs = ansi_cprng_aes_tv_template, | ||
| 2262 | .count = ANSI_CPRNG_AES_TEST_VECTORS | ||
| 2263 | } | ||
| 2264 | } | 2262 | } |
| 2265 | }, { | 2263 | }, { |
| 2266 | .alg = "authenc(hmac(md5),ecb(cipher_null))", | 2264 | .alg = "authenc(hmac(md5),ecb(cipher_null))", |
| 2267 | .test = alg_test_aead, | 2265 | .test = alg_test_aead, |
| 2268 | .suite = { | 2266 | .suite = { |
| 2269 | .aead = { | 2267 | .aead = { |
| 2270 | .enc = { | 2268 | .enc = __VECS(hmac_md5_ecb_cipher_null_enc_tv_template), |
| 2271 | .vecs = hmac_md5_ecb_cipher_null_enc_tv_template, | 2269 | .dec = __VECS(hmac_md5_ecb_cipher_null_dec_tv_template) |
| 2272 | .count = HMAC_MD5_ECB_CIPHER_NULL_ENC_TEST_VECTORS | ||
| 2273 | }, | ||
| 2274 | .dec = { | ||
| 2275 | .vecs = hmac_md5_ecb_cipher_null_dec_tv_template, | ||
| 2276 | .count = HMAC_MD5_ECB_CIPHER_NULL_DEC_TEST_VECTORS | ||
| 2277 | } | ||
| 2278 | } | 2270 | } |
| 2279 | } | 2271 | } |
| 2280 | }, { | 2272 | }, { |
| @@ -2282,12 +2274,7 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2282 | .test = alg_test_aead, | 2274 | .test = alg_test_aead, |
| 2283 | .suite = { | 2275 | .suite = { |
| 2284 | .aead = { | 2276 | .aead = { |
| 2285 | .enc = { | 2277 | .enc = __VECS(hmac_sha1_aes_cbc_enc_tv_temp) |
| 2286 | .vecs = | ||
| 2287 | hmac_sha1_aes_cbc_enc_tv_temp, | ||
| 2288 | .count = | ||
| 2289 | HMAC_SHA1_AES_CBC_ENC_TEST_VEC | ||
| 2290 | } | ||
| 2291 | } | 2278 | } |
| 2292 | } | 2279 | } |
| 2293 | }, { | 2280 | }, { |
| @@ -2295,12 +2282,7 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2295 | .test = alg_test_aead, | 2282 | .test = alg_test_aead, |
| 2296 | .suite = { | 2283 | .suite = { |
| 2297 | .aead = { | 2284 | .aead = { |
| 2298 | .enc = { | 2285 | .enc = __VECS(hmac_sha1_des_cbc_enc_tv_temp) |
| 2299 | .vecs = | ||
| 2300 | hmac_sha1_des_cbc_enc_tv_temp, | ||
| 2301 | .count = | ||
| 2302 | HMAC_SHA1_DES_CBC_ENC_TEST_VEC | ||
| 2303 | } | ||
| 2304 | } | 2286 | } |
| 2305 | } | 2287 | } |
| 2306 | }, { | 2288 | }, { |
| @@ -2309,12 +2291,7 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2309 | .fips_allowed = 1, | 2291 | .fips_allowed = 1, |
| 2310 | .suite = { | 2292 | .suite = { |
| 2311 | .aead = { | 2293 | .aead = { |
| 2312 | .enc = { | 2294 | .enc = __VECS(hmac_sha1_des3_ede_cbc_enc_tv_temp) |
| 2313 | .vecs = | ||
| 2314 | hmac_sha1_des3_ede_cbc_enc_tv_temp, | ||
| 2315 | .count = | ||
| 2316 | HMAC_SHA1_DES3_EDE_CBC_ENC_TEST_VEC | ||
| 2317 | } | ||
| 2318 | } | 2295 | } |
| 2319 | } | 2296 | } |
| 2320 | }, { | 2297 | }, { |
| @@ -2326,18 +2303,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2326 | .test = alg_test_aead, | 2303 | .test = alg_test_aead, |
| 2327 | .suite = { | 2304 | .suite = { |
| 2328 | .aead = { | 2305 | .aead = { |
| 2329 | .enc = { | 2306 | .enc = __VECS(hmac_sha1_ecb_cipher_null_enc_tv_temp), |
| 2330 | .vecs = | 2307 | .dec = __VECS(hmac_sha1_ecb_cipher_null_dec_tv_temp) |
| 2331 | hmac_sha1_ecb_cipher_null_enc_tv_temp, | ||
| 2332 | .count = | ||
| 2333 | HMAC_SHA1_ECB_CIPHER_NULL_ENC_TEST_VEC | ||
| 2334 | }, | ||
| 2335 | .dec = { | ||
| 2336 | .vecs = | ||
| 2337 | hmac_sha1_ecb_cipher_null_dec_tv_temp, | ||
| 2338 | .count = | ||
| 2339 | HMAC_SHA1_ECB_CIPHER_NULL_DEC_TEST_VEC | ||
| 2340 | } | ||
| 2341 | } | 2308 | } |
| 2342 | } | 2309 | } |
| 2343 | }, { | 2310 | }, { |
| @@ -2349,12 +2316,7 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2349 | .test = alg_test_aead, | 2316 | .test = alg_test_aead, |
| 2350 | .suite = { | 2317 | .suite = { |
| 2351 | .aead = { | 2318 | .aead = { |
| 2352 | .enc = { | 2319 | .enc = __VECS(hmac_sha224_des_cbc_enc_tv_temp) |
| 2353 | .vecs = | ||
| 2354 | hmac_sha224_des_cbc_enc_tv_temp, | ||
| 2355 | .count = | ||
| 2356 | HMAC_SHA224_DES_CBC_ENC_TEST_VEC | ||
| 2357 | } | ||
| 2358 | } | 2320 | } |
| 2359 | } | 2321 | } |
| 2360 | }, { | 2322 | }, { |
| @@ -2363,12 +2325,7 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2363 | .fips_allowed = 1, | 2325 | .fips_allowed = 1, |
| 2364 | .suite = { | 2326 | .suite = { |
| 2365 | .aead = { | 2327 | .aead = { |
| 2366 | .enc = { | 2328 | .enc = __VECS(hmac_sha224_des3_ede_cbc_enc_tv_temp) |
| 2367 | .vecs = | ||
| 2368 | hmac_sha224_des3_ede_cbc_enc_tv_temp, | ||
| 2369 | .count = | ||
| 2370 | HMAC_SHA224_DES3_EDE_CBC_ENC_TEST_VEC | ||
| 2371 | } | ||
| 2372 | } | 2329 | } |
| 2373 | } | 2330 | } |
| 2374 | }, { | 2331 | }, { |
| @@ -2377,12 +2334,7 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2377 | .fips_allowed = 1, | 2334 | .fips_allowed = 1, |
| 2378 | .suite = { | 2335 | .suite = { |
| 2379 | .aead = { | 2336 | .aead = { |
| 2380 | .enc = { | 2337 | .enc = __VECS(hmac_sha256_aes_cbc_enc_tv_temp) |
| 2381 | .vecs = | ||
| 2382 | hmac_sha256_aes_cbc_enc_tv_temp, | ||
| 2383 | .count = | ||
| 2384 | HMAC_SHA256_AES_CBC_ENC_TEST_VEC | ||
| 2385 | } | ||
| 2386 | } | 2338 | } |
| 2387 | } | 2339 | } |
| 2388 | }, { | 2340 | }, { |
| @@ -2390,12 +2342,7 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2390 | .test = alg_test_aead, | 2342 | .test = alg_test_aead, |
| 2391 | .suite = { | 2343 | .suite = { |
| 2392 | .aead = { | 2344 | .aead = { |
| 2393 | .enc = { | 2345 | .enc = __VECS(hmac_sha256_des_cbc_enc_tv_temp) |
| 2394 | .vecs = | ||
| 2395 | hmac_sha256_des_cbc_enc_tv_temp, | ||
| 2396 | .count = | ||
| 2397 | HMAC_SHA256_DES_CBC_ENC_TEST_VEC | ||
| 2398 | } | ||
| 2399 | } | 2346 | } |
| 2400 | } | 2347 | } |
| 2401 | }, { | 2348 | }, { |
| @@ -2404,12 +2351,7 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2404 | .fips_allowed = 1, | 2351 | .fips_allowed = 1, |
| 2405 | .suite = { | 2352 | .suite = { |
| 2406 | .aead = { | 2353 | .aead = { |
| 2407 | .enc = { | 2354 | .enc = __VECS(hmac_sha256_des3_ede_cbc_enc_tv_temp) |
| 2408 | .vecs = | ||
| 2409 | hmac_sha256_des3_ede_cbc_enc_tv_temp, | ||
| 2410 | .count = | ||
| 2411 | HMAC_SHA256_DES3_EDE_CBC_ENC_TEST_VEC | ||
| 2412 | } | ||
| 2413 | } | 2355 | } |
| 2414 | } | 2356 | } |
| 2415 | }, { | 2357 | }, { |
| @@ -2425,12 +2367,7 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2425 | .test = alg_test_aead, | 2367 | .test = alg_test_aead, |
| 2426 | .suite = { | 2368 | .suite = { |
| 2427 | .aead = { | 2369 | .aead = { |
| 2428 | .enc = { | 2370 | .enc = __VECS(hmac_sha384_des_cbc_enc_tv_temp) |
| 2429 | .vecs = | ||
| 2430 | hmac_sha384_des_cbc_enc_tv_temp, | ||
| 2431 | .count = | ||
| 2432 | HMAC_SHA384_DES_CBC_ENC_TEST_VEC | ||
| 2433 | } | ||
| 2434 | } | 2371 | } |
| 2435 | } | 2372 | } |
| 2436 | }, { | 2373 | }, { |
| @@ -2439,12 +2376,7 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2439 | .fips_allowed = 1, | 2376 | .fips_allowed = 1, |
| 2440 | .suite = { | 2377 | .suite = { |
| 2441 | .aead = { | 2378 | .aead = { |
| 2442 | .enc = { | 2379 | .enc = __VECS(hmac_sha384_des3_ede_cbc_enc_tv_temp) |
| 2443 | .vecs = | ||
| 2444 | hmac_sha384_des3_ede_cbc_enc_tv_temp, | ||
| 2445 | .count = | ||
| 2446 | HMAC_SHA384_DES3_EDE_CBC_ENC_TEST_VEC | ||
| 2447 | } | ||
| 2448 | } | 2380 | } |
| 2449 | } | 2381 | } |
| 2450 | }, { | 2382 | }, { |
| @@ -2461,12 +2393,7 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2461 | .test = alg_test_aead, | 2393 | .test = alg_test_aead, |
| 2462 | .suite = { | 2394 | .suite = { |
| 2463 | .aead = { | 2395 | .aead = { |
| 2464 | .enc = { | 2396 | .enc = __VECS(hmac_sha512_aes_cbc_enc_tv_temp) |
| 2465 | .vecs = | ||
| 2466 | hmac_sha512_aes_cbc_enc_tv_temp, | ||
| 2467 | .count = | ||
| 2468 | HMAC_SHA512_AES_CBC_ENC_TEST_VEC | ||
| 2469 | } | ||
| 2470 | } | 2397 | } |
| 2471 | } | 2398 | } |
| 2472 | }, { | 2399 | }, { |
| @@ -2474,12 +2401,7 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2474 | .test = alg_test_aead, | 2401 | .test = alg_test_aead, |
| 2475 | .suite = { | 2402 | .suite = { |
| 2476 | .aead = { | 2403 | .aead = { |
| 2477 | .enc = { | 2404 | .enc = __VECS(hmac_sha512_des_cbc_enc_tv_temp) |
| 2478 | .vecs = | ||
| 2479 | hmac_sha512_des_cbc_enc_tv_temp, | ||
| 2480 | .count = | ||
| 2481 | HMAC_SHA512_DES_CBC_ENC_TEST_VEC | ||
| 2482 | } | ||
| 2483 | } | 2405 | } |
| 2484 | } | 2406 | } |
| 2485 | }, { | 2407 | }, { |
| @@ -2488,12 +2410,7 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2488 | .fips_allowed = 1, | 2410 | .fips_allowed = 1, |
| 2489 | .suite = { | 2411 | .suite = { |
| 2490 | .aead = { | 2412 | .aead = { |
| 2491 | .enc = { | 2413 | .enc = __VECS(hmac_sha512_des3_ede_cbc_enc_tv_temp) |
| 2492 | .vecs = | ||
| 2493 | hmac_sha512_des3_ede_cbc_enc_tv_temp, | ||
| 2494 | .count = | ||
| 2495 | HMAC_SHA512_DES3_EDE_CBC_ENC_TEST_VEC | ||
| 2496 | } | ||
| 2497 | } | 2414 | } |
| 2498 | } | 2415 | } |
| 2499 | }, { | 2416 | }, { |
| @@ -2510,14 +2427,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2510 | .fips_allowed = 1, | 2427 | .fips_allowed = 1, |
| 2511 | .suite = { | 2428 | .suite = { |
| 2512 | .cipher = { | 2429 | .cipher = { |
| 2513 | .enc = { | 2430 | .enc = __VECS(aes_cbc_enc_tv_template), |
| 2514 | .vecs = aes_cbc_enc_tv_template, | 2431 | .dec = __VECS(aes_cbc_dec_tv_template) |
| 2515 | .count = AES_CBC_ENC_TEST_VECTORS | ||
| 2516 | }, | ||
| 2517 | .dec = { | ||
| 2518 | .vecs = aes_cbc_dec_tv_template, | ||
| 2519 | .count = AES_CBC_DEC_TEST_VECTORS | ||
| 2520 | } | ||
| 2521 | } | 2432 | } |
| 2522 | } | 2433 | } |
| 2523 | }, { | 2434 | }, { |
| @@ -2525,14 +2436,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2525 | .test = alg_test_skcipher, | 2436 | .test = alg_test_skcipher, |
| 2526 | .suite = { | 2437 | .suite = { |
| 2527 | .cipher = { | 2438 | .cipher = { |
| 2528 | .enc = { | 2439 | .enc = __VECS(anubis_cbc_enc_tv_template), |
| 2529 | .vecs = anubis_cbc_enc_tv_template, | 2440 | .dec = __VECS(anubis_cbc_dec_tv_template) |
| 2530 | .count = ANUBIS_CBC_ENC_TEST_VECTORS | ||
| 2531 | }, | ||
| 2532 | .dec = { | ||
| 2533 | .vecs = anubis_cbc_dec_tv_template, | ||
| 2534 | .count = ANUBIS_CBC_DEC_TEST_VECTORS | ||
| 2535 | } | ||
| 2536 | } | 2441 | } |
| 2537 | } | 2442 | } |
| 2538 | }, { | 2443 | }, { |
| @@ -2540,14 +2445,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2540 | .test = alg_test_skcipher, | 2445 | .test = alg_test_skcipher, |
| 2541 | .suite = { | 2446 | .suite = { |
| 2542 | .cipher = { | 2447 | .cipher = { |
| 2543 | .enc = { | 2448 | .enc = __VECS(bf_cbc_enc_tv_template), |
| 2544 | .vecs = bf_cbc_enc_tv_template, | 2449 | .dec = __VECS(bf_cbc_dec_tv_template) |
| 2545 | .count = BF_CBC_ENC_TEST_VECTORS | ||
| 2546 | }, | ||
| 2547 | .dec = { | ||
| 2548 | .vecs = bf_cbc_dec_tv_template, | ||
| 2549 | .count = BF_CBC_DEC_TEST_VECTORS | ||
| 2550 | } | ||
| 2551 | } | 2450 | } |
| 2552 | } | 2451 | } |
| 2553 | }, { | 2452 | }, { |
| @@ -2555,14 +2454,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2555 | .test = alg_test_skcipher, | 2454 | .test = alg_test_skcipher, |
| 2556 | .suite = { | 2455 | .suite = { |
| 2557 | .cipher = { | 2456 | .cipher = { |
| 2558 | .enc = { | 2457 | .enc = __VECS(camellia_cbc_enc_tv_template), |
| 2559 | .vecs = camellia_cbc_enc_tv_template, | 2458 | .dec = __VECS(camellia_cbc_dec_tv_template) |
| 2560 | .count = CAMELLIA_CBC_ENC_TEST_VECTORS | ||
| 2561 | }, | ||
| 2562 | .dec = { | ||
| 2563 | .vecs = camellia_cbc_dec_tv_template, | ||
| 2564 | .count = CAMELLIA_CBC_DEC_TEST_VECTORS | ||
| 2565 | } | ||
| 2566 | } | 2459 | } |
| 2567 | } | 2460 | } |
| 2568 | }, { | 2461 | }, { |
| @@ -2570,14 +2463,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2570 | .test = alg_test_skcipher, | 2463 | .test = alg_test_skcipher, |
| 2571 | .suite = { | 2464 | .suite = { |
| 2572 | .cipher = { | 2465 | .cipher = { |
| 2573 | .enc = { | 2466 | .enc = __VECS(cast5_cbc_enc_tv_template), |
| 2574 | .vecs = cast5_cbc_enc_tv_template, | 2467 | .dec = __VECS(cast5_cbc_dec_tv_template) |
| 2575 | .count = CAST5_CBC_ENC_TEST_VECTORS | ||
| 2576 | }, | ||
| 2577 | .dec = { | ||
| 2578 | .vecs = cast5_cbc_dec_tv_template, | ||
| 2579 | .count = CAST5_CBC_DEC_TEST_VECTORS | ||
| 2580 | } | ||
| 2581 | } | 2468 | } |
| 2582 | } | 2469 | } |
| 2583 | }, { | 2470 | }, { |
| @@ -2585,14 +2472,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2585 | .test = alg_test_skcipher, | 2472 | .test = alg_test_skcipher, |
| 2586 | .suite = { | 2473 | .suite = { |
| 2587 | .cipher = { | 2474 | .cipher = { |
| 2588 | .enc = { | 2475 | .enc = __VECS(cast6_cbc_enc_tv_template), |
| 2589 | .vecs = cast6_cbc_enc_tv_template, | 2476 | .dec = __VECS(cast6_cbc_dec_tv_template) |
| 2590 | .count = CAST6_CBC_ENC_TEST_VECTORS | ||
| 2591 | }, | ||
| 2592 | .dec = { | ||
| 2593 | .vecs = cast6_cbc_dec_tv_template, | ||
| 2594 | .count = CAST6_CBC_DEC_TEST_VECTORS | ||
| 2595 | } | ||
| 2596 | } | 2477 | } |
| 2597 | } | 2478 | } |
| 2598 | }, { | 2479 | }, { |
| @@ -2600,14 +2481,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2600 | .test = alg_test_skcipher, | 2481 | .test = alg_test_skcipher, |
| 2601 | .suite = { | 2482 | .suite = { |
| 2602 | .cipher = { | 2483 | .cipher = { |
| 2603 | .enc = { | 2484 | .enc = __VECS(des_cbc_enc_tv_template), |
| 2604 | .vecs = des_cbc_enc_tv_template, | 2485 | .dec = __VECS(des_cbc_dec_tv_template) |
| 2605 | .count = DES_CBC_ENC_TEST_VECTORS | ||
| 2606 | }, | ||
| 2607 | .dec = { | ||
| 2608 | .vecs = des_cbc_dec_tv_template, | ||
| 2609 | .count = DES_CBC_DEC_TEST_VECTORS | ||
| 2610 | } | ||
| 2611 | } | 2486 | } |
| 2612 | } | 2487 | } |
| 2613 | }, { | 2488 | }, { |
| @@ -2616,14 +2491,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2616 | .fips_allowed = 1, | 2491 | .fips_allowed = 1, |
| 2617 | .suite = { | 2492 | .suite = { |
| 2618 | .cipher = { | 2493 | .cipher = { |
| 2619 | .enc = { | 2494 | .enc = __VECS(des3_ede_cbc_enc_tv_template), |
| 2620 | .vecs = des3_ede_cbc_enc_tv_template, | 2495 | .dec = __VECS(des3_ede_cbc_dec_tv_template) |
| 2621 | .count = DES3_EDE_CBC_ENC_TEST_VECTORS | ||
| 2622 | }, | ||
| 2623 | .dec = { | ||
| 2624 | .vecs = des3_ede_cbc_dec_tv_template, | ||
| 2625 | .count = DES3_EDE_CBC_DEC_TEST_VECTORS | ||
| 2626 | } | ||
| 2627 | } | 2496 | } |
| 2628 | } | 2497 | } |
| 2629 | }, { | 2498 | }, { |
| @@ -2631,14 +2500,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2631 | .test = alg_test_skcipher, | 2500 | .test = alg_test_skcipher, |
| 2632 | .suite = { | 2501 | .suite = { |
| 2633 | .cipher = { | 2502 | .cipher = { |
| 2634 | .enc = { | 2503 | .enc = __VECS(serpent_cbc_enc_tv_template), |
| 2635 | .vecs = serpent_cbc_enc_tv_template, | 2504 | .dec = __VECS(serpent_cbc_dec_tv_template) |
| 2636 | .count = SERPENT_CBC_ENC_TEST_VECTORS | ||
| 2637 | }, | ||
| 2638 | .dec = { | ||
| 2639 | .vecs = serpent_cbc_dec_tv_template, | ||
| 2640 | .count = SERPENT_CBC_DEC_TEST_VECTORS | ||
| 2641 | } | ||
| 2642 | } | 2505 | } |
| 2643 | } | 2506 | } |
| 2644 | }, { | 2507 | }, { |
| @@ -2646,30 +2509,25 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2646 | .test = alg_test_skcipher, | 2509 | .test = alg_test_skcipher, |
| 2647 | .suite = { | 2510 | .suite = { |
| 2648 | .cipher = { | 2511 | .cipher = { |
| 2649 | .enc = { | 2512 | .enc = __VECS(tf_cbc_enc_tv_template), |
| 2650 | .vecs = tf_cbc_enc_tv_template, | 2513 | .dec = __VECS(tf_cbc_dec_tv_template) |
| 2651 | .count = TF_CBC_ENC_TEST_VECTORS | ||
| 2652 | }, | ||
| 2653 | .dec = { | ||
| 2654 | .vecs = tf_cbc_dec_tv_template, | ||
| 2655 | .count = TF_CBC_DEC_TEST_VECTORS | ||
| 2656 | } | ||
| 2657 | } | 2514 | } |
| 2658 | } | 2515 | } |
| 2659 | }, { | 2516 | }, { |
| 2517 | .alg = "cbcmac(aes)", | ||
| 2518 | .fips_allowed = 1, | ||
| 2519 | .test = alg_test_hash, | ||
| 2520 | .suite = { | ||
| 2521 | .hash = __VECS(aes_cbcmac_tv_template) | ||
| 2522 | } | ||
| 2523 | }, { | ||
| 2660 | .alg = "ccm(aes)", | 2524 | .alg = "ccm(aes)", |
| 2661 | .test = alg_test_aead, | 2525 | .test = alg_test_aead, |
| 2662 | .fips_allowed = 1, | 2526 | .fips_allowed = 1, |
| 2663 | .suite = { | 2527 | .suite = { |
| 2664 | .aead = { | 2528 | .aead = { |
| 2665 | .enc = { | 2529 | .enc = __VECS(aes_ccm_enc_tv_template), |
| 2666 | .vecs = aes_ccm_enc_tv_template, | 2530 | .dec = __VECS(aes_ccm_dec_tv_template) |
| 2667 | .count = AES_CCM_ENC_TEST_VECTORS | ||
| 2668 | }, | ||
| 2669 | .dec = { | ||
| 2670 | .vecs = aes_ccm_dec_tv_template, | ||
| 2671 | .count = AES_CCM_DEC_TEST_VECTORS | ||
| 2672 | } | ||
| 2673 | } | 2531 | } |
| 2674 | } | 2532 | } |
| 2675 | }, { | 2533 | }, { |
| @@ -2677,14 +2535,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2677 | .test = alg_test_skcipher, | 2535 | .test = alg_test_skcipher, |
| 2678 | .suite = { | 2536 | .suite = { |
| 2679 | .cipher = { | 2537 | .cipher = { |
| 2680 | .enc = { | 2538 | .enc = __VECS(chacha20_enc_tv_template), |
| 2681 | .vecs = chacha20_enc_tv_template, | 2539 | .dec = __VECS(chacha20_enc_tv_template), |
| 2682 | .count = CHACHA20_ENC_TEST_VECTORS | ||
| 2683 | }, | ||
| 2684 | .dec = { | ||
| 2685 | .vecs = chacha20_enc_tv_template, | ||
| 2686 | .count = CHACHA20_ENC_TEST_VECTORS | ||
| 2687 | }, | ||
| 2688 | } | 2540 | } |
| 2689 | } | 2541 | } |
| 2690 | }, { | 2542 | }, { |
| @@ -2692,20 +2544,14 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2692 | .fips_allowed = 1, | 2544 | .fips_allowed = 1, |
| 2693 | .test = alg_test_hash, | 2545 | .test = alg_test_hash, |
| 2694 | .suite = { | 2546 | .suite = { |
| 2695 | .hash = { | 2547 | .hash = __VECS(aes_cmac128_tv_template) |
| 2696 | .vecs = aes_cmac128_tv_template, | ||
| 2697 | .count = CMAC_AES_TEST_VECTORS | ||
| 2698 | } | ||
| 2699 | } | 2548 | } |
| 2700 | }, { | 2549 | }, { |
| 2701 | .alg = "cmac(des3_ede)", | 2550 | .alg = "cmac(des3_ede)", |
| 2702 | .fips_allowed = 1, | 2551 | .fips_allowed = 1, |
| 2703 | .test = alg_test_hash, | 2552 | .test = alg_test_hash, |
| 2704 | .suite = { | 2553 | .suite = { |
| 2705 | .hash = { | 2554 | .hash = __VECS(des3_ede_cmac64_tv_template) |
| 2706 | .vecs = des3_ede_cmac64_tv_template, | ||
| 2707 | .count = CMAC_DES3_EDE_TEST_VECTORS | ||
| 2708 | } | ||
| 2709 | } | 2555 | } |
| 2710 | }, { | 2556 | }, { |
| 2711 | .alg = "compress_null", | 2557 | .alg = "compress_null", |
| @@ -2714,30 +2560,21 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2714 | .alg = "crc32", | 2560 | .alg = "crc32", |
| 2715 | .test = alg_test_hash, | 2561 | .test = alg_test_hash, |
| 2716 | .suite = { | 2562 | .suite = { |
| 2717 | .hash = { | 2563 | .hash = __VECS(crc32_tv_template) |
| 2718 | .vecs = crc32_tv_template, | ||
| 2719 | .count = CRC32_TEST_VECTORS | ||
| 2720 | } | ||
| 2721 | } | 2564 | } |
| 2722 | }, { | 2565 | }, { |
| 2723 | .alg = "crc32c", | 2566 | .alg = "crc32c", |
| 2724 | .test = alg_test_crc32c, | 2567 | .test = alg_test_crc32c, |
| 2725 | .fips_allowed = 1, | 2568 | .fips_allowed = 1, |
| 2726 | .suite = { | 2569 | .suite = { |
| 2727 | .hash = { | 2570 | .hash = __VECS(crc32c_tv_template) |
| 2728 | .vecs = crc32c_tv_template, | ||
| 2729 | .count = CRC32C_TEST_VECTORS | ||
| 2730 | } | ||
| 2731 | } | 2571 | } |
| 2732 | }, { | 2572 | }, { |
| 2733 | .alg = "crct10dif", | 2573 | .alg = "crct10dif", |
| 2734 | .test = alg_test_hash, | 2574 | .test = alg_test_hash, |
| 2735 | .fips_allowed = 1, | 2575 | .fips_allowed = 1, |
| 2736 | .suite = { | 2576 | .suite = { |
| 2737 | .hash = { | 2577 | .hash = __VECS(crct10dif_tv_template) |
| 2738 | .vecs = crct10dif_tv_template, | ||
| 2739 | .count = CRCT10DIF_TEST_VECTORS | ||
| 2740 | } | ||
| 2741 | } | 2578 | } |
| 2742 | }, { | 2579 | }, { |
| 2743 | .alg = "ctr(aes)", | 2580 | .alg = "ctr(aes)", |
| @@ -2745,14 +2582,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2745 | .fips_allowed = 1, | 2582 | .fips_allowed = 1, |
| 2746 | .suite = { | 2583 | .suite = { |
| 2747 | .cipher = { | 2584 | .cipher = { |
| 2748 | .enc = { | 2585 | .enc = __VECS(aes_ctr_enc_tv_template), |
| 2749 | .vecs = aes_ctr_enc_tv_template, | 2586 | .dec = __VECS(aes_ctr_dec_tv_template) |
| 2750 | .count = AES_CTR_ENC_TEST_VECTORS | ||
| 2751 | }, | ||
| 2752 | .dec = { | ||
| 2753 | .vecs = aes_ctr_dec_tv_template, | ||
| 2754 | .count = AES_CTR_DEC_TEST_VECTORS | ||
| 2755 | } | ||
| 2756 | } | 2587 | } |
| 2757 | } | 2588 | } |
| 2758 | }, { | 2589 | }, { |
| @@ -2760,14 +2591,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2760 | .test = alg_test_skcipher, | 2591 | .test = alg_test_skcipher, |
| 2761 | .suite = { | 2592 | .suite = { |
| 2762 | .cipher = { | 2593 | .cipher = { |
| 2763 | .enc = { | 2594 | .enc = __VECS(bf_ctr_enc_tv_template), |
| 2764 | .vecs = bf_ctr_enc_tv_template, | 2595 | .dec = __VECS(bf_ctr_dec_tv_template) |
| 2765 | .count = BF_CTR_ENC_TEST_VECTORS | ||
| 2766 | }, | ||
| 2767 | .dec = { | ||
| 2768 | .vecs = bf_ctr_dec_tv_template, | ||
| 2769 | .count = BF_CTR_DEC_TEST_VECTORS | ||
| 2770 | } | ||
| 2771 | } | 2596 | } |
| 2772 | } | 2597 | } |
| 2773 | }, { | 2598 | }, { |
| @@ -2775,14 +2600,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2775 | .test = alg_test_skcipher, | 2600 | .test = alg_test_skcipher, |
| 2776 | .suite = { | 2601 | .suite = { |
| 2777 | .cipher = { | 2602 | .cipher = { |
| 2778 | .enc = { | 2603 | .enc = __VECS(camellia_ctr_enc_tv_template), |
| 2779 | .vecs = camellia_ctr_enc_tv_template, | 2604 | .dec = __VECS(camellia_ctr_dec_tv_template) |
| 2780 | .count = CAMELLIA_CTR_ENC_TEST_VECTORS | ||
| 2781 | }, | ||
| 2782 | .dec = { | ||
| 2783 | .vecs = camellia_ctr_dec_tv_template, | ||
| 2784 | .count = CAMELLIA_CTR_DEC_TEST_VECTORS | ||
| 2785 | } | ||
| 2786 | } | 2605 | } |
| 2787 | } | 2606 | } |
| 2788 | }, { | 2607 | }, { |
| @@ -2790,14 +2609,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2790 | .test = alg_test_skcipher, | 2609 | .test = alg_test_skcipher, |
| 2791 | .suite = { | 2610 | .suite = { |
| 2792 | .cipher = { | 2611 | .cipher = { |
| 2793 | .enc = { | 2612 | .enc = __VECS(cast5_ctr_enc_tv_template), |
| 2794 | .vecs = cast5_ctr_enc_tv_template, | 2613 | .dec = __VECS(cast5_ctr_dec_tv_template) |
| 2795 | .count = CAST5_CTR_ENC_TEST_VECTORS | ||
| 2796 | }, | ||
| 2797 | .dec = { | ||
| 2798 | .vecs = cast5_ctr_dec_tv_template, | ||
| 2799 | .count = CAST5_CTR_DEC_TEST_VECTORS | ||
| 2800 | } | ||
| 2801 | } | 2614 | } |
| 2802 | } | 2615 | } |
| 2803 | }, { | 2616 | }, { |
| @@ -2805,14 +2618,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2805 | .test = alg_test_skcipher, | 2618 | .test = alg_test_skcipher, |
| 2806 | .suite = { | 2619 | .suite = { |
| 2807 | .cipher = { | 2620 | .cipher = { |
| 2808 | .enc = { | 2621 | .enc = __VECS(cast6_ctr_enc_tv_template), |
| 2809 | .vecs = cast6_ctr_enc_tv_template, | 2622 | .dec = __VECS(cast6_ctr_dec_tv_template) |
| 2810 | .count = CAST6_CTR_ENC_TEST_VECTORS | ||
| 2811 | }, | ||
| 2812 | .dec = { | ||
| 2813 | .vecs = cast6_ctr_dec_tv_template, | ||
| 2814 | .count = CAST6_CTR_DEC_TEST_VECTORS | ||
| 2815 | } | ||
| 2816 | } | 2623 | } |
| 2817 | } | 2624 | } |
| 2818 | }, { | 2625 | }, { |
| @@ -2820,14 +2627,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2820 | .test = alg_test_skcipher, | 2627 | .test = alg_test_skcipher, |
| 2821 | .suite = { | 2628 | .suite = { |
| 2822 | .cipher = { | 2629 | .cipher = { |
| 2823 | .enc = { | 2630 | .enc = __VECS(des_ctr_enc_tv_template), |
| 2824 | .vecs = des_ctr_enc_tv_template, | 2631 | .dec = __VECS(des_ctr_dec_tv_template) |
| 2825 | .count = DES_CTR_ENC_TEST_VECTORS | ||
| 2826 | }, | ||
| 2827 | .dec = { | ||
| 2828 | .vecs = des_ctr_dec_tv_template, | ||
| 2829 | .count = DES_CTR_DEC_TEST_VECTORS | ||
| 2830 | } | ||
| 2831 | } | 2632 | } |
| 2832 | } | 2633 | } |
| 2833 | }, { | 2634 | }, { |
| @@ -2835,14 +2636,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2835 | .test = alg_test_skcipher, | 2636 | .test = alg_test_skcipher, |
| 2836 | .suite = { | 2637 | .suite = { |
| 2837 | .cipher = { | 2638 | .cipher = { |
| 2838 | .enc = { | 2639 | .enc = __VECS(des3_ede_ctr_enc_tv_template), |
| 2839 | .vecs = des3_ede_ctr_enc_tv_template, | 2640 | .dec = __VECS(des3_ede_ctr_dec_tv_template) |
| 2840 | .count = DES3_EDE_CTR_ENC_TEST_VECTORS | ||
| 2841 | }, | ||
| 2842 | .dec = { | ||
| 2843 | .vecs = des3_ede_ctr_dec_tv_template, | ||
| 2844 | .count = DES3_EDE_CTR_DEC_TEST_VECTORS | ||
| 2845 | } | ||
| 2846 | } | 2641 | } |
| 2847 | } | 2642 | } |
| 2848 | }, { | 2643 | }, { |
| @@ -2850,14 +2645,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2850 | .test = alg_test_skcipher, | 2645 | .test = alg_test_skcipher, |
| 2851 | .suite = { | 2646 | .suite = { |
| 2852 | .cipher = { | 2647 | .cipher = { |
| 2853 | .enc = { | 2648 | .enc = __VECS(serpent_ctr_enc_tv_template), |
| 2854 | .vecs = serpent_ctr_enc_tv_template, | 2649 | .dec = __VECS(serpent_ctr_dec_tv_template) |
| 2855 | .count = SERPENT_CTR_ENC_TEST_VECTORS | ||
| 2856 | }, | ||
| 2857 | .dec = { | ||
| 2858 | .vecs = serpent_ctr_dec_tv_template, | ||
| 2859 | .count = SERPENT_CTR_DEC_TEST_VECTORS | ||
| 2860 | } | ||
| 2861 | } | 2650 | } |
| 2862 | } | 2651 | } |
| 2863 | }, { | 2652 | }, { |
| @@ -2865,14 +2654,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2865 | .test = alg_test_skcipher, | 2654 | .test = alg_test_skcipher, |
| 2866 | .suite = { | 2655 | .suite = { |
| 2867 | .cipher = { | 2656 | .cipher = { |
| 2868 | .enc = { | 2657 | .enc = __VECS(tf_ctr_enc_tv_template), |
| 2869 | .vecs = tf_ctr_enc_tv_template, | 2658 | .dec = __VECS(tf_ctr_dec_tv_template) |
| 2870 | .count = TF_CTR_ENC_TEST_VECTORS | ||
| 2871 | }, | ||
| 2872 | .dec = { | ||
| 2873 | .vecs = tf_ctr_dec_tv_template, | ||
| 2874 | .count = TF_CTR_DEC_TEST_VECTORS | ||
| 2875 | } | ||
| 2876 | } | 2659 | } |
| 2877 | } | 2660 | } |
| 2878 | }, { | 2661 | }, { |
| @@ -2880,14 +2663,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2880 | .test = alg_test_skcipher, | 2663 | .test = alg_test_skcipher, |
| 2881 | .suite = { | 2664 | .suite = { |
| 2882 | .cipher = { | 2665 | .cipher = { |
| 2883 | .enc = { | 2666 | .enc = __VECS(cts_mode_enc_tv_template), |
| 2884 | .vecs = cts_mode_enc_tv_template, | 2667 | .dec = __VECS(cts_mode_dec_tv_template) |
| 2885 | .count = CTS_MODE_ENC_TEST_VECTORS | ||
| 2886 | }, | ||
| 2887 | .dec = { | ||
| 2888 | .vecs = cts_mode_dec_tv_template, | ||
| 2889 | .count = CTS_MODE_DEC_TEST_VECTORS | ||
| 2890 | } | ||
| 2891 | } | 2668 | } |
| 2892 | } | 2669 | } |
| 2893 | }, { | 2670 | }, { |
| @@ -2896,14 +2673,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2896 | .fips_allowed = 1, | 2673 | .fips_allowed = 1, |
| 2897 | .suite = { | 2674 | .suite = { |
| 2898 | .comp = { | 2675 | .comp = { |
| 2899 | .comp = { | 2676 | .comp = __VECS(deflate_comp_tv_template), |
| 2900 | .vecs = deflate_comp_tv_template, | 2677 | .decomp = __VECS(deflate_decomp_tv_template) |
| 2901 | .count = DEFLATE_COMP_TEST_VECTORS | ||
| 2902 | }, | ||
| 2903 | .decomp = { | ||
| 2904 | .vecs = deflate_decomp_tv_template, | ||
| 2905 | .count = DEFLATE_DECOMP_TEST_VECTORS | ||
| 2906 | } | ||
| 2907 | } | 2678 | } |
| 2908 | } | 2679 | } |
| 2909 | }, { | 2680 | }, { |
| @@ -2911,10 +2682,7 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2911 | .test = alg_test_kpp, | 2682 | .test = alg_test_kpp, |
| 2912 | .fips_allowed = 1, | 2683 | .fips_allowed = 1, |
| 2913 | .suite = { | 2684 | .suite = { |
| 2914 | .kpp = { | 2685 | .kpp = __VECS(dh_tv_template) |
| 2915 | .vecs = dh_tv_template, | ||
| 2916 | .count = DH_TEST_VECTORS | ||
| 2917 | } | ||
| 2918 | } | 2686 | } |
| 2919 | }, { | 2687 | }, { |
| 2920 | .alg = "digest_null", | 2688 | .alg = "digest_null", |
| @@ -2924,30 +2692,21 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2924 | .test = alg_test_drbg, | 2692 | .test = alg_test_drbg, |
| 2925 | .fips_allowed = 1, | 2693 | .fips_allowed = 1, |
| 2926 | .suite = { | 2694 | .suite = { |
| 2927 | .drbg = { | 2695 | .drbg = __VECS(drbg_nopr_ctr_aes128_tv_template) |
| 2928 | .vecs = drbg_nopr_ctr_aes128_tv_template, | ||
| 2929 | .count = ARRAY_SIZE(drbg_nopr_ctr_aes128_tv_template) | ||
| 2930 | } | ||
| 2931 | } | 2696 | } |
| 2932 | }, { | 2697 | }, { |
| 2933 | .alg = "drbg_nopr_ctr_aes192", | 2698 | .alg = "drbg_nopr_ctr_aes192", |
| 2934 | .test = alg_test_drbg, | 2699 | .test = alg_test_drbg, |
| 2935 | .fips_allowed = 1, | 2700 | .fips_allowed = 1, |
| 2936 | .suite = { | 2701 | .suite = { |
| 2937 | .drbg = { | 2702 | .drbg = __VECS(drbg_nopr_ctr_aes192_tv_template) |
| 2938 | .vecs = drbg_nopr_ctr_aes192_tv_template, | ||
| 2939 | .count = ARRAY_SIZE(drbg_nopr_ctr_aes192_tv_template) | ||
| 2940 | } | ||
| 2941 | } | 2703 | } |
| 2942 | }, { | 2704 | }, { |
| 2943 | .alg = "drbg_nopr_ctr_aes256", | 2705 | .alg = "drbg_nopr_ctr_aes256", |
| 2944 | .test = alg_test_drbg, | 2706 | .test = alg_test_drbg, |
| 2945 | .fips_allowed = 1, | 2707 | .fips_allowed = 1, |
| 2946 | .suite = { | 2708 | .suite = { |
| 2947 | .drbg = { | 2709 | .drbg = __VECS(drbg_nopr_ctr_aes256_tv_template) |
| 2948 | .vecs = drbg_nopr_ctr_aes256_tv_template, | ||
| 2949 | .count = ARRAY_SIZE(drbg_nopr_ctr_aes256_tv_template) | ||
| 2950 | } | ||
| 2951 | } | 2710 | } |
| 2952 | }, { | 2711 | }, { |
| 2953 | /* | 2712 | /* |
| @@ -2962,11 +2721,7 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2962 | .test = alg_test_drbg, | 2721 | .test = alg_test_drbg, |
| 2963 | .fips_allowed = 1, | 2722 | .fips_allowed = 1, |
| 2964 | .suite = { | 2723 | .suite = { |
| 2965 | .drbg = { | 2724 | .drbg = __VECS(drbg_nopr_hmac_sha256_tv_template) |
| 2966 | .vecs = drbg_nopr_hmac_sha256_tv_template, | ||
| 2967 | .count = | ||
| 2968 | ARRAY_SIZE(drbg_nopr_hmac_sha256_tv_template) | ||
| 2969 | } | ||
| 2970 | } | 2725 | } |
| 2971 | }, { | 2726 | }, { |
| 2972 | /* covered by drbg_nopr_hmac_sha256 test */ | 2727 | /* covered by drbg_nopr_hmac_sha256 test */ |
| @@ -2986,10 +2741,7 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 2986 | .test = alg_test_drbg, | 2741 | .test = alg_test_drbg, |
| 2987 | .fips_allowed = 1, | 2742 | .fips_allowed = 1, |
| 2988 | .suite = { | 2743 | .suite = { |
| 2989 | .drbg = { | 2744 | .drbg = __VECS(drbg_nopr_sha256_tv_template) |
| 2990 | .vecs = drbg_nopr_sha256_tv_template, | ||
| 2991 | .count = ARRAY_SIZE(drbg_nopr_sha256_tv_template) | ||
| 2992 | } | ||
| 2993 | } | 2745 | } |
| 2994 | }, { | 2746 | }, { |
| 2995 | /* covered by drbg_nopr_sha256 test */ | 2747 | /* covered by drbg_nopr_sha256 test */ |
| @@ -3005,10 +2757,7 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3005 | .test = alg_test_drbg, | 2757 | .test = alg_test_drbg, |
| 3006 | .fips_allowed = 1, | 2758 | .fips_allowed = 1, |
| 3007 | .suite = { | 2759 | .suite = { |
| 3008 | .drbg = { | 2760 | .drbg = __VECS(drbg_pr_ctr_aes128_tv_template) |
| 3009 | .vecs = drbg_pr_ctr_aes128_tv_template, | ||
| 3010 | .count = ARRAY_SIZE(drbg_pr_ctr_aes128_tv_template) | ||
| 3011 | } | ||
| 3012 | } | 2761 | } |
| 3013 | }, { | 2762 | }, { |
| 3014 | /* covered by drbg_pr_ctr_aes128 test */ | 2763 | /* covered by drbg_pr_ctr_aes128 test */ |
| @@ -3028,10 +2777,7 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3028 | .test = alg_test_drbg, | 2777 | .test = alg_test_drbg, |
| 3029 | .fips_allowed = 1, | 2778 | .fips_allowed = 1, |
| 3030 | .suite = { | 2779 | .suite = { |
| 3031 | .drbg = { | 2780 | .drbg = __VECS(drbg_pr_hmac_sha256_tv_template) |
| 3032 | .vecs = drbg_pr_hmac_sha256_tv_template, | ||
| 3033 | .count = ARRAY_SIZE(drbg_pr_hmac_sha256_tv_template) | ||
| 3034 | } | ||
| 3035 | } | 2781 | } |
| 3036 | }, { | 2782 | }, { |
| 3037 | /* covered by drbg_pr_hmac_sha256 test */ | 2783 | /* covered by drbg_pr_hmac_sha256 test */ |
| @@ -3051,10 +2797,7 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3051 | .test = alg_test_drbg, | 2797 | .test = alg_test_drbg, |
| 3052 | .fips_allowed = 1, | 2798 | .fips_allowed = 1, |
| 3053 | .suite = { | 2799 | .suite = { |
| 3054 | .drbg = { | 2800 | .drbg = __VECS(drbg_pr_sha256_tv_template) |
| 3055 | .vecs = drbg_pr_sha256_tv_template, | ||
| 3056 | .count = ARRAY_SIZE(drbg_pr_sha256_tv_template) | ||
| 3057 | } | ||
| 3058 | } | 2801 | } |
| 3059 | }, { | 2802 | }, { |
| 3060 | /* covered by drbg_pr_sha256 test */ | 2803 | /* covered by drbg_pr_sha256 test */ |
| @@ -3071,14 +2814,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3071 | .fips_allowed = 1, | 2814 | .fips_allowed = 1, |
| 3072 | .suite = { | 2815 | .suite = { |
| 3073 | .cipher = { | 2816 | .cipher = { |
| 3074 | .enc = { | 2817 | .enc = __VECS(aes_enc_tv_template), |
| 3075 | .vecs = aes_enc_tv_template, | 2818 | .dec = __VECS(aes_dec_tv_template) |
| 3076 | .count = AES_ENC_TEST_VECTORS | ||
| 3077 | }, | ||
| 3078 | .dec = { | ||
| 3079 | .vecs = aes_dec_tv_template, | ||
| 3080 | .count = AES_DEC_TEST_VECTORS | ||
| 3081 | } | ||
| 3082 | } | 2819 | } |
| 3083 | } | 2820 | } |
| 3084 | }, { | 2821 | }, { |
| @@ -3086,14 +2823,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3086 | .test = alg_test_skcipher, | 2823 | .test = alg_test_skcipher, |
| 3087 | .suite = { | 2824 | .suite = { |
| 3088 | .cipher = { | 2825 | .cipher = { |
| 3089 | .enc = { | 2826 | .enc = __VECS(anubis_enc_tv_template), |
| 3090 | .vecs = anubis_enc_tv_template, | 2827 | .dec = __VECS(anubis_dec_tv_template) |
| 3091 | .count = ANUBIS_ENC_TEST_VECTORS | ||
| 3092 | }, | ||
| 3093 | .dec = { | ||
| 3094 | .vecs = anubis_dec_tv_template, | ||
| 3095 | .count = ANUBIS_DEC_TEST_VECTORS | ||
| 3096 | } | ||
| 3097 | } | 2828 | } |
| 3098 | } | 2829 | } |
| 3099 | }, { | 2830 | }, { |
| @@ -3101,14 +2832,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3101 | .test = alg_test_skcipher, | 2832 | .test = alg_test_skcipher, |
| 3102 | .suite = { | 2833 | .suite = { |
| 3103 | .cipher = { | 2834 | .cipher = { |
| 3104 | .enc = { | 2835 | .enc = __VECS(arc4_enc_tv_template), |
| 3105 | .vecs = arc4_enc_tv_template, | 2836 | .dec = __VECS(arc4_dec_tv_template) |
| 3106 | .count = ARC4_ENC_TEST_VECTORS | ||
| 3107 | }, | ||
| 3108 | .dec = { | ||
| 3109 | .vecs = arc4_dec_tv_template, | ||
| 3110 | .count = ARC4_DEC_TEST_VECTORS | ||
| 3111 | } | ||
| 3112 | } | 2837 | } |
| 3113 | } | 2838 | } |
| 3114 | }, { | 2839 | }, { |
| @@ -3116,14 +2841,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3116 | .test = alg_test_skcipher, | 2841 | .test = alg_test_skcipher, |
| 3117 | .suite = { | 2842 | .suite = { |
| 3118 | .cipher = { | 2843 | .cipher = { |
| 3119 | .enc = { | 2844 | .enc = __VECS(bf_enc_tv_template), |
| 3120 | .vecs = bf_enc_tv_template, | 2845 | .dec = __VECS(bf_dec_tv_template) |
| 3121 | .count = BF_ENC_TEST_VECTORS | ||
| 3122 | }, | ||
| 3123 | .dec = { | ||
| 3124 | .vecs = bf_dec_tv_template, | ||
| 3125 | .count = BF_DEC_TEST_VECTORS | ||
| 3126 | } | ||
| 3127 | } | 2846 | } |
| 3128 | } | 2847 | } |
| 3129 | }, { | 2848 | }, { |
| @@ -3131,14 +2850,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3131 | .test = alg_test_skcipher, | 2850 | .test = alg_test_skcipher, |
| 3132 | .suite = { | 2851 | .suite = { |
| 3133 | .cipher = { | 2852 | .cipher = { |
| 3134 | .enc = { | 2853 | .enc = __VECS(camellia_enc_tv_template), |
| 3135 | .vecs = camellia_enc_tv_template, | 2854 | .dec = __VECS(camellia_dec_tv_template) |
| 3136 | .count = CAMELLIA_ENC_TEST_VECTORS | ||
| 3137 | }, | ||
| 3138 | .dec = { | ||
| 3139 | .vecs = camellia_dec_tv_template, | ||
| 3140 | .count = CAMELLIA_DEC_TEST_VECTORS | ||
| 3141 | } | ||
| 3142 | } | 2855 | } |
| 3143 | } | 2856 | } |
| 3144 | }, { | 2857 | }, { |
| @@ -3146,14 +2859,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3146 | .test = alg_test_skcipher, | 2859 | .test = alg_test_skcipher, |
| 3147 | .suite = { | 2860 | .suite = { |
| 3148 | .cipher = { | 2861 | .cipher = { |
| 3149 | .enc = { | 2862 | .enc = __VECS(cast5_enc_tv_template), |
| 3150 | .vecs = cast5_enc_tv_template, | 2863 | .dec = __VECS(cast5_dec_tv_template) |
| 3151 | .count = CAST5_ENC_TEST_VECTORS | ||
| 3152 | }, | ||
| 3153 | .dec = { | ||
| 3154 | .vecs = cast5_dec_tv_template, | ||
| 3155 | .count = CAST5_DEC_TEST_VECTORS | ||
| 3156 | } | ||
| 3157 | } | 2864 | } |
| 3158 | } | 2865 | } |
| 3159 | }, { | 2866 | }, { |
| @@ -3161,14 +2868,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3161 | .test = alg_test_skcipher, | 2868 | .test = alg_test_skcipher, |
| 3162 | .suite = { | 2869 | .suite = { |
| 3163 | .cipher = { | 2870 | .cipher = { |
| 3164 | .enc = { | 2871 | .enc = __VECS(cast6_enc_tv_template), |
| 3165 | .vecs = cast6_enc_tv_template, | 2872 | .dec = __VECS(cast6_dec_tv_template) |
| 3166 | .count = CAST6_ENC_TEST_VECTORS | ||
| 3167 | }, | ||
| 3168 | .dec = { | ||
| 3169 | .vecs = cast6_dec_tv_template, | ||
| 3170 | .count = CAST6_DEC_TEST_VECTORS | ||
| 3171 | } | ||
| 3172 | } | 2873 | } |
| 3173 | } | 2874 | } |
| 3174 | }, { | 2875 | }, { |
| @@ -3179,14 +2880,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3179 | .test = alg_test_skcipher, | 2880 | .test = alg_test_skcipher, |
| 3180 | .suite = { | 2881 | .suite = { |
| 3181 | .cipher = { | 2882 | .cipher = { |
| 3182 | .enc = { | 2883 | .enc = __VECS(des_enc_tv_template), |
| 3183 | .vecs = des_enc_tv_template, | 2884 | .dec = __VECS(des_dec_tv_template) |
| 3184 | .count = DES_ENC_TEST_VECTORS | ||
| 3185 | }, | ||
| 3186 | .dec = { | ||
| 3187 | .vecs = des_dec_tv_template, | ||
| 3188 | .count = DES_DEC_TEST_VECTORS | ||
| 3189 | } | ||
| 3190 | } | 2885 | } |
| 3191 | } | 2886 | } |
| 3192 | }, { | 2887 | }, { |
| @@ -3195,14 +2890,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3195 | .fips_allowed = 1, | 2890 | .fips_allowed = 1, |
| 3196 | .suite = { | 2891 | .suite = { |
| 3197 | .cipher = { | 2892 | .cipher = { |
| 3198 | .enc = { | 2893 | .enc = __VECS(des3_ede_enc_tv_template), |
| 3199 | .vecs = des3_ede_enc_tv_template, | 2894 | .dec = __VECS(des3_ede_dec_tv_template) |
| 3200 | .count = DES3_EDE_ENC_TEST_VECTORS | ||
| 3201 | }, | ||
| 3202 | .dec = { | ||
| 3203 | .vecs = des3_ede_dec_tv_template, | ||
| 3204 | .count = DES3_EDE_DEC_TEST_VECTORS | ||
| 3205 | } | ||
| 3206 | } | 2895 | } |
| 3207 | } | 2896 | } |
| 3208 | }, { | 2897 | }, { |
| @@ -3225,14 +2914,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3225 | .test = alg_test_skcipher, | 2914 | .test = alg_test_skcipher, |
| 3226 | .suite = { | 2915 | .suite = { |
| 3227 | .cipher = { | 2916 | .cipher = { |
| 3228 | .enc = { | 2917 | .enc = __VECS(khazad_enc_tv_template), |
| 3229 | .vecs = khazad_enc_tv_template, | 2918 | .dec = __VECS(khazad_dec_tv_template) |
| 3230 | .count = KHAZAD_ENC_TEST_VECTORS | ||
| 3231 | }, | ||
| 3232 | .dec = { | ||
| 3233 | .vecs = khazad_dec_tv_template, | ||
| 3234 | .count = KHAZAD_DEC_TEST_VECTORS | ||
| 3235 | } | ||
| 3236 | } | 2919 | } |
| 3237 | } | 2920 | } |
| 3238 | }, { | 2921 | }, { |
| @@ -3240,14 +2923,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3240 | .test = alg_test_skcipher, | 2923 | .test = alg_test_skcipher, |
| 3241 | .suite = { | 2924 | .suite = { |
| 3242 | .cipher = { | 2925 | .cipher = { |
| 3243 | .enc = { | 2926 | .enc = __VECS(seed_enc_tv_template), |
| 3244 | .vecs = seed_enc_tv_template, | 2927 | .dec = __VECS(seed_dec_tv_template) |
| 3245 | .count = SEED_ENC_TEST_VECTORS | ||
| 3246 | }, | ||
| 3247 | .dec = { | ||
| 3248 | .vecs = seed_dec_tv_template, | ||
| 3249 | .count = SEED_DEC_TEST_VECTORS | ||
| 3250 | } | ||
| 3251 | } | 2928 | } |
| 3252 | } | 2929 | } |
| 3253 | }, { | 2930 | }, { |
| @@ -3255,14 +2932,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3255 | .test = alg_test_skcipher, | 2932 | .test = alg_test_skcipher, |
| 3256 | .suite = { | 2933 | .suite = { |
| 3257 | .cipher = { | 2934 | .cipher = { |
| 3258 | .enc = { | 2935 | .enc = __VECS(serpent_enc_tv_template), |
| 3259 | .vecs = serpent_enc_tv_template, | 2936 | .dec = __VECS(serpent_dec_tv_template) |
| 3260 | .count = SERPENT_ENC_TEST_VECTORS | ||
| 3261 | }, | ||
| 3262 | .dec = { | ||
| 3263 | .vecs = serpent_dec_tv_template, | ||
| 3264 | .count = SERPENT_DEC_TEST_VECTORS | ||
| 3265 | } | ||
| 3266 | } | 2937 | } |
| 3267 | } | 2938 | } |
| 3268 | }, { | 2939 | }, { |
| @@ -3270,14 +2941,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3270 | .test = alg_test_skcipher, | 2941 | .test = alg_test_skcipher, |
| 3271 | .suite = { | 2942 | .suite = { |
| 3272 | .cipher = { | 2943 | .cipher = { |
| 3273 | .enc = { | 2944 | .enc = __VECS(tea_enc_tv_template), |
| 3274 | .vecs = tea_enc_tv_template, | 2945 | .dec = __VECS(tea_dec_tv_template) |
| 3275 | .count = TEA_ENC_TEST_VECTORS | ||
| 3276 | }, | ||
| 3277 | .dec = { | ||
| 3278 | .vecs = tea_dec_tv_template, | ||
| 3279 | .count = TEA_DEC_TEST_VECTORS | ||
| 3280 | } | ||
| 3281 | } | 2946 | } |
| 3282 | } | 2947 | } |
| 3283 | }, { | 2948 | }, { |
| @@ -3285,14 +2950,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3285 | .test = alg_test_skcipher, | 2950 | .test = alg_test_skcipher, |
| 3286 | .suite = { | 2951 | .suite = { |
| 3287 | .cipher = { | 2952 | .cipher = { |
| 3288 | .enc = { | 2953 | .enc = __VECS(tnepres_enc_tv_template), |
| 3289 | .vecs = tnepres_enc_tv_template, | 2954 | .dec = __VECS(tnepres_dec_tv_template) |
| 3290 | .count = TNEPRES_ENC_TEST_VECTORS | ||
| 3291 | }, | ||
| 3292 | .dec = { | ||
| 3293 | .vecs = tnepres_dec_tv_template, | ||
| 3294 | .count = TNEPRES_DEC_TEST_VECTORS | ||
| 3295 | } | ||
| 3296 | } | 2955 | } |
| 3297 | } | 2956 | } |
| 3298 | }, { | 2957 | }, { |
| @@ -3300,14 +2959,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3300 | .test = alg_test_skcipher, | 2959 | .test = alg_test_skcipher, |
| 3301 | .suite = { | 2960 | .suite = { |
| 3302 | .cipher = { | 2961 | .cipher = { |
| 3303 | .enc = { | 2962 | .enc = __VECS(tf_enc_tv_template), |
| 3304 | .vecs = tf_enc_tv_template, | 2963 | .dec = __VECS(tf_dec_tv_template) |
| 3305 | .count = TF_ENC_TEST_VECTORS | ||
| 3306 | }, | ||
| 3307 | .dec = { | ||
| 3308 | .vecs = tf_dec_tv_template, | ||
| 3309 | .count = TF_DEC_TEST_VECTORS | ||
| 3310 | } | ||
| 3311 | } | 2964 | } |
| 3312 | } | 2965 | } |
| 3313 | }, { | 2966 | }, { |
| @@ -3315,14 +2968,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3315 | .test = alg_test_skcipher, | 2968 | .test = alg_test_skcipher, |
| 3316 | .suite = { | 2969 | .suite = { |
| 3317 | .cipher = { | 2970 | .cipher = { |
| 3318 | .enc = { | 2971 | .enc = __VECS(xeta_enc_tv_template), |
| 3319 | .vecs = xeta_enc_tv_template, | 2972 | .dec = __VECS(xeta_dec_tv_template) |
| 3320 | .count = XETA_ENC_TEST_VECTORS | ||
| 3321 | }, | ||
| 3322 | .dec = { | ||
| 3323 | .vecs = xeta_dec_tv_template, | ||
| 3324 | .count = XETA_DEC_TEST_VECTORS | ||
| 3325 | } | ||
| 3326 | } | 2973 | } |
| 3327 | } | 2974 | } |
| 3328 | }, { | 2975 | }, { |
| @@ -3330,14 +2977,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3330 | .test = alg_test_skcipher, | 2977 | .test = alg_test_skcipher, |
| 3331 | .suite = { | 2978 | .suite = { |
| 3332 | .cipher = { | 2979 | .cipher = { |
| 3333 | .enc = { | 2980 | .enc = __VECS(xtea_enc_tv_template), |
| 3334 | .vecs = xtea_enc_tv_template, | 2981 | .dec = __VECS(xtea_dec_tv_template) |
| 3335 | .count = XTEA_ENC_TEST_VECTORS | ||
| 3336 | }, | ||
| 3337 | .dec = { | ||
| 3338 | .vecs = xtea_dec_tv_template, | ||
| 3339 | .count = XTEA_DEC_TEST_VECTORS | ||
| 3340 | } | ||
| 3341 | } | 2982 | } |
| 3342 | } | 2983 | } |
| 3343 | }, { | 2984 | }, { |
| @@ -3345,10 +2986,7 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3345 | .test = alg_test_kpp, | 2986 | .test = alg_test_kpp, |
| 3346 | .fips_allowed = 1, | 2987 | .fips_allowed = 1, |
| 3347 | .suite = { | 2988 | .suite = { |
| 3348 | .kpp = { | 2989 | .kpp = __VECS(ecdh_tv_template) |
| 3349 | .vecs = ecdh_tv_template, | ||
| 3350 | .count = ECDH_TEST_VECTORS | ||
| 3351 | } | ||
| 3352 | } | 2990 | } |
| 3353 | }, { | 2991 | }, { |
| 3354 | .alg = "gcm(aes)", | 2992 | .alg = "gcm(aes)", |
| @@ -3356,14 +2994,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3356 | .fips_allowed = 1, | 2994 | .fips_allowed = 1, |
| 3357 | .suite = { | 2995 | .suite = { |
| 3358 | .aead = { | 2996 | .aead = { |
| 3359 | .enc = { | 2997 | .enc = __VECS(aes_gcm_enc_tv_template), |
| 3360 | .vecs = aes_gcm_enc_tv_template, | 2998 | .dec = __VECS(aes_gcm_dec_tv_template) |
| 3361 | .count = AES_GCM_ENC_TEST_VECTORS | ||
| 3362 | }, | ||
| 3363 | .dec = { | ||
| 3364 | .vecs = aes_gcm_dec_tv_template, | ||
| 3365 | .count = AES_GCM_DEC_TEST_VECTORS | ||
| 3366 | } | ||
| 3367 | } | 2999 | } |
| 3368 | } | 3000 | } |
| 3369 | }, { | 3001 | }, { |
| @@ -3371,136 +3003,94 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3371 | .test = alg_test_hash, | 3003 | .test = alg_test_hash, |
| 3372 | .fips_allowed = 1, | 3004 | .fips_allowed = 1, |
| 3373 | .suite = { | 3005 | .suite = { |
| 3374 | .hash = { | 3006 | .hash = __VECS(ghash_tv_template) |
| 3375 | .vecs = ghash_tv_template, | ||
| 3376 | .count = GHASH_TEST_VECTORS | ||
| 3377 | } | ||
| 3378 | } | 3007 | } |
| 3379 | }, { | 3008 | }, { |
| 3380 | .alg = "hmac(crc32)", | 3009 | .alg = "hmac(crc32)", |
| 3381 | .test = alg_test_hash, | 3010 | .test = alg_test_hash, |
| 3382 | .suite = { | 3011 | .suite = { |
| 3383 | .hash = { | 3012 | .hash = __VECS(bfin_crc_tv_template) |
| 3384 | .vecs = bfin_crc_tv_template, | ||
| 3385 | .count = BFIN_CRC_TEST_VECTORS | ||
| 3386 | } | ||
| 3387 | } | 3013 | } |
| 3388 | }, { | 3014 | }, { |
| 3389 | .alg = "hmac(md5)", | 3015 | .alg = "hmac(md5)", |
| 3390 | .test = alg_test_hash, | 3016 | .test = alg_test_hash, |
| 3391 | .suite = { | 3017 | .suite = { |
| 3392 | .hash = { | 3018 | .hash = __VECS(hmac_md5_tv_template) |
| 3393 | .vecs = hmac_md5_tv_template, | ||
| 3394 | .count = HMAC_MD5_TEST_VECTORS | ||
| 3395 | } | ||
| 3396 | } | 3019 | } |
| 3397 | }, { | 3020 | }, { |
| 3398 | .alg = "hmac(rmd128)", | 3021 | .alg = "hmac(rmd128)", |
| 3399 | .test = alg_test_hash, | 3022 | .test = alg_test_hash, |
| 3400 | .suite = { | 3023 | .suite = { |
| 3401 | .hash = { | 3024 | .hash = __VECS(hmac_rmd128_tv_template) |
| 3402 | .vecs = hmac_rmd128_tv_template, | ||
| 3403 | .count = HMAC_RMD128_TEST_VECTORS | ||
| 3404 | } | ||
| 3405 | } | 3025 | } |
| 3406 | }, { | 3026 | }, { |
| 3407 | .alg = "hmac(rmd160)", | 3027 | .alg = "hmac(rmd160)", |
| 3408 | .test = alg_test_hash, | 3028 | .test = alg_test_hash, |
| 3409 | .suite = { | 3029 | .suite = { |
| 3410 | .hash = { | 3030 | .hash = __VECS(hmac_rmd160_tv_template) |
| 3411 | .vecs = hmac_rmd160_tv_template, | ||
| 3412 | .count = HMAC_RMD160_TEST_VECTORS | ||
| 3413 | } | ||
| 3414 | } | 3031 | } |
| 3415 | }, { | 3032 | }, { |
| 3416 | .alg = "hmac(sha1)", | 3033 | .alg = "hmac(sha1)", |
| 3417 | .test = alg_test_hash, | 3034 | .test = alg_test_hash, |
| 3418 | .fips_allowed = 1, | 3035 | .fips_allowed = 1, |
| 3419 | .suite = { | 3036 | .suite = { |
| 3420 | .hash = { | 3037 | .hash = __VECS(hmac_sha1_tv_template) |
| 3421 | .vecs = hmac_sha1_tv_template, | ||
| 3422 | .count = HMAC_SHA1_TEST_VECTORS | ||
| 3423 | } | ||
| 3424 | } | 3038 | } |
| 3425 | }, { | 3039 | }, { |
| 3426 | .alg = "hmac(sha224)", | 3040 | .alg = "hmac(sha224)", |
| 3427 | .test = alg_test_hash, | 3041 | .test = alg_test_hash, |
| 3428 | .fips_allowed = 1, | 3042 | .fips_allowed = 1, |
| 3429 | .suite = { | 3043 | .suite = { |
| 3430 | .hash = { | 3044 | .hash = __VECS(hmac_sha224_tv_template) |
| 3431 | .vecs = hmac_sha224_tv_template, | ||
| 3432 | .count = HMAC_SHA224_TEST_VECTORS | ||
| 3433 | } | ||
| 3434 | } | 3045 | } |
| 3435 | }, { | 3046 | }, { |
| 3436 | .alg = "hmac(sha256)", | 3047 | .alg = "hmac(sha256)", |
| 3437 | .test = alg_test_hash, | 3048 | .test = alg_test_hash, |
| 3438 | .fips_allowed = 1, | 3049 | .fips_allowed = 1, |
| 3439 | .suite = { | 3050 | .suite = { |
| 3440 | .hash = { | 3051 | .hash = __VECS(hmac_sha256_tv_template) |
| 3441 | .vecs = hmac_sha256_tv_template, | ||
| 3442 | .count = HMAC_SHA256_TEST_VECTORS | ||
| 3443 | } | ||
| 3444 | } | 3052 | } |
| 3445 | }, { | 3053 | }, { |
| 3446 | .alg = "hmac(sha3-224)", | 3054 | .alg = "hmac(sha3-224)", |
| 3447 | .test = alg_test_hash, | 3055 | .test = alg_test_hash, |
| 3448 | .fips_allowed = 1, | 3056 | .fips_allowed = 1, |
| 3449 | .suite = { | 3057 | .suite = { |
| 3450 | .hash = { | 3058 | .hash = __VECS(hmac_sha3_224_tv_template) |
| 3451 | .vecs = hmac_sha3_224_tv_template, | ||
| 3452 | .count = HMAC_SHA3_224_TEST_VECTORS | ||
| 3453 | } | ||
| 3454 | } | 3059 | } |
| 3455 | }, { | 3060 | }, { |
| 3456 | .alg = "hmac(sha3-256)", | 3061 | .alg = "hmac(sha3-256)", |
| 3457 | .test = alg_test_hash, | 3062 | .test = alg_test_hash, |
| 3458 | .fips_allowed = 1, | 3063 | .fips_allowed = 1, |
| 3459 | .suite = { | 3064 | .suite = { |
| 3460 | .hash = { | 3065 | .hash = __VECS(hmac_sha3_256_tv_template) |
| 3461 | .vecs = hmac_sha3_256_tv_template, | ||
| 3462 | .count = HMAC_SHA3_256_TEST_VECTORS | ||
| 3463 | } | ||
| 3464 | } | 3066 | } |
| 3465 | }, { | 3067 | }, { |
| 3466 | .alg = "hmac(sha3-384)", | 3068 | .alg = "hmac(sha3-384)", |
| 3467 | .test = alg_test_hash, | 3069 | .test = alg_test_hash, |
| 3468 | .fips_allowed = 1, | 3070 | .fips_allowed = 1, |
| 3469 | .suite = { | 3071 | .suite = { |
| 3470 | .hash = { | 3072 | .hash = __VECS(hmac_sha3_384_tv_template) |
| 3471 | .vecs = hmac_sha3_384_tv_template, | ||
| 3472 | .count = HMAC_SHA3_384_TEST_VECTORS | ||
| 3473 | } | ||
| 3474 | } | 3073 | } |
| 3475 | }, { | 3074 | }, { |
| 3476 | .alg = "hmac(sha3-512)", | 3075 | .alg = "hmac(sha3-512)", |
| 3477 | .test = alg_test_hash, | 3076 | .test = alg_test_hash, |
| 3478 | .fips_allowed = 1, | 3077 | .fips_allowed = 1, |
| 3479 | .suite = { | 3078 | .suite = { |
| 3480 | .hash = { | 3079 | .hash = __VECS(hmac_sha3_512_tv_template) |
| 3481 | .vecs = hmac_sha3_512_tv_template, | ||
| 3482 | .count = HMAC_SHA3_512_TEST_VECTORS | ||
| 3483 | } | ||
| 3484 | } | 3080 | } |
| 3485 | }, { | 3081 | }, { |
| 3486 | .alg = "hmac(sha384)", | 3082 | .alg = "hmac(sha384)", |
| 3487 | .test = alg_test_hash, | 3083 | .test = alg_test_hash, |
| 3488 | .fips_allowed = 1, | 3084 | .fips_allowed = 1, |
| 3489 | .suite = { | 3085 | .suite = { |
| 3490 | .hash = { | 3086 | .hash = __VECS(hmac_sha384_tv_template) |
| 3491 | .vecs = hmac_sha384_tv_template, | ||
| 3492 | .count = HMAC_SHA384_TEST_VECTORS | ||
| 3493 | } | ||
| 3494 | } | 3087 | } |
| 3495 | }, { | 3088 | }, { |
| 3496 | .alg = "hmac(sha512)", | 3089 | .alg = "hmac(sha512)", |
| 3497 | .test = alg_test_hash, | 3090 | .test = alg_test_hash, |
| 3498 | .fips_allowed = 1, | 3091 | .fips_allowed = 1, |
| 3499 | .suite = { | 3092 | .suite = { |
| 3500 | .hash = { | 3093 | .hash = __VECS(hmac_sha512_tv_template) |
| 3501 | .vecs = hmac_sha512_tv_template, | ||
| 3502 | .count = HMAC_SHA512_TEST_VECTORS | ||
| 3503 | } | ||
| 3504 | } | 3094 | } |
| 3505 | }, { | 3095 | }, { |
| 3506 | .alg = "jitterentropy_rng", | 3096 | .alg = "jitterentropy_rng", |
| @@ -3512,14 +3102,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3512 | .fips_allowed = 1, | 3102 | .fips_allowed = 1, |
| 3513 | .suite = { | 3103 | .suite = { |
| 3514 | .cipher = { | 3104 | .cipher = { |
| 3515 | .enc = { | 3105 | .enc = __VECS(aes_kw_enc_tv_template), |
| 3516 | .vecs = aes_kw_enc_tv_template, | 3106 | .dec = __VECS(aes_kw_dec_tv_template) |
| 3517 | .count = ARRAY_SIZE(aes_kw_enc_tv_template) | ||
| 3518 | }, | ||
| 3519 | .dec = { | ||
| 3520 | .vecs = aes_kw_dec_tv_template, | ||
| 3521 | .count = ARRAY_SIZE(aes_kw_dec_tv_template) | ||
| 3522 | } | ||
| 3523 | } | 3107 | } |
| 3524 | } | 3108 | } |
| 3525 | }, { | 3109 | }, { |
| @@ -3527,14 +3111,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3527 | .test = alg_test_skcipher, | 3111 | .test = alg_test_skcipher, |
| 3528 | .suite = { | 3112 | .suite = { |
| 3529 | .cipher = { | 3113 | .cipher = { |
| 3530 | .enc = { | 3114 | .enc = __VECS(aes_lrw_enc_tv_template), |
| 3531 | .vecs = aes_lrw_enc_tv_template, | 3115 | .dec = __VECS(aes_lrw_dec_tv_template) |
| 3532 | .count = AES_LRW_ENC_TEST_VECTORS | ||
| 3533 | }, | ||
| 3534 | .dec = { | ||
| 3535 | .vecs = aes_lrw_dec_tv_template, | ||
| 3536 | .count = AES_LRW_DEC_TEST_VECTORS | ||
| 3537 | } | ||
| 3538 | } | 3116 | } |
| 3539 | } | 3117 | } |
| 3540 | }, { | 3118 | }, { |
| @@ -3542,14 +3120,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3542 | .test = alg_test_skcipher, | 3120 | .test = alg_test_skcipher, |
| 3543 | .suite = { | 3121 | .suite = { |
| 3544 | .cipher = { | 3122 | .cipher = { |
| 3545 | .enc = { | 3123 | .enc = __VECS(camellia_lrw_enc_tv_template), |
| 3546 | .vecs = camellia_lrw_enc_tv_template, | 3124 | .dec = __VECS(camellia_lrw_dec_tv_template) |
| 3547 | .count = CAMELLIA_LRW_ENC_TEST_VECTORS | ||
| 3548 | }, | ||
| 3549 | .dec = { | ||
| 3550 | .vecs = camellia_lrw_dec_tv_template, | ||
| 3551 | .count = CAMELLIA_LRW_DEC_TEST_VECTORS | ||
| 3552 | } | ||
| 3553 | } | 3125 | } |
| 3554 | } | 3126 | } |
| 3555 | }, { | 3127 | }, { |
| @@ -3557,14 +3129,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3557 | .test = alg_test_skcipher, | 3129 | .test = alg_test_skcipher, |
| 3558 | .suite = { | 3130 | .suite = { |
| 3559 | .cipher = { | 3131 | .cipher = { |
| 3560 | .enc = { | 3132 | .enc = __VECS(cast6_lrw_enc_tv_template), |
| 3561 | .vecs = cast6_lrw_enc_tv_template, | 3133 | .dec = __VECS(cast6_lrw_dec_tv_template) |
| 3562 | .count = CAST6_LRW_ENC_TEST_VECTORS | ||
| 3563 | }, | ||
| 3564 | .dec = { | ||
| 3565 | .vecs = cast6_lrw_dec_tv_template, | ||
| 3566 | .count = CAST6_LRW_DEC_TEST_VECTORS | ||
| 3567 | } | ||
| 3568 | } | 3134 | } |
| 3569 | } | 3135 | } |
| 3570 | }, { | 3136 | }, { |
| @@ -3572,14 +3138,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3572 | .test = alg_test_skcipher, | 3138 | .test = alg_test_skcipher, |
| 3573 | .suite = { | 3139 | .suite = { |
| 3574 | .cipher = { | 3140 | .cipher = { |
| 3575 | .enc = { | 3141 | .enc = __VECS(serpent_lrw_enc_tv_template), |
| 3576 | .vecs = serpent_lrw_enc_tv_template, | 3142 | .dec = __VECS(serpent_lrw_dec_tv_template) |
| 3577 | .count = SERPENT_LRW_ENC_TEST_VECTORS | ||
| 3578 | }, | ||
| 3579 | .dec = { | ||
| 3580 | .vecs = serpent_lrw_dec_tv_template, | ||
| 3581 | .count = SERPENT_LRW_DEC_TEST_VECTORS | ||
| 3582 | } | ||
| 3583 | } | 3143 | } |
| 3584 | } | 3144 | } |
| 3585 | }, { | 3145 | }, { |
| @@ -3587,14 +3147,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3587 | .test = alg_test_skcipher, | 3147 | .test = alg_test_skcipher, |
| 3588 | .suite = { | 3148 | .suite = { |
| 3589 | .cipher = { | 3149 | .cipher = { |
| 3590 | .enc = { | 3150 | .enc = __VECS(tf_lrw_enc_tv_template), |
| 3591 | .vecs = tf_lrw_enc_tv_template, | 3151 | .dec = __VECS(tf_lrw_dec_tv_template) |
| 3592 | .count = TF_LRW_ENC_TEST_VECTORS | ||
| 3593 | }, | ||
| 3594 | .dec = { | ||
| 3595 | .vecs = tf_lrw_dec_tv_template, | ||
| 3596 | .count = TF_LRW_DEC_TEST_VECTORS | ||
| 3597 | } | ||
| 3598 | } | 3152 | } |
| 3599 | } | 3153 | } |
| 3600 | }, { | 3154 | }, { |
| @@ -3603,14 +3157,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3603 | .fips_allowed = 1, | 3157 | .fips_allowed = 1, |
| 3604 | .suite = { | 3158 | .suite = { |
| 3605 | .comp = { | 3159 | .comp = { |
| 3606 | .comp = { | 3160 | .comp = __VECS(lz4_comp_tv_template), |
| 3607 | .vecs = lz4_comp_tv_template, | 3161 | .decomp = __VECS(lz4_decomp_tv_template) |
| 3608 | .count = LZ4_COMP_TEST_VECTORS | ||
| 3609 | }, | ||
| 3610 | .decomp = { | ||
| 3611 | .vecs = lz4_decomp_tv_template, | ||
| 3612 | .count = LZ4_DECOMP_TEST_VECTORS | ||
| 3613 | } | ||
| 3614 | } | 3162 | } |
| 3615 | } | 3163 | } |
| 3616 | }, { | 3164 | }, { |
| @@ -3619,14 +3167,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3619 | .fips_allowed = 1, | 3167 | .fips_allowed = 1, |
| 3620 | .suite = { | 3168 | .suite = { |
| 3621 | .comp = { | 3169 | .comp = { |
| 3622 | .comp = { | 3170 | .comp = __VECS(lz4hc_comp_tv_template), |
| 3623 | .vecs = lz4hc_comp_tv_template, | 3171 | .decomp = __VECS(lz4hc_decomp_tv_template) |
| 3624 | .count = LZ4HC_COMP_TEST_VECTORS | ||
| 3625 | }, | ||
| 3626 | .decomp = { | ||
| 3627 | .vecs = lz4hc_decomp_tv_template, | ||
| 3628 | .count = LZ4HC_DECOMP_TEST_VECTORS | ||
| 3629 | } | ||
| 3630 | } | 3172 | } |
| 3631 | } | 3173 | } |
| 3632 | }, { | 3174 | }, { |
| @@ -3635,42 +3177,27 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3635 | .fips_allowed = 1, | 3177 | .fips_allowed = 1, |
| 3636 | .suite = { | 3178 | .suite = { |
| 3637 | .comp = { | 3179 | .comp = { |
| 3638 | .comp = { | 3180 | .comp = __VECS(lzo_comp_tv_template), |
| 3639 | .vecs = lzo_comp_tv_template, | 3181 | .decomp = __VECS(lzo_decomp_tv_template) |
| 3640 | .count = LZO_COMP_TEST_VECTORS | ||
| 3641 | }, | ||
| 3642 | .decomp = { | ||
| 3643 | .vecs = lzo_decomp_tv_template, | ||
| 3644 | .count = LZO_DECOMP_TEST_VECTORS | ||
| 3645 | } | ||
| 3646 | } | 3182 | } |
| 3647 | } | 3183 | } |
| 3648 | }, { | 3184 | }, { |
| 3649 | .alg = "md4", | 3185 | .alg = "md4", |
| 3650 | .test = alg_test_hash, | 3186 | .test = alg_test_hash, |
| 3651 | .suite = { | 3187 | .suite = { |
| 3652 | .hash = { | 3188 | .hash = __VECS(md4_tv_template) |
| 3653 | .vecs = md4_tv_template, | ||
| 3654 | .count = MD4_TEST_VECTORS | ||
| 3655 | } | ||
| 3656 | } | 3189 | } |
| 3657 | }, { | 3190 | }, { |
| 3658 | .alg = "md5", | 3191 | .alg = "md5", |
| 3659 | .test = alg_test_hash, | 3192 | .test = alg_test_hash, |
| 3660 | .suite = { | 3193 | .suite = { |
| 3661 | .hash = { | 3194 | .hash = __VECS(md5_tv_template) |
| 3662 | .vecs = md5_tv_template, | ||
| 3663 | .count = MD5_TEST_VECTORS | ||
| 3664 | } | ||
| 3665 | } | 3195 | } |
| 3666 | }, { | 3196 | }, { |
| 3667 | .alg = "michael_mic", | 3197 | .alg = "michael_mic", |
| 3668 | .test = alg_test_hash, | 3198 | .test = alg_test_hash, |
| 3669 | .suite = { | 3199 | .suite = { |
| 3670 | .hash = { | 3200 | .hash = __VECS(michael_mic_tv_template) |
| 3671 | .vecs = michael_mic_tv_template, | ||
| 3672 | .count = MICHAEL_MIC_TEST_VECTORS | ||
| 3673 | } | ||
| 3674 | } | 3201 | } |
| 3675 | }, { | 3202 | }, { |
| 3676 | .alg = "ofb(aes)", | 3203 | .alg = "ofb(aes)", |
| @@ -3678,14 +3205,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3678 | .fips_allowed = 1, | 3205 | .fips_allowed = 1, |
| 3679 | .suite = { | 3206 | .suite = { |
| 3680 | .cipher = { | 3207 | .cipher = { |
| 3681 | .enc = { | 3208 | .enc = __VECS(aes_ofb_enc_tv_template), |
| 3682 | .vecs = aes_ofb_enc_tv_template, | 3209 | .dec = __VECS(aes_ofb_dec_tv_template) |
| 3683 | .count = AES_OFB_ENC_TEST_VECTORS | ||
| 3684 | }, | ||
| 3685 | .dec = { | ||
| 3686 | .vecs = aes_ofb_dec_tv_template, | ||
| 3687 | .count = AES_OFB_DEC_TEST_VECTORS | ||
| 3688 | } | ||
| 3689 | } | 3210 | } |
| 3690 | } | 3211 | } |
| 3691 | }, { | 3212 | }, { |
| @@ -3693,24 +3214,15 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3693 | .test = alg_test_skcipher, | 3214 | .test = alg_test_skcipher, |
| 3694 | .suite = { | 3215 | .suite = { |
| 3695 | .cipher = { | 3216 | .cipher = { |
| 3696 | .enc = { | 3217 | .enc = __VECS(fcrypt_pcbc_enc_tv_template), |
| 3697 | .vecs = fcrypt_pcbc_enc_tv_template, | 3218 | .dec = __VECS(fcrypt_pcbc_dec_tv_template) |
| 3698 | .count = FCRYPT_ENC_TEST_VECTORS | ||
| 3699 | }, | ||
| 3700 | .dec = { | ||
| 3701 | .vecs = fcrypt_pcbc_dec_tv_template, | ||
| 3702 | .count = FCRYPT_DEC_TEST_VECTORS | ||
| 3703 | } | ||
| 3704 | } | 3219 | } |
| 3705 | } | 3220 | } |
| 3706 | }, { | 3221 | }, { |
| 3707 | .alg = "poly1305", | 3222 | .alg = "poly1305", |
| 3708 | .test = alg_test_hash, | 3223 | .test = alg_test_hash, |
| 3709 | .suite = { | 3224 | .suite = { |
| 3710 | .hash = { | 3225 | .hash = __VECS(poly1305_tv_template) |
| 3711 | .vecs = poly1305_tv_template, | ||
| 3712 | .count = POLY1305_TEST_VECTORS | ||
| 3713 | } | ||
| 3714 | } | 3226 | } |
| 3715 | }, { | 3227 | }, { |
| 3716 | .alg = "rfc3686(ctr(aes))", | 3228 | .alg = "rfc3686(ctr(aes))", |
| @@ -3718,14 +3230,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3718 | .fips_allowed = 1, | 3230 | .fips_allowed = 1, |
| 3719 | .suite = { | 3231 | .suite = { |
| 3720 | .cipher = { | 3232 | .cipher = { |
| 3721 | .enc = { | 3233 | .enc = __VECS(aes_ctr_rfc3686_enc_tv_template), |
| 3722 | .vecs = aes_ctr_rfc3686_enc_tv_template, | 3234 | .dec = __VECS(aes_ctr_rfc3686_dec_tv_template) |
| 3723 | .count = AES_CTR_3686_ENC_TEST_VECTORS | ||
| 3724 | }, | ||
| 3725 | .dec = { | ||
| 3726 | .vecs = aes_ctr_rfc3686_dec_tv_template, | ||
| 3727 | .count = AES_CTR_3686_DEC_TEST_VECTORS | ||
| 3728 | } | ||
| 3729 | } | 3235 | } |
| 3730 | } | 3236 | } |
| 3731 | }, { | 3237 | }, { |
| @@ -3734,14 +3240,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3734 | .fips_allowed = 1, | 3240 | .fips_allowed = 1, |
| 3735 | .suite = { | 3241 | .suite = { |
| 3736 | .aead = { | 3242 | .aead = { |
| 3737 | .enc = { | 3243 | .enc = __VECS(aes_gcm_rfc4106_enc_tv_template), |
| 3738 | .vecs = aes_gcm_rfc4106_enc_tv_template, | 3244 | .dec = __VECS(aes_gcm_rfc4106_dec_tv_template) |
| 3739 | .count = AES_GCM_4106_ENC_TEST_VECTORS | ||
| 3740 | }, | ||
| 3741 | .dec = { | ||
| 3742 | .vecs = aes_gcm_rfc4106_dec_tv_template, | ||
| 3743 | .count = AES_GCM_4106_DEC_TEST_VECTORS | ||
| 3744 | } | ||
| 3745 | } | 3245 | } |
| 3746 | } | 3246 | } |
| 3747 | }, { | 3247 | }, { |
| @@ -3750,14 +3250,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3750 | .fips_allowed = 1, | 3250 | .fips_allowed = 1, |
| 3751 | .suite = { | 3251 | .suite = { |
| 3752 | .aead = { | 3252 | .aead = { |
| 3753 | .enc = { | 3253 | .enc = __VECS(aes_ccm_rfc4309_enc_tv_template), |
| 3754 | .vecs = aes_ccm_rfc4309_enc_tv_template, | 3254 | .dec = __VECS(aes_ccm_rfc4309_dec_tv_template) |
| 3755 | .count = AES_CCM_4309_ENC_TEST_VECTORS | ||
| 3756 | }, | ||
| 3757 | .dec = { | ||
| 3758 | .vecs = aes_ccm_rfc4309_dec_tv_template, | ||
| 3759 | .count = AES_CCM_4309_DEC_TEST_VECTORS | ||
| 3760 | } | ||
| 3761 | } | 3255 | } |
| 3762 | } | 3256 | } |
| 3763 | }, { | 3257 | }, { |
| @@ -3765,14 +3259,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3765 | .test = alg_test_aead, | 3259 | .test = alg_test_aead, |
| 3766 | .suite = { | 3260 | .suite = { |
| 3767 | .aead = { | 3261 | .aead = { |
| 3768 | .enc = { | 3262 | .enc = __VECS(aes_gcm_rfc4543_enc_tv_template), |
| 3769 | .vecs = aes_gcm_rfc4543_enc_tv_template, | 3263 | .dec = __VECS(aes_gcm_rfc4543_dec_tv_template), |
| 3770 | .count = AES_GCM_4543_ENC_TEST_VECTORS | ||
| 3771 | }, | ||
| 3772 | .dec = { | ||
| 3773 | .vecs = aes_gcm_rfc4543_dec_tv_template, | ||
| 3774 | .count = AES_GCM_4543_DEC_TEST_VECTORS | ||
| 3775 | }, | ||
| 3776 | } | 3264 | } |
| 3777 | } | 3265 | } |
| 3778 | }, { | 3266 | }, { |
| @@ -3780,14 +3268,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3780 | .test = alg_test_aead, | 3268 | .test = alg_test_aead, |
| 3781 | .suite = { | 3269 | .suite = { |
| 3782 | .aead = { | 3270 | .aead = { |
| 3783 | .enc = { | 3271 | .enc = __VECS(rfc7539_enc_tv_template), |
| 3784 | .vecs = rfc7539_enc_tv_template, | 3272 | .dec = __VECS(rfc7539_dec_tv_template), |
| 3785 | .count = RFC7539_ENC_TEST_VECTORS | ||
| 3786 | }, | ||
| 3787 | .dec = { | ||
| 3788 | .vecs = rfc7539_dec_tv_template, | ||
| 3789 | .count = RFC7539_DEC_TEST_VECTORS | ||
| 3790 | }, | ||
| 3791 | } | 3273 | } |
| 3792 | } | 3274 | } |
| 3793 | }, { | 3275 | }, { |
| @@ -3795,71 +3277,47 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3795 | .test = alg_test_aead, | 3277 | .test = alg_test_aead, |
| 3796 | .suite = { | 3278 | .suite = { |
| 3797 | .aead = { | 3279 | .aead = { |
| 3798 | .enc = { | 3280 | .enc = __VECS(rfc7539esp_enc_tv_template), |
| 3799 | .vecs = rfc7539esp_enc_tv_template, | 3281 | .dec = __VECS(rfc7539esp_dec_tv_template), |
| 3800 | .count = RFC7539ESP_ENC_TEST_VECTORS | ||
| 3801 | }, | ||
| 3802 | .dec = { | ||
| 3803 | .vecs = rfc7539esp_dec_tv_template, | ||
| 3804 | .count = RFC7539ESP_DEC_TEST_VECTORS | ||
| 3805 | }, | ||
| 3806 | } | 3282 | } |
| 3807 | } | 3283 | } |
| 3808 | }, { | 3284 | }, { |
| 3809 | .alg = "rmd128", | 3285 | .alg = "rmd128", |
| 3810 | .test = alg_test_hash, | 3286 | .test = alg_test_hash, |
| 3811 | .suite = { | 3287 | .suite = { |
| 3812 | .hash = { | 3288 | .hash = __VECS(rmd128_tv_template) |
| 3813 | .vecs = rmd128_tv_template, | ||
| 3814 | .count = RMD128_TEST_VECTORS | ||
| 3815 | } | ||
| 3816 | } | 3289 | } |
| 3817 | }, { | 3290 | }, { |
| 3818 | .alg = "rmd160", | 3291 | .alg = "rmd160", |
| 3819 | .test = alg_test_hash, | 3292 | .test = alg_test_hash, |
| 3820 | .suite = { | 3293 | .suite = { |
| 3821 | .hash = { | 3294 | .hash = __VECS(rmd160_tv_template) |
| 3822 | .vecs = rmd160_tv_template, | ||
| 3823 | .count = RMD160_TEST_VECTORS | ||
| 3824 | } | ||
| 3825 | } | 3295 | } |
| 3826 | }, { | 3296 | }, { |
| 3827 | .alg = "rmd256", | 3297 | .alg = "rmd256", |
| 3828 | .test = alg_test_hash, | 3298 | .test = alg_test_hash, |
| 3829 | .suite = { | 3299 | .suite = { |
| 3830 | .hash = { | 3300 | .hash = __VECS(rmd256_tv_template) |
| 3831 | .vecs = rmd256_tv_template, | ||
| 3832 | .count = RMD256_TEST_VECTORS | ||
| 3833 | } | ||
| 3834 | } | 3301 | } |
| 3835 | }, { | 3302 | }, { |
| 3836 | .alg = "rmd320", | 3303 | .alg = "rmd320", |
| 3837 | .test = alg_test_hash, | 3304 | .test = alg_test_hash, |
| 3838 | .suite = { | 3305 | .suite = { |
| 3839 | .hash = { | 3306 | .hash = __VECS(rmd320_tv_template) |
| 3840 | .vecs = rmd320_tv_template, | ||
| 3841 | .count = RMD320_TEST_VECTORS | ||
| 3842 | } | ||
| 3843 | } | 3307 | } |
| 3844 | }, { | 3308 | }, { |
| 3845 | .alg = "rsa", | 3309 | .alg = "rsa", |
| 3846 | .test = alg_test_akcipher, | 3310 | .test = alg_test_akcipher, |
| 3847 | .fips_allowed = 1, | 3311 | .fips_allowed = 1, |
| 3848 | .suite = { | 3312 | .suite = { |
| 3849 | .akcipher = { | 3313 | .akcipher = __VECS(rsa_tv_template) |
| 3850 | .vecs = rsa_tv_template, | ||
| 3851 | .count = RSA_TEST_VECTORS | ||
| 3852 | } | ||
| 3853 | } | 3314 | } |
| 3854 | }, { | 3315 | }, { |
| 3855 | .alg = "salsa20", | 3316 | .alg = "salsa20", |
| 3856 | .test = alg_test_skcipher, | 3317 | .test = alg_test_skcipher, |
| 3857 | .suite = { | 3318 | .suite = { |
| 3858 | .cipher = { | 3319 | .cipher = { |
| 3859 | .enc = { | 3320 | .enc = __VECS(salsa20_stream_enc_tv_template) |
| 3860 | .vecs = salsa20_stream_enc_tv_template, | ||
| 3861 | .count = SALSA20_STREAM_ENC_TEST_VECTORS | ||
| 3862 | } | ||
| 3863 | } | 3321 | } |
| 3864 | } | 3322 | } |
| 3865 | }, { | 3323 | }, { |
| @@ -3867,162 +3325,111 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 3867 | .test = alg_test_hash, | 3325 | .test = alg_test_hash, |
| 3868 | .fips_allowed = 1, | 3326 | .fips_allowed = 1, |
| 3869 | .suite = { | 3327 | .suite = { |
| 3870 | .hash = { | 3328 | .hash = __VECS(sha1_tv_template) |
| 3871 | .vecs = sha1_tv_template, | ||
| 3872 | .count = SHA1_TEST_VECTORS | ||
| 3873 | } | ||
| 3874 | } | 3329 | } |
| 3875 | }, { | 3330 | }, { |
| 3876 | .alg = "sha224", | 3331 | .alg = "sha224", |
| 3877 | .test = alg_test_hash, | 3332 | .test = alg_test_hash, |
| 3878 | .fips_allowed = 1, | 3333 | .fips_allowed = 1, |
| 3879 | .suite = { | 3334 | .suite = { |
| 3880 | .hash = { | 3335 | .hash = __VECS(sha224_tv_template) |
| 3881 | .vecs = sha224_tv_template, | ||
| 3882 | .count = SHA224_TEST_VECTORS | ||
| 3883 | } | ||
| 3884 | } | 3336 | } |
| 3885 | }, { | 3337 | }, { |
| 3886 | .alg = "sha256", | 3338 | .alg = "sha256", |
| 3887 | .test = alg_test_hash, | 3339 | .test = alg_test_hash, |
| 3888 | .fips_allowed = 1, | 3340 | .fips_allowed = 1, |
| 3889 | .suite = { | 3341 | .suite = { |
| 3890 | .hash = { | 3342 | .hash = __VECS(sha256_tv_template) |
| 3891 | .vecs = sha256_tv_template, | ||
| 3892 | .count = SHA256_TEST_VECTORS | ||
| 3893 | } | ||
| 3894 | } | 3343 | } |
| 3895 | }, { | 3344 | }, { |
| 3896 | .alg = "sha3-224", | 3345 | .alg = "sha3-224", |
| 3897 | .test = alg_test_hash, | 3346 | .test = alg_test_hash, |
| 3898 | .fips_allowed = 1, | 3347 | .fips_allowed = 1, |
| 3899 | .suite = { | 3348 | .suite = { |
| 3900 | .hash = { | 3349 | .hash = __VECS(sha3_224_tv_template) |
| 3901 | .vecs = sha3_224_tv_template, | ||
| 3902 | .count = SHA3_224_TEST_VECTORS | ||
| 3903 | } | ||
| 3904 | } | 3350 | } |
| 3905 | }, { | 3351 | }, { |
| 3906 | .alg = "sha3-256", | 3352 | .alg = "sha3-256", |
| 3907 | .test = alg_test_hash, | 3353 | .test = alg_test_hash, |
| 3908 | .fips_allowed = 1, | 3354 | .fips_allowed = 1, |
| 3909 | .suite = { | 3355 | .suite = { |
| 3910 | .hash = { | 3356 | .hash = __VECS(sha3_256_tv_template) |
| 3911 | .vecs = sha3_256_tv_template, | ||
| 3912 | .count = SHA3_256_TEST_VECTORS | ||
| 3913 | } | ||
| 3914 | } | 3357 | } |
| 3915 | }, { | 3358 | }, { |
| 3916 | .alg = "sha3-384", | 3359 | .alg = "sha3-384", |
| 3917 | .test = alg_test_hash, | 3360 | .test = alg_test_hash, |
| 3918 | .fips_allowed = 1, | 3361 | .fips_allowed = 1, |
| 3919 | .suite = { | 3362 | .suite = { |
| 3920 | .hash = { | 3363 | .hash = __VECS(sha3_384_tv_template) |
| 3921 | .vecs = sha3_384_tv_template, | ||
| 3922 | .count = SHA3_384_TEST_VECTORS | ||
| 3923 | } | ||
| 3924 | } | 3364 | } |
| 3925 | }, { | 3365 | }, { |
| 3926 | .alg = "sha3-512", | 3366 | .alg = "sha3-512", |
| 3927 | .test = alg_test_hash, | 3367 | .test = alg_test_hash, |
| 3928 | .fips_allowed = 1, | 3368 | .fips_allowed = 1, |
| 3929 | .suite = { | 3369 | .suite = { |
| 3930 | .hash = { | 3370 | .hash = __VECS(sha3_512_tv_template) |
| 3931 | .vecs = sha3_512_tv_template, | ||
| 3932 | .count = SHA3_512_TEST_VECTORS | ||
| 3933 | } | ||
| 3934 | } | 3371 | } |
| 3935 | }, { | 3372 | }, { |
| 3936 | .alg = "sha384", | 3373 | .alg = "sha384", |
| 3937 | .test = alg_test_hash, | 3374 | .test = alg_test_hash, |
| 3938 | .fips_allowed = 1, | 3375 | .fips_allowed = 1, |
| 3939 | .suite = { | 3376 | .suite = { |
| 3940 | .hash = { | 3377 | .hash = __VECS(sha384_tv_template) |
| 3941 | .vecs = sha384_tv_template, | ||
| 3942 | .count = SHA384_TEST_VECTORS | ||
| 3943 | } | ||
| 3944 | } | 3378 | } |
| 3945 | }, { | 3379 | }, { |
| 3946 | .alg = "sha512", | 3380 | .alg = "sha512", |
| 3947 | .test = alg_test_hash, | 3381 | .test = alg_test_hash, |
| 3948 | .fips_allowed = 1, | 3382 | .fips_allowed = 1, |
| 3949 | .suite = { | 3383 | .suite = { |
| 3950 | .hash = { | 3384 | .hash = __VECS(sha512_tv_template) |
| 3951 | .vecs = sha512_tv_template, | ||
| 3952 | .count = SHA512_TEST_VECTORS | ||
| 3953 | } | ||
| 3954 | } | 3385 | } |
| 3955 | }, { | 3386 | }, { |
| 3956 | .alg = "tgr128", | 3387 | .alg = "tgr128", |
| 3957 | .test = alg_test_hash, | 3388 | .test = alg_test_hash, |
| 3958 | .suite = { | 3389 | .suite = { |
| 3959 | .hash = { | 3390 | .hash = __VECS(tgr128_tv_template) |
| 3960 | .vecs = tgr128_tv_template, | ||
| 3961 | .count = TGR128_TEST_VECTORS | ||
| 3962 | } | ||
| 3963 | } | 3391 | } |
| 3964 | }, { | 3392 | }, { |
| 3965 | .alg = "tgr160", | 3393 | .alg = "tgr160", |
| 3966 | .test = alg_test_hash, | 3394 | .test = alg_test_hash, |
| 3967 | .suite = { | 3395 | .suite = { |
| 3968 | .hash = { | 3396 | .hash = __VECS(tgr160_tv_template) |
| 3969 | .vecs = tgr160_tv_template, | ||
| 3970 | .count = TGR160_TEST_VECTORS | ||
| 3971 | } | ||
| 3972 | } | 3397 | } |
| 3973 | }, { | 3398 | }, { |
| 3974 | .alg = "tgr192", | 3399 | .alg = "tgr192", |
| 3975 | .test = alg_test_hash, | 3400 | .test = alg_test_hash, |
| 3976 | .suite = { | 3401 | .suite = { |
| 3977 | .hash = { | 3402 | .hash = __VECS(tgr192_tv_template) |
| 3978 | .vecs = tgr192_tv_template, | ||
| 3979 | .count = TGR192_TEST_VECTORS | ||
| 3980 | } | ||
| 3981 | } | 3403 | } |
| 3982 | }, { | 3404 | }, { |
| 3983 | .alg = "vmac(aes)", | 3405 | .alg = "vmac(aes)", |
| 3984 | .test = alg_test_hash, | 3406 | .test = alg_test_hash, |
| 3985 | .suite = { | 3407 | .suite = { |
| 3986 | .hash = { | 3408 | .hash = __VECS(aes_vmac128_tv_template) |
| 3987 | .vecs = aes_vmac128_tv_template, | ||
| 3988 | .count = VMAC_AES_TEST_VECTORS | ||
| 3989 | } | ||
| 3990 | } | 3409 | } |
| 3991 | }, { | 3410 | }, { |
| 3992 | .alg = "wp256", | 3411 | .alg = "wp256", |
| 3993 | .test = alg_test_hash, | 3412 | .test = alg_test_hash, |
| 3994 | .suite = { | 3413 | .suite = { |
| 3995 | .hash = { | 3414 | .hash = __VECS(wp256_tv_template) |
| 3996 | .vecs = wp256_tv_template, | ||
| 3997 | .count = WP256_TEST_VECTORS | ||
| 3998 | } | ||
| 3999 | } | 3415 | } |
| 4000 | }, { | 3416 | }, { |
| 4001 | .alg = "wp384", | 3417 | .alg = "wp384", |
| 4002 | .test = alg_test_hash, | 3418 | .test = alg_test_hash, |
| 4003 | .suite = { | 3419 | .suite = { |
| 4004 | .hash = { | 3420 | .hash = __VECS(wp384_tv_template) |
| 4005 | .vecs = wp384_tv_template, | ||
| 4006 | .count = WP384_TEST_VECTORS | ||
| 4007 | } | ||
| 4008 | } | 3421 | } |
| 4009 | }, { | 3422 | }, { |
| 4010 | .alg = "wp512", | 3423 | .alg = "wp512", |
| 4011 | .test = alg_test_hash, | 3424 | .test = alg_test_hash, |
| 4012 | .suite = { | 3425 | .suite = { |
| 4013 | .hash = { | 3426 | .hash = __VECS(wp512_tv_template) |
| 4014 | .vecs = wp512_tv_template, | ||
| 4015 | .count = WP512_TEST_VECTORS | ||
| 4016 | } | ||
| 4017 | } | 3427 | } |
| 4018 | }, { | 3428 | }, { |
| 4019 | .alg = "xcbc(aes)", | 3429 | .alg = "xcbc(aes)", |
| 4020 | .test = alg_test_hash, | 3430 | .test = alg_test_hash, |
| 4021 | .suite = { | 3431 | .suite = { |
| 4022 | .hash = { | 3432 | .hash = __VECS(aes_xcbc128_tv_template) |
| 4023 | .vecs = aes_xcbc128_tv_template, | ||
| 4024 | .count = XCBC_AES_TEST_VECTORS | ||
| 4025 | } | ||
| 4026 | } | 3433 | } |
| 4027 | }, { | 3434 | }, { |
| 4028 | .alg = "xts(aes)", | 3435 | .alg = "xts(aes)", |
| @@ -4030,14 +3437,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 4030 | .fips_allowed = 1, | 3437 | .fips_allowed = 1, |
| 4031 | .suite = { | 3438 | .suite = { |
| 4032 | .cipher = { | 3439 | .cipher = { |
| 4033 | .enc = { | 3440 | .enc = __VECS(aes_xts_enc_tv_template), |
| 4034 | .vecs = aes_xts_enc_tv_template, | 3441 | .dec = __VECS(aes_xts_dec_tv_template) |
| 4035 | .count = AES_XTS_ENC_TEST_VECTORS | ||
| 4036 | }, | ||
| 4037 | .dec = { | ||
| 4038 | .vecs = aes_xts_dec_tv_template, | ||
| 4039 | .count = AES_XTS_DEC_TEST_VECTORS | ||
| 4040 | } | ||
| 4041 | } | 3442 | } |
| 4042 | } | 3443 | } |
| 4043 | }, { | 3444 | }, { |
| @@ -4045,14 +3446,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 4045 | .test = alg_test_skcipher, | 3446 | .test = alg_test_skcipher, |
| 4046 | .suite = { | 3447 | .suite = { |
| 4047 | .cipher = { | 3448 | .cipher = { |
| 4048 | .enc = { | 3449 | .enc = __VECS(camellia_xts_enc_tv_template), |
| 4049 | .vecs = camellia_xts_enc_tv_template, | 3450 | .dec = __VECS(camellia_xts_dec_tv_template) |
| 4050 | .count = CAMELLIA_XTS_ENC_TEST_VECTORS | ||
| 4051 | }, | ||
| 4052 | .dec = { | ||
| 4053 | .vecs = camellia_xts_dec_tv_template, | ||
| 4054 | .count = CAMELLIA_XTS_DEC_TEST_VECTORS | ||
| 4055 | } | ||
| 4056 | } | 3451 | } |
| 4057 | } | 3452 | } |
| 4058 | }, { | 3453 | }, { |
| @@ -4060,14 +3455,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 4060 | .test = alg_test_skcipher, | 3455 | .test = alg_test_skcipher, |
| 4061 | .suite = { | 3456 | .suite = { |
| 4062 | .cipher = { | 3457 | .cipher = { |
| 4063 | .enc = { | 3458 | .enc = __VECS(cast6_xts_enc_tv_template), |
| 4064 | .vecs = cast6_xts_enc_tv_template, | 3459 | .dec = __VECS(cast6_xts_dec_tv_template) |
| 4065 | .count = CAST6_XTS_ENC_TEST_VECTORS | ||
| 4066 | }, | ||
| 4067 | .dec = { | ||
| 4068 | .vecs = cast6_xts_dec_tv_template, | ||
| 4069 | .count = CAST6_XTS_DEC_TEST_VECTORS | ||
| 4070 | } | ||
| 4071 | } | 3460 | } |
| 4072 | } | 3461 | } |
| 4073 | }, { | 3462 | }, { |
| @@ -4075,14 +3464,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 4075 | .test = alg_test_skcipher, | 3464 | .test = alg_test_skcipher, |
| 4076 | .suite = { | 3465 | .suite = { |
| 4077 | .cipher = { | 3466 | .cipher = { |
| 4078 | .enc = { | 3467 | .enc = __VECS(serpent_xts_enc_tv_template), |
| 4079 | .vecs = serpent_xts_enc_tv_template, | 3468 | .dec = __VECS(serpent_xts_dec_tv_template) |
| 4080 | .count = SERPENT_XTS_ENC_TEST_VECTORS | ||
| 4081 | }, | ||
| 4082 | .dec = { | ||
| 4083 | .vecs = serpent_xts_dec_tv_template, | ||
| 4084 | .count = SERPENT_XTS_DEC_TEST_VECTORS | ||
| 4085 | } | ||
| 4086 | } | 3469 | } |
| 4087 | } | 3470 | } |
| 4088 | }, { | 3471 | }, { |
| @@ -4090,14 +3473,8 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
| 4090 | .test = alg_test_skcipher, | 3473 | .test = alg_test_skcipher, |
| 4091 | .suite = { | 3474 | .suite = { |
| 4092 | .cipher = { | 3475 | .cipher = { |
| 4093 | .enc = { | 3476 | .enc = __VECS(tf_xts_enc_tv_template), |
| 4094 | .vecs = tf_xts_enc_tv_template, | 3477 | .dec = __VECS(tf_xts_dec_tv_template) |
| 4095 | .count = TF_XTS_ENC_TEST_VECTORS | ||
| 4096 | }, | ||
| 4097 | .dec = { | ||
| 4098 | .vecs = tf_xts_dec_tv_template, | ||
| 4099 | .count = TF_XTS_DEC_TEST_VECTORS | ||
| 4100 | } | ||
| 4101 | } | 3478 | } |
| 4102 | } | 3479 | } |
| 4103 | } | 3480 | } |
diff --git a/crypto/testmgr.h b/crypto/testmgr.h index 9b656be7f52f..03f473116f78 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h | |||
| @@ -151,11 +151,6 @@ static char zeroed_string[48]; | |||
| 151 | /* | 151 | /* |
| 152 | * RSA test vectors. Borrowed from openSSL. | 152 | * RSA test vectors. Borrowed from openSSL. |
| 153 | */ | 153 | */ |
| 154 | #ifdef CONFIG_CRYPTO_FIPS | ||
| 155 | #define RSA_TEST_VECTORS 2 | ||
| 156 | #else | ||
| 157 | #define RSA_TEST_VECTORS 5 | ||
| 158 | #endif | ||
| 159 | static struct akcipher_testvec rsa_tv_template[] = { | 154 | static struct akcipher_testvec rsa_tv_template[] = { |
| 160 | { | 155 | { |
| 161 | #ifndef CONFIG_CRYPTO_FIPS | 156 | #ifndef CONFIG_CRYPTO_FIPS |
| @@ -340,6 +335,7 @@ static struct akcipher_testvec rsa_tv_template[] = { | |||
| 340 | .m_size = 8, | 335 | .m_size = 8, |
| 341 | .c_size = 256, | 336 | .c_size = 256, |
| 342 | .public_key_vec = true, | 337 | .public_key_vec = true, |
| 338 | #ifndef CONFIG_CRYPTO_FIPS | ||
| 343 | }, { | 339 | }, { |
| 344 | .key = | 340 | .key = |
| 345 | "\x30\x82\x09\x29" /* sequence of 2345 bytes */ | 341 | "\x30\x82\x09\x29" /* sequence of 2345 bytes */ |
| @@ -538,11 +534,10 @@ static struct akcipher_testvec rsa_tv_template[] = { | |||
| 538 | .key_len = 2349, | 534 | .key_len = 2349, |
| 539 | .m_size = 8, | 535 | .m_size = 8, |
| 540 | .c_size = 512, | 536 | .c_size = 512, |
| 537 | #endif | ||
| 541 | } | 538 | } |
| 542 | }; | 539 | }; |
| 543 | 540 | ||
| 544 | #define DH_TEST_VECTORS 2 | ||
| 545 | |||
| 546 | struct kpp_testvec dh_tv_template[] = { | 541 | struct kpp_testvec dh_tv_template[] = { |
| 547 | { | 542 | { |
| 548 | .secret = | 543 | .secret = |
| @@ -760,11 +755,6 @@ struct kpp_testvec dh_tv_template[] = { | |||
| 760 | } | 755 | } |
| 761 | }; | 756 | }; |
| 762 | 757 | ||
| 763 | #ifdef CONFIG_CRYPTO_FIPS | ||
| 764 | #define ECDH_TEST_VECTORS 1 | ||
| 765 | #else | ||
| 766 | #define ECDH_TEST_VECTORS 2 | ||
| 767 | #endif | ||
| 768 | struct kpp_testvec ecdh_tv_template[] = { | 758 | struct kpp_testvec ecdh_tv_template[] = { |
| 769 | { | 759 | { |
| 770 | #ifndef CONFIG_CRYPTO_FIPS | 760 | #ifndef CONFIG_CRYPTO_FIPS |
| @@ -856,8 +846,6 @@ struct kpp_testvec ecdh_tv_template[] = { | |||
| 856 | /* | 846 | /* |
| 857 | * MD4 test vectors from RFC1320 | 847 | * MD4 test vectors from RFC1320 |
| 858 | */ | 848 | */ |
| 859 | #define MD4_TEST_VECTORS 7 | ||
| 860 | |||
| 861 | static struct hash_testvec md4_tv_template [] = { | 849 | static struct hash_testvec md4_tv_template [] = { |
| 862 | { | 850 | { |
| 863 | .plaintext = "", | 851 | .plaintext = "", |
| @@ -899,7 +887,6 @@ static struct hash_testvec md4_tv_template [] = { | |||
| 899 | }, | 887 | }, |
| 900 | }; | 888 | }; |
| 901 | 889 | ||
| 902 | #define SHA3_224_TEST_VECTORS 3 | ||
| 903 | static struct hash_testvec sha3_224_tv_template[] = { | 890 | static struct hash_testvec sha3_224_tv_template[] = { |
| 904 | { | 891 | { |
| 905 | .plaintext = "", | 892 | .plaintext = "", |
| @@ -925,7 +912,6 @@ static struct hash_testvec sha3_224_tv_template[] = { | |||
| 925 | }, | 912 | }, |
| 926 | }; | 913 | }; |
| 927 | 914 | ||
| 928 | #define SHA3_256_TEST_VECTORS 3 | ||
| 929 | static struct hash_testvec sha3_256_tv_template[] = { | 915 | static struct hash_testvec sha3_256_tv_template[] = { |
| 930 | { | 916 | { |
| 931 | .plaintext = "", | 917 | .plaintext = "", |
| @@ -952,7 +938,6 @@ static struct hash_testvec sha3_256_tv_template[] = { | |||
| 952 | }; | 938 | }; |
| 953 | 939 | ||
| 954 | 940 | ||
| 955 | #define SHA3_384_TEST_VECTORS 3 | ||
| 956 | static struct hash_testvec sha3_384_tv_template[] = { | 941 | static struct hash_testvec sha3_384_tv_template[] = { |
| 957 | { | 942 | { |
| 958 | .plaintext = "", | 943 | .plaintext = "", |
| @@ -985,7 +970,6 @@ static struct hash_testvec sha3_384_tv_template[] = { | |||
| 985 | }; | 970 | }; |
| 986 | 971 | ||
| 987 | 972 | ||
| 988 | #define SHA3_512_TEST_VECTORS 3 | ||
| 989 | static struct hash_testvec sha3_512_tv_template[] = { | 973 | static struct hash_testvec sha3_512_tv_template[] = { |
| 990 | { | 974 | { |
| 991 | .plaintext = "", | 975 | .plaintext = "", |
| @@ -1027,8 +1011,6 @@ static struct hash_testvec sha3_512_tv_template[] = { | |||
| 1027 | /* | 1011 | /* |
| 1028 | * MD5 test vectors from RFC1321 | 1012 | * MD5 test vectors from RFC1321 |
| 1029 | */ | 1013 | */ |
| 1030 | #define MD5_TEST_VECTORS 7 | ||
| 1031 | |||
| 1032 | static struct hash_testvec md5_tv_template[] = { | 1014 | static struct hash_testvec md5_tv_template[] = { |
| 1033 | { | 1015 | { |
| 1034 | .digest = "\xd4\x1d\x8c\xd9\x8f\x00\xb2\x04" | 1016 | .digest = "\xd4\x1d\x8c\xd9\x8f\x00\xb2\x04" |
| @@ -1073,8 +1055,6 @@ static struct hash_testvec md5_tv_template[] = { | |||
| 1073 | /* | 1055 | /* |
| 1074 | * RIPEMD-128 test vectors from ISO/IEC 10118-3:2004(E) | 1056 | * RIPEMD-128 test vectors from ISO/IEC 10118-3:2004(E) |
| 1075 | */ | 1057 | */ |
| 1076 | #define RMD128_TEST_VECTORS 10 | ||
| 1077 | |||
| 1078 | static struct hash_testvec rmd128_tv_template[] = { | 1058 | static struct hash_testvec rmd128_tv_template[] = { |
| 1079 | { | 1059 | { |
| 1080 | .digest = "\xcd\xf2\x62\x13\xa1\x50\xdc\x3e" | 1060 | .digest = "\xcd\xf2\x62\x13\xa1\x50\xdc\x3e" |
| @@ -1137,8 +1117,6 @@ static struct hash_testvec rmd128_tv_template[] = { | |||
| 1137 | /* | 1117 | /* |
| 1138 | * RIPEMD-160 test vectors from ISO/IEC 10118-3:2004(E) | 1118 | * RIPEMD-160 test vectors from ISO/IEC 10118-3:2004(E) |
| 1139 | */ | 1119 | */ |
| 1140 | #define RMD160_TEST_VECTORS 10 | ||
| 1141 | |||
| 1142 | static struct hash_testvec rmd160_tv_template[] = { | 1120 | static struct hash_testvec rmd160_tv_template[] = { |
| 1143 | { | 1121 | { |
| 1144 | .digest = "\x9c\x11\x85\xa5\xc5\xe9\xfc\x54\x61\x28" | 1122 | .digest = "\x9c\x11\x85\xa5\xc5\xe9\xfc\x54\x61\x28" |
| @@ -1201,8 +1179,6 @@ static struct hash_testvec rmd160_tv_template[] = { | |||
| 1201 | /* | 1179 | /* |
| 1202 | * RIPEMD-256 test vectors | 1180 | * RIPEMD-256 test vectors |
| 1203 | */ | 1181 | */ |
| 1204 | #define RMD256_TEST_VECTORS 8 | ||
| 1205 | |||
| 1206 | static struct hash_testvec rmd256_tv_template[] = { | 1182 | static struct hash_testvec rmd256_tv_template[] = { |
| 1207 | { | 1183 | { |
| 1208 | .digest = "\x02\xba\x4c\x4e\x5f\x8e\xcd\x18" | 1184 | .digest = "\x02\xba\x4c\x4e\x5f\x8e\xcd\x18" |
| @@ -1269,8 +1245,6 @@ static struct hash_testvec rmd256_tv_template[] = { | |||
| 1269 | /* | 1245 | /* |
| 1270 | * RIPEMD-320 test vectors | 1246 | * RIPEMD-320 test vectors |
| 1271 | */ | 1247 | */ |
| 1272 | #define RMD320_TEST_VECTORS 8 | ||
| 1273 | |||
| 1274 | static struct hash_testvec rmd320_tv_template[] = { | 1248 | static struct hash_testvec rmd320_tv_template[] = { |
| 1275 | { | 1249 | { |
| 1276 | .digest = "\x22\xd6\x5d\x56\x61\x53\x6c\xdc\x75\xc1" | 1250 | .digest = "\x22\xd6\x5d\x56\x61\x53\x6c\xdc\x75\xc1" |
| @@ -1334,7 +1308,6 @@ static struct hash_testvec rmd320_tv_template[] = { | |||
| 1334 | } | 1308 | } |
| 1335 | }; | 1309 | }; |
| 1336 | 1310 | ||
| 1337 | #define CRCT10DIF_TEST_VECTORS ARRAY_SIZE(crct10dif_tv_template) | ||
| 1338 | static struct hash_testvec crct10dif_tv_template[] = { | 1311 | static struct hash_testvec crct10dif_tv_template[] = { |
| 1339 | { | 1312 | { |
| 1340 | .plaintext = "abc", | 1313 | .plaintext = "abc", |
| @@ -1385,8 +1358,6 @@ static struct hash_testvec crct10dif_tv_template[] = { | |||
| 1385 | * SHA1 test vectors from from FIPS PUB 180-1 | 1358 | * SHA1 test vectors from from FIPS PUB 180-1 |
| 1386 | * Long vector from CAVS 5.0 | 1359 | * Long vector from CAVS 5.0 |
| 1387 | */ | 1360 | */ |
| 1388 | #define SHA1_TEST_VECTORS 6 | ||
| 1389 | |||
| 1390 | static struct hash_testvec sha1_tv_template[] = { | 1361 | static struct hash_testvec sha1_tv_template[] = { |
| 1391 | { | 1362 | { |
| 1392 | .plaintext = "", | 1363 | .plaintext = "", |
| @@ -1577,8 +1548,6 @@ static struct hash_testvec sha1_tv_template[] = { | |||
| 1577 | /* | 1548 | /* |
| 1578 | * SHA224 test vectors from from FIPS PUB 180-2 | 1549 | * SHA224 test vectors from from FIPS PUB 180-2 |
| 1579 | */ | 1550 | */ |
| 1580 | #define SHA224_TEST_VECTORS 5 | ||
| 1581 | |||
| 1582 | static struct hash_testvec sha224_tv_template[] = { | 1551 | static struct hash_testvec sha224_tv_template[] = { |
| 1583 | { | 1552 | { |
| 1584 | .plaintext = "", | 1553 | .plaintext = "", |
| @@ -1751,8 +1720,6 @@ static struct hash_testvec sha224_tv_template[] = { | |||
| 1751 | /* | 1720 | /* |
| 1752 | * SHA256 test vectors from from NIST | 1721 | * SHA256 test vectors from from NIST |
| 1753 | */ | 1722 | */ |
| 1754 | #define SHA256_TEST_VECTORS 5 | ||
| 1755 | |||
| 1756 | static struct hash_testvec sha256_tv_template[] = { | 1723 | static struct hash_testvec sha256_tv_template[] = { |
| 1757 | { | 1724 | { |
| 1758 | .plaintext = "", | 1725 | .plaintext = "", |
| @@ -1924,8 +1891,6 @@ static struct hash_testvec sha256_tv_template[] = { | |||
| 1924 | /* | 1891 | /* |
| 1925 | * SHA384 test vectors from from NIST and kerneli | 1892 | * SHA384 test vectors from from NIST and kerneli |
| 1926 | */ | 1893 | */ |
| 1927 | #define SHA384_TEST_VECTORS 6 | ||
| 1928 | |||
| 1929 | static struct hash_testvec sha384_tv_template[] = { | 1894 | static struct hash_testvec sha384_tv_template[] = { |
| 1930 | { | 1895 | { |
| 1931 | .plaintext = "", | 1896 | .plaintext = "", |
| @@ -2118,8 +2083,6 @@ static struct hash_testvec sha384_tv_template[] = { | |||
| 2118 | /* | 2083 | /* |
| 2119 | * SHA512 test vectors from from NIST and kerneli | 2084 | * SHA512 test vectors from from NIST and kerneli |
| 2120 | */ | 2085 | */ |
| 2121 | #define SHA512_TEST_VECTORS 6 | ||
| 2122 | |||
| 2123 | static struct hash_testvec sha512_tv_template[] = { | 2086 | static struct hash_testvec sha512_tv_template[] = { |
| 2124 | { | 2087 | { |
| 2125 | .plaintext = "", | 2088 | .plaintext = "", |
| @@ -2327,8 +2290,6 @@ static struct hash_testvec sha512_tv_template[] = { | |||
| 2327 | * by Vincent Rijmen and Paulo S. L. M. Barreto as part of the NESSIE | 2290 | * by Vincent Rijmen and Paulo S. L. M. Barreto as part of the NESSIE |
| 2328 | * submission | 2291 | * submission |
| 2329 | */ | 2292 | */ |
| 2330 | #define WP512_TEST_VECTORS 8 | ||
| 2331 | |||
| 2332 | static struct hash_testvec wp512_tv_template[] = { | 2293 | static struct hash_testvec wp512_tv_template[] = { |
| 2333 | { | 2294 | { |
| 2334 | .plaintext = "", | 2295 | .plaintext = "", |
| @@ -2425,8 +2386,6 @@ static struct hash_testvec wp512_tv_template[] = { | |||
| 2425 | }, | 2386 | }, |
| 2426 | }; | 2387 | }; |
| 2427 | 2388 | ||
| 2428 | #define WP384_TEST_VECTORS 8 | ||
| 2429 | |||
| 2430 | static struct hash_testvec wp384_tv_template[] = { | 2389 | static struct hash_testvec wp384_tv_template[] = { |
| 2431 | { | 2390 | { |
| 2432 | .plaintext = "", | 2391 | .plaintext = "", |
| @@ -2507,8 +2466,6 @@ static struct hash_testvec wp384_tv_template[] = { | |||
| 2507 | }, | 2466 | }, |
| 2508 | }; | 2467 | }; |
| 2509 | 2468 | ||
| 2510 | #define WP256_TEST_VECTORS 8 | ||
| 2511 | |||
| 2512 | static struct hash_testvec wp256_tv_template[] = { | 2469 | static struct hash_testvec wp256_tv_template[] = { |
| 2513 | { | 2470 | { |
| 2514 | .plaintext = "", | 2471 | .plaintext = "", |
| @@ -2576,8 +2533,6 @@ static struct hash_testvec wp256_tv_template[] = { | |||
| 2576 | /* | 2533 | /* |
| 2577 | * TIGER test vectors from Tiger website | 2534 | * TIGER test vectors from Tiger website |
| 2578 | */ | 2535 | */ |
| 2579 | #define TGR192_TEST_VECTORS 6 | ||
| 2580 | |||
| 2581 | static struct hash_testvec tgr192_tv_template[] = { | 2536 | static struct hash_testvec tgr192_tv_template[] = { |
| 2582 | { | 2537 | { |
| 2583 | .plaintext = "", | 2538 | .plaintext = "", |
| @@ -2621,8 +2576,6 @@ static struct hash_testvec tgr192_tv_template[] = { | |||
| 2621 | }, | 2576 | }, |
| 2622 | }; | 2577 | }; |
| 2623 | 2578 | ||
| 2624 | #define TGR160_TEST_VECTORS 6 | ||
| 2625 | |||
| 2626 | static struct hash_testvec tgr160_tv_template[] = { | 2579 | static struct hash_testvec tgr160_tv_template[] = { |
| 2627 | { | 2580 | { |
| 2628 | .plaintext = "", | 2581 | .plaintext = "", |
| @@ -2666,8 +2619,6 @@ static struct hash_testvec tgr160_tv_template[] = { | |||
| 2666 | }, | 2619 | }, |
| 2667 | }; | 2620 | }; |
| 2668 | 2621 | ||
| 2669 | #define TGR128_TEST_VECTORS 6 | ||
| 2670 | |||
| 2671 | static struct hash_testvec tgr128_tv_template[] = { | 2622 | static struct hash_testvec tgr128_tv_template[] = { |
| 2672 | { | 2623 | { |
| 2673 | .plaintext = "", | 2624 | .plaintext = "", |
| @@ -2705,8 +2656,6 @@ static struct hash_testvec tgr128_tv_template[] = { | |||
| 2705 | }, | 2656 | }, |
| 2706 | }; | 2657 | }; |
| 2707 | 2658 | ||
| 2708 | #define GHASH_TEST_VECTORS 6 | ||
| 2709 | |||
| 2710 | static struct hash_testvec ghash_tv_template[] = | 2659 | static struct hash_testvec ghash_tv_template[] = |
| 2711 | { | 2660 | { |
| 2712 | { | 2661 | { |
| @@ -2822,8 +2771,6 @@ static struct hash_testvec ghash_tv_template[] = | |||
| 2822 | * HMAC-MD5 test vectors from RFC2202 | 2771 | * HMAC-MD5 test vectors from RFC2202 |
| 2823 | * (These need to be fixed to not use strlen). | 2772 | * (These need to be fixed to not use strlen). |
| 2824 | */ | 2773 | */ |
| 2825 | #define HMAC_MD5_TEST_VECTORS 7 | ||
| 2826 | |||
| 2827 | static struct hash_testvec hmac_md5_tv_template[] = | 2774 | static struct hash_testvec hmac_md5_tv_template[] = |
| 2828 | { | 2775 | { |
| 2829 | { | 2776 | { |
| @@ -2904,8 +2851,6 @@ static struct hash_testvec hmac_md5_tv_template[] = | |||
| 2904 | /* | 2851 | /* |
| 2905 | * HMAC-RIPEMD128 test vectors from RFC2286 | 2852 | * HMAC-RIPEMD128 test vectors from RFC2286 |
| 2906 | */ | 2853 | */ |
| 2907 | #define HMAC_RMD128_TEST_VECTORS 7 | ||
| 2908 | |||
| 2909 | static struct hash_testvec hmac_rmd128_tv_template[] = { | 2854 | static struct hash_testvec hmac_rmd128_tv_template[] = { |
| 2910 | { | 2855 | { |
| 2911 | .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", | 2856 | .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", |
| @@ -2985,8 +2930,6 @@ static struct hash_testvec hmac_rmd128_tv_template[] = { | |||
| 2985 | /* | 2930 | /* |
| 2986 | * HMAC-RIPEMD160 test vectors from RFC2286 | 2931 | * HMAC-RIPEMD160 test vectors from RFC2286 |
| 2987 | */ | 2932 | */ |
| 2988 | #define HMAC_RMD160_TEST_VECTORS 7 | ||
| 2989 | |||
| 2990 | static struct hash_testvec hmac_rmd160_tv_template[] = { | 2933 | static struct hash_testvec hmac_rmd160_tv_template[] = { |
| 2991 | { | 2934 | { |
| 2992 | .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", | 2935 | .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", |
| @@ -3066,8 +3009,6 @@ static struct hash_testvec hmac_rmd160_tv_template[] = { | |||
| 3066 | /* | 3009 | /* |
| 3067 | * HMAC-SHA1 test vectors from RFC2202 | 3010 | * HMAC-SHA1 test vectors from RFC2202 |
| 3068 | */ | 3011 | */ |
| 3069 | #define HMAC_SHA1_TEST_VECTORS 7 | ||
| 3070 | |||
| 3071 | static struct hash_testvec hmac_sha1_tv_template[] = { | 3012 | static struct hash_testvec hmac_sha1_tv_template[] = { |
| 3072 | { | 3013 | { |
| 3073 | .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", | 3014 | .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", |
| @@ -3149,8 +3090,6 @@ static struct hash_testvec hmac_sha1_tv_template[] = { | |||
| 3149 | /* | 3090 | /* |
| 3150 | * SHA224 HMAC test vectors from RFC4231 | 3091 | * SHA224 HMAC test vectors from RFC4231 |
| 3151 | */ | 3092 | */ |
| 3152 | #define HMAC_SHA224_TEST_VECTORS 4 | ||
| 3153 | |||
| 3154 | static struct hash_testvec hmac_sha224_tv_template[] = { | 3093 | static struct hash_testvec hmac_sha224_tv_template[] = { |
| 3155 | { | 3094 | { |
| 3156 | .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" | 3095 | .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" |
| @@ -3264,8 +3203,6 @@ static struct hash_testvec hmac_sha224_tv_template[] = { | |||
| 3264 | * HMAC-SHA256 test vectors from | 3203 | * HMAC-SHA256 test vectors from |
| 3265 | * draft-ietf-ipsec-ciph-sha-256-01.txt | 3204 | * draft-ietf-ipsec-ciph-sha-256-01.txt |
| 3266 | */ | 3205 | */ |
| 3267 | #define HMAC_SHA256_TEST_VECTORS 10 | ||
| 3268 | |||
| 3269 | static struct hash_testvec hmac_sha256_tv_template[] = { | 3206 | static struct hash_testvec hmac_sha256_tv_template[] = { |
| 3270 | { | 3207 | { |
| 3271 | .key = "\x01\x02\x03\x04\x05\x06\x07\x08" | 3208 | .key = "\x01\x02\x03\x04\x05\x06\x07\x08" |
| @@ -3401,8 +3338,6 @@ static struct hash_testvec hmac_sha256_tv_template[] = { | |||
| 3401 | }, | 3338 | }, |
| 3402 | }; | 3339 | }; |
| 3403 | 3340 | ||
| 3404 | #define CMAC_AES_TEST_VECTORS 6 | ||
| 3405 | |||
| 3406 | static struct hash_testvec aes_cmac128_tv_template[] = { | 3341 | static struct hash_testvec aes_cmac128_tv_template[] = { |
| 3407 | { /* From NIST Special Publication 800-38B, AES-128 */ | 3342 | { /* From NIST Special Publication 800-38B, AES-128 */ |
| 3408 | .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6" | 3343 | .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6" |
| @@ -3478,7 +3413,65 @@ static struct hash_testvec aes_cmac128_tv_template[] = { | |||
| 3478 | } | 3413 | } |
| 3479 | }; | 3414 | }; |
| 3480 | 3415 | ||
| 3481 | #define CMAC_DES3_EDE_TEST_VECTORS 4 | 3416 | static struct hash_testvec aes_cbcmac_tv_template[] = { |
| 3417 | { | ||
| 3418 | .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6" | ||
| 3419 | "\xab\xf7\x15\x88\x09\xcf\x4f\x3c", | ||
| 3420 | .plaintext = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96" | ||
| 3421 | "\xe9\x3d\x7e\x11\x73\x93\x17\x2a", | ||
| 3422 | .digest = "\x3a\xd7\x7b\xb4\x0d\x7a\x36\x60" | ||
| 3423 | "\xa8\x9e\xca\xf3\x24\x66\xef\x97", | ||
| 3424 | .psize = 16, | ||
| 3425 | .ksize = 16, | ||
| 3426 | }, { | ||
| 3427 | .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6" | ||
| 3428 | "\xab\xf7\x15\x88\x09\xcf\x4f\x3c", | ||
| 3429 | .plaintext = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96" | ||
| 3430 | "\xe9\x3d\x7e\x11\x73\x93\x17\x2a" | ||
| 3431 | "\xae\x2d\x8a\x57\x1e\x03\xac\x9c" | ||
| 3432 | "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51" | ||
| 3433 | "\x30", | ||
| 3434 | .digest = "\x9d\x0d\xd0\x63\xfb\xcb\x24\x43" | ||
| 3435 | "\xf8\xf2\x76\x03\xac\x39\xb0\x9d", | ||
| 3436 | .psize = 33, | ||
| 3437 | .ksize = 16, | ||
| 3438 | .np = 2, | ||
| 3439 | .tap = { 7, 26 }, | ||
| 3440 | }, { | ||
| 3441 | .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6" | ||
| 3442 | "\xab\xf7\x15\x88\x09\xcf\x4f\x3c", | ||
| 3443 | .plaintext = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96" | ||
| 3444 | "\xe9\x3d\x7e\x11\x73\x93\x17\x2a" | ||
| 3445 | "\xae\x2d\x8a\x57\x1e\x03\xac\x9c" | ||
| 3446 | "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51" | ||
| 3447 | "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11" | ||
| 3448 | "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef" | ||
| 3449 | "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17" | ||
| 3450 | "\xad\x2b\x41\x7b\xe6\x6c\x37", | ||
| 3451 | .digest = "\xc0\x71\x73\xb8\xa0\x2c\x11\x7c" | ||
| 3452 | "\xaf\xdc\xb2\xf8\x89\x32\xa3\x3a", | ||
| 3453 | .psize = 63, | ||
| 3454 | .ksize = 16, | ||
| 3455 | }, { | ||
| 3456 | .key = "\x60\x3d\xeb\x10\x15\xca\x71\xbe" | ||
| 3457 | "\x2b\x73\xae\xf0\x85\x7d\x77\x81" | ||
| 3458 | "\x1f\x35\x2c\x07\x3b\x61\x08\xd7" | ||
| 3459 | "\x2d\x98\x10\xa3\x09\x14\xdf\xf4", | ||
| 3460 | .plaintext = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96" | ||
| 3461 | "\xe9\x3d\x7e\x11\x73\x93\x17\x2a" | ||
| 3462 | "\xae\x2d\x8a\x57\x1e\x03\xac\x9c" | ||
| 3463 | "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51" | ||
| 3464 | "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11" | ||
| 3465 | "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef" | ||
| 3466 | "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17" | ||
| 3467 | "\xad\x2b\x41\x7b\xe6\x6c\x37\x10" | ||
| 3468 | "\x1c", | ||
| 3469 | .digest = "\x6a\x4e\xdb\x21\x47\x51\xdf\x4f" | ||
| 3470 | "\xa8\x4d\x4c\x10\x3b\x72\x7d\xd6", | ||
| 3471 | .psize = 65, | ||
| 3472 | .ksize = 32, | ||
| 3473 | } | ||
| 3474 | }; | ||
| 3482 | 3475 | ||
| 3483 | static struct hash_testvec des3_ede_cmac64_tv_template[] = { | 3476 | static struct hash_testvec des3_ede_cmac64_tv_template[] = { |
| 3484 | /* | 3477 | /* |
| @@ -3526,8 +3519,6 @@ static struct hash_testvec des3_ede_cmac64_tv_template[] = { | |||
| 3526 | } | 3519 | } |
| 3527 | }; | 3520 | }; |
| 3528 | 3521 | ||
| 3529 | #define XCBC_AES_TEST_VECTORS 6 | ||
| 3530 | |||
| 3531 | static struct hash_testvec aes_xcbc128_tv_template[] = { | 3522 | static struct hash_testvec aes_xcbc128_tv_template[] = { |
| 3532 | { | 3523 | { |
| 3533 | .key = "\x00\x01\x02\x03\x04\x05\x06\x07" | 3524 | .key = "\x00\x01\x02\x03\x04\x05\x06\x07" |
| @@ -3594,7 +3585,6 @@ static struct hash_testvec aes_xcbc128_tv_template[] = { | |||
| 3594 | } | 3585 | } |
| 3595 | }; | 3586 | }; |
| 3596 | 3587 | ||
| 3597 | #define VMAC_AES_TEST_VECTORS 11 | ||
| 3598 | static char vmac_string1[128] = {'\x01', '\x01', '\x01', '\x01', | 3588 | static char vmac_string1[128] = {'\x01', '\x01', '\x01', '\x01', |
| 3599 | '\x02', '\x03', '\x02', '\x02', | 3589 | '\x02', '\x03', '\x02', '\x02', |
| 3600 | '\x02', '\x04', '\x01', '\x07', | 3590 | '\x02', '\x04', '\x01', '\x07', |
| @@ -3701,8 +3691,6 @@ static struct hash_testvec aes_vmac128_tv_template[] = { | |||
| 3701 | * SHA384 HMAC test vectors from RFC4231 | 3691 | * SHA384 HMAC test vectors from RFC4231 |
| 3702 | */ | 3692 | */ |
| 3703 | 3693 | ||
| 3704 | #define HMAC_SHA384_TEST_VECTORS 4 | ||
| 3705 | |||
| 3706 | static struct hash_testvec hmac_sha384_tv_template[] = { | 3694 | static struct hash_testvec hmac_sha384_tv_template[] = { |
| 3707 | { | 3695 | { |
| 3708 | .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" | 3696 | .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" |
| @@ -3801,8 +3789,6 @@ static struct hash_testvec hmac_sha384_tv_template[] = { | |||
| 3801 | * SHA512 HMAC test vectors from RFC4231 | 3789 | * SHA512 HMAC test vectors from RFC4231 |
| 3802 | */ | 3790 | */ |
| 3803 | 3791 | ||
| 3804 | #define HMAC_SHA512_TEST_VECTORS 4 | ||
| 3805 | |||
| 3806 | static struct hash_testvec hmac_sha512_tv_template[] = { | 3792 | static struct hash_testvec hmac_sha512_tv_template[] = { |
| 3807 | { | 3793 | { |
| 3808 | .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" | 3794 | .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" |
| @@ -3908,8 +3894,6 @@ static struct hash_testvec hmac_sha512_tv_template[] = { | |||
| 3908 | }, | 3894 | }, |
| 3909 | }; | 3895 | }; |
| 3910 | 3896 | ||
| 3911 | #define HMAC_SHA3_224_TEST_VECTORS 4 | ||
| 3912 | |||
| 3913 | static struct hash_testvec hmac_sha3_224_tv_template[] = { | 3897 | static struct hash_testvec hmac_sha3_224_tv_template[] = { |
| 3914 | { | 3898 | { |
| 3915 | .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" | 3899 | .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" |
| @@ -3999,8 +3983,6 @@ static struct hash_testvec hmac_sha3_224_tv_template[] = { | |||
| 3999 | }, | 3983 | }, |
| 4000 | }; | 3984 | }; |
| 4001 | 3985 | ||
| 4002 | #define HMAC_SHA3_256_TEST_VECTORS 4 | ||
| 4003 | |||
| 4004 | static struct hash_testvec hmac_sha3_256_tv_template[] = { | 3986 | static struct hash_testvec hmac_sha3_256_tv_template[] = { |
| 4005 | { | 3987 | { |
| 4006 | .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" | 3988 | .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" |
| @@ -4090,8 +4072,6 @@ static struct hash_testvec hmac_sha3_256_tv_template[] = { | |||
| 4090 | }, | 4072 | }, |
| 4091 | }; | 4073 | }; |
| 4092 | 4074 | ||
| 4093 | #define HMAC_SHA3_384_TEST_VECTORS 4 | ||
| 4094 | |||
| 4095 | static struct hash_testvec hmac_sha3_384_tv_template[] = { | 4075 | static struct hash_testvec hmac_sha3_384_tv_template[] = { |
| 4096 | { | 4076 | { |
| 4097 | .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" | 4077 | .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" |
| @@ -4189,8 +4169,6 @@ static struct hash_testvec hmac_sha3_384_tv_template[] = { | |||
| 4189 | }, | 4169 | }, |
| 4190 | }; | 4170 | }; |
| 4191 | 4171 | ||
| 4192 | #define HMAC_SHA3_512_TEST_VECTORS 4 | ||
| 4193 | |||
| 4194 | static struct hash_testvec hmac_sha3_512_tv_template[] = { | 4172 | static struct hash_testvec hmac_sha3_512_tv_template[] = { |
| 4195 | { | 4173 | { |
| 4196 | .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" | 4174 | .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" |
| @@ -4300,8 +4278,6 @@ static struct hash_testvec hmac_sha3_512_tv_template[] = { | |||
| 4300 | * Poly1305 test vectors from RFC7539 A.3. | 4278 | * Poly1305 test vectors from RFC7539 A.3. |
| 4301 | */ | 4279 | */ |
| 4302 | 4280 | ||
| 4303 | #define POLY1305_TEST_VECTORS 11 | ||
| 4304 | |||
| 4305 | static struct hash_testvec poly1305_tv_template[] = { | 4281 | static struct hash_testvec poly1305_tv_template[] = { |
| 4306 | { /* Test Vector #1 */ | 4282 | { /* Test Vector #1 */ |
| 4307 | .plaintext = "\x00\x00\x00\x00\x00\x00\x00\x00" | 4283 | .plaintext = "\x00\x00\x00\x00\x00\x00\x00\x00" |
| @@ -4547,19 +4523,6 @@ static struct hash_testvec poly1305_tv_template[] = { | |||
| 4547 | /* | 4523 | /* |
| 4548 | * DES test vectors. | 4524 | * DES test vectors. |
| 4549 | */ | 4525 | */ |
| 4550 | #define DES_ENC_TEST_VECTORS 11 | ||
| 4551 | #define DES_DEC_TEST_VECTORS 5 | ||
| 4552 | #define DES_CBC_ENC_TEST_VECTORS 6 | ||
| 4553 | #define DES_CBC_DEC_TEST_VECTORS 5 | ||
| 4554 | #define DES_CTR_ENC_TEST_VECTORS 2 | ||
| 4555 | #define DES_CTR_DEC_TEST_VECTORS 2 | ||
| 4556 | #define DES3_EDE_ENC_TEST_VECTORS 4 | ||
| 4557 | #define DES3_EDE_DEC_TEST_VECTORS 4 | ||
| 4558 | #define DES3_EDE_CBC_ENC_TEST_VECTORS 2 | ||
| 4559 | #define DES3_EDE_CBC_DEC_TEST_VECTORS 2 | ||
| 4560 | #define DES3_EDE_CTR_ENC_TEST_VECTORS 2 | ||
| 4561 | #define DES3_EDE_CTR_DEC_TEST_VECTORS 2 | ||
| 4562 | |||
| 4563 | static struct cipher_testvec des_enc_tv_template[] = { | 4526 | static struct cipher_testvec des_enc_tv_template[] = { |
| 4564 | { /* From Applied Cryptography */ | 4527 | { /* From Applied Cryptography */ |
| 4565 | .key = "\x01\x23\x45\x67\x89\xab\xcd\xef", | 4528 | .key = "\x01\x23\x45\x67\x89\xab\xcd\xef", |
| @@ -6620,13 +6583,6 @@ static struct cipher_testvec des3_ede_ctr_dec_tv_template[] = { | |||
| 6620 | /* | 6583 | /* |
| 6621 | * Blowfish test vectors. | 6584 | * Blowfish test vectors. |
| 6622 | */ | 6585 | */ |
| 6623 | #define BF_ENC_TEST_VECTORS 7 | ||
| 6624 | #define BF_DEC_TEST_VECTORS 7 | ||
| 6625 | #define BF_CBC_ENC_TEST_VECTORS 2 | ||
| 6626 | #define BF_CBC_DEC_TEST_VECTORS 2 | ||
| 6627 | #define BF_CTR_ENC_TEST_VECTORS 2 | ||
| 6628 | #define BF_CTR_DEC_TEST_VECTORS 2 | ||
| 6629 | |||
| 6630 | static struct cipher_testvec bf_enc_tv_template[] = { | 6586 | static struct cipher_testvec bf_enc_tv_template[] = { |
| 6631 | { /* DES test vectors from OpenSSL */ | 6587 | { /* DES test vectors from OpenSSL */ |
| 6632 | .key = "\x00\x00\x00\x00\x00\x00\x00\x00", | 6588 | .key = "\x00\x00\x00\x00\x00\x00\x00\x00", |
| @@ -8152,17 +8108,6 @@ static struct cipher_testvec bf_ctr_dec_tv_template[] = { | |||
| 8152 | /* | 8108 | /* |
| 8153 | * Twofish test vectors. | 8109 | * Twofish test vectors. |
| 8154 | */ | 8110 | */ |
| 8155 | #define TF_ENC_TEST_VECTORS 4 | ||
| 8156 | #define TF_DEC_TEST_VECTORS 4 | ||
| 8157 | #define TF_CBC_ENC_TEST_VECTORS 5 | ||
| 8158 | #define TF_CBC_DEC_TEST_VECTORS 5 | ||
| 8159 | #define TF_CTR_ENC_TEST_VECTORS 2 | ||
| 8160 | #define TF_CTR_DEC_TEST_VECTORS 2 | ||
| 8161 | #define TF_LRW_ENC_TEST_VECTORS 8 | ||
| 8162 | #define TF_LRW_DEC_TEST_VECTORS 8 | ||
| 8163 | #define TF_XTS_ENC_TEST_VECTORS 5 | ||
| 8164 | #define TF_XTS_DEC_TEST_VECTORS 5 | ||
| 8165 | |||
| 8166 | static struct cipher_testvec tf_enc_tv_template[] = { | 8111 | static struct cipher_testvec tf_enc_tv_template[] = { |
| 8167 | { | 8112 | { |
| 8168 | .key = zeroed_string, | 8113 | .key = zeroed_string, |
| @@ -10881,24 +10826,6 @@ static struct cipher_testvec tf_xts_dec_tv_template[] = { | |||
| 10881 | * Serpent test vectors. These are backwards because Serpent writes | 10826 | * Serpent test vectors. These are backwards because Serpent writes |
| 10882 | * octet sequences in right-to-left mode. | 10827 | * octet sequences in right-to-left mode. |
| 10883 | */ | 10828 | */ |
| 10884 | #define SERPENT_ENC_TEST_VECTORS 5 | ||
| 10885 | #define SERPENT_DEC_TEST_VECTORS 5 | ||
| 10886 | |||
| 10887 | #define TNEPRES_ENC_TEST_VECTORS 4 | ||
| 10888 | #define TNEPRES_DEC_TEST_VECTORS 4 | ||
| 10889 | |||
| 10890 | #define SERPENT_CBC_ENC_TEST_VECTORS 1 | ||
| 10891 | #define SERPENT_CBC_DEC_TEST_VECTORS 1 | ||
| 10892 | |||
| 10893 | #define SERPENT_CTR_ENC_TEST_VECTORS 2 | ||
| 10894 | #define SERPENT_CTR_DEC_TEST_VECTORS 2 | ||
| 10895 | |||
| 10896 | #define SERPENT_LRW_ENC_TEST_VECTORS 8 | ||
| 10897 | #define SERPENT_LRW_DEC_TEST_VECTORS 8 | ||
| 10898 | |||
| 10899 | #define SERPENT_XTS_ENC_TEST_VECTORS 5 | ||
| 10900 | #define SERPENT_XTS_DEC_TEST_VECTORS 5 | ||
| 10901 | |||
| 10902 | static struct cipher_testvec serpent_enc_tv_template[] = { | 10829 | static struct cipher_testvec serpent_enc_tv_template[] = { |
| 10903 | { | 10830 | { |
| 10904 | .input = "\x00\x01\x02\x03\x04\x05\x06\x07" | 10831 | .input = "\x00\x01\x02\x03\x04\x05\x06\x07" |
| @@ -13637,17 +13564,6 @@ static struct cipher_testvec serpent_xts_dec_tv_template[] = { | |||
| 13637 | }; | 13564 | }; |
| 13638 | 13565 | ||
| 13639 | /* Cast6 test vectors from RFC 2612 */ | 13566 | /* Cast6 test vectors from RFC 2612 */ |
| 13640 | #define CAST6_ENC_TEST_VECTORS 4 | ||
| 13641 | #define CAST6_DEC_TEST_VECTORS 4 | ||
| 13642 | #define CAST6_CBC_ENC_TEST_VECTORS 1 | ||
| 13643 | #define CAST6_CBC_DEC_TEST_VECTORS 1 | ||
| 13644 | #define CAST6_CTR_ENC_TEST_VECTORS 2 | ||
| 13645 | #define CAST6_CTR_DEC_TEST_VECTORS 2 | ||
| 13646 | #define CAST6_LRW_ENC_TEST_VECTORS 1 | ||
| 13647 | #define CAST6_LRW_DEC_TEST_VECTORS 1 | ||
| 13648 | #define CAST6_XTS_ENC_TEST_VECTORS 1 | ||
| 13649 | #define CAST6_XTS_DEC_TEST_VECTORS 1 | ||
| 13650 | |||
| 13651 | static struct cipher_testvec cast6_enc_tv_template[] = { | 13567 | static struct cipher_testvec cast6_enc_tv_template[] = { |
| 13652 | { | 13568 | { |
| 13653 | .key = "\x23\x42\xbb\x9e\xfa\x38\x54\x2c" | 13569 | .key = "\x23\x42\xbb\x9e\xfa\x38\x54\x2c" |
| @@ -15182,38 +15098,6 @@ static struct cipher_testvec cast6_xts_dec_tv_template[] = { | |||
| 15182 | /* | 15098 | /* |
| 15183 | * AES test vectors. | 15099 | * AES test vectors. |
| 15184 | */ | 15100 | */ |
| 15185 | #define AES_ENC_TEST_VECTORS 4 | ||
| 15186 | #define AES_DEC_TEST_VECTORS 4 | ||
| 15187 | #define AES_CBC_ENC_TEST_VECTORS 5 | ||
| 15188 | #define AES_CBC_DEC_TEST_VECTORS 5 | ||
| 15189 | #define HMAC_MD5_ECB_CIPHER_NULL_ENC_TEST_VECTORS 2 | ||
| 15190 | #define HMAC_MD5_ECB_CIPHER_NULL_DEC_TEST_VECTORS 2 | ||
| 15191 | #define HMAC_SHA1_ECB_CIPHER_NULL_ENC_TEST_VEC 2 | ||
| 15192 | #define HMAC_SHA1_ECB_CIPHER_NULL_DEC_TEST_VEC 2 | ||
| 15193 | #define HMAC_SHA1_AES_CBC_ENC_TEST_VEC 7 | ||
| 15194 | #define HMAC_SHA256_AES_CBC_ENC_TEST_VEC 7 | ||
| 15195 | #define HMAC_SHA512_AES_CBC_ENC_TEST_VEC 7 | ||
| 15196 | #define AES_LRW_ENC_TEST_VECTORS 8 | ||
| 15197 | #define AES_LRW_DEC_TEST_VECTORS 8 | ||
| 15198 | #define AES_XTS_ENC_TEST_VECTORS 5 | ||
| 15199 | #define AES_XTS_DEC_TEST_VECTORS 5 | ||
| 15200 | #define AES_CTR_ENC_TEST_VECTORS 5 | ||
| 15201 | #define AES_CTR_DEC_TEST_VECTORS 5 | ||
| 15202 | #define AES_OFB_ENC_TEST_VECTORS 1 | ||
| 15203 | #define AES_OFB_DEC_TEST_VECTORS 1 | ||
| 15204 | #define AES_CTR_3686_ENC_TEST_VECTORS 7 | ||
| 15205 | #define AES_CTR_3686_DEC_TEST_VECTORS 6 | ||
| 15206 | #define AES_GCM_ENC_TEST_VECTORS 9 | ||
| 15207 | #define AES_GCM_DEC_TEST_VECTORS 8 | ||
| 15208 | #define AES_GCM_4106_ENC_TEST_VECTORS 23 | ||
| 15209 | #define AES_GCM_4106_DEC_TEST_VECTORS 23 | ||
| 15210 | #define AES_GCM_4543_ENC_TEST_VECTORS 1 | ||
| 15211 | #define AES_GCM_4543_DEC_TEST_VECTORS 2 | ||
| 15212 | #define AES_CCM_ENC_TEST_VECTORS 8 | ||
| 15213 | #define AES_CCM_DEC_TEST_VECTORS 7 | ||
| 15214 | #define AES_CCM_4309_ENC_TEST_VECTORS 7 | ||
| 15215 | #define AES_CCM_4309_DEC_TEST_VECTORS 10 | ||
| 15216 | |||
| 15217 | static struct cipher_testvec aes_enc_tv_template[] = { | 15101 | static struct cipher_testvec aes_enc_tv_template[] = { |
| 15218 | { /* From FIPS-197 */ | 15102 | { /* From FIPS-197 */ |
| 15219 | .key = "\x00\x01\x02\x03\x04\x05\x06\x07" | 15103 | .key = "\x00\x01\x02\x03\x04\x05\x06\x07" |
| @@ -17069,8 +16953,6 @@ static struct aead_testvec hmac_sha512_aes_cbc_enc_tv_temp[] = { | |||
| 17069 | }, | 16953 | }, |
| 17070 | }; | 16954 | }; |
| 17071 | 16955 | ||
| 17072 | #define HMAC_SHA1_DES_CBC_ENC_TEST_VEC 1 | ||
| 17073 | |||
| 17074 | static struct aead_testvec hmac_sha1_des_cbc_enc_tv_temp[] = { | 16956 | static struct aead_testvec hmac_sha1_des_cbc_enc_tv_temp[] = { |
| 17075 | { /*Generated with cryptopp*/ | 16957 | { /*Generated with cryptopp*/ |
| 17076 | #ifdef __LITTLE_ENDIAN | 16958 | #ifdef __LITTLE_ENDIAN |
| @@ -17130,8 +17012,6 @@ static struct aead_testvec hmac_sha1_des_cbc_enc_tv_temp[] = { | |||
| 17130 | }, | 17012 | }, |
| 17131 | }; | 17013 | }; |
| 17132 | 17014 | ||
| 17133 | #define HMAC_SHA224_DES_CBC_ENC_TEST_VEC 1 | ||
| 17134 | |||
| 17135 | static struct aead_testvec hmac_sha224_des_cbc_enc_tv_temp[] = { | 17015 | static struct aead_testvec hmac_sha224_des_cbc_enc_tv_temp[] = { |
| 17136 | { /*Generated with cryptopp*/ | 17016 | { /*Generated with cryptopp*/ |
| 17137 | #ifdef __LITTLE_ENDIAN | 17017 | #ifdef __LITTLE_ENDIAN |
| @@ -17191,8 +17071,6 @@ static struct aead_testvec hmac_sha224_des_cbc_enc_tv_temp[] = { | |||
| 17191 | }, | 17071 | }, |
| 17192 | }; | 17072 | }; |
| 17193 | 17073 | ||
| 17194 | #define HMAC_SHA256_DES_CBC_ENC_TEST_VEC 1 | ||
| 17195 | |||
| 17196 | static struct aead_testvec hmac_sha256_des_cbc_enc_tv_temp[] = { | 17074 | static struct aead_testvec hmac_sha256_des_cbc_enc_tv_temp[] = { |
| 17197 | { /*Generated with cryptopp*/ | 17075 | { /*Generated with cryptopp*/ |
| 17198 | #ifdef __LITTLE_ENDIAN | 17076 | #ifdef __LITTLE_ENDIAN |
| @@ -17254,8 +17132,6 @@ static struct aead_testvec hmac_sha256_des_cbc_enc_tv_temp[] = { | |||
| 17254 | }, | 17132 | }, |
| 17255 | }; | 17133 | }; |
| 17256 | 17134 | ||
| 17257 | #define HMAC_SHA384_DES_CBC_ENC_TEST_VEC 1 | ||
| 17258 | |||
| 17259 | static struct aead_testvec hmac_sha384_des_cbc_enc_tv_temp[] = { | 17135 | static struct aead_testvec hmac_sha384_des_cbc_enc_tv_temp[] = { |
| 17260 | { /*Generated with cryptopp*/ | 17136 | { /*Generated with cryptopp*/ |
| 17261 | #ifdef __LITTLE_ENDIAN | 17137 | #ifdef __LITTLE_ENDIAN |
| @@ -17321,8 +17197,6 @@ static struct aead_testvec hmac_sha384_des_cbc_enc_tv_temp[] = { | |||
| 17321 | }, | 17197 | }, |
| 17322 | }; | 17198 | }; |
| 17323 | 17199 | ||
| 17324 | #define HMAC_SHA512_DES_CBC_ENC_TEST_VEC 1 | ||
| 17325 | |||
| 17326 | static struct aead_testvec hmac_sha512_des_cbc_enc_tv_temp[] = { | 17200 | static struct aead_testvec hmac_sha512_des_cbc_enc_tv_temp[] = { |
| 17327 | { /*Generated with cryptopp*/ | 17201 | { /*Generated with cryptopp*/ |
| 17328 | #ifdef __LITTLE_ENDIAN | 17202 | #ifdef __LITTLE_ENDIAN |
| @@ -17392,8 +17266,6 @@ static struct aead_testvec hmac_sha512_des_cbc_enc_tv_temp[] = { | |||
| 17392 | }, | 17266 | }, |
| 17393 | }; | 17267 | }; |
| 17394 | 17268 | ||
| 17395 | #define HMAC_SHA1_DES3_EDE_CBC_ENC_TEST_VEC 1 | ||
| 17396 | |||
| 17397 | static struct aead_testvec hmac_sha1_des3_ede_cbc_enc_tv_temp[] = { | 17269 | static struct aead_testvec hmac_sha1_des3_ede_cbc_enc_tv_temp[] = { |
| 17398 | { /*Generated with cryptopp*/ | 17270 | { /*Generated with cryptopp*/ |
| 17399 | #ifdef __LITTLE_ENDIAN | 17271 | #ifdef __LITTLE_ENDIAN |
| @@ -17455,8 +17327,6 @@ static struct aead_testvec hmac_sha1_des3_ede_cbc_enc_tv_temp[] = { | |||
| 17455 | }, | 17327 | }, |
| 17456 | }; | 17328 | }; |
| 17457 | 17329 | ||
| 17458 | #define HMAC_SHA224_DES3_EDE_CBC_ENC_TEST_VEC 1 | ||
| 17459 | |||
| 17460 | static struct aead_testvec hmac_sha224_des3_ede_cbc_enc_tv_temp[] = { | 17330 | static struct aead_testvec hmac_sha224_des3_ede_cbc_enc_tv_temp[] = { |
| 17461 | { /*Generated with cryptopp*/ | 17331 | { /*Generated with cryptopp*/ |
| 17462 | #ifdef __LITTLE_ENDIAN | 17332 | #ifdef __LITTLE_ENDIAN |
| @@ -17518,8 +17388,6 @@ static struct aead_testvec hmac_sha224_des3_ede_cbc_enc_tv_temp[] = { | |||
| 17518 | }, | 17388 | }, |
| 17519 | }; | 17389 | }; |
| 17520 | 17390 | ||
| 17521 | #define HMAC_SHA256_DES3_EDE_CBC_ENC_TEST_VEC 1 | ||
| 17522 | |||
| 17523 | static struct aead_testvec hmac_sha256_des3_ede_cbc_enc_tv_temp[] = { | 17391 | static struct aead_testvec hmac_sha256_des3_ede_cbc_enc_tv_temp[] = { |
| 17524 | { /*Generated with cryptopp*/ | 17392 | { /*Generated with cryptopp*/ |
| 17525 | #ifdef __LITTLE_ENDIAN | 17393 | #ifdef __LITTLE_ENDIAN |
| @@ -17583,8 +17451,6 @@ static struct aead_testvec hmac_sha256_des3_ede_cbc_enc_tv_temp[] = { | |||
| 17583 | }, | 17451 | }, |
| 17584 | }; | 17452 | }; |
| 17585 | 17453 | ||
| 17586 | #define HMAC_SHA384_DES3_EDE_CBC_ENC_TEST_VEC 1 | ||
| 17587 | |||
| 17588 | static struct aead_testvec hmac_sha384_des3_ede_cbc_enc_tv_temp[] = { | 17454 | static struct aead_testvec hmac_sha384_des3_ede_cbc_enc_tv_temp[] = { |
| 17589 | { /*Generated with cryptopp*/ | 17455 | { /*Generated with cryptopp*/ |
| 17590 | #ifdef __LITTLE_ENDIAN | 17456 | #ifdef __LITTLE_ENDIAN |
| @@ -17652,8 +17518,6 @@ static struct aead_testvec hmac_sha384_des3_ede_cbc_enc_tv_temp[] = { | |||
| 17652 | }, | 17518 | }, |
| 17653 | }; | 17519 | }; |
| 17654 | 17520 | ||
| 17655 | #define HMAC_SHA512_DES3_EDE_CBC_ENC_TEST_VEC 1 | ||
| 17656 | |||
| 17657 | static struct aead_testvec hmac_sha512_des3_ede_cbc_enc_tv_temp[] = { | 17521 | static struct aead_testvec hmac_sha512_des3_ede_cbc_enc_tv_temp[] = { |
| 17658 | { /*Generated with cryptopp*/ | 17522 | { /*Generated with cryptopp*/ |
| 17659 | #ifdef __LITTLE_ENDIAN | 17523 | #ifdef __LITTLE_ENDIAN |
| @@ -22827,7 +22691,7 @@ static struct aead_testvec aes_ccm_enc_tv_template[] = { | |||
| 22827 | "\x09\x75\x9a\x9b\x3c\x9b\x27\x39", | 22691 | "\x09\x75\x9a\x9b\x3c\x9b\x27\x39", |
| 22828 | .klen = 32, | 22692 | .klen = 32, |
| 22829 | .iv = "\x03\xf9\xd9\x4e\x63\xb5\x3d\x9d" | 22693 | .iv = "\x03\xf9\xd9\x4e\x63\xb5\x3d\x9d" |
| 22830 | "\x43\xf6\x1e\x50", | 22694 | "\x43\xf6\x1e\x50\0\0\0\0", |
| 22831 | .assoc = "\x57\xf5\x6b\x8b\x57\x5c\x3d\x3b" | 22695 | .assoc = "\x57\xf5\x6b\x8b\x57\x5c\x3d\x3b" |
| 22832 | "\x13\x02\x01\x0c\x83\x4c\x96\x35" | 22696 | "\x13\x02\x01\x0c\x83\x4c\x96\x35" |
| 22833 | "\x8e\xd6\x39\xcf\x7d\x14\x9b\x94" | 22697 | "\x8e\xd6\x39\xcf\x7d\x14\x9b\x94" |
| @@ -24434,8 +24298,6 @@ static struct aead_testvec aes_ccm_rfc4309_dec_tv_template[] = { | |||
| 24434 | /* | 24298 | /* |
| 24435 | * ChaCha20-Poly1305 AEAD test vectors from RFC7539 2.8.2./A.5. | 24299 | * ChaCha20-Poly1305 AEAD test vectors from RFC7539 2.8.2./A.5. |
| 24436 | */ | 24300 | */ |
| 24437 | #define RFC7539_ENC_TEST_VECTORS 2 | ||
| 24438 | #define RFC7539_DEC_TEST_VECTORS 2 | ||
| 24439 | static struct aead_testvec rfc7539_enc_tv_template[] = { | 24301 | static struct aead_testvec rfc7539_enc_tv_template[] = { |
| 24440 | { | 24302 | { |
| 24441 | .key = "\x80\x81\x82\x83\x84\x85\x86\x87" | 24303 | .key = "\x80\x81\x82\x83\x84\x85\x86\x87" |
| @@ -24703,8 +24565,6 @@ static struct aead_testvec rfc7539_dec_tv_template[] = { | |||
| 24703 | /* | 24565 | /* |
| 24704 | * draft-irtf-cfrg-chacha20-poly1305 | 24566 | * draft-irtf-cfrg-chacha20-poly1305 |
| 24705 | */ | 24567 | */ |
| 24706 | #define RFC7539ESP_DEC_TEST_VECTORS 1 | ||
| 24707 | #define RFC7539ESP_ENC_TEST_VECTORS 1 | ||
| 24708 | static struct aead_testvec rfc7539esp_enc_tv_template[] = { | 24568 | static struct aead_testvec rfc7539esp_enc_tv_template[] = { |
| 24709 | { | 24569 | { |
| 24710 | .key = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a" | 24570 | .key = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a" |
| @@ -24927,8 +24787,6 @@ static struct cipher_testvec aes_kw_dec_tv_template[] = { | |||
| 24927 | * http://csrc.nist.gov/groups/STM/cavp/documents/rng/RNGVS.pdf | 24787 | * http://csrc.nist.gov/groups/STM/cavp/documents/rng/RNGVS.pdf |
| 24928 | * Only AES-128 is supported at this time. | 24788 | * Only AES-128 is supported at this time. |
| 24929 | */ | 24789 | */ |
| 24930 | #define ANSI_CPRNG_AES_TEST_VECTORS 6 | ||
| 24931 | |||
| 24932 | static struct cprng_testvec ansi_cprng_aes_tv_template[] = { | 24790 | static struct cprng_testvec ansi_cprng_aes_tv_template[] = { |
| 24933 | { | 24791 | { |
| 24934 | .key = "\xf3\xb1\x66\x6d\x13\x60\x72\x42" | 24792 | .key = "\xf3\xb1\x66\x6d\x13\x60\x72\x42" |
| @@ -25846,13 +25704,6 @@ static struct drbg_testvec drbg_nopr_ctr_aes128_tv_template[] = { | |||
| 25846 | }; | 25704 | }; |
| 25847 | 25705 | ||
| 25848 | /* Cast5 test vectors from RFC 2144 */ | 25706 | /* Cast5 test vectors from RFC 2144 */ |
| 25849 | #define CAST5_ENC_TEST_VECTORS 4 | ||
| 25850 | #define CAST5_DEC_TEST_VECTORS 4 | ||
| 25851 | #define CAST5_CBC_ENC_TEST_VECTORS 1 | ||
| 25852 | #define CAST5_CBC_DEC_TEST_VECTORS 1 | ||
| 25853 | #define CAST5_CTR_ENC_TEST_VECTORS 2 | ||
| 25854 | #define CAST5_CTR_DEC_TEST_VECTORS 2 | ||
| 25855 | |||
| 25856 | static struct cipher_testvec cast5_enc_tv_template[] = { | 25707 | static struct cipher_testvec cast5_enc_tv_template[] = { |
| 25857 | { | 25708 | { |
| 25858 | .key = "\x01\x23\x45\x67\x12\x34\x56\x78" | 25709 | .key = "\x01\x23\x45\x67\x12\x34\x56\x78" |
| @@ -26756,9 +26607,6 @@ static struct cipher_testvec cast5_ctr_dec_tv_template[] = { | |||
| 26756 | /* | 26607 | /* |
| 26757 | * ARC4 test vectors from OpenSSL | 26608 | * ARC4 test vectors from OpenSSL |
| 26758 | */ | 26609 | */ |
| 26759 | #define ARC4_ENC_TEST_VECTORS 7 | ||
| 26760 | #define ARC4_DEC_TEST_VECTORS 7 | ||
| 26761 | |||
| 26762 | static struct cipher_testvec arc4_enc_tv_template[] = { | 26610 | static struct cipher_testvec arc4_enc_tv_template[] = { |
| 26763 | { | 26611 | { |
| 26764 | .key = "\x01\x23\x45\x67\x89\xab\xcd\xef", | 26612 | .key = "\x01\x23\x45\x67\x89\xab\xcd\xef", |
| @@ -26894,9 +26742,6 @@ static struct cipher_testvec arc4_dec_tv_template[] = { | |||
| 26894 | /* | 26742 | /* |
| 26895 | * TEA test vectors | 26743 | * TEA test vectors |
| 26896 | */ | 26744 | */ |
| 26897 | #define TEA_ENC_TEST_VECTORS 4 | ||
| 26898 | #define TEA_DEC_TEST_VECTORS 4 | ||
| 26899 | |||
| 26900 | static struct cipher_testvec tea_enc_tv_template[] = { | 26745 | static struct cipher_testvec tea_enc_tv_template[] = { |
| 26901 | { | 26746 | { |
| 26902 | .key = zeroed_string, | 26747 | .key = zeroed_string, |
| @@ -26986,9 +26831,6 @@ static struct cipher_testvec tea_dec_tv_template[] = { | |||
| 26986 | /* | 26831 | /* |
| 26987 | * XTEA test vectors | 26832 | * XTEA test vectors |
| 26988 | */ | 26833 | */ |
| 26989 | #define XTEA_ENC_TEST_VECTORS 4 | ||
| 26990 | #define XTEA_DEC_TEST_VECTORS 4 | ||
| 26991 | |||
| 26992 | static struct cipher_testvec xtea_enc_tv_template[] = { | 26834 | static struct cipher_testvec xtea_enc_tv_template[] = { |
| 26993 | { | 26835 | { |
| 26994 | .key = zeroed_string, | 26836 | .key = zeroed_string, |
| @@ -27078,9 +26920,6 @@ static struct cipher_testvec xtea_dec_tv_template[] = { | |||
| 27078 | /* | 26920 | /* |
| 27079 | * KHAZAD test vectors. | 26921 | * KHAZAD test vectors. |
| 27080 | */ | 26922 | */ |
| 27081 | #define KHAZAD_ENC_TEST_VECTORS 5 | ||
| 27082 | #define KHAZAD_DEC_TEST_VECTORS 5 | ||
| 27083 | |||
| 27084 | static struct cipher_testvec khazad_enc_tv_template[] = { | 26923 | static struct cipher_testvec khazad_enc_tv_template[] = { |
| 27085 | { | 26924 | { |
| 27086 | .key = "\x80\x00\x00\x00\x00\x00\x00\x00" | 26925 | .key = "\x80\x00\x00\x00\x00\x00\x00\x00" |
| @@ -27177,11 +27016,6 @@ static struct cipher_testvec khazad_dec_tv_template[] = { | |||
| 27177 | * Anubis test vectors. | 27016 | * Anubis test vectors. |
| 27178 | */ | 27017 | */ |
| 27179 | 27018 | ||
| 27180 | #define ANUBIS_ENC_TEST_VECTORS 5 | ||
| 27181 | #define ANUBIS_DEC_TEST_VECTORS 5 | ||
| 27182 | #define ANUBIS_CBC_ENC_TEST_VECTORS 2 | ||
| 27183 | #define ANUBIS_CBC_DEC_TEST_VECTORS 2 | ||
| 27184 | |||
| 27185 | static struct cipher_testvec anubis_enc_tv_template[] = { | 27019 | static struct cipher_testvec anubis_enc_tv_template[] = { |
| 27186 | { | 27020 | { |
| 27187 | .key = "\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe" | 27021 | .key = "\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe" |
| @@ -27381,9 +27215,6 @@ static struct cipher_testvec anubis_cbc_dec_tv_template[] = { | |||
| 27381 | /* | 27215 | /* |
| 27382 | * XETA test vectors | 27216 | * XETA test vectors |
| 27383 | */ | 27217 | */ |
| 27384 | #define XETA_ENC_TEST_VECTORS 4 | ||
| 27385 | #define XETA_DEC_TEST_VECTORS 4 | ||
| 27386 | |||
| 27387 | static struct cipher_testvec xeta_enc_tv_template[] = { | 27218 | static struct cipher_testvec xeta_enc_tv_template[] = { |
| 27388 | { | 27219 | { |
| 27389 | .key = zeroed_string, | 27220 | .key = zeroed_string, |
| @@ -27473,9 +27304,6 @@ static struct cipher_testvec xeta_dec_tv_template[] = { | |||
| 27473 | /* | 27304 | /* |
| 27474 | * FCrypt test vectors | 27305 | * FCrypt test vectors |
| 27475 | */ | 27306 | */ |
| 27476 | #define FCRYPT_ENC_TEST_VECTORS ARRAY_SIZE(fcrypt_pcbc_enc_tv_template) | ||
| 27477 | #define FCRYPT_DEC_TEST_VECTORS ARRAY_SIZE(fcrypt_pcbc_dec_tv_template) | ||
| 27478 | |||
| 27479 | static struct cipher_testvec fcrypt_pcbc_enc_tv_template[] = { | 27307 | static struct cipher_testvec fcrypt_pcbc_enc_tv_template[] = { |
| 27480 | { /* http://www.openafs.org/pipermail/openafs-devel/2000-December/005320.html */ | 27308 | { /* http://www.openafs.org/pipermail/openafs-devel/2000-December/005320.html */ |
| 27481 | .key = "\x00\x00\x00\x00\x00\x00\x00\x00", | 27309 | .key = "\x00\x00\x00\x00\x00\x00\x00\x00", |
| @@ -27601,17 +27429,6 @@ static struct cipher_testvec fcrypt_pcbc_dec_tv_template[] = { | |||
| 27601 | /* | 27429 | /* |
| 27602 | * CAMELLIA test vectors. | 27430 | * CAMELLIA test vectors. |
| 27603 | */ | 27431 | */ |
| 27604 | #define CAMELLIA_ENC_TEST_VECTORS 4 | ||
| 27605 | #define CAMELLIA_DEC_TEST_VECTORS 4 | ||
| 27606 | #define CAMELLIA_CBC_ENC_TEST_VECTORS 3 | ||
| 27607 | #define CAMELLIA_CBC_DEC_TEST_VECTORS 3 | ||
| 27608 | #define CAMELLIA_CTR_ENC_TEST_VECTORS 2 | ||
| 27609 | #define CAMELLIA_CTR_DEC_TEST_VECTORS 2 | ||
| 27610 | #define CAMELLIA_LRW_ENC_TEST_VECTORS 8 | ||
| 27611 | #define CAMELLIA_LRW_DEC_TEST_VECTORS 8 | ||
| 27612 | #define CAMELLIA_XTS_ENC_TEST_VECTORS 5 | ||
| 27613 | #define CAMELLIA_XTS_DEC_TEST_VECTORS 5 | ||
| 27614 | |||
| 27615 | static struct cipher_testvec camellia_enc_tv_template[] = { | 27432 | static struct cipher_testvec camellia_enc_tv_template[] = { |
| 27616 | { | 27433 | { |
| 27617 | .key = "\x01\x23\x45\x67\x89\xab\xcd\xef" | 27434 | .key = "\x01\x23\x45\x67\x89\xab\xcd\xef" |
| @@ -31331,9 +31148,6 @@ static struct cipher_testvec camellia_xts_dec_tv_template[] = { | |||
| 31331 | /* | 31148 | /* |
| 31332 | * SEED test vectors | 31149 | * SEED test vectors |
| 31333 | */ | 31150 | */ |
| 31334 | #define SEED_ENC_TEST_VECTORS 4 | ||
| 31335 | #define SEED_DEC_TEST_VECTORS 4 | ||
| 31336 | |||
| 31337 | static struct cipher_testvec seed_enc_tv_template[] = { | 31151 | static struct cipher_testvec seed_enc_tv_template[] = { |
| 31338 | { | 31152 | { |
| 31339 | .key = zeroed_string, | 31153 | .key = zeroed_string, |
| @@ -31418,7 +31232,6 @@ static struct cipher_testvec seed_dec_tv_template[] = { | |||
| 31418 | } | 31232 | } |
| 31419 | }; | 31233 | }; |
| 31420 | 31234 | ||
| 31421 | #define SALSA20_STREAM_ENC_TEST_VECTORS 5 | ||
| 31422 | static struct cipher_testvec salsa20_stream_enc_tv_template[] = { | 31235 | static struct cipher_testvec salsa20_stream_enc_tv_template[] = { |
| 31423 | /* | 31236 | /* |
| 31424 | * Testvectors from verified.test-vectors submitted to ECRYPT. | 31237 | * Testvectors from verified.test-vectors submitted to ECRYPT. |
| @@ -32588,7 +32401,6 @@ static struct cipher_testvec salsa20_stream_enc_tv_template[] = { | |||
| 32588 | }, | 32401 | }, |
| 32589 | }; | 32402 | }; |
| 32590 | 32403 | ||
| 32591 | #define CHACHA20_ENC_TEST_VECTORS 4 | ||
| 32592 | static struct cipher_testvec chacha20_enc_tv_template[] = { | 32404 | static struct cipher_testvec chacha20_enc_tv_template[] = { |
| 32593 | { /* RFC7539 A.2. Test Vector #1 */ | 32405 | { /* RFC7539 A.2. Test Vector #1 */ |
| 32594 | .key = "\x00\x00\x00\x00\x00\x00\x00\x00" | 32406 | .key = "\x00\x00\x00\x00\x00\x00\x00\x00" |
| @@ -33100,8 +32912,6 @@ static struct cipher_testvec chacha20_enc_tv_template[] = { | |||
| 33100 | /* | 32912 | /* |
| 33101 | * CTS (Cipher Text Stealing) mode tests | 32913 | * CTS (Cipher Text Stealing) mode tests |
| 33102 | */ | 32914 | */ |
| 33103 | #define CTS_MODE_ENC_TEST_VECTORS 6 | ||
| 33104 | #define CTS_MODE_DEC_TEST_VECTORS 6 | ||
| 33105 | static struct cipher_testvec cts_mode_enc_tv_template[] = { | 32915 | static struct cipher_testvec cts_mode_enc_tv_template[] = { |
| 33106 | { /* from rfc3962 */ | 32916 | { /* from rfc3962 */ |
| 33107 | .klen = 16, | 32917 | .klen = 16, |
| @@ -33322,9 +33132,6 @@ struct comp_testvec { | |||
| 33322 | * Params: winbits=-11, Z_DEFAULT_COMPRESSION, MAX_MEM_LEVEL. | 33132 | * Params: winbits=-11, Z_DEFAULT_COMPRESSION, MAX_MEM_LEVEL. |
| 33323 | */ | 33133 | */ |
| 33324 | 33134 | ||
| 33325 | #define DEFLATE_COMP_TEST_VECTORS 2 | ||
| 33326 | #define DEFLATE_DECOMP_TEST_VECTORS 2 | ||
| 33327 | |||
| 33328 | static struct comp_testvec deflate_comp_tv_template[] = { | 33135 | static struct comp_testvec deflate_comp_tv_template[] = { |
| 33329 | { | 33136 | { |
| 33330 | .inlen = 70, | 33137 | .inlen = 70, |
| @@ -33400,9 +33207,6 @@ static struct comp_testvec deflate_decomp_tv_template[] = { | |||
| 33400 | /* | 33207 | /* |
| 33401 | * LZO test vectors (null-terminated strings). | 33208 | * LZO test vectors (null-terminated strings). |
| 33402 | */ | 33209 | */ |
| 33403 | #define LZO_COMP_TEST_VECTORS 2 | ||
| 33404 | #define LZO_DECOMP_TEST_VECTORS 2 | ||
| 33405 | |||
| 33406 | static struct comp_testvec lzo_comp_tv_template[] = { | 33210 | static struct comp_testvec lzo_comp_tv_template[] = { |
| 33407 | { | 33211 | { |
| 33408 | .inlen = 70, | 33212 | .inlen = 70, |
| @@ -33534,8 +33338,6 @@ static struct hash_testvec michael_mic_tv_template[] = { | |||
| 33534 | /* | 33338 | /* |
| 33535 | * CRC32 test vectors | 33339 | * CRC32 test vectors |
| 33536 | */ | 33340 | */ |
| 33537 | #define CRC32_TEST_VECTORS 14 | ||
| 33538 | |||
| 33539 | static struct hash_testvec crc32_tv_template[] = { | 33341 | static struct hash_testvec crc32_tv_template[] = { |
| 33540 | { | 33342 | { |
| 33541 | .key = "\x87\xa9\xcb\xed", | 33343 | .key = "\x87\xa9\xcb\xed", |
| @@ -33968,8 +33770,6 @@ static struct hash_testvec crc32_tv_template[] = { | |||
| 33968 | /* | 33770 | /* |
| 33969 | * CRC32C test vectors | 33771 | * CRC32C test vectors |
| 33970 | */ | 33772 | */ |
| 33971 | #define CRC32C_TEST_VECTORS 15 | ||
| 33972 | |||
| 33973 | static struct hash_testvec crc32c_tv_template[] = { | 33773 | static struct hash_testvec crc32c_tv_template[] = { |
| 33974 | { | 33774 | { |
| 33975 | .psize = 0, | 33775 | .psize = 0, |
| @@ -34406,8 +34206,6 @@ static struct hash_testvec crc32c_tv_template[] = { | |||
| 34406 | /* | 34206 | /* |
| 34407 | * Blakcifn CRC test vectors | 34207 | * Blakcifn CRC test vectors |
| 34408 | */ | 34208 | */ |
| 34409 | #define BFIN_CRC_TEST_VECTORS 6 | ||
| 34410 | |||
| 34411 | static struct hash_testvec bfin_crc_tv_template[] = { | 34209 | static struct hash_testvec bfin_crc_tv_template[] = { |
| 34412 | { | 34210 | { |
| 34413 | .psize = 0, | 34211 | .psize = 0, |
| @@ -34493,69 +34291,125 @@ static struct hash_testvec bfin_crc_tv_template[] = { | |||
| 34493 | 34291 | ||
| 34494 | }; | 34292 | }; |
| 34495 | 34293 | ||
| 34496 | #define LZ4_COMP_TEST_VECTORS 1 | ||
| 34497 | #define LZ4_DECOMP_TEST_VECTORS 1 | ||
| 34498 | |||
| 34499 | static struct comp_testvec lz4_comp_tv_template[] = { | 34294 | static struct comp_testvec lz4_comp_tv_template[] = { |
| 34500 | { | 34295 | { |
| 34501 | .inlen = 70, | 34296 | .inlen = 255, |
| 34502 | .outlen = 45, | 34297 | .outlen = 218, |
| 34503 | .input = "Join us now and share the software " | 34298 | .input = "LZ4 is lossless compression algorithm, providing" |
| 34504 | "Join us now and share the software ", | 34299 | " compression speed at 400 MB/s per core, scalable " |
| 34505 | .output = "\xf0\x10\x4a\x6f\x69\x6e\x20\x75" | 34300 | "with multi-cores CPU. It features an extremely fast " |
| 34506 | "\x73\x20\x6e\x6f\x77\x20\x61\x6e" | 34301 | "decoder, with speed in multiple GB/s per core, " |
| 34507 | "\x64\x20\x73\x68\x61\x72\x65\x20" | 34302 | "typically reaching RAM speed limits on multi-core " |
| 34508 | "\x74\x68\x65\x20\x73\x6f\x66\x74" | 34303 | "systems.", |
| 34509 | "\x77\x0d\x00\x0f\x23\x00\x0b\x50" | 34304 | .output = "\xf9\x21\x4c\x5a\x34\x20\x69\x73\x20\x6c\x6f\x73\x73" |
| 34510 | "\x77\x61\x72\x65\x20", | 34305 | "\x6c\x65\x73\x73\x20\x63\x6f\x6d\x70\x72\x65\x73\x73" |
| 34306 | "\x69\x6f\x6e\x20\x61\x6c\x67\x6f\x72\x69\x74\x68\x6d" | ||
| 34307 | "\x2c\x20\x70\x72\x6f\x76\x69\x64\x69\x6e\x67\x21\x00" | ||
| 34308 | "\xf0\x21\x73\x70\x65\x65\x64\x20\x61\x74\x20\x34\x30" | ||
| 34309 | "\x30\x20\x4d\x42\x2f\x73\x20\x70\x65\x72\x20\x63\x6f" | ||
| 34310 | "\x72\x65\x2c\x20\x73\x63\x61\x6c\x61\x62\x6c\x65\x20" | ||
| 34311 | "\x77\x69\x74\x68\x20\x6d\x75\x6c\x74\x69\x2d\x1a\x00" | ||
| 34312 | "\xf0\x00\x73\x20\x43\x50\x55\x2e\x20\x49\x74\x20\x66" | ||
| 34313 | "\x65\x61\x74\x75\x11\x00\xf2\x0b\x61\x6e\x20\x65\x78" | ||
| 34314 | "\x74\x72\x65\x6d\x65\x6c\x79\x20\x66\x61\x73\x74\x20" | ||
| 34315 | "\x64\x65\x63\x6f\x64\x65\x72\x2c\x3d\x00\x02\x67\x00" | ||
| 34316 | "\x22\x69\x6e\x46\x00\x5a\x70\x6c\x65\x20\x47\x6c\x00" | ||
| 34317 | "\xf0\x00\x74\x79\x70\x69\x63\x61\x6c\x6c\x79\x20\x72" | ||
| 34318 | "\x65\x61\x63\x68\xa7\x00\x33\x52\x41\x4d\x38\x00\x83" | ||
| 34319 | "\x6c\x69\x6d\x69\x74\x73\x20\x6f\x3f\x00\x01\x85\x00" | ||
| 34320 | "\x90\x20\x73\x79\x73\x74\x65\x6d\x73\x2e", | ||
| 34321 | |||
| 34511 | }, | 34322 | }, |
| 34512 | }; | 34323 | }; |
| 34513 | 34324 | ||
| 34514 | static struct comp_testvec lz4_decomp_tv_template[] = { | 34325 | static struct comp_testvec lz4_decomp_tv_template[] = { |
| 34515 | { | 34326 | { |
| 34516 | .inlen = 45, | 34327 | .inlen = 218, |
| 34517 | .outlen = 70, | 34328 | .outlen = 255, |
| 34518 | .input = "\xf0\x10\x4a\x6f\x69\x6e\x20\x75" | 34329 | .input = "\xf9\x21\x4c\x5a\x34\x20\x69\x73\x20\x6c\x6f\x73\x73" |
| 34519 | "\x73\x20\x6e\x6f\x77\x20\x61\x6e" | 34330 | "\x6c\x65\x73\x73\x20\x63\x6f\x6d\x70\x72\x65\x73\x73" |
| 34520 | "\x64\x20\x73\x68\x61\x72\x65\x20" | 34331 | "\x69\x6f\x6e\x20\x61\x6c\x67\x6f\x72\x69\x74\x68\x6d" |
| 34521 | "\x74\x68\x65\x20\x73\x6f\x66\x74" | 34332 | "\x2c\x20\x70\x72\x6f\x76\x69\x64\x69\x6e\x67\x21\x00" |
| 34522 | "\x77\x0d\x00\x0f\x23\x00\x0b\x50" | 34333 | "\xf0\x21\x73\x70\x65\x65\x64\x20\x61\x74\x20\x34\x30" |
| 34523 | "\x77\x61\x72\x65\x20", | 34334 | "\x30\x20\x4d\x42\x2f\x73\x20\x70\x65\x72\x20\x63\x6f" |
| 34524 | .output = "Join us now and share the software " | 34335 | "\x72\x65\x2c\x20\x73\x63\x61\x6c\x61\x62\x6c\x65\x20" |
| 34525 | "Join us now and share the software ", | 34336 | "\x77\x69\x74\x68\x20\x6d\x75\x6c\x74\x69\x2d\x1a\x00" |
| 34337 | "\xf0\x00\x73\x20\x43\x50\x55\x2e\x20\x49\x74\x20\x66" | ||
| 34338 | "\x65\x61\x74\x75\x11\x00\xf2\x0b\x61\x6e\x20\x65\x78" | ||
| 34339 | "\x74\x72\x65\x6d\x65\x6c\x79\x20\x66\x61\x73\x74\x20" | ||
| 34340 | "\x64\x65\x63\x6f\x64\x65\x72\x2c\x3d\x00\x02\x67\x00" | ||
| 34341 | "\x22\x69\x6e\x46\x00\x5a\x70\x6c\x65\x20\x47\x6c\x00" | ||
| 34342 | "\xf0\x00\x74\x79\x70\x69\x63\x61\x6c\x6c\x79\x20\x72" | ||
| 34343 | "\x65\x61\x63\x68\xa7\x00\x33\x52\x41\x4d\x38\x00\x83" | ||
| 34344 | "\x6c\x69\x6d\x69\x74\x73\x20\x6f\x3f\x00\x01\x85\x00" | ||
| 34345 | "\x90\x20\x73\x79\x73\x74\x65\x6d\x73\x2e", | ||
| 34346 | .output = "LZ4 is lossless compression algorithm, providing" | ||
| 34347 | " compression speed at 400 MB/s per core, scalable " | ||
| 34348 | "with multi-cores CPU. It features an extremely fast " | ||
| 34349 | "decoder, with speed in multiple GB/s per core, " | ||
| 34350 | "typically reaching RAM speed limits on multi-core " | ||
| 34351 | "systems.", | ||
| 34526 | }, | 34352 | }, |
| 34527 | }; | 34353 | }; |
| 34528 | 34354 | ||
| 34529 | #define LZ4HC_COMP_TEST_VECTORS 1 | ||
| 34530 | #define LZ4HC_DECOMP_TEST_VECTORS 1 | ||
| 34531 | |||
| 34532 | static struct comp_testvec lz4hc_comp_tv_template[] = { | 34355 | static struct comp_testvec lz4hc_comp_tv_template[] = { |
| 34533 | { | 34356 | { |
| 34534 | .inlen = 70, | 34357 | .inlen = 255, |
| 34535 | .outlen = 45, | 34358 | .outlen = 216, |
| 34536 | .input = "Join us now and share the software " | 34359 | .input = "LZ4 is lossless compression algorithm, providing" |
| 34537 | "Join us now and share the software ", | 34360 | " compression speed at 400 MB/s per core, scalable " |
| 34538 | .output = "\xf0\x10\x4a\x6f\x69\x6e\x20\x75" | 34361 | "with multi-cores CPU. It features an extremely fast " |
| 34539 | "\x73\x20\x6e\x6f\x77\x20\x61\x6e" | 34362 | "decoder, with speed in multiple GB/s per core, " |
| 34540 | "\x64\x20\x73\x68\x61\x72\x65\x20" | 34363 | "typically reaching RAM speed limits on multi-core " |
| 34541 | "\x74\x68\x65\x20\x73\x6f\x66\x74" | 34364 | "systems.", |
| 34542 | "\x77\x0d\x00\x0f\x23\x00\x0b\x50" | 34365 | .output = "\xf9\x21\x4c\x5a\x34\x20\x69\x73\x20\x6c\x6f\x73\x73" |
| 34543 | "\x77\x61\x72\x65\x20", | 34366 | "\x6c\x65\x73\x73\x20\x63\x6f\x6d\x70\x72\x65\x73\x73" |
| 34367 | "\x69\x6f\x6e\x20\x61\x6c\x67\x6f\x72\x69\x74\x68\x6d" | ||
| 34368 | "\x2c\x20\x70\x72\x6f\x76\x69\x64\x69\x6e\x67\x21\x00" | ||
| 34369 | "\xf0\x21\x73\x70\x65\x65\x64\x20\x61\x74\x20\x34\x30" | ||
| 34370 | "\x30\x20\x4d\x42\x2f\x73\x20\x70\x65\x72\x20\x63\x6f" | ||
| 34371 | "\x72\x65\x2c\x20\x73\x63\x61\x6c\x61\x62\x6c\x65\x20" | ||
| 34372 | "\x77\x69\x74\x68\x20\x6d\x75\x6c\x74\x69\x2d\x1a\x00" | ||
| 34373 | "\xf0\x00\x73\x20\x43\x50\x55\x2e\x20\x49\x74\x20\x66" | ||
| 34374 | "\x65\x61\x74\x75\x11\x00\xf2\x0b\x61\x6e\x20\x65\x78" | ||
| 34375 | "\x74\x72\x65\x6d\x65\x6c\x79\x20\x66\x61\x73\x74\x20" | ||
| 34376 | "\x64\x65\x63\x6f\x64\x65\x72\x2c\x3d\x00\x02\x67\x00" | ||
| 34377 | "\x22\x69\x6e\x46\x00\x5a\x70\x6c\x65\x20\x47\x6c\x00" | ||
| 34378 | "\xf0\x00\x74\x79\x70\x69\x63\x61\x6c\x6c\x79\x20\x72" | ||
| 34379 | "\x65\x61\x63\x68\xa7\x00\x33\x52\x41\x4d\x38\x00\x97" | ||
| 34380 | "\x6c\x69\x6d\x69\x74\x73\x20\x6f\x6e\x85\x00\x90\x20" | ||
| 34381 | "\x73\x79\x73\x74\x65\x6d\x73\x2e", | ||
| 34382 | |||
| 34544 | }, | 34383 | }, |
| 34545 | }; | 34384 | }; |
| 34546 | 34385 | ||
| 34547 | static struct comp_testvec lz4hc_decomp_tv_template[] = { | 34386 | static struct comp_testvec lz4hc_decomp_tv_template[] = { |
| 34548 | { | 34387 | { |
| 34549 | .inlen = 45, | 34388 | .inlen = 216, |
| 34550 | .outlen = 70, | 34389 | .outlen = 255, |
| 34551 | .input = "\xf0\x10\x4a\x6f\x69\x6e\x20\x75" | 34390 | .input = "\xf9\x21\x4c\x5a\x34\x20\x69\x73\x20\x6c\x6f\x73\x73" |
| 34552 | "\x73\x20\x6e\x6f\x77\x20\x61\x6e" | 34391 | "\x6c\x65\x73\x73\x20\x63\x6f\x6d\x70\x72\x65\x73\x73" |
| 34553 | "\x64\x20\x73\x68\x61\x72\x65\x20" | 34392 | "\x69\x6f\x6e\x20\x61\x6c\x67\x6f\x72\x69\x74\x68\x6d" |
| 34554 | "\x74\x68\x65\x20\x73\x6f\x66\x74" | 34393 | "\x2c\x20\x70\x72\x6f\x76\x69\x64\x69\x6e\x67\x21\x00" |
| 34555 | "\x77\x0d\x00\x0f\x23\x00\x0b\x50" | 34394 | "\xf0\x21\x73\x70\x65\x65\x64\x20\x61\x74\x20\x34\x30" |
| 34556 | "\x77\x61\x72\x65\x20", | 34395 | "\x30\x20\x4d\x42\x2f\x73\x20\x70\x65\x72\x20\x63\x6f" |
| 34557 | .output = "Join us now and share the software " | 34396 | "\x72\x65\x2c\x20\x73\x63\x61\x6c\x61\x62\x6c\x65\x20" |
| 34558 | "Join us now and share the software ", | 34397 | "\x77\x69\x74\x68\x20\x6d\x75\x6c\x74\x69\x2d\x1a\x00" |
| 34398 | "\xf0\x00\x73\x20\x43\x50\x55\x2e\x20\x49\x74\x20\x66" | ||
| 34399 | "\x65\x61\x74\x75\x11\x00\xf2\x0b\x61\x6e\x20\x65\x78" | ||
| 34400 | "\x74\x72\x65\x6d\x65\x6c\x79\x20\x66\x61\x73\x74\x20" | ||
| 34401 | "\x64\x65\x63\x6f\x64\x65\x72\x2c\x3d\x00\x02\x67\x00" | ||
| 34402 | "\x22\x69\x6e\x46\x00\x5a\x70\x6c\x65\x20\x47\x6c\x00" | ||
| 34403 | "\xf0\x00\x74\x79\x70\x69\x63\x61\x6c\x6c\x79\x20\x72" | ||
| 34404 | "\x65\x61\x63\x68\xa7\x00\x33\x52\x41\x4d\x38\x00\x97" | ||
| 34405 | "\x6c\x69\x6d\x69\x74\x73\x20\x6f\x6e\x85\x00\x90\x20" | ||
| 34406 | "\x73\x79\x73\x74\x65\x6d\x73\x2e", | ||
| 34407 | .output = "LZ4 is lossless compression algorithm, providing" | ||
| 34408 | " compression speed at 400 MB/s per core, scalable " | ||
| 34409 | "with multi-cores CPU. It features an extremely fast " | ||
| 34410 | "decoder, with speed in multiple GB/s per core, " | ||
| 34411 | "typically reaching RAM speed limits on multi-core " | ||
| 34412 | "systems.", | ||
| 34559 | }, | 34413 | }, |
| 34560 | }; | 34414 | }; |
| 34561 | 34415 | ||
diff --git a/crypto/xts.c b/crypto/xts.c index 410a2e299085..baeb34dd8582 100644 --- a/crypto/xts.c +++ b/crypto/xts.c | |||
| @@ -463,6 +463,7 @@ static int create(struct crypto_template *tmpl, struct rtattr **tb) | |||
| 463 | struct xts_instance_ctx *ctx; | 463 | struct xts_instance_ctx *ctx; |
| 464 | struct skcipher_alg *alg; | 464 | struct skcipher_alg *alg; |
| 465 | const char *cipher_name; | 465 | const char *cipher_name; |
| 466 | u32 mask; | ||
| 466 | int err; | 467 | int err; |
| 467 | 468 | ||
| 468 | algt = crypto_get_attr_type(tb); | 469 | algt = crypto_get_attr_type(tb); |
| @@ -483,18 +484,19 @@ static int create(struct crypto_template *tmpl, struct rtattr **tb) | |||
| 483 | ctx = skcipher_instance_ctx(inst); | 484 | ctx = skcipher_instance_ctx(inst); |
| 484 | 485 | ||
| 485 | crypto_set_skcipher_spawn(&ctx->spawn, skcipher_crypto_instance(inst)); | 486 | crypto_set_skcipher_spawn(&ctx->spawn, skcipher_crypto_instance(inst)); |
| 486 | err = crypto_grab_skcipher(&ctx->spawn, cipher_name, 0, | 487 | |
| 487 | crypto_requires_sync(algt->type, | 488 | mask = crypto_requires_off(algt->type, algt->mask, |
| 488 | algt->mask)); | 489 | CRYPTO_ALG_NEED_FALLBACK | |
| 490 | CRYPTO_ALG_ASYNC); | ||
| 491 | |||
| 492 | err = crypto_grab_skcipher(&ctx->spawn, cipher_name, 0, mask); | ||
| 489 | if (err == -ENOENT) { | 493 | if (err == -ENOENT) { |
| 490 | err = -ENAMETOOLONG; | 494 | err = -ENAMETOOLONG; |
| 491 | if (snprintf(ctx->name, CRYPTO_MAX_ALG_NAME, "ecb(%s)", | 495 | if (snprintf(ctx->name, CRYPTO_MAX_ALG_NAME, "ecb(%s)", |
| 492 | cipher_name) >= CRYPTO_MAX_ALG_NAME) | 496 | cipher_name) >= CRYPTO_MAX_ALG_NAME) |
| 493 | goto err_free_inst; | 497 | goto err_free_inst; |
| 494 | 498 | ||
| 495 | err = crypto_grab_skcipher(&ctx->spawn, ctx->name, 0, | 499 | err = crypto_grab_skcipher(&ctx->spawn, ctx->name, 0, mask); |
| 496 | crypto_requires_sync(algt->type, | ||
| 497 | algt->mask)); | ||
| 498 | } | 500 | } |
| 499 | 501 | ||
| 500 | if (err) | 502 | if (err) |
