From dc0b1d47274c5410f14d3a77103997ff8b03b000 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 3 Oct 2018 03:20:00 +0200 Subject: curve25519-arm: use new simd api --- src/crypto/zinc/curve25519/curve25519-arm-glue.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src') 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 . All Rights Reserved. */ +#include #include #include -#include 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], -- cgit v1.2.3-59-g8ed1b