Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto update from Herbert Xu: "Here is the crypto update for 4.6: API: - Convert remaining crypto_hash users to shash or ahash, also convert blkcipher/ablkcipher users to skcipher. - Remove crypto_hash interface. - Remove crypto_pcomp interface. - Add crypto engine for async cipher drivers. - Add akcipher documentation. - Add skcipher documentation. Algorithms: - Rename crypto/crc32 to avoid name clash with lib/crc32. - Fix bug in keywrap where we zero the wrong pointer. Drivers: - Support T5/M5, T7/M7 SPARC CPUs in n2 hwrng driver. - Add PIC32 hwrng driver. - Support BCM6368 in bcm63xx hwrng driver. - Pack structs for 32-bit compat users in qat. - Use crypto engine in omap-aes. - Add support for sama5d2x SoCs in atmel-sha. - Make atmel-sha available again. - Make sahara hashing available again. - Make ccp hashing available again. - Make sha1-mb available again. - Add support for multiple devices in ccp. - Improve DMA performance in caam. - Add hashing support to rockchip" * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (116 commits) crypto: qat - remove redundant arbiter configuration crypto: ux500 - fix checks of error code returned by devm_ioremap_resource() crypto: atmel - fix checks of error code returned by devm_ioremap_resource() crypto: qat - Change the definition of icp_qat_uof_regtype hwrng: exynos - use __maybe_unused to hide pm functions crypto: ccp - Add abstraction for device-specific calls crypto: ccp - CCP versioning support crypto: ccp - Support for multiple CCPs crypto: ccp - Remove check for x86 family and model crypto: ccp - memset request context to zero during import lib/mpi: use "static inline" instead of "extern inline" lib/mpi: avoid assembler warning hwrng: bcm63xx - fix non device tree compatibility crypto: testmgr - allow rfc3686 aes-ctr variants in fips mode. crypto: qat - The AE id should be less than the maximal AE number lib/mpi: Endianness fix crypto: rockchip - add hash support for crypto engine in rk3288 crypto: xts - fix compile errors crypto: doc - add skcipher API documentation crypto: doc - update AEAD AD handling ...
This commit is contained in:
@@ -216,7 +216,7 @@ extern UDItype __udiv_qrnnd(UDItype *, UDItype, UDItype, UDItype);
|
||||
__asm__ ("%@ Inlined umul_ppmm\n" \
|
||||
"umull %r1, %r0, %r2, %r3" \
|
||||
: "=&r" ((USItype)(xh)), \
|
||||
"=r" ((USItype)(xl)) \
|
||||
"=&r" ((USItype)(xl)) \
|
||||
: "r" ((USItype)(a)), \
|
||||
"r" ((USItype)(b)) \
|
||||
: "r0", "r1")
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#define G10_MPI_INLINE_H
|
||||
|
||||
#ifndef G10_MPI_INLINE_DECL
|
||||
#define G10_MPI_INLINE_DECL extern inline
|
||||
#define G10_MPI_INLINE_DECL static inline
|
||||
#endif
|
||||
|
||||
G10_MPI_INLINE_DECL mpi_limb_t
|
||||
|
@@ -168,19 +168,19 @@ void mpi_rshift_limbs(MPI a, unsigned int count);
|
||||
int mpi_lshift_limbs(MPI a, unsigned int count);
|
||||
|
||||
/*-- mpihelp-add.c --*/
|
||||
mpi_limb_t mpihelp_add_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
|
||||
static inline mpi_limb_t mpihelp_add_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
|
||||
mpi_size_t s1_size, mpi_limb_t s2_limb);
|
||||
mpi_limb_t mpihelp_add_n(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
|
||||
mpi_ptr_t s2_ptr, mpi_size_t size);
|
||||
mpi_limb_t mpihelp_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
|
||||
static inline mpi_limb_t mpihelp_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
|
||||
mpi_ptr_t s2_ptr, mpi_size_t s2_size);
|
||||
|
||||
/*-- mpihelp-sub.c --*/
|
||||
mpi_limb_t mpihelp_sub_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
|
||||
static inline mpi_limb_t mpihelp_sub_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
|
||||
mpi_size_t s1_size, mpi_limb_t s2_limb);
|
||||
mpi_limb_t mpihelp_sub_n(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
|
||||
mpi_ptr_t s2_ptr, mpi_size_t size);
|
||||
mpi_limb_t mpihelp_sub(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
|
||||
static inline mpi_limb_t mpihelp_sub(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
|
||||
mpi_ptr_t s2_ptr, mpi_size_t s2_size);
|
||||
|
||||
/*-- mpihelp-cmp.c --*/
|
||||
|
@@ -128,6 +128,23 @@ leave:
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mpi_read_from_buffer);
|
||||
|
||||
static int count_lzeros(MPI a)
|
||||
{
|
||||
mpi_limb_t alimb;
|
||||
int i, lzeros = 0;
|
||||
|
||||
for (i = a->nlimbs - 1; i >= 0; i--) {
|
||||
alimb = a->d[i];
|
||||
if (alimb == 0) {
|
||||
lzeros += sizeof(mpi_limb_t);
|
||||
} else {
|
||||
lzeros += count_leading_zeros(alimb) / 8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return lzeros;
|
||||
}
|
||||
|
||||
/**
|
||||
* mpi_read_buffer() - read MPI to a bufer provided by user (msb first)
|
||||
*
|
||||
@@ -148,7 +165,7 @@ int mpi_read_buffer(MPI a, uint8_t *buf, unsigned buf_len, unsigned *nbytes,
|
||||
uint8_t *p;
|
||||
mpi_limb_t alimb;
|
||||
unsigned int n = mpi_get_size(a);
|
||||
int i, lzeros = 0;
|
||||
int i, lzeros;
|
||||
|
||||
if (!buf || !nbytes)
|
||||
return -EINVAL;
|
||||
@@ -156,14 +173,7 @@ int mpi_read_buffer(MPI a, uint8_t *buf, unsigned buf_len, unsigned *nbytes,
|
||||
if (sign)
|
||||
*sign = a->sign;
|
||||
|
||||
p = (void *)&a->d[a->nlimbs] - 1;
|
||||
|
||||
for (i = a->nlimbs * sizeof(alimb) - 1; i >= 0; i--, p--) {
|
||||
if (!*p)
|
||||
lzeros++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
lzeros = count_lzeros(a);
|
||||
|
||||
if (buf_len < n - lzeros) {
|
||||
*nbytes = n - lzeros;
|
||||
@@ -351,7 +361,7 @@ int mpi_write_to_sgl(MPI a, struct scatterlist *sgl, unsigned *nbytes,
|
||||
u8 *p, *p2;
|
||||
mpi_limb_t alimb, alimb2;
|
||||
unsigned int n = mpi_get_size(a);
|
||||
int i, x, y = 0, lzeros = 0, buf_len;
|
||||
int i, x, y = 0, lzeros, buf_len;
|
||||
|
||||
if (!nbytes)
|
||||
return -EINVAL;
|
||||
@@ -359,14 +369,7 @@ int mpi_write_to_sgl(MPI a, struct scatterlist *sgl, unsigned *nbytes,
|
||||
if (sign)
|
||||
*sign = a->sign;
|
||||
|
||||
p = (void *)&a->d[a->nlimbs] - 1;
|
||||
|
||||
for (i = a->nlimbs * sizeof(alimb) - 1; i >= 0; i--, p--) {
|
||||
if (!*p)
|
||||
lzeros++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
lzeros = count_lzeros(a);
|
||||
|
||||
if (*nbytes < n - lzeros) {
|
||||
*nbytes = n - lzeros;
|
||||
|
Reference in New Issue
Block a user