diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-10-03 03:20:00 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-10-03 03:20:00 +0200 |
commit | a538792c3f5a0eec31cb22e9e30b57272df601e5 (patch) | |
tree | 27a1d7017b04f5bc9fa455bcf17b2e51f02fa0fc /src/crypto/zinc/curve25519/curve25519-arm-glue.h | |
parent | 12ec009136ef4558741901643be60915947ebe99 (diff) |
curve25519-arm: use new simd api
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/crypto/zinc/curve25519/curve25519-arm-glue.h')
-rw-r--r-- | src/crypto/zinc/curve25519/curve25519-arm-glue.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/crypto/zinc/curve25519/curve25519-arm-glue.h b/src/crypto/zinc/curve25519/curve25519-arm-glue.h index 1e6769c..4f4c337 100644 --- a/src/crypto/zinc/curve25519/curve25519-arm-glue.h +++ b/src/crypto/zinc/curve25519/curve25519-arm-glue.h @@ -3,9 +3,9 @@ * Copyright (C) 2015-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. */ +#include <linux/simd.h> #include <asm/hwcap.h> #include <asm/neon.h> -#include <asm/simd.h> asmlinkage void curve25519_neon(u8 mypublic[CURVE25519_KEY_SIZE], const u8 secret[CURVE25519_KEY_SIZE], @@ -22,15 +22,18 @@ static inline bool curve25519_arch(u8 mypublic[CURVE25519_KEY_SIZE], const u8 secret[CURVE25519_KEY_SIZE], const u8 basepoint[CURVE25519_KEY_SIZE]) { + simd_context_t simd_context; + bool used_arch = false; + + simd_get(&simd_context); if (IS_ENABLED(CONFIG_KERNEL_MODE_NEON) && !IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) && curve25519_use_neon && - may_use_simd()) { - kernel_neon_begin(); + simd_use(&simd_context)) { curve25519_neon(mypublic, secret, basepoint); - kernel_neon_end(); - return true; + used_arch = true; } - return false; + simd_put(&simd_context); + return used_arch; } static inline bool curve25519_base_arch(u8 pub[CURVE25519_KEY_SIZE], |