mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto updates from Herbert Xu: "API: - hwrng core now credits for low-quality RNG devices. Algorithms: - Optimisations for neon aes on arm/arm64. - Add accelerated crc32_be on arm64. - Add ffdheXYZ(dh) templates. - Disallow hmac keys < 112 bits in FIPS mode. - Add AVX assembly implementation for sm3 on x86. Drivers: - Add missing local_bh_disable calls for crypto_engine callback. - Ensure BH is disabled in crypto_engine callback path. - Fix zero length DMA mappings in ccree. - Add synchronization between mailbox accesses in octeontx2. - Add Xilinx SHA3 driver. - Add support for the TDES IP available on sama7g5 SoC in atmel" * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (137 commits) crypto: xilinx - Turn SHA into a tristate and allow COMPILE_TEST MAINTAINERS: update HPRE/SEC2/TRNG driver maintainers list crypto: dh - Remove the unused function dh_safe_prime_dh_alg() hwrng: nomadik - Change clk_disable to clk_disable_unprepare crypto: arm64 - cleanup comments crypto: qat - fix initialization of pfvf rts_map_msg structures crypto: qat - fix initialization of pfvf cap_msg structures crypto: qat - remove unneeded assignment crypto: qat - disable registration of algorithms crypto: hisilicon/qm - fix memset during queues clearing crypto: xilinx: prevent probing on non-xilinx hardware crypto: marvell/octeontx - Use swap() instead of open coding it crypto: ccree - Fix use after free in cc_cipher_exit() crypto: ccp - ccp_dmaengine_unregister release dma channels crypto: octeontx2 - fix missing unlock hwrng: cavium - fix NULL but dereferenced coccicheck error crypto: cavium/nitrox - don't cast parameter in bit operations crypto: vmx - add missing dependencies MAINTAINERS: Add maintainer for Xilinx ZynqMP SHA3 driver crypto: xilinx - Add Xilinx SHA3 driver ...
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include <crypto/algapi.h>
|
||||
#include <crypto/internal/simd.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/fips.h>
|
||||
@@ -21,6 +22,11 @@
|
||||
|
||||
static LIST_HEAD(crypto_template_list);
|
||||
|
||||
#ifdef CONFIG_CRYPTO_MANAGER_EXTRA_TESTS
|
||||
DEFINE_PER_CPU(bool, crypto_simd_disabled_for_test);
|
||||
EXPORT_PER_CPU_SYMBOL_GPL(crypto_simd_disabled_for_test);
|
||||
#endif
|
||||
|
||||
static inline void crypto_check_module_sig(struct module *mod)
|
||||
{
|
||||
if (fips_enabled && mod && !module_sig_ok(mod))
|
||||
@@ -322,9 +328,17 @@ void crypto_alg_tested(const char *name, int err)
|
||||
found:
|
||||
q->cra_flags |= CRYPTO_ALG_DEAD;
|
||||
alg = test->adult;
|
||||
if (err || list_empty(&alg->cra_list))
|
||||
|
||||
if (list_empty(&alg->cra_list))
|
||||
goto complete;
|
||||
|
||||
if (err == -ECANCELED)
|
||||
alg->cra_flags |= CRYPTO_ALG_FIPS_INTERNAL;
|
||||
else if (err)
|
||||
goto complete;
|
||||
else
|
||||
alg->cra_flags &= ~CRYPTO_ALG_FIPS_INTERNAL;
|
||||
|
||||
alg->cra_flags |= CRYPTO_ALG_TESTED;
|
||||
|
||||
/* Only satisfy larval waiters if we are the best. */
|
||||
@@ -604,6 +618,7 @@ int crypto_register_instance(struct crypto_template *tmpl,
|
||||
{
|
||||
struct crypto_larval *larval;
|
||||
struct crypto_spawn *spawn;
|
||||
u32 fips_internal = 0;
|
||||
int err;
|
||||
|
||||
err = crypto_check_alg(&inst->alg);
|
||||
@@ -626,11 +641,15 @@ int crypto_register_instance(struct crypto_template *tmpl,
|
||||
spawn->inst = inst;
|
||||
spawn->registered = true;
|
||||
|
||||
fips_internal |= spawn->alg->cra_flags;
|
||||
|
||||
crypto_mod_put(spawn->alg);
|
||||
|
||||
spawn = next;
|
||||
}
|
||||
|
||||
inst->alg.cra_flags |= (fips_internal & CRYPTO_ALG_FIPS_INTERNAL);
|
||||
|
||||
larval = __crypto_register_alg(&inst->alg);
|
||||
if (IS_ERR(larval))
|
||||
goto unlock;
|
||||
@@ -683,7 +702,8 @@ int crypto_grab_spawn(struct crypto_spawn *spawn, struct crypto_instance *inst,
|
||||
if (IS_ERR(name))
|
||||
return PTR_ERR(name);
|
||||
|
||||
alg = crypto_find_alg(name, spawn->frontend, type, mask);
|
||||
alg = crypto_find_alg(name, spawn->frontend,
|
||||
type | CRYPTO_ALG_FIPS_INTERNAL, mask);
|
||||
if (IS_ERR(alg))
|
||||
return PTR_ERR(alg);
|
||||
|
||||
@@ -1002,7 +1022,13 @@ void __crypto_xor(u8 *dst, const u8 *src1, const u8 *src2, unsigned int len)
|
||||
}
|
||||
|
||||
while (IS_ENABLED(CONFIG_64BIT) && len >= 8 && !(relalign & 7)) {
|
||||
*(u64 *)dst = *(u64 *)src1 ^ *(u64 *)src2;
|
||||
if (IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)) {
|
||||
u64 l = get_unaligned((u64 *)src1) ^
|
||||
get_unaligned((u64 *)src2);
|
||||
put_unaligned(l, (u64 *)dst);
|
||||
} else {
|
||||
*(u64 *)dst = *(u64 *)src1 ^ *(u64 *)src2;
|
||||
}
|
||||
dst += 8;
|
||||
src1 += 8;
|
||||
src2 += 8;
|
||||
@@ -1010,7 +1036,13 @@ void __crypto_xor(u8 *dst, const u8 *src1, const u8 *src2, unsigned int len)
|
||||
}
|
||||
|
||||
while (len >= 4 && !(relalign & 3)) {
|
||||
*(u32 *)dst = *(u32 *)src1 ^ *(u32 *)src2;
|
||||
if (IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)) {
|
||||
u32 l = get_unaligned((u32 *)src1) ^
|
||||
get_unaligned((u32 *)src2);
|
||||
put_unaligned(l, (u32 *)dst);
|
||||
} else {
|
||||
*(u32 *)dst = *(u32 *)src1 ^ *(u32 *)src2;
|
||||
}
|
||||
dst += 4;
|
||||
src1 += 4;
|
||||
src2 += 4;
|
||||
@@ -1018,7 +1050,13 @@ void __crypto_xor(u8 *dst, const u8 *src1, const u8 *src2, unsigned int len)
|
||||
}
|
||||
|
||||
while (len >= 2 && !(relalign & 1)) {
|
||||
*(u16 *)dst = *(u16 *)src1 ^ *(u16 *)src2;
|
||||
if (IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)) {
|
||||
u16 l = get_unaligned((u16 *)src1) ^
|
||||
get_unaligned((u16 *)src2);
|
||||
put_unaligned(l, (u16 *)dst);
|
||||
} else {
|
||||
*(u16 *)dst = *(u16 *)src1 ^ *(u16 *)src2;
|
||||
}
|
||||
dst += 2;
|
||||
src1 += 2;
|
||||
src2 += 2;
|
||||
|
Reference in New Issue
Block a user