~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/crypto/internal/simd.h

Version: ~ [ linux-5.16 ] ~ [ linux-5.15.13 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.90 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.170 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.224 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.261 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.296 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.298 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * Shared crypto simd helpers
  4  */
  5 
  6 #ifndef _CRYPTO_INTERNAL_SIMD_H
  7 #define _CRYPTO_INTERNAL_SIMD_H
  8 
  9 #include <linux/percpu.h>
 10 #include <linux/types.h>
 11 
 12 /* skcipher support */
 13 
 14 struct simd_skcipher_alg;
 15 struct skcipher_alg;
 16 
 17 struct simd_skcipher_alg *simd_skcipher_create_compat(const char *algname,
 18                                                       const char *drvname,
 19                                                       const char *basename);
 20 struct simd_skcipher_alg *simd_skcipher_create(const char *algname,
 21                                                const char *basename);
 22 void simd_skcipher_free(struct simd_skcipher_alg *alg);
 23 
 24 int simd_register_skciphers_compat(struct skcipher_alg *algs, int count,
 25                                    struct simd_skcipher_alg **simd_algs);
 26 
 27 void simd_unregister_skciphers(struct skcipher_alg *algs, int count,
 28                                struct simd_skcipher_alg **simd_algs);
 29 
 30 /* AEAD support */
 31 
 32 struct simd_aead_alg;
 33 struct aead_alg;
 34 
 35 struct simd_aead_alg *simd_aead_create_compat(const char *algname,
 36                                               const char *drvname,
 37                                               const char *basename);
 38 struct simd_aead_alg *simd_aead_create(const char *algname,
 39                                        const char *basename);
 40 void simd_aead_free(struct simd_aead_alg *alg);
 41 
 42 int simd_register_aeads_compat(struct aead_alg *algs, int count,
 43                                struct simd_aead_alg **simd_algs);
 44 
 45 void simd_unregister_aeads(struct aead_alg *algs, int count,
 46                            struct simd_aead_alg **simd_algs);
 47 
 48 /*
 49  * crypto_simd_usable() - is it allowed at this time to use SIMD instructions or
 50  *                        access the SIMD register file?
 51  *
 52  * This delegates to may_use_simd(), except that this also returns false if SIMD
 53  * in crypto code has been temporarily disabled on this CPU by the crypto
 54  * self-tests, in order to test the no-SIMD fallback code.  This override is
 55  * currently limited to configurations where the extra self-tests are enabled,
 56  * because it might be a bit too invasive to be part of the regular self-tests.
 57  *
 58  * This is a macro so that <asm/simd.h>, which some architectures don't have,
 59  * doesn't have to be included directly here.
 60  */
 61 #ifdef CONFIG_CRYPTO_MANAGER_EXTRA_TESTS
 62 DECLARE_PER_CPU(bool, crypto_simd_disabled_for_test);
 63 #define crypto_simd_usable() \
 64         (may_use_simd() && !this_cpu_read(crypto_simd_disabled_for_test))
 65 #else
 66 #define crypto_simd_usable() may_use_simd()
 67 #endif
 68 
 69 #endif /* _CRYPTO_INTERNAL_SIMD_H */
 70 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp