mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
crypto: Deduplicate le32_to_cpu_array() and cpu_to_le32_array()
Deduplicate le32_to_cpu_array() and cpu_to_le32_array() by moving them to the generic header. No functional change implied. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
0550f5a5f0
commit
9def051018
17
crypto/md4.c
17
crypto/md4.c
@ -64,23 +64,6 @@ static inline u32 H(u32 x, u32 y, u32 z)
|
|||||||
#define ROUND2(a,b,c,d,k,s) (a = lshift(a + G(b,c,d) + k + (u32)0x5A827999,s))
|
#define ROUND2(a,b,c,d,k,s) (a = lshift(a + G(b,c,d) + k + (u32)0x5A827999,s))
|
||||||
#define ROUND3(a,b,c,d,k,s) (a = lshift(a + H(b,c,d) + k + (u32)0x6ED9EBA1,s))
|
#define ROUND3(a,b,c,d,k,s) (a = lshift(a + H(b,c,d) + k + (u32)0x6ED9EBA1,s))
|
||||||
|
|
||||||
/* XXX: this stuff can be optimized */
|
|
||||||
static inline void le32_to_cpu_array(u32 *buf, unsigned int words)
|
|
||||||
{
|
|
||||||
while (words--) {
|
|
||||||
__le32_to_cpus(buf);
|
|
||||||
buf++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void cpu_to_le32_array(u32 *buf, unsigned int words)
|
|
||||||
{
|
|
||||||
while (words--) {
|
|
||||||
__cpu_to_le32s(buf);
|
|
||||||
buf++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void md4_transform(u32 *hash, u32 const *in)
|
static void md4_transform(u32 *hash, u32 const *in)
|
||||||
{
|
{
|
||||||
u32 a, b, c, d;
|
u32 a, b, c, d;
|
||||||
|
17
crypto/md5.c
17
crypto/md5.c
@ -32,23 +32,6 @@ const u8 md5_zero_message_hash[MD5_DIGEST_SIZE] = {
|
|||||||
};
|
};
|
||||||
EXPORT_SYMBOL_GPL(md5_zero_message_hash);
|
EXPORT_SYMBOL_GPL(md5_zero_message_hash);
|
||||||
|
|
||||||
/* XXX: this stuff can be optimized */
|
|
||||||
static inline void le32_to_cpu_array(u32 *buf, unsigned int words)
|
|
||||||
{
|
|
||||||
while (words--) {
|
|
||||||
__le32_to_cpus(buf);
|
|
||||||
buf++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void cpu_to_le32_array(u32 *buf, unsigned int words)
|
|
||||||
{
|
|
||||||
while (words--) {
|
|
||||||
__cpu_to_le32s(buf);
|
|
||||||
buf++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define F1(x, y, z) (z ^ (x & (y ^ z)))
|
#define F1(x, y, z) (z ^ (x & (y ^ z)))
|
||||||
#define F2(x, y, z) F1(z, x, y)
|
#define F2(x, y, z) F1(z, x, y)
|
||||||
#define F3(x, y, z) (x ^ y ^ z)
|
#define F3(x, y, z) (x ^ y ^ z)
|
||||||
|
@ -156,6 +156,23 @@ static inline void le64_add_cpu(__le64 *var, u64 val)
|
|||||||
*var = cpu_to_le64(le64_to_cpu(*var) + val);
|
*var = cpu_to_le64(le64_to_cpu(*var) + val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* XXX: this stuff can be optimized */
|
||||||
|
static inline void le32_to_cpu_array(u32 *buf, unsigned int words)
|
||||||
|
{
|
||||||
|
while (words--) {
|
||||||
|
__le32_to_cpus(buf);
|
||||||
|
buf++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void cpu_to_le32_array(u32 *buf, unsigned int words)
|
||||||
|
{
|
||||||
|
while (words--) {
|
||||||
|
__cpu_to_le32s(buf);
|
||||||
|
buf++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline void be16_add_cpu(__be16 *var, u16 val)
|
static inline void be16_add_cpu(__be16 *var, u16 val)
|
||||||
{
|
{
|
||||||
*var = cpu_to_be16(be16_to_cpu(*var) + val);
|
*var = cpu_to_be16(be16_to_cpu(*var) + val);
|
||||||
|
Loading…
Reference in New Issue
Block a user