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.

lib/crypto: curve25519: Move a couple functions out-of-line

Move curve25519() and curve25519_generate_public() from curve25519.h to
curve25519.c. There's no good reason for them to be inline.

Link: https://lore.kernel.org/r/20250906213523.84915-10-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>

+36 -26
+3 -25
include/crypto/curve25519.h
··· 6 6 #ifndef CURVE25519_H 7 7 #define CURVE25519_H 8 8 9 - #include <crypto/algapi.h> // For crypto_memneq. 10 9 #include <linux/types.h> 11 10 #include <linux/random.h> 12 11 ··· 27 28 void curve25519_base_arch(u8 pub[CURVE25519_KEY_SIZE], 28 29 const u8 secret[CURVE25519_KEY_SIZE]); 29 30 30 - static inline 31 31 bool __must_check curve25519(u8 mypublic[CURVE25519_KEY_SIZE], 32 32 const u8 secret[CURVE25519_KEY_SIZE], 33 - const u8 basepoint[CURVE25519_KEY_SIZE]) 34 - { 35 - if (IS_ENABLED(CONFIG_CRYPTO_ARCH_HAVE_LIB_CURVE25519)) 36 - curve25519_arch(mypublic, secret, basepoint); 37 - else 38 - curve25519_generic(mypublic, secret, basepoint); 39 - return crypto_memneq(mypublic, curve25519_null_point, 40 - CURVE25519_KEY_SIZE); 41 - } 33 + const u8 basepoint[CURVE25519_KEY_SIZE]); 42 34 43 - static inline bool 44 - __must_check curve25519_generate_public(u8 pub[CURVE25519_KEY_SIZE], 45 - const u8 secret[CURVE25519_KEY_SIZE]) 46 - { 47 - if (unlikely(!crypto_memneq(secret, curve25519_null_point, 48 - CURVE25519_KEY_SIZE))) 49 - return false; 50 - 51 - if (IS_ENABLED(CONFIG_CRYPTO_ARCH_HAVE_LIB_CURVE25519)) 52 - curve25519_base_arch(pub, secret); 53 - else 54 - curve25519_generic(pub, secret, curve25519_base_point); 55 - return crypto_memneq(pub, curve25519_null_point, CURVE25519_KEY_SIZE); 56 - } 35 + bool __must_check curve25519_generate_public(u8 pub[CURVE25519_KEY_SIZE], 36 + const u8 secret[CURVE25519_KEY_SIZE]); 57 37 58 38 static inline void curve25519_clamp_secret(u8 secret[CURVE25519_KEY_SIZE]) 59 39 {
+33 -1
lib/crypto/curve25519.c
··· 10 10 */ 11 11 12 12 #include <crypto/curve25519.h> 13 - #include <linux/module.h> 13 + #include <crypto/utils.h> 14 + #include <linux/export.h> 14 15 #include <linux/init.h> 16 + #include <linux/module.h> 17 + 18 + bool __must_check 19 + curve25519(u8 mypublic[CURVE25519_KEY_SIZE], 20 + const u8 secret[CURVE25519_KEY_SIZE], 21 + const u8 basepoint[CURVE25519_KEY_SIZE]) 22 + { 23 + if (IS_ENABLED(CONFIG_CRYPTO_ARCH_HAVE_LIB_CURVE25519)) 24 + curve25519_arch(mypublic, secret, basepoint); 25 + else 26 + curve25519_generic(mypublic, secret, basepoint); 27 + return crypto_memneq(mypublic, curve25519_null_point, 28 + CURVE25519_KEY_SIZE); 29 + } 30 + EXPORT_SYMBOL(curve25519); 31 + 32 + bool __must_check 33 + curve25519_generate_public(u8 pub[CURVE25519_KEY_SIZE], 34 + const u8 secret[CURVE25519_KEY_SIZE]) 35 + { 36 + if (unlikely(!crypto_memneq(secret, curve25519_null_point, 37 + CURVE25519_KEY_SIZE))) 38 + return false; 39 + 40 + if (IS_ENABLED(CONFIG_CRYPTO_ARCH_HAVE_LIB_CURVE25519)) 41 + curve25519_base_arch(pub, secret); 42 + else 43 + curve25519_generic(pub, secret, curve25519_base_point); 44 + return crypto_memneq(pub, curve25519_null_point, CURVE25519_KEY_SIZE); 45 + } 46 + EXPORT_SYMBOL(curve25519_generate_public); 15 47 16 48 static int __init curve25519_init(void) 17 49 {