• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# SPDX-License-Identifier: GPL-2.0
2#
3# Generic algorithms support
4#
5config XOR_BLOCKS
6	tristate
7
8#
9# async_tx api: hardware offloaded memory transfer/transform support
10#
11source "crypto/async_tx/Kconfig"
12
13#
14# Cryptographic API Configuration
15#
16menuconfig CRYPTO
17	tristate "Cryptographic API"
18	select CRYPTO_LIB_UTILS
19	help
20	  This option provides the core Cryptographic API.
21
22if CRYPTO
23
24menu "Crypto core or helper"
25
26config CRYPTO_FIPS
27	bool "FIPS 200 compliance"
28	depends on (CRYPTO_ANSI_CPRNG || CRYPTO_DRBG) && !CRYPTO_MANAGER_DISABLE_TESTS
29	depends on (MODULE_SIG || !MODULES)
30	help
31	  This option enables the fips boot option which is
32	  required if you want the system to operate in a FIPS 200
33	  certification.  You should say no unless you know what
34	  this is.
35
36config CRYPTO_FIPS_NAME
37	string "FIPS Module Name"
38	default "Linux Kernel Cryptographic API"
39	depends on CRYPTO_FIPS
40	help
41	  This option sets the FIPS Module name reported by the Crypto API via
42	  the /proc/sys/crypto/fips_name file.
43
44config CRYPTO_FIPS_CUSTOM_VERSION
45	bool "Use Custom FIPS Module Version"
46	depends on CRYPTO_FIPS
47	default n
48
49config CRYPTO_FIPS_VERSION
50	string "FIPS Module Version"
51	default "(none)"
52	depends on CRYPTO_FIPS_CUSTOM_VERSION
53	help
54	  This option provides the ability to override the FIPS Module Version.
55	  By default the KERNELRELEASE value is used.
56
57config CRYPTO_FIPS140_MOD
58	tristate "Enable FIPS 140 cryptographic module"
59	depends on ARM64
60	depends on CC_IS_CLANG
61	depends on m
62	select CRYPTO_FIPS140_MERGE_MOD_SECTIONS
63	help
64	  This option enables building a loadable module fips140.ko, which
65	  contains various crypto algorithms that are also built into vmlinux.
66	  At load time, this module overrides the built-in implementations of
67	  these algorithms with its implementations.  It also runs self-tests on
68	  these algorithms and verifies the integrity of its code and data.  If
69	  either of these steps fails, the kernel will panic.
70
71	  This module is intended to be loaded at early boot time in order to
72	  meet FIPS 140 and NIAP FPT_TST_EXT.1 requirements.  It shouldn't be
73	  used if you don't need to meet these requirements.
74
75config CRYPTO_FIPS140_MOD_EVAL_TESTING
76	bool "Enable evaluation testing features in FIPS 140 module"
77	depends on CRYPTO_FIPS140_MOD
78	help
79	  This option adds some features to the FIPS 140 module which are needed
80	  for lab evaluation testing of the module, e.g. support for injecting
81	  errors and support for a userspace interface to some of the module's
82	  services.  This option should not be enabled in production builds.
83
84config CRYPTO_FIPS140_MERGE_MOD_SECTIONS
85	bool
86	help
87	  This option causes the module linker script to place the delimeters
88	  of the text and rodata sections at the appropriate places so that
89	  the FIPS 140 integrity check can be performed. This option is required
90	  by the Crypto FIPS 140 module, and can be enabled by other FIPS 140
91	  modules using the same logic to perform the self integrity check.
92
93config CRYPTO_FIPS140_MOD_DEBUG_INTEGRITY_CHECK
94	bool "Debug the integrity check in FIPS 140 module"
95	depends on CRYPTO_FIPS140_MOD
96	help
97	  This option makes the FIPS 140 module provide debugfs files containing
98	  the text and rodata that were used for the integrity check, i.e. the
99	  runtime text and rodata with relocations and code patches unapplied.
100	  This option also makes the module load even if the integrity check
101	  fails so that these files can be used to debug the failure.  (A
102	  possible failure mode is that the kernel has added a new type of code
103	  patching and the module needs to be updated to disable or unapply it.)
104
105	  This option must not be enabled in production builds.
106
107	  Example commands for debugging an integrity check failure:
108
109		adb root
110		adb shell mount debugfs -t debugfs /sys/kernel/debug
111		adb shell cp /sys/kernel/debug/fips140/{text,rodata} /data/local/tmp/
112		adb pull /data/local/tmp/text text.checked
113		adb pull /data/local/tmp/rodata rodata.checked
114		llvm-objcopy -O binary --only-section=.text fips140.ko text.orig
115		llvm-objcopy -O binary --only-section=.rodata fips140.ko rodata.orig
116		for f in {text,rodata}.{orig,checked}; do xxd -g1 $f > $f.xxd; done
117		vimdiff text.{orig,checked}.xxd
118		vimdiff rodata.{orig,checked}.xxd
119
120config CRYPTO_ALGAPI
121	tristate
122	select CRYPTO_ALGAPI2
123	help
124	  This option provides the API for cryptographic algorithms.
125
126config CRYPTO_ALGAPI2
127	tristate
128
129config CRYPTO_AEAD
130	tristate
131	select CRYPTO_AEAD2
132	select CRYPTO_ALGAPI
133
134config CRYPTO_AEAD2
135	tristate
136	select CRYPTO_ALGAPI2
137
138config CRYPTO_SIG
139	tristate
140	select CRYPTO_SIG2
141	select CRYPTO_ALGAPI
142
143config CRYPTO_SIG2
144	tristate
145	select CRYPTO_ALGAPI2
146
147config CRYPTO_SKCIPHER
148	tristate
149	select CRYPTO_SKCIPHER2
150	select CRYPTO_ALGAPI
151	select CRYPTO_ECB
152
153config CRYPTO_SKCIPHER2
154	tristate
155	select CRYPTO_ALGAPI2
156
157config CRYPTO_HASH
158	tristate
159	select CRYPTO_HASH2
160	select CRYPTO_ALGAPI
161
162config CRYPTO_HASH2
163	tristate
164	select CRYPTO_ALGAPI2
165
166config CRYPTO_RNG
167	tristate
168	select CRYPTO_RNG2
169	select CRYPTO_ALGAPI
170
171config CRYPTO_RNG2
172	tristate
173	select CRYPTO_ALGAPI2
174
175config CRYPTO_RNG_DEFAULT
176	tristate
177	select CRYPTO_DRBG_MENU
178
179config CRYPTO_AKCIPHER2
180	tristate
181	select CRYPTO_ALGAPI2
182
183config CRYPTO_AKCIPHER
184	tristate
185	select CRYPTO_AKCIPHER2
186	select CRYPTO_ALGAPI
187
188config CRYPTO_KPP2
189	tristate
190	select CRYPTO_ALGAPI2
191
192config CRYPTO_KPP
193	tristate
194	select CRYPTO_ALGAPI
195	select CRYPTO_KPP2
196
197config CRYPTO_ACOMP2
198	tristate
199	select CRYPTO_ALGAPI2
200	select SGL_ALLOC
201
202config CRYPTO_ACOMP
203	tristate
204	select CRYPTO_ALGAPI
205	select CRYPTO_ACOMP2
206
207config CRYPTO_MANAGER
208	tristate "Cryptographic algorithm manager"
209	select CRYPTO_MANAGER2
210	help
211	  Create default cryptographic template instantiations such as
212	  cbc(aes).
213
214config CRYPTO_MANAGER2
215	def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y)
216	select CRYPTO_ACOMP2
217	select CRYPTO_AEAD2
218	select CRYPTO_AKCIPHER2
219	select CRYPTO_SIG2
220	select CRYPTO_HASH2
221	select CRYPTO_KPP2
222	select CRYPTO_RNG2
223	select CRYPTO_SKCIPHER2
224
225config CRYPTO_USER
226	tristate "Userspace cryptographic algorithm configuration"
227	depends on NET
228	select CRYPTO_MANAGER
229	help
230	  Userspace configuration for cryptographic instantiations such as
231	  cbc(aes).
232
233config CRYPTO_MANAGER_DISABLE_TESTS
234	bool "Disable run-time self tests"
235	default y
236	help
237	  Disable run-time self tests that normally take place at
238	  algorithm registration.
239
240config CRYPTO_MANAGER_EXTRA_TESTS
241	bool "Enable extra run-time crypto self tests"
242	depends on DEBUG_KERNEL && !CRYPTO_MANAGER_DISABLE_TESTS && CRYPTO_MANAGER
243	help
244	  Enable extra run-time self tests of registered crypto algorithms,
245	  including randomized fuzz tests.
246
247	  This is intended for developer use only, as these tests take much
248	  longer to run than the normal self tests.
249
250config CRYPTO_NULL
251	tristate "Null algorithms"
252	select CRYPTO_NULL2
253	help
254	  These are 'Null' algorithms, used by IPsec, which do nothing.
255
256config CRYPTO_NULL2
257	tristate
258	select CRYPTO_ALGAPI2
259	select CRYPTO_SKCIPHER2
260	select CRYPTO_HASH2
261
262config CRYPTO_PCRYPT
263	tristate "Parallel crypto engine"
264	depends on SMP
265	select PADATA
266	select CRYPTO_MANAGER
267	select CRYPTO_AEAD
268	help
269	  This converts an arbitrary crypto algorithm into a parallel
270	  algorithm that executes in kernel threads.
271
272config CRYPTO_CRYPTD
273	tristate "Software async crypto daemon"
274	select CRYPTO_SKCIPHER
275	select CRYPTO_HASH
276	select CRYPTO_MANAGER
277	help
278	  This is a generic software asynchronous crypto daemon that
279	  converts an arbitrary synchronous software crypto algorithm
280	  into an asynchronous algorithm that executes in a kernel thread.
281
282config CRYPTO_AUTHENC
283	tristate "Authenc support"
284	select CRYPTO_AEAD
285	select CRYPTO_SKCIPHER
286	select CRYPTO_MANAGER
287	select CRYPTO_HASH
288	select CRYPTO_NULL
289	help
290	  Authenc: Combined mode wrapper for IPsec.
291
292	  This is required for IPSec ESP (XFRM_ESP).
293
294config CRYPTO_TEST
295	tristate "Testing module"
296	depends on m || EXPERT
297	select CRYPTO_MANAGER
298	help
299	  Quick & dirty crypto test module.
300
301config CRYPTO_SIMD
302	tristate
303	select CRYPTO_CRYPTD
304
305config CRYPTO_ENGINE
306	tristate
307
308endmenu
309
310menu "Public-key cryptography"
311
312config CRYPTO_RSA
313	tristate "RSA (Rivest-Shamir-Adleman)"
314	select CRYPTO_AKCIPHER
315	select CRYPTO_MANAGER
316	select MPILIB
317	select ASN1
318	help
319	  RSA (Rivest-Shamir-Adleman) public key algorithm (RFC8017)
320
321config CRYPTO_DH
322	tristate "DH (Diffie-Hellman)"
323	select CRYPTO_KPP
324	select MPILIB
325	help
326	  DH (Diffie-Hellman) key exchange algorithm
327
328config CRYPTO_DH_RFC7919_GROUPS
329	bool "RFC 7919 FFDHE groups"
330	depends on CRYPTO_DH
331	select CRYPTO_RNG_DEFAULT
332	help
333	  FFDHE (Finite-Field-based Diffie-Hellman Ephemeral) groups
334	  defined in RFC7919.
335
336	  Support these finite-field groups in DH key exchanges:
337	  - ffdhe2048, ffdhe3072, ffdhe4096, ffdhe6144, ffdhe8192
338
339	  If unsure, say N.
340
341config CRYPTO_ECC
342	tristate
343	select CRYPTO_RNG_DEFAULT
344
345config CRYPTO_ECDH
346	tristate "ECDH (Elliptic Curve Diffie-Hellman)"
347	select CRYPTO_ECC
348	select CRYPTO_KPP
349	help
350	  ECDH (Elliptic Curve Diffie-Hellman) key exchange algorithm
351	  using curves P-192, P-256, and P-384 (FIPS 186)
352
353config CRYPTO_ECDSA
354	tristate "ECDSA (Elliptic Curve Digital Signature Algorithm)"
355	select CRYPTO_ECC
356	select CRYPTO_AKCIPHER
357	select ASN1
358	help
359	  ECDSA (Elliptic Curve Digital Signature Algorithm) (FIPS 186,
360	  ISO/IEC 14888-3)
361	  using curves P-192, P-256, and P-384
362
363	  Only signature verification is implemented.
364
365config CRYPTO_ECRDSA
366	tristate "EC-RDSA (Elliptic Curve Russian Digital Signature Algorithm)"
367	select CRYPTO_ECC
368	select CRYPTO_AKCIPHER
369	select CRYPTO_STREEBOG
370	select OID_REGISTRY
371	select ASN1
372	help
373	  Elliptic Curve Russian Digital Signature Algorithm (GOST R 34.10-2012,
374	  RFC 7091, ISO/IEC 14888-3)
375
376	  One of the Russian cryptographic standard algorithms (called GOST
377	  algorithms). Only signature verification is implemented.
378
379config CRYPTO_CURVE25519
380	tristate "Curve25519"
381	select CRYPTO_KPP
382	select CRYPTO_LIB_CURVE25519_GENERIC
383	select CRYPTO_LIB_CURVE25519_INTERNAL
384	help
385	  Curve25519 elliptic curve (RFC7748)
386
387endmenu
388
389menu "Block ciphers"
390
391config CRYPTO_AES
392	tristate "AES (Advanced Encryption Standard)"
393	select CRYPTO_ALGAPI
394	select CRYPTO_LIB_AES
395	help
396	  AES cipher algorithms (Rijndael)(FIPS-197, ISO/IEC 18033-3)
397
398	  Rijndael appears to be consistently a very good performer in
399	  both hardware and software across a wide range of computing
400	  environments regardless of its use in feedback or non-feedback
401	  modes. Its key setup time is excellent, and its key agility is
402	  good. Rijndael's very low memory requirements make it very well
403	  suited for restricted-space environments, in which it also
404	  demonstrates excellent performance. Rijndael's operations are
405	  among the easiest to defend against power and timing attacks.
406
407	  The AES specifies three key sizes: 128, 192 and 256 bits
408
409config CRYPTO_AES_TI
410	tristate "AES (Advanced Encryption Standard) (fixed time)"
411	select CRYPTO_ALGAPI
412	select CRYPTO_LIB_AES
413	help
414	  AES cipher algorithms (Rijndael)(FIPS-197, ISO/IEC 18033-3)
415
416	  This is a generic implementation of AES that attempts to eliminate
417	  data dependent latencies as much as possible without affecting
418	  performance too much. It is intended for use by the generic CCM
419	  and GCM drivers, and other CTR or CMAC/XCBC based modes that rely
420	  solely on encryption (although decryption is supported as well, but
421	  with a more dramatic performance hit)
422
423	  Instead of using 16 lookup tables of 1 KB each, (8 for encryption and
424	  8 for decryption), this implementation only uses just two S-boxes of
425	  256 bytes each, and attempts to eliminate data dependent latencies by
426	  prefetching the entire table into the cache at the start of each
427	  block. Interrupts are also disabled to avoid races where cachelines
428	  are evicted when the CPU is interrupted to do something else.
429
430config CRYPTO_ANUBIS
431	tristate "Anubis"
432	depends on CRYPTO_USER_API_ENABLE_OBSOLETE
433	select CRYPTO_ALGAPI
434	help
435	  Anubis cipher algorithm
436
437	  Anubis is a variable key length cipher which can use keys from
438	  128 bits to 320 bits in length.  It was evaluated as a entrant
439	  in the NESSIE competition.
440
441	  See https://web.archive.org/web/20160606112246/http://www.larc.usp.br/~pbarreto/AnubisPage.html
442	  for further information.
443
444config CRYPTO_ARIA
445	tristate "ARIA"
446	select CRYPTO_ALGAPI
447	help
448	  ARIA cipher algorithm (RFC5794)
449
450	  ARIA is a standard encryption algorithm of the Republic of Korea.
451	  The ARIA specifies three key sizes and rounds.
452	  128-bit: 12 rounds.
453	  192-bit: 14 rounds.
454	  256-bit: 16 rounds.
455
456	  See:
457	  https://seed.kisa.or.kr/kisa/algorithm/EgovAriaInfo.do
458
459config CRYPTO_BLOWFISH
460	tristate "Blowfish"
461	select CRYPTO_ALGAPI
462	select CRYPTO_BLOWFISH_COMMON
463	help
464	  Blowfish cipher algorithm, by Bruce Schneier
465
466	  This is a variable key length cipher which can use keys from 32
467	  bits to 448 bits in length.  It's fast, simple and specifically
468	  designed for use on "large microprocessors".
469
470	  See https://www.schneier.com/blowfish.html for further information.
471
472config CRYPTO_BLOWFISH_COMMON
473	tristate
474	help
475	  Common parts of the Blowfish cipher algorithm shared by the
476	  generic c and the assembler implementations.
477
478config CRYPTO_CAMELLIA
479	tristate "Camellia"
480	select CRYPTO_ALGAPI
481	help
482	  Camellia cipher algorithms (ISO/IEC 18033-3)
483
484	  Camellia is a symmetric key block cipher developed jointly
485	  at NTT and Mitsubishi Electric Corporation.
486
487	  The Camellia specifies three key sizes: 128, 192 and 256 bits.
488
489	  See https://info.isl.ntt.co.jp/crypt/eng/camellia/ for further information.
490
491config CRYPTO_CAST_COMMON
492	tristate
493	help
494	  Common parts of the CAST cipher algorithms shared by the
495	  generic c and the assembler implementations.
496
497config CRYPTO_CAST5
498	tristate "CAST5 (CAST-128)"
499	select CRYPTO_ALGAPI
500	select CRYPTO_CAST_COMMON
501	help
502	  CAST5 (CAST-128) cipher algorithm (RFC2144, ISO/IEC 18033-3)
503
504config CRYPTO_CAST6
505	tristate "CAST6 (CAST-256)"
506	select CRYPTO_ALGAPI
507	select CRYPTO_CAST_COMMON
508	help
509	  CAST6 (CAST-256) encryption algorithm (RFC2612)
510
511config CRYPTO_DES
512	tristate "DES and Triple DES EDE"
513	select CRYPTO_ALGAPI
514	select CRYPTO_LIB_DES
515	help
516	  DES (Data Encryption Standard)(FIPS 46-2, ISO/IEC 18033-3) and
517	  Triple DES EDE (Encrypt/Decrypt/Encrypt) (FIPS 46-3, ISO/IEC 18033-3)
518	  cipher algorithms
519
520config CRYPTO_FCRYPT
521	tristate "FCrypt"
522	select CRYPTO_ALGAPI
523	select CRYPTO_SKCIPHER
524	help
525	  FCrypt algorithm used by RxRPC
526
527	  See https://ota.polyonymo.us/fcrypt-paper.txt
528
529config CRYPTO_KHAZAD
530	tristate "Khazad"
531	depends on CRYPTO_USER_API_ENABLE_OBSOLETE
532	select CRYPTO_ALGAPI
533	help
534	  Khazad cipher algorithm
535
536	  Khazad was a finalist in the initial NESSIE competition.  It is
537	  an algorithm optimized for 64-bit processors with good performance
538	  on 32-bit processors.  Khazad uses an 128 bit key size.
539
540	  See https://web.archive.org/web/20171011071731/http://www.larc.usp.br/~pbarreto/KhazadPage.html
541	  for further information.
542
543config CRYPTO_SEED
544	tristate "SEED"
545	depends on CRYPTO_USER_API_ENABLE_OBSOLETE
546	select CRYPTO_ALGAPI
547	help
548	  SEED cipher algorithm (RFC4269, ISO/IEC 18033-3)
549
550	  SEED is a 128-bit symmetric key block cipher that has been
551	  developed by KISA (Korea Information Security Agency) as a
552	  national standard encryption algorithm of the Republic of Korea.
553	  It is a 16 round block cipher with the key size of 128 bit.
554
555	  See https://seed.kisa.or.kr/kisa/algorithm/EgovSeedInfo.do
556	  for further information.
557
558config CRYPTO_SERPENT
559	tristate "Serpent"
560	select CRYPTO_ALGAPI
561	help
562	  Serpent cipher algorithm, by Anderson, Biham & Knudsen
563
564	  Keys are allowed to be from 0 to 256 bits in length, in steps
565	  of 8 bits.
566
567	  See https://www.cl.cam.ac.uk/~rja14/serpent.html for further information.
568
569config CRYPTO_SM4
570	tristate
571
572config CRYPTO_SM4_GENERIC
573	tristate "SM4 (ShangMi 4)"
574	select CRYPTO_ALGAPI
575	select CRYPTO_SM4
576	help
577	  SM4 cipher algorithms (OSCCA GB/T 32907-2016,
578	  ISO/IEC 18033-3:2010/Amd 1:2021)
579
580	  SM4 (GBT.32907-2016) is a cryptographic standard issued by the
581	  Organization of State Commercial Administration of China (OSCCA)
582	  as an authorized cryptographic algorithms for the use within China.
583
584	  SMS4 was originally created for use in protecting wireless
585	  networks, and is mandated in the Chinese National Standard for
586	  Wireless LAN WAPI (Wired Authentication and Privacy Infrastructure)
587	  (GB.15629.11-2003).
588
589	  The latest SM4 standard (GBT.32907-2016) was proposed by OSCCA and
590	  standardized through TC 260 of the Standardization Administration
591	  of the People's Republic of China (SAC).
592
593	  The input, output, and key of SMS4 are each 128 bits.
594
595	  See https://eprint.iacr.org/2008/329.pdf for further information.
596
597	  If unsure, say N.
598
599config CRYPTO_TEA
600	tristate "TEA, XTEA and XETA"
601	depends on CRYPTO_USER_API_ENABLE_OBSOLETE
602	select CRYPTO_ALGAPI
603	help
604	  TEA (Tiny Encryption Algorithm) cipher algorithms
605
606	  Tiny Encryption Algorithm is a simple cipher that uses
607	  many rounds for security.  It is very fast and uses
608	  little memory.
609
610	  Xtendend Tiny Encryption Algorithm is a modification to
611	  the TEA algorithm to address a potential key weakness
612	  in the TEA algorithm.
613
614	  Xtendend Encryption Tiny Algorithm is a mis-implementation
615	  of the XTEA algorithm for compatibility purposes.
616
617config CRYPTO_TWOFISH
618	tristate "Twofish"
619	select CRYPTO_ALGAPI
620	select CRYPTO_TWOFISH_COMMON
621	help
622	  Twofish cipher algorithm
623
624	  Twofish was submitted as an AES (Advanced Encryption Standard)
625	  candidate cipher by researchers at CounterPane Systems.  It is a
626	  16 round block cipher supporting key sizes of 128, 192, and 256
627	  bits.
628
629	  See https://www.schneier.com/twofish.html for further information.
630
631config CRYPTO_TWOFISH_COMMON
632	tristate
633	help
634	  Common parts of the Twofish cipher algorithm shared by the
635	  generic c and the assembler implementations.
636
637endmenu
638
639menu "Length-preserving ciphers and modes"
640
641config CRYPTO_ADIANTUM
642	tristate "Adiantum"
643	select CRYPTO_CHACHA20
644	select CRYPTO_LIB_POLY1305_GENERIC
645	select CRYPTO_NHPOLY1305
646	select CRYPTO_MANAGER
647	help
648	  Adiantum tweakable, length-preserving encryption mode
649
650	  Designed for fast and secure disk encryption, especially on
651	  CPUs without dedicated crypto instructions.  It encrypts
652	  each sector using the XChaCha12 stream cipher, two passes of
653	  an ε-almost-∆-universal hash function, and an invocation of
654	  the AES-256 block cipher on a single 16-byte block.  On CPUs
655	  without AES instructions, Adiantum is much faster than
656	  AES-XTS.
657
658	  Adiantum's security is provably reducible to that of its
659	  underlying stream and block ciphers, subject to a security
660	  bound.  Unlike XTS, Adiantum is a true wide-block encryption
661	  mode, so it actually provides an even stronger notion of
662	  security than XTS, subject to the security bound.
663
664	  If unsure, say N.
665
666config CRYPTO_ARC4
667	tristate "ARC4 (Alleged Rivest Cipher 4)"
668	depends on CRYPTO_USER_API_ENABLE_OBSOLETE
669	select CRYPTO_SKCIPHER
670	select CRYPTO_LIB_ARC4
671	help
672	  ARC4 cipher algorithm
673
674	  ARC4 is a stream cipher using keys ranging from 8 bits to 2048
675	  bits in length.  This algorithm is required for driver-based
676	  WEP, but it should not be for other purposes because of the
677	  weakness of the algorithm.
678
679config CRYPTO_CHACHA20
680	tristate "ChaCha"
681	select CRYPTO_LIB_CHACHA_GENERIC
682	select CRYPTO_LIB_CHACHA_INTERNAL
683	select CRYPTO_SKCIPHER
684	help
685	  The ChaCha20, XChaCha20, and XChaCha12 stream cipher algorithms
686
687	  ChaCha20 is a 256-bit high-speed stream cipher designed by Daniel J.
688	  Bernstein and further specified in RFC7539 for use in IETF protocols.
689	  This is the portable C implementation of ChaCha20.  See
690	  https://cr.yp.to/chacha/chacha-20080128.pdf for further information.
691
692	  XChaCha20 is the application of the XSalsa20 construction to ChaCha20
693	  rather than to Salsa20.  XChaCha20 extends ChaCha20's nonce length
694	  from 64 bits (or 96 bits using the RFC7539 convention) to 192 bits,
695	  while provably retaining ChaCha20's security.  See
696	  https://cr.yp.to/snuffle/xsalsa-20081128.pdf for further information.
697
698	  XChaCha12 is XChaCha20 reduced to 12 rounds, with correspondingly
699	  reduced security margin but increased performance.  It can be needed
700	  in some performance-sensitive scenarios.
701
702config CRYPTO_CBC
703	tristate "CBC (Cipher Block Chaining)"
704	select CRYPTO_SKCIPHER
705	select CRYPTO_MANAGER
706	help
707	  CBC (Cipher Block Chaining) mode (NIST SP800-38A)
708
709	  This block cipher mode is required for IPSec ESP (XFRM_ESP).
710
711config CRYPTO_CTR
712	tristate "CTR (Counter)"
713	select CRYPTO_SKCIPHER
714	select CRYPTO_MANAGER
715	help
716	  CTR (Counter) mode (NIST SP800-38A)
717
718config CRYPTO_CTS
719	tristate "CTS (Cipher Text Stealing)"
720	select CRYPTO_SKCIPHER
721	select CRYPTO_MANAGER
722	help
723	  CBC-CS3 variant of CTS (Cipher Text Stealing) (NIST
724	  Addendum to SP800-38A (October 2010))
725
726	  This mode is required for Kerberos gss mechanism support
727	  for AES encryption.
728
729config CRYPTO_ECB
730	tristate "ECB (Electronic Codebook)"
731	select CRYPTO_SKCIPHER2
732	select CRYPTO_MANAGER
733	help
734	  ECB (Electronic Codebook) mode (NIST SP800-38A)
735
736config CRYPTO_HCTR2
737	tristate "HCTR2"
738	select CRYPTO_XCTR
739	select CRYPTO_POLYVAL
740	select CRYPTO_MANAGER
741	help
742	  HCTR2 length-preserving encryption mode
743
744	  A mode for storage encryption that is efficient on processors with
745	  instructions to accelerate AES and carryless multiplication, e.g.
746	  x86 processors with AES-NI and CLMUL, and ARM processors with the
747	  ARMv8 crypto extensions.
748
749	  See https://eprint.iacr.org/2021/1441
750
751config CRYPTO_KEYWRAP
752	tristate "KW (AES Key Wrap)"
753	select CRYPTO_SKCIPHER
754	select CRYPTO_MANAGER
755	help
756	  KW (AES Key Wrap) authenticated encryption mode (NIST SP800-38F
757	  and RFC3394) without padding.
758
759config CRYPTO_LRW
760	tristate "LRW (Liskov Rivest Wagner)"
761	select CRYPTO_LIB_GF128MUL
762	select CRYPTO_SKCIPHER
763	select CRYPTO_MANAGER
764	select CRYPTO_ECB
765	help
766	  LRW (Liskov Rivest Wagner) mode
767
768	  A tweakable, non malleable, non movable
769	  narrow block cipher mode for dm-crypt.  Use it with cipher
770	  specification string aes-lrw-benbi, the key must be 256, 320 or 384.
771	  The first 128, 192 or 256 bits in the key are used for AES and the
772	  rest is used to tie each cipher block to its logical position.
773
774	  See https://people.csail.mit.edu/rivest/pubs/LRW02.pdf
775
776config CRYPTO_PCBC
777	tristate "PCBC (Propagating Cipher Block Chaining)"
778	select CRYPTO_SKCIPHER
779	select CRYPTO_MANAGER
780	help
781	  PCBC (Propagating Cipher Block Chaining) mode
782
783	  This block cipher mode is required for RxRPC.
784
785config CRYPTO_XCTR
786	tristate
787	select CRYPTO_SKCIPHER
788	select CRYPTO_MANAGER
789	help
790	  XCTR (XOR Counter) mode for HCTR2
791
792	  This blockcipher mode is a variant of CTR mode using XORs and little-endian
793	  addition rather than big-endian arithmetic.
794
795	  XCTR mode is used to implement HCTR2.
796
797config CRYPTO_XTS
798	tristate "XTS (XOR Encrypt XOR with ciphertext stealing)"
799	select CRYPTO_SKCIPHER
800	select CRYPTO_MANAGER
801	select CRYPTO_ECB
802	help
803	  XTS (XOR Encrypt XOR with ciphertext stealing) mode (NIST SP800-38E
804	  and IEEE 1619)
805
806	  Use with aes-xts-plain, key size 256, 384 or 512 bits. This
807	  implementation currently can't handle a sectorsize which is not a
808	  multiple of 16 bytes.
809
810config CRYPTO_NHPOLY1305
811	tristate
812	select CRYPTO_HASH
813	select CRYPTO_LIB_POLY1305_GENERIC
814
815endmenu
816
817menu "AEAD (authenticated encryption with associated data) ciphers"
818
819config CRYPTO_AEGIS128
820	tristate "AEGIS-128"
821	select CRYPTO_AEAD
822	select CRYPTO_AES  # for AES S-box tables
823	help
824	  AEGIS-128 AEAD algorithm
825
826config CRYPTO_AEGIS128_SIMD
827	bool "AEGIS-128 (arm NEON, arm64 NEON)"
828	depends on CRYPTO_AEGIS128 && ((ARM || ARM64) && KERNEL_MODE_NEON)
829	default y
830	help
831	  AEGIS-128 AEAD algorithm
832
833	  Architecture: arm or arm64 using:
834	  - NEON (Advanced SIMD) extension
835
836config CRYPTO_CHACHA20POLY1305
837	tristate "ChaCha20-Poly1305"
838	select CRYPTO_CHACHA20
839	select CRYPTO_POLY1305
840	select CRYPTO_AEAD
841	select CRYPTO_MANAGER
842	help
843	  ChaCha20 stream cipher and Poly1305 authenticator combined
844	  mode (RFC8439)
845
846config CRYPTO_CCM
847	tristate "CCM (Counter with Cipher Block Chaining-MAC)"
848	select CRYPTO_CTR
849	select CRYPTO_HASH
850	select CRYPTO_AEAD
851	select CRYPTO_MANAGER
852	help
853	  CCM (Counter with Cipher Block Chaining-Message Authentication Code)
854	  authenticated encryption mode (NIST SP800-38C)
855
856config CRYPTO_GCM
857	tristate "GCM (Galois/Counter Mode) and GMAC (GCM MAC)"
858	select CRYPTO_CTR
859	select CRYPTO_AEAD
860	select CRYPTO_GHASH
861	select CRYPTO_NULL
862	select CRYPTO_MANAGER
863	help
864	  GCM (Galois/Counter Mode) authenticated encryption mode and GMAC
865	  (GCM Message Authentication Code) (NIST SP800-38D)
866
867	  This is required for IPSec ESP (XFRM_ESP).
868
869config CRYPTO_GENIV
870	tristate
871	select CRYPTO_AEAD
872	select CRYPTO_NULL
873	select CRYPTO_MANAGER
874	select CRYPTO_RNG_DEFAULT
875
876config CRYPTO_SEQIV
877	tristate "Sequence Number IV Generator"
878	select CRYPTO_GENIV
879	help
880	  Sequence Number IV generator
881
882	  This IV generator generates an IV based on a sequence number by
883	  xoring it with a salt.  This algorithm is mainly useful for CTR.
884
885	  This is required for IPsec ESP (XFRM_ESP).
886
887config CRYPTO_ECHAINIV
888	tristate "Encrypted Chain IV Generator"
889	select CRYPTO_GENIV
890	help
891	  Encrypted Chain IV generator
892
893	  This IV generator generates an IV based on the encryption of
894	  a sequence number xored with a salt.  This is the default
895	  algorithm for CBC.
896
897config CRYPTO_ESSIV
898	tristate "Encrypted Salt-Sector IV Generator"
899	select CRYPTO_AUTHENC
900	help
901	  Encrypted Salt-Sector IV generator
902
903	  This IV generator is used in some cases by fscrypt and/or
904	  dm-crypt. It uses the hash of the block encryption key as the
905	  symmetric key for a block encryption pass applied to the input
906	  IV, making low entropy IV sources more suitable for block
907	  encryption.
908
909	  This driver implements a crypto API template that can be
910	  instantiated either as an skcipher or as an AEAD (depending on the
911	  type of the first template argument), and which defers encryption
912	  and decryption requests to the encapsulated cipher after applying
913	  ESSIV to the input IV. Note that in the AEAD case, it is assumed
914	  that the keys are presented in the same format used by the authenc
915	  template, and that the IV appears at the end of the authenticated
916	  associated data (AAD) region (which is how dm-crypt uses it.)
917
918	  Note that the use of ESSIV is not recommended for new deployments,
919	  and so this only needs to be enabled when interoperability with
920	  existing encrypted volumes of filesystems is required, or when
921	  building for a particular system that requires it (e.g., when
922	  the SoC in question has accelerated CBC but not XTS, making CBC
923	  combined with ESSIV the only feasible mode for h/w accelerated
924	  block encryption)
925
926endmenu
927
928menu "Hashes, digests, and MACs"
929
930config CRYPTO_BLAKE2B
931	tristate "BLAKE2b"
932	select CRYPTO_HASH
933	help
934	  BLAKE2b cryptographic hash function (RFC 7693)
935
936	  BLAKE2b is optimized for 64-bit platforms and can produce digests
937	  of any size between 1 and 64 bytes. The keyed hash is also implemented.
938
939	  This module provides the following algorithms:
940	  - blake2b-160
941	  - blake2b-256
942	  - blake2b-384
943	  - blake2b-512
944
945	  Used by the btrfs filesystem.
946
947	  See https://blake2.net for further information.
948
949config CRYPTO_CMAC
950	tristate "CMAC (Cipher-based MAC)"
951	select CRYPTO_HASH
952	select CRYPTO_MANAGER
953	help
954	  CMAC (Cipher-based Message Authentication Code) authentication
955	  mode (NIST SP800-38B and IETF RFC4493)
956
957config CRYPTO_GHASH
958	tristate "GHASH"
959	select CRYPTO_HASH
960	select CRYPTO_LIB_GF128MUL
961	help
962	  GCM GHASH function (NIST SP800-38D)
963
964config CRYPTO_HMAC
965	tristate "HMAC (Keyed-Hash MAC)"
966	select CRYPTO_HASH
967	select CRYPTO_MANAGER
968	help
969	  HMAC (Keyed-Hash Message Authentication Code) (FIPS 198 and
970	  RFC2104)
971
972	  This is required for IPsec AH (XFRM_AH) and IPsec ESP (XFRM_ESP).
973
974config CRYPTO_MD4
975	tristate "MD4"
976	select CRYPTO_HASH
977	help
978	  MD4 message digest algorithm (RFC1320)
979
980config CRYPTO_MD5
981	tristate "MD5"
982	select CRYPTO_HASH
983	help
984	  MD5 message digest algorithm (RFC1321)
985
986config CRYPTO_MICHAEL_MIC
987	tristate "Michael MIC"
988	select CRYPTO_HASH
989	help
990	  Michael MIC (Message Integrity Code) (IEEE 802.11i)
991
992	  Defined by the IEEE 802.11i TKIP (Temporal Key Integrity Protocol),
993	  known as WPA (Wif-Fi Protected Access).
994
995	  This algorithm is required for TKIP, but it should not be used for
996	  other purposes because of the weakness of the algorithm.
997
998config CRYPTO_POLYVAL
999	tristate
1000	select CRYPTO_HASH
1001	select CRYPTO_LIB_GF128MUL
1002	help
1003	  POLYVAL hash function for HCTR2
1004
1005	  This is used in HCTR2.  It is not a general-purpose
1006	  cryptographic hash function.
1007
1008config CRYPTO_POLY1305
1009	tristate "Poly1305"
1010	select CRYPTO_HASH
1011	select CRYPTO_LIB_POLY1305_GENERIC
1012	select CRYPTO_LIB_POLY1305_INTERNAL
1013	help
1014	  Poly1305 authenticator algorithm (RFC7539)
1015
1016	  Poly1305 is an authenticator algorithm designed by Daniel J. Bernstein.
1017	  It is used for the ChaCha20-Poly1305 AEAD, specified in RFC7539 for use
1018	  in IETF protocols. This is the portable C implementation of Poly1305.
1019
1020config CRYPTO_RMD160
1021	tristate "RIPEMD-160"
1022	select CRYPTO_HASH
1023	help
1024	  RIPEMD-160 hash function (ISO/IEC 10118-3)
1025
1026	  RIPEMD-160 is a 160-bit cryptographic hash function. It is intended
1027	  to be used as a secure replacement for the 128-bit hash functions
1028	  MD4, MD5 and its predecessor RIPEMD
1029	  (not to be confused with RIPEMD-128).
1030
1031	  Its speed is comparable to SHA-1 and there are no known attacks
1032	  against RIPEMD-160.
1033
1034	  Developed by Hans Dobbertin, Antoon Bosselaers and Bart Preneel.
1035	  See https://homes.esat.kuleuven.be/~bosselae/ripemd160.html
1036	  for further information.
1037
1038config CRYPTO_SHA1
1039	tristate "SHA-1"
1040	select CRYPTO_HASH
1041	select CRYPTO_LIB_SHA1
1042	help
1043	  SHA-1 secure hash algorithm (FIPS 180, ISO/IEC 10118-3)
1044
1045config CRYPTO_SHA256
1046	tristate "SHA-224 and SHA-256"
1047	select CRYPTO_HASH
1048	select CRYPTO_LIB_SHA256
1049	help
1050	  SHA-224 and SHA-256 secure hash algorithms (FIPS 180, ISO/IEC 10118-3)
1051
1052	  This is required for IPsec AH (XFRM_AH) and IPsec ESP (XFRM_ESP).
1053	  Used by the btrfs filesystem, Ceph, NFS, and SMB.
1054
1055config CRYPTO_SHA512
1056	tristate "SHA-384 and SHA-512"
1057	select CRYPTO_HASH
1058	help
1059	  SHA-384 and SHA-512 secure hash algorithms (FIPS 180, ISO/IEC 10118-3)
1060
1061config CRYPTO_SHA3
1062	tristate "SHA-3"
1063	select CRYPTO_HASH
1064	help
1065	  SHA-3 secure hash algorithms (FIPS 202, ISO/IEC 10118-3)
1066
1067config CRYPTO_SM3
1068	tristate
1069
1070config CRYPTO_SM3_GENERIC
1071	tristate "SM3 (ShangMi 3)"
1072	select CRYPTO_HASH
1073	select CRYPTO_SM3
1074	help
1075	  SM3 (ShangMi 3) secure hash function (OSCCA GM/T 0004-2012, ISO/IEC 10118-3)
1076
1077	  This is part of the Chinese Commercial Cryptography suite.
1078
1079	  References:
1080	  http://www.oscca.gov.cn/UpFile/20101222141857786.pdf
1081	  https://datatracker.ietf.org/doc/html/draft-shen-sm3-hash
1082
1083config CRYPTO_STREEBOG
1084	tristate "Streebog"
1085	select CRYPTO_HASH
1086	help
1087	  Streebog Hash Function (GOST R 34.11-2012, RFC 6986, ISO/IEC 10118-3)
1088
1089	  This is one of the Russian cryptographic standard algorithms (called
1090	  GOST algorithms). This setting enables two hash algorithms with
1091	  256 and 512 bits output.
1092
1093	  References:
1094	  https://tc26.ru/upload/iblock/fed/feddbb4d26b685903faa2ba11aea43f6.pdf
1095	  https://tools.ietf.org/html/rfc6986
1096
1097config CRYPTO_VMAC
1098	tristate "VMAC"
1099	select CRYPTO_HASH
1100	select CRYPTO_MANAGER
1101	help
1102	  VMAC is a message authentication algorithm designed for
1103	  very high speed on 64-bit architectures.
1104
1105	  See https://fastcrypto.org/vmac for further information.
1106
1107config CRYPTO_WP512
1108	tristate "Whirlpool"
1109	select CRYPTO_HASH
1110	help
1111	  Whirlpool hash function (ISO/IEC 10118-3)
1112
1113	  512, 384 and 256-bit hashes.
1114
1115	  Whirlpool-512 is part of the NESSIE cryptographic primitives.
1116
1117	  See https://web.archive.org/web/20171129084214/http://www.larc.usp.br/~pbarreto/WhirlpoolPage.html
1118	  for further information.
1119
1120config CRYPTO_XCBC
1121	tristate "XCBC-MAC (Extended Cipher Block Chaining MAC)"
1122	select CRYPTO_HASH
1123	select CRYPTO_MANAGER
1124	help
1125	  XCBC-MAC (Extended Cipher Block Chaining Message Authentication
1126	  Code) (RFC3566)
1127
1128config CRYPTO_XXHASH
1129	tristate "xxHash"
1130	select CRYPTO_HASH
1131	select XXHASH
1132	help
1133	  xxHash non-cryptographic hash algorithm
1134
1135	  Extremely fast, working at speeds close to RAM limits.
1136
1137	  Used by the btrfs filesystem.
1138
1139endmenu
1140
1141menu "CRCs (cyclic redundancy checks)"
1142
1143config CRYPTO_CRC32C
1144	tristate "CRC32c"
1145	select CRYPTO_HASH
1146	select CRC32
1147	help
1148	  CRC32c CRC algorithm with the iSCSI polynomial (RFC 3385 and RFC 3720)
1149
1150	  A 32-bit CRC (cyclic redundancy check) with a polynomial defined
1151	  by G. Castagnoli, S. Braeuer and M. Herrman in "Optimization of Cyclic
1152	  Redundancy-Check Codes with 24 and 32 Parity Bits", IEEE Transactions
1153	  on Communications, Vol. 41, No. 6, June 1993, selected for use with
1154	  iSCSI.
1155
1156	  Used by btrfs, ext4, jbd2, NVMeoF/TCP, and iSCSI.
1157
1158config CRYPTO_CRC32
1159	tristate "CRC32"
1160	select CRYPTO_HASH
1161	select CRC32
1162	help
1163	  CRC32 CRC algorithm (IEEE 802.3)
1164
1165	  Used by RoCEv2 and f2fs.
1166
1167config CRYPTO_CRCT10DIF
1168	tristate "CRCT10DIF"
1169	select CRYPTO_HASH
1170	help
1171	  CRC16 CRC algorithm used for the T10 (SCSI) Data Integrity Field (DIF)
1172
1173	  CRC algorithm used by the SCSI Block Commands standard.
1174
1175config CRYPTO_CRC64_ROCKSOFT
1176	tristate "CRC64 based on Rocksoft Model algorithm"
1177	depends on CRC64
1178	select CRYPTO_HASH
1179	help
1180	  CRC64 CRC algorithm based on the Rocksoft Model CRC Algorithm
1181
1182	  Used by the NVMe implementation of T10 DIF (BLK_DEV_INTEGRITY)
1183
1184	  See https://zlib.net/crc_v3.txt
1185
1186endmenu
1187
1188menu "Compression"
1189
1190config CRYPTO_DEFLATE
1191	tristate "Deflate"
1192	select CRYPTO_ALGAPI
1193	select CRYPTO_ACOMP2
1194	select ZLIB_INFLATE
1195	select ZLIB_DEFLATE
1196	help
1197	  Deflate compression algorithm (RFC1951)
1198
1199	  Used by IPSec with the IPCOMP protocol (RFC3173, RFC2394)
1200
1201config CRYPTO_LZO
1202	tristate "LZO"
1203	select CRYPTO_ALGAPI
1204	select CRYPTO_ACOMP2
1205	select LZO_COMPRESS
1206	select LZO_DECOMPRESS
1207	help
1208	  LZO compression algorithm
1209
1210	  See https://www.oberhumer.com/opensource/lzo/ for further information.
1211
1212config CRYPTO_842
1213	tristate "842"
1214	select CRYPTO_ALGAPI
1215	select CRYPTO_ACOMP2
1216	select 842_COMPRESS
1217	select 842_DECOMPRESS
1218	help
1219	  842 compression algorithm by IBM
1220
1221	  See https://github.com/plauth/lib842 for further information.
1222
1223config CRYPTO_LZ4
1224	tristate "LZ4"
1225	select CRYPTO_ALGAPI
1226	select CRYPTO_ACOMP2
1227	select LZ4_COMPRESS
1228	select LZ4_DECOMPRESS
1229	help
1230	  LZ4 compression algorithm
1231
1232	  See https://github.com/lz4/lz4 for further information.
1233
1234config CRYPTO_LZ4HC
1235	tristate "LZ4HC"
1236	select CRYPTO_ALGAPI
1237	select CRYPTO_ACOMP2
1238	select LZ4HC_COMPRESS
1239	select LZ4_DECOMPRESS
1240	help
1241	  LZ4 high compression mode algorithm
1242
1243	  See https://github.com/lz4/lz4 for further information.
1244
1245config CRYPTO_ZSTD
1246	tristate "Zstd"
1247	select CRYPTO_ALGAPI
1248	select CRYPTO_ACOMP2
1249	select ZSTD_COMPRESS
1250	select ZSTD_DECOMPRESS
1251	help
1252	  zstd compression algorithm
1253
1254	  See https://github.com/facebook/zstd for further information.
1255
1256endmenu
1257
1258menu "Random number generation"
1259
1260config CRYPTO_ANSI_CPRNG
1261	tristate "ANSI PRNG (Pseudo Random Number Generator)"
1262	select CRYPTO_AES
1263	select CRYPTO_RNG
1264	help
1265	  Pseudo RNG (random number generator) (ANSI X9.31 Appendix A.2.4)
1266
1267	  This uses the AES cipher algorithm.
1268
1269	  Note that this option must be enabled if CRYPTO_FIPS is selected
1270
1271menuconfig CRYPTO_DRBG_MENU
1272	tristate "NIST SP800-90A DRBG (Deterministic Random Bit Generator)"
1273	help
1274	  DRBG (Deterministic Random Bit Generator) (NIST SP800-90A)
1275
1276	  In the following submenu, one or more of the DRBG types must be selected.
1277
1278if CRYPTO_DRBG_MENU
1279
1280config CRYPTO_DRBG_HMAC
1281	bool
1282	default y
1283	select CRYPTO_HMAC
1284	select CRYPTO_SHA512
1285
1286config CRYPTO_DRBG_HASH
1287	bool "Hash_DRBG"
1288	select CRYPTO_SHA256
1289	help
1290	  Hash_DRBG variant as defined in NIST SP800-90A.
1291
1292	  This uses the SHA-1, SHA-256, SHA-384, or SHA-512 hash algorithms.
1293
1294config CRYPTO_DRBG_CTR
1295	bool "CTR_DRBG"
1296	select CRYPTO_AES
1297	select CRYPTO_CTR
1298	help
1299	  CTR_DRBG variant as defined in NIST SP800-90A.
1300
1301	  This uses the AES cipher algorithm with the counter block mode.
1302
1303config CRYPTO_DRBG
1304	tristate
1305	default CRYPTO_DRBG_MENU
1306	select CRYPTO_RNG
1307	select CRYPTO_JITTERENTROPY
1308
1309endif	# if CRYPTO_DRBG_MENU
1310
1311config CRYPTO_JITTERENTROPY
1312	tristate "CPU Jitter Non-Deterministic RNG (Random Number Generator)"
1313	select CRYPTO_RNG
1314	select CRYPTO_SHA3
1315	help
1316	  CPU Jitter RNG (Random Number Generator) from the Jitterentropy library
1317
1318	  A non-physical non-deterministic ("true") RNG (e.g., an entropy source
1319	  compliant with NIST SP800-90B) intended to provide a seed to a
1320	  deterministic RNG (e.g., per NIST SP800-90C).
1321	  This RNG does not perform any cryptographic whitening of the generated
1322	  random numbers.
1323
1324	  See https://www.chronox.de/jent/
1325
1326if CRYPTO_JITTERENTROPY
1327if CRYPTO_FIPS && EXPERT
1328
1329choice
1330	prompt "CPU Jitter RNG Memory Size"
1331	default CRYPTO_JITTERENTROPY_MEMSIZE_2
1332	help
1333	  The Jitter RNG measures the execution time of memory accesses.
1334	  Multiple consecutive memory accesses are performed. If the memory
1335	  size fits into a cache (e.g. L1), only the memory access timing
1336	  to that cache is measured. The closer the cache is to the CPU
1337	  the less variations are measured and thus the less entropy is
1338	  obtained. Thus, if the memory size fits into the L1 cache, the
1339	  obtained entropy is less than if the memory size fits within
1340	  L1 + L2, which in turn is less if the memory fits into
1341	  L1 + L2 + L3. Thus, by selecting a different memory size,
1342	  the entropy rate produced by the Jitter RNG can be modified.
1343
1344	config CRYPTO_JITTERENTROPY_MEMSIZE_2
1345		bool "2048 Bytes (default)"
1346
1347	config CRYPTO_JITTERENTROPY_MEMSIZE_128
1348		bool "128 kBytes"
1349
1350	config CRYPTO_JITTERENTROPY_MEMSIZE_1024
1351		bool "1024 kBytes"
1352
1353	config CRYPTO_JITTERENTROPY_MEMSIZE_8192
1354		bool "8192 kBytes"
1355endchoice
1356
1357config CRYPTO_JITTERENTROPY_MEMORY_BLOCKS
1358	int
1359	default 64 if CRYPTO_JITTERENTROPY_MEMSIZE_2
1360	default 512 if CRYPTO_JITTERENTROPY_MEMSIZE_128
1361	default 1024 if CRYPTO_JITTERENTROPY_MEMSIZE_1024
1362	default 4096 if CRYPTO_JITTERENTROPY_MEMSIZE_8192
1363
1364config CRYPTO_JITTERENTROPY_MEMORY_BLOCKSIZE
1365	int
1366	default 32 if CRYPTO_JITTERENTROPY_MEMSIZE_2
1367	default 256 if CRYPTO_JITTERENTROPY_MEMSIZE_128
1368	default 1024 if CRYPTO_JITTERENTROPY_MEMSIZE_1024
1369	default 2048 if CRYPTO_JITTERENTROPY_MEMSIZE_8192
1370
1371config CRYPTO_JITTERENTROPY_OSR
1372	int "CPU Jitter RNG Oversampling Rate"
1373	range 1 15
1374	default 3
1375	help
1376	  The Jitter RNG allows the specification of an oversampling rate (OSR).
1377	  The Jitter RNG operation requires a fixed amount of timing
1378	  measurements to produce one output block of random numbers. The
1379	  OSR value is multiplied with the amount of timing measurements to
1380	  generate one output block. Thus, the timing measurement is oversampled
1381	  by the OSR factor. The oversampling allows the Jitter RNG to operate
1382	  on hardware whose timers deliver limited amount of entropy (e.g.
1383	  the timer is coarse) by setting the OSR to a higher value. The
1384	  trade-off, however, is that the Jitter RNG now requires more time
1385	  to generate random numbers.
1386
1387config CRYPTO_JITTERENTROPY_TESTINTERFACE
1388	bool "CPU Jitter RNG Test Interface"
1389	help
1390	  The test interface allows a privileged process to capture
1391	  the raw unconditioned high resolution time stamp noise that
1392	  is collected by the Jitter RNG for statistical analysis. As
1393	  this data is used at the same time to generate random bits,
1394	  the Jitter RNG operates in an insecure mode as long as the
1395	  recording is enabled. This interface therefore is only
1396	  intended for testing purposes and is not suitable for
1397	  production systems.
1398
1399	  The raw noise data can be obtained using the jent_raw_hires
1400	  debugfs file. Using the option
1401	  jitterentropy_testing.boot_raw_hires_test=1 the raw noise of
1402	  the first 1000 entropy events since boot can be sampled.
1403
1404	  If unsure, select N.
1405
1406endif	# if CRYPTO_FIPS && EXPERT
1407
1408if !(CRYPTO_FIPS && EXPERT)
1409
1410config CRYPTO_JITTERENTROPY_MEMORY_BLOCKS
1411	int
1412	default 64
1413
1414config CRYPTO_JITTERENTROPY_MEMORY_BLOCKSIZE
1415	int
1416	default 32
1417
1418config CRYPTO_JITTERENTROPY_OSR
1419	int
1420	default 1
1421
1422config CRYPTO_JITTERENTROPY_TESTINTERFACE
1423	bool
1424
1425endif	# if !(CRYPTO_FIPS && EXPERT)
1426endif	# if CRYPTO_JITTERENTROPY
1427
1428config CRYPTO_KDF800108_CTR
1429	tristate
1430	select CRYPTO_HMAC
1431	select CRYPTO_SHA256
1432
1433endmenu
1434menu "Userspace interface"
1435
1436config CRYPTO_USER_API
1437	tristate
1438
1439config CRYPTO_USER_API_HASH
1440	tristate "Hash algorithms"
1441	depends on NET
1442	select CRYPTO_HASH
1443	select CRYPTO_USER_API
1444	help
1445	  Enable the userspace interface for hash algorithms.
1446
1447	  See Documentation/crypto/userspace-if.rst and
1448	  https://www.chronox.de/libkcapi/html/index.html
1449
1450config CRYPTO_USER_API_SKCIPHER
1451	tristate "Symmetric key cipher algorithms"
1452	depends on NET
1453	select CRYPTO_SKCIPHER
1454	select CRYPTO_USER_API
1455	help
1456	  Enable the userspace interface for symmetric key cipher algorithms.
1457
1458	  See Documentation/crypto/userspace-if.rst and
1459	  https://www.chronox.de/libkcapi/html/index.html
1460
1461config CRYPTO_USER_API_RNG
1462	tristate "RNG (random number generator) algorithms"
1463	depends on NET
1464	select CRYPTO_RNG
1465	select CRYPTO_USER_API
1466	help
1467	  Enable the userspace interface for RNG (random number generator)
1468	  algorithms.
1469
1470	  See Documentation/crypto/userspace-if.rst and
1471	  https://www.chronox.de/libkcapi/html/index.html
1472
1473config CRYPTO_USER_API_RNG_CAVP
1474	bool "Enable CAVP testing of DRBG"
1475	depends on CRYPTO_USER_API_RNG && CRYPTO_DRBG
1476	help
1477	  Enable extra APIs in the userspace interface for NIST CAVP
1478	  (Cryptographic Algorithm Validation Program) testing:
1479	  - resetting DRBG entropy
1480	  - providing Additional Data
1481
1482	  This should only be enabled for CAVP testing. You should say
1483	  no unless you know what this is.
1484
1485config CRYPTO_USER_API_AEAD
1486	tristate "AEAD cipher algorithms"
1487	depends on NET
1488	select CRYPTO_AEAD
1489	select CRYPTO_SKCIPHER
1490	select CRYPTO_NULL
1491	select CRYPTO_USER_API
1492	help
1493	  Enable the userspace interface for AEAD cipher algorithms.
1494
1495	  See Documentation/crypto/userspace-if.rst and
1496	  https://www.chronox.de/libkcapi/html/index.html
1497
1498config CRYPTO_USER_API_ENABLE_OBSOLETE
1499	bool "Obsolete cryptographic algorithms"
1500	depends on CRYPTO_USER_API
1501	default y
1502	help
1503	  Allow obsolete cryptographic algorithms to be selected that have
1504	  already been phased out from internal use by the kernel, and are
1505	  only useful for userspace clients that still rely on them.
1506
1507endmenu
1508
1509config CRYPTO_HASH_INFO
1510	bool
1511
1512if !KMSAN # avoid false positives from assembly
1513if ARM
1514source "arch/arm/crypto/Kconfig"
1515endif
1516if ARM64
1517source "arch/arm64/crypto/Kconfig"
1518endif
1519if LOONGARCH
1520source "arch/loongarch/crypto/Kconfig"
1521endif
1522if MIPS
1523source "arch/mips/crypto/Kconfig"
1524endif
1525if PPC
1526source "arch/powerpc/crypto/Kconfig"
1527endif
1528if RISCV
1529source "arch/riscv/crypto/Kconfig"
1530endif
1531if S390
1532source "arch/s390/crypto/Kconfig"
1533endif
1534if SPARC
1535source "arch/sparc/crypto/Kconfig"
1536endif
1537if X86
1538source "arch/x86/crypto/Kconfig"
1539endif
1540endif
1541
1542source "drivers/crypto/Kconfig"
1543source "crypto/asymmetric_keys/Kconfig"
1544source "certs/Kconfig"
1545
1546endif	# if CRYPTO
1547