summaryrefslogtreecommitdiffstats
path: root/arch/arm/probes
AgeCommit message (Expand)Author
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500Thomas Gleixner
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174Thomas Gleixner
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 159Thomas Gleixner
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156Thomas Gleixner
2019-05-21treewide: Add SPDX license identifier - Makefile/KconfigThomas Gleixner
2019-02-12ARM: 8834/1: Fix: kprobes: optimized kprobes illegal instructionMathieu Desnoyers
2018-11-08ARM: 8806/1: kprobes: Fix false positive with FORTIFY_SOURCEKees Cook
2018-08-20Merge tag 'trace-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/rost...Linus Torvalds
2018-08-13Uprobe: Additional argument arch_uprobe to uprobe_write_opcode()Ravi Bangoria
2018-06-21kprobes/arm: Fix %p uses in error messagesMasami Hiramatsu
2018-06-21bpf/error-inject/kprobes: Clear current_kprobe and enable preempt in kprobeMasami Hiramatsu
2018-06-21ARM/kprobes: Don't call the ->break_handler() in arm kprobes codeMasami Hiramatsu
2018-06-21ARM/kprobes: Remove jprobe arm implementationMasami Hiramatsu
2018-06-12treewide: kmalloc() -> kmalloc_array()Kees Cook
2018-05-19ARM: 8770/1: kprobes: Prohibit probing on optimized_callbackMasami Hiramatsu
2018-05-19ARM: 8769/1: kprobes: Fix to use get_kprobe_ctlblk after irq-disabedMasami Hiramatsu
2017-12-17ARM: probes: avoid adding kprobes to sensitive kernel-entry/exit codeRussell King
2017-11-07arm/kprobes: Remove jprobe test caseMasami Hiramatsu
2017-11-07arm/kprobes: Fix kretprobe test to check correct counterMasami Hiramatsu
2017-11-02License cleanup: add SPDX GPL-2.0 license identifier to files with no licenseGreg Kroah-Hartman
2017-05-26arm: Prevent hotplug rwsem recursionThomas Gleixner
2017-03-21arm: kprobes: Align stack to 8-bytes in test codeJon Medhurst
2017-03-21arm: kprobes: Fix the return address of multiple kretprobesMasami Hiramatsu
2017-03-21arm: kprobes: Skip single-stepping in recursing path if possibleMasami Hiramatsu
2017-03-21arm: kprobes: Allow to handle reentered kprobe on single-steppingMasami Hiramatsu
2017-03-02sched/headers: Prepare for new header dependencies before moving code to <lin...Ingo Molnar
2017-03-02sched/headers: Prepare for new header dependencies before moving code to <lin...Ingo Molnar
2017-02-27kprobes: move kprobe declarations to asm-generic/kprobes.hLuis R. Rodriguez
2015-02-10ARM: kprobes: Fix compilation error caused by superfluous '*'Jon Medhurst
2015-01-20ARM: kprobes: Eliminate test code's use of BX instruction on ARMv4 CPUsJon Medhurst
2015-01-14ARM: optprobes: execute instruction during restoring if possible.Wang Nan
2015-01-13ARM: kprobes: check register usage for probed instruction.Wang Nan
2015-01-13ARM: kprobes: Fix unreliable MRS instruction testsJon Medhurst (Tixy)
2015-01-13ARM: kprobes: enable OPTPROBES for ARM 32Wang Nan
2015-01-13ARM: kprobes: Add test cases for stack consuming instructionsJon Medhurst (Tixy)
2015-01-13ARM: kprobes: disallow probing stack consuming instructionsWang Nan
2015-01-13ARM: kprobes: collects stack consumption for store instructionsWang Nan
2015-01-09ARM: kprobes: introduces checkerWang Nan
2015-01-09ARM: probes: Use correct action types for MOVW, SEV and WFIJon Medhurst
2015-01-09ARM: probes: move all probe code to dedicate directoryWang Nan
'#n321'>321 322 323
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Cryptographic API.
 *
 * RIPEMD-128 - RACE Integrity Primitives Evaluation Message Digest.
 *
 * Based on the reference implementation by Antoon Bosselaers, ESAT-COSIC
 *
 * Copyright (c) 2008 Adrian-Ken Rueegsegger <ken@codelabs.ch>
 */
#include <crypto/internal/hash.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/types.h>
#include <asm/byteorder.h>

#include "ripemd.h"

struct rmd128_ctx {
	u64 byte_count;
	u32 state[4];
	__le32 buffer[16];
};

#define K1  RMD_K1
#define K2  RMD_K2
#define K3  RMD_K3
#define K4  RMD_K4
#define KK1 RMD_K6
#define KK2 RMD_K7
#define KK3 RMD_K8
#define KK4 RMD_K1

#define F1(x, y, z) (x ^ y ^ z)		/* XOR */
#define F2(x, y, z) (z ^ (x & (y ^ z)))	/* x ? y : z */
#define F3(x, y, z) ((x | ~y) ^ z)
#define F4(x, y, z) (y ^ (z & (x ^ y)))	/* z ? x : y */

#define ROUND(a, b, c, d, f, k, x, s)  { \
	(a) += f((b), (c), (d)) + le32_to_cpup(&(x)) + (k);	\
	(a) = rol32((a), (s)); \
}

static void rmd128_transform(u32 *state, const __le32 *in)
{
	u32 aa, bb, cc, dd, aaa, bbb, ccc, ddd;

	/* Initialize left lane */
	aa = state[0];
	bb = state[1];
	cc = state[2];
	dd = state[3];

	/* Initialize right lane */
	aaa = state[0];
	bbb = state[1];
	ccc = state[2];
	ddd = state[3];

	/* round 1: left lane */
	ROUND(aa, bb, cc, dd, F1, K1, in[0],  11);
	ROUND(dd, aa, bb, cc, F1, K1, in[1],  14);
	ROUND(cc, dd, aa, bb, F1, K1, in[2],  15);
	ROUND(bb, cc, dd, aa, F1, K1, in[3],  12);
	ROUND(aa, bb, cc, dd, F1, K1, in[4],   5);
	ROUND(dd, aa, bb, cc, F1, K1, in[5],   8);
	ROUND(cc, dd, aa, bb, F1, K1, in[6],   7);
	ROUND(bb, cc, dd, aa, F1, K1, in[7],   9);
	ROUND(aa, bb, cc, dd, F1, K1, in[8],  11);
	ROUND(dd, aa, bb, cc, F1, K1, in[9],  13);
	ROUND(cc, dd, aa, bb, F1, K1, in[10], 14);
	ROUND(bb, cc, dd, aa, F1, K1, in[11], 15);
	ROUND(aa, bb, cc, dd, F1, K1, in[12],  6);
	ROUND(dd, aa, bb, cc, F1, K1, in[13],  7);
	ROUND(cc, dd, aa, bb, F1, K1, in[14],  9);
	ROUND(bb, cc, dd, aa, F1, K1, in[15],  8);

	/* round 2: left lane */
	ROUND(aa, bb, cc, dd, F2, K2, in[7],   7);
	ROUND(dd, aa, bb, cc, F2, K2, in[4],   6);
	ROUND(cc, dd, aa, bb, F2, K2, in[13],  8);
	ROUND(bb, cc, dd, aa, F2, K2, in[1],  13);
	ROUND(aa, bb, cc, dd, F2, K2, in[10], 11);
	ROUND(dd, aa, bb, cc, F2, K2, in[6],   9);
	ROUND(cc, dd, aa, bb, F2, K2, in[15],  7);
	ROUND(bb, cc, dd, aa, F2, K2, in[3],  15);
	ROUND(aa, bb, cc, dd, F2, K2, in[12],  7);
	ROUND(dd, aa, bb, cc, F2, K2, in[0],  12);
	ROUND(cc, dd, aa, bb, F2, K2, in[9],  15);
	ROUND(bb, cc, dd, aa, F2, K2, in[5],   9);
	ROUND(aa, bb, cc, dd, F2, K2, in[2],  11);
	ROUND(dd, aa, bb, cc, F2, K2, in[14],  7);
	ROUND(cc, dd, aa, bb, F2, K2, in[11], 13);
	ROUND(bb, cc, dd, aa, F2, K2, in[8],  12);

	/* round 3: left lane */
	ROUND(aa, bb, cc, dd, F3, K3, in[3],  11);
	ROUND(dd, aa, bb, cc, F3, K3, in[10], 13);
	ROUND(cc, dd, aa, bb, F3, K3, in[14],  6);
	ROUND(bb, cc, dd, aa, F3, K3, in[4],   7);
	ROUND(aa, bb, cc, dd, F3, K3, in[9],  14);
	ROUND(dd, aa, bb, cc, F3, K3, in[15],  9);
	ROUND(cc, dd, aa, bb, F3, K3, in[8],  13);
	ROUND(bb, cc, dd, aa, F3, K3, in[1],  15);
	ROUND(aa, bb, cc, dd, F3, K3, in[2],  14);
	ROUND(dd, aa, bb, cc, F3, K3, in[7],   8);
	ROUND(cc, dd, aa, bb, F3, K3, in[0],  13);
	ROUND(bb, cc, dd, aa, F3, K3, in[6],   6);
	ROUND(aa, bb, cc, dd, F3, K3, in[13],  5);
	ROUND(dd, aa, bb, cc, F3, K3, in[11], 12);
	ROUND(cc, dd, aa, bb, F3, K3, in[5],   7);
	ROUND(bb, cc, dd, aa, F3, K3, in[12],  5);

	/* round 4: left lane */
	ROUND(aa, bb, cc, dd, F4, K4, in[1],  11);
	ROUND(dd, aa, bb, cc, F4, K4, in[9],  12);
	ROUND(cc, dd, aa, bb, F4, K4, in[11], 14);
	ROUND(bb, cc, dd, aa, F4, K4, in[10], 15);
	ROUND(aa, bb, cc, dd, F4, K4, in[0],  14);
	ROUND(dd, aa, bb, cc, F4, K4, in[8],  15);
	ROUND(cc, dd, aa, bb, F4, K4, in[12],  9);
	ROUND(bb, cc, dd, aa, F4, K4, in[4],   8);
	ROUND(aa, bb, cc, dd, F4, K4, in[13],  9);
	ROUND(dd, aa, bb, cc, F4, K4, in[3],  14