-static inline void __ctr_inc_byte(u8 *a, unsigned int size)
-{
- u8 *b = (a + size);
- u8 c;
-
- for (; size; size--) {
- c = *--b + 1;
- *b = c;
- if (c)
- break;
- }
-}
-
-static void ctr_inc_quad(u8 *a, unsigned int size)
-{
- __be32 *b = (__be32 *)(a + size);
- u32 c;
-
- for (; size >= 4; size -=4) {
- c = be32_to_cpu(*--b) + 1;
- *b = cpu_to_be32(c);
- if (c)
- return;
- }
-
- __ctr_inc_byte(a, size);
-}
-
-static void xor_byte(u8 *a, const u8 *b, unsigned int bs)
-{
- for (; bs; bs--)
- *a++ ^= *b++;
-}
-
-static void xor_quad(u8 *dst, const u8 *src, unsigned int bs)
-{
- u32 *a = (u32 *)dst;
- u32 *b = (u32 *)src;
-
- for (; bs >= 4; bs -= 4)
- *a++ ^= *b++;
-
- xor_byte((u8 *)a, (u8 *)b, bs);
-}
-