diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-06 23:15:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-06 23:15:06 -0400 |
commit | 81ff5d2cba4f86cd850b9ee4a530cd221ee45aa3 (patch) | |
tree | 532847c0823dc864e3aa9da6cde863e48157eafa /crypto/streebog_generic.c | |
parent | 7aefd944f038c7469571adb37769cb6f3924ecfa (diff) | |
parent | e59f755ceb6d6f39f90899d2a4e39c3e05837e12 (diff) |
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto update from Herbert Xu:
"API:
- Add support for AEAD in simd
- Add fuzz testing to testmgr
- Add panic_on_fail module parameter to testmgr
- Use per-CPU struct instead multiple variables in scompress
- Change verify API for akcipher
Algorithms:
- Convert x86 AEAD algorithms over to simd
- Forbid 2-key 3DES in FIPS mode
- Add EC-RDSA (GOST 34.10) algorithm
Drivers:
- Set output IV with ctr-aes in crypto4xx
- Set output IV in rockchip
- Fix potential length overflow with hashing in sun4i-ss
- Fix computation error with ctr in vmx
- Add SM4 protected keys support in ccree
- Remove long-broken mxc-scc driver
- Add rfc4106(gcm(aes)) cipher support in cavium/nitrox"
* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (179 commits)
crypto: ccree - use a proper le32 type for le32 val
crypto: ccree - remove set but not used variable 'du_size'
crypto: ccree - Make cc_sec_disable static
crypto: ccree - fix spelling mistake "protedcted" -> "protected"
crypto: caam/qi2 - generate hash keys in-place
crypto: caam/qi2 - fix DMA mapping of stack memory
crypto: caam/qi2 - fix zero-length buffer DMA mapping
crypto: stm32/cryp - update to return iv_out
crypto: stm32/cryp - remove request mutex protection
crypto: stm32/cryp - add weak key check for DES
crypto: atmel - remove set but not used variable 'alg_name'
crypto: picoxcell - Use dev_get_drvdata()
crypto: crypto4xx - get rid of redundant using_sd variable
crypto: crypto4xx - use sync skcipher for fallback
crypto: crypto4xx - fix cfb and ofb "overran dst buffer" issues
crypto: crypto4xx - fix ctr-aes missing output IV
crypto: ecrdsa - select ASN1 and OID_REGISTRY for EC-RDSA
crypto: ux500 - use ccflags-y instead of CFLAGS_<basename>.o
crypto: ccree - handle tee fips error during power management resume
crypto: ccree - add function to handle cryptocell tee fips error
...
Diffstat (limited to 'crypto/streebog_generic.c')
-rw-r--r-- | crypto/streebog_generic.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/crypto/streebog_generic.c b/crypto/streebog_generic.c index 5a2eafed9c29..63663c3bab7e 100644 --- a/crypto/streebog_generic.c +++ b/crypto/streebog_generic.c | |||
@@ -996,7 +996,7 @@ static void streebog_add512(const struct streebog_uint512 *x, | |||
996 | 996 | ||
997 | static void streebog_g(struct streebog_uint512 *h, | 997 | static void streebog_g(struct streebog_uint512 *h, |
998 | const struct streebog_uint512 *N, | 998 | const struct streebog_uint512 *N, |
999 | const u8 *m) | 999 | const struct streebog_uint512 *m) |
1000 | { | 1000 | { |
1001 | struct streebog_uint512 Ki, data; | 1001 | struct streebog_uint512 Ki, data; |
1002 | unsigned int i; | 1002 | unsigned int i; |
@@ -1005,7 +1005,7 @@ static void streebog_g(struct streebog_uint512 *h, | |||
1005 | 1005 | ||
1006 | /* Starting E() */ | 1006 | /* Starting E() */ |
1007 | Ki = data; | 1007 | Ki = data; |
1008 | streebog_xlps(&Ki, (const struct streebog_uint512 *)&m[0], &data); | 1008 | streebog_xlps(&Ki, m, &data); |
1009 | 1009 | ||
1010 | for (i = 0; i < 11; i++) | 1010 | for (i = 0; i < 11; i++) |
1011 | streebog_round(i, &Ki, &data); | 1011 | streebog_round(i, &Ki, &data); |
@@ -1015,16 +1015,19 @@ static void streebog_g(struct streebog_uint512 *h, | |||
1015 | /* E() done */ | 1015 | /* E() done */ |
1016 | 1016 | ||
1017 | streebog_xor(&data, h, &data); | 1017 | streebog_xor(&data, h, &data); |
1018 | streebog_xor(&data, (const struct streebog_uint512 *)&m[0], h); | 1018 | streebog_xor(&data, m, h); |
1019 | } | 1019 | } |
1020 | 1020 | ||
1021 | static void streebog_stage2(struct streebog_state *ctx, const u8 *data) | 1021 | static void streebog_stage2(struct streebog_state *ctx, const u8 *data) |
1022 | { | 1022 | { |
1023 | streebog_g(&ctx->h, &ctx->N, data); | 1023 | struct streebog_uint512 m; |
1024 | |||
1025 | memcpy(&m, data, sizeof(m)); | ||
1026 | |||
1027 | streebog_g(&ctx->h, &ctx->N, &m); | ||
1024 | 1028 | ||
1025 | streebog_add512(&ctx->N, &buffer512, &ctx->N); | 1029 | streebog_add512(&ctx->N, &buffer512, &ctx->N); |
1026 | streebog_add512(&ctx->Sigma, (const struct streebog_uint512 *)data, | 1030 | streebog_add512(&ctx->Sigma, &m, &ctx->Sigma); |
1027 | &ctx->Sigma); | ||
1028 | } | 1031 | } |
1029 | 1032 | ||
1030 | static void streebog_stage3(struct streebog_state *ctx) | 1033 | static void streebog_stage3(struct streebog_state *ctx) |
@@ -1034,13 +1037,11 @@ static void streebog_stage3(struct streebog_state *ctx) | |||
1034 | buf.qword[0] = cpu_to_le64(ctx->fillsize << 3); | 1037 | buf.qword[0] = cpu_to_le64(ctx->fillsize << 3); |
1035 | streebog_pad(ctx); | 1038 | streebog_pad(ctx); |
1036 | 1039 | ||
1037 | streebog_g(&ctx->h, &ctx->N, (const u8 *)&ctx->buffer); | 1040 | streebog_g(&ctx->h, &ctx->N, &ctx->m); |
1038 | streebog_add512(&ctx->N, &buf, &ctx->N); | 1041 | streebog_add512(&ctx->N, &buf, &ctx->N); |
1039 | streebog_add512(&ctx->Sigma, | 1042 | streebog_add512(&ctx->Sigma, &ctx->m, &ctx->Sigma); |
1040 | (const struct streebog_uint512 *)&ctx->buffer[0], | 1043 | streebog_g(&ctx->h, &buffer0, &ctx->N); |
1041 | &ctx->Sigma); | 1044 | streebog_g(&ctx->h, &buffer0, &ctx->Sigma); |
1042 | streebog_g(&ctx->h, &buffer0, (const u8 *)&ctx->N); | ||
1043 | streebog_g(&ctx->h, &buffer0, (const u8 *)&ctx->Sigma); | ||
1044 | memcpy(&ctx->hash, &ctx->h, sizeof(struct streebog_uint512)); | 1045 | memcpy(&ctx->hash, &ctx->h, sizeof(struct streebog_uint512)); |
1045 | } | 1046 | } |
1046 | 1047 | ||
@@ -1127,7 +1128,7 @@ static void __exit streebog_mod_fini(void) | |||
1127 | crypto_unregister_shashes(algs, ARRAY_SIZE(algs)); | 1128 | crypto_unregister_shashes(algs, ARRAY_SIZE(algs)); |
1128 | } | 1129 | } |
1129 | 1130 | ||
1130 | module_init(streebog_mod_init); | 1131 | subsys_initcall(streebog_mod_init); |
1131 | module_exit(streebog_mod_fini); | 1132 | module_exit(streebog_mod_fini); |
1132 | 1133 | ||
1133 | MODULE_LICENSE("GPL"); | 1134 | MODULE_LICENSE("GPL"); |