Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v6.19-rc7 46 lines 1.4 kB view raw
1// SPDX-License-Identifier: GPL-2.0 OR MIT 2/* 3 * Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. 4 * 5 * Based on public domain code from Daniel J. Bernstein and Peter Schwabe. This 6 * began from SUPERCOP's curve25519/neon2/scalarmult.s, but has subsequently been 7 * manually reworked for use in kernel space. 8 */ 9 10#include <asm/hwcap.h> 11#include <asm/neon.h> 12#include <asm/simd.h> 13#include <crypto/internal/simd.h> 14#include <linux/types.h> 15#include <linux/jump_label.h> 16 17asmlinkage void curve25519_neon(u8 mypublic[CURVE25519_KEY_SIZE], 18 const u8 secret[CURVE25519_KEY_SIZE], 19 const u8 basepoint[CURVE25519_KEY_SIZE]); 20 21static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_neon); 22 23static void curve25519_arch(u8 out[CURVE25519_KEY_SIZE], 24 const u8 scalar[CURVE25519_KEY_SIZE], 25 const u8 point[CURVE25519_KEY_SIZE]) 26{ 27 if (static_branch_likely(&have_neon) && crypto_simd_usable()) { 28 scoped_ksimd() 29 curve25519_neon(out, scalar, point); 30 } else { 31 curve25519_generic(out, scalar, point); 32 } 33} 34 35static void curve25519_base_arch(u8 pub[CURVE25519_KEY_SIZE], 36 const u8 secret[CURVE25519_KEY_SIZE]) 37{ 38 curve25519_arch(pub, secret, curve25519_base_point); 39} 40 41#define curve25519_mod_init_arch curve25519_mod_init_arch 42static void curve25519_mod_init_arch(void) 43{ 44 if (elf_hwcap & HWCAP_NEON) 45 static_branch_enable(&have_neon); 46}