aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_boot.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-04-05 14:36:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-05 14:36:31 -0400
commitea431793f198e26d1553f36ed8b5a830b531eee4 (patch)
treeb97d79adee8cef49c65b0be96aa38d17f4005e18 /kernel/trace/trace_boot.c
parent32fb6c17566ec66de87324a834c7776f40e35e78 (diff)
parent276e79ee6b3ff670dc9c041178da4b61af456a27 (diff)
Merge branch 'for-linus' of git://repo.or.cz/cris-mirror
* 'for-linus' of git://repo.or.cz/cris-mirror: CRISv32: Remove extraneous space between -I and the path. cris: convert obsolete hw_interrupt_type to struct irq_chip BUG to BUG_ON changes cpumask: use mm_cpumask() wrapper: cris cpumask: Use accessors code.: cris cpumask: prepare for iterators to only go to nr_cpu_ids/nr_cpumask_bits.: cris
Diffstat (limited to 'kernel/trace/trace_boot.c')
0 files changed, 0 insertions, 0 deletions
* under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * */ #include <linux/init.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/crypto.h> #include <linux/types.h> #include <crypto/algapi.h> #include <asm/byteorder.h> #define SALSA20_IV_SIZE 8U #define SALSA20_MIN_KEY_SIZE 16U #define SALSA20_MAX_KEY_SIZE 32U /* * Start of code taken from D. J. Bernstein's reference implementation. * With some modifications and optimizations made to suit our needs. */ /* salsa20-ref.c version 20051118 D. J. Bernstein Public domain. */ #define ROTATE(v,n) (((v) << (n)) | ((v) >> (32 - (n)))) #define XOR(v,w) ((v) ^ (w)) #define PLUS(v,w) (((v) + (w))) #define PLUSONE(v) (PLUS((v),1)) #define U32TO8_LITTLE(p, v) \ { (p)[0] = (v >> 0) & 0xff; (p)[1] = (v >> 8) & 0xff; \ (p)[2] = (v >> 16) & 0xff; (p)[3] = (v >> 24) & 0xff; } #define U8TO32_LITTLE(p) \ (((u32)((p)[0]) ) | ((u32)((p)[1]) << 8) | \ ((u32)((p)[2]) << 16) | ((u32)((p)[3]) << 24) ) struct salsa20_ctx { u32 input[16]; }; static void salsa20_wordtobyte(u8 output[64], const u32 input[16]) { u32 x[16]; int i; memcpy(x, input, sizeof(x)); for (i = 20; i > 0; i -= 2) { x[ 4] = XOR(x[ 4],ROTATE(PLUS(x[ 0],x[12]), 7)); x[ 8] = XOR(x[ 8],ROTATE(PLUS(x[ 4],x[ 0]), 9)); x[12] = XOR(x[12],ROTATE(PLUS(x[ 8],x[ 4]),13)); x[ 0] = XOR(x[ 0],ROTATE(PLUS(x[12],x[ 8]),18)); x[ 9] = XOR(x[ 9],ROTATE(PLUS(x[ 5],x[ 1]), 7)); x[13] = XOR(x[13],ROTATE(PLUS(x[ 9],x[ 5]), 9)); x[ 1] = XOR(x[ 1],ROTATE(PLUS(x[13],x[ 9]),13)); x[ 5] = XOR(x[ 5],ROTATE(PLUS(x[ 1],x[13]),18)); x[14] = XOR(x[14],ROTATE(PLUS(x[10],x[ 6]), 7)); x[ 2] = XOR(x[ 2],ROTATE(PLUS(x[14],x[10]), 9)); x[ 6] = XOR(x[ 6],ROTATE(PLUS(x[ 2],x[14]),13)); x[10] = XOR(x[10],ROTATE(PLUS(x[ 6],x[ 2]),18)); x[ 3] = XOR(x[ 3],ROTATE(PLUS(x[15],x[11]), 7)); x[ 7] = XOR(x[ 7],ROTATE(PLUS(x[ 3],x[15]), 9)); x[11] = XOR(x[11],ROTATE(PLUS(x[ 7],x[ 3]),13)); x[15] = XOR(x[15],ROTATE(PLUS(x[11],x[ 7]),18)); x[ 1] = XOR(x[ 1],ROTATE(PLUS(x[ 0],x[ 3]), 7)); x[ 2] = XOR(x[ 2],ROTATE(PLUS(x[ 1],x[ 0]), 9)); x[ 3] = XOR(x[ 3],ROTATE(PLUS(x[ 2],x[ 1]),13)); x[ 0] = XOR(x[ 0],ROTATE(PLUS(x[ 3],x[ 2]),18)); x[ 6] = XOR(x[ 6],ROTATE(PLUS(x[ 5],x[ 4]), 7)); x[ 7] = XOR(x[ 7],ROTATE(PLUS(x[ 6],x[ 5]), 9)); x[ 4] = XOR(x[ 4],ROTATE(PLUS(x[ 7],x[ 6]),13)); x[ 5] = XOR(x[ 5],ROTATE(PLUS(x[ 4],x[ 7]),18)); x[11] = XOR(x[11],ROTATE(PLUS(x[10],x[ 9]), 7)); x[ 8] = XOR(x[ 8],ROTATE(PLUS(x[11],x[10]), 9));