146 lines
4.5 KiB
Text
146 lines
4.5 KiB
Text
|
#
|
||
|
# For a description of the syntax of this configuration file,
|
||
|
# see scripts/config/Kconfig-language.txt
|
||
|
#
|
||
|
|
||
|
menu "BigInt Options"
|
||
|
depends on !CONFIG_SSL_SKELETON_MODE
|
||
|
|
||
|
choice
|
||
|
prompt "Reduction Algorithm"
|
||
|
default CONFIG_BIGINT_BARRETT
|
||
|
|
||
|
config CONFIG_BIGINT_CLASSICAL
|
||
|
bool "Classical"
|
||
|
help
|
||
|
Classical uses standard division. It has no limitations and is
|
||
|
theoretically the slowest due to the divisions used. For this particular
|
||
|
implementation it is surprisingly quite fast.
|
||
|
|
||
|
config CONFIG_BIGINT_MONTGOMERY
|
||
|
bool "Montgomery"
|
||
|
help
|
||
|
Montgomery uses simple addition and multiplication to achieve its
|
||
|
performance. It has the limitation that 0 <= x, y < m, and so is not
|
||
|
used when CRT is active.
|
||
|
|
||
|
This option will not be normally selected.
|
||
|
|
||
|
config CONFIG_BIGINT_BARRETT
|
||
|
bool "Barrett"
|
||
|
help
|
||
|
Barrett performs expensive precomputation before reduction and partial
|
||
|
multiplies for computational speed.
|
||
|
|
||
|
It is about 40% faster than Classical/Montgomery with the expense of
|
||
|
about 2kB, and so this option is normally selected.
|
||
|
|
||
|
endchoice
|
||
|
|
||
|
config CONFIG_BIGINT_CRT
|
||
|
bool "Chinese Remainder Theorem (CRT)"
|
||
|
default y
|
||
|
help
|
||
|
Allow the Chinese Remainder Theorem (CRT) to be used.
|
||
|
|
||
|
Uses a number of extra coefficients from the private key to improve the
|
||
|
performance of a decryption. This feature is one of the most
|
||
|
significant performance improvements (it reduces a decryption time by
|
||
|
over 3 times).
|
||
|
|
||
|
This option should be selected.
|
||
|
|
||
|
config CONFIG_BIGINT_KARATSUBA
|
||
|
bool "Karatsuba Multiplication"
|
||
|
default n
|
||
|
help
|
||
|
Allow Karasuba multiplication to be used.
|
||
|
|
||
|
Uses 3 multiplications (plus a number of additions/subtractions)
|
||
|
instead of 4. Multiplications are O(N^2) but addition/subtraction
|
||
|
is O(N) hence for large numbers is beneficial. For this project, the
|
||
|
effect was only useful for 4096 bit keys (for 32 bit processors). For
|
||
|
8 bit processors this option might be a possibility.
|
||
|
|
||
|
It costs about 2kB to enable it.
|
||
|
|
||
|
config MUL_KARATSUBA_THRESH
|
||
|
int "Karatsuba Multiplication Theshold"
|
||
|
default 20
|
||
|
depends on CONFIG_BIGINT_KARATSUBA
|
||
|
help
|
||
|
The minimum number of components needed before Karasuba muliplication
|
||
|
is used.
|
||
|
|
||
|
This is very dependent on the speed/implementation of bi_add()/
|
||
|
bi_subtract(). There is a bit of trial and error here and will be
|
||
|
at a different point for different architectures.
|
||
|
|
||
|
config SQU_KARATSUBA_THRESH
|
||
|
int "Karatsuba Square Threshold"
|
||
|
default 40
|
||
|
depends on CONFIG_BIGINT_KARATSUBA && CONFIG_BIGINT_SQUARE
|
||
|
help
|
||
|
The minimum number of components needed before Karatsuba squaring
|
||
|
is used.
|
||
|
|
||
|
This is very dependent on the speed/implementation of bi_add()/
|
||
|
bi_subtract(). There is a bit of trial and error here and will be
|
||
|
at a different point for different architectures.
|
||
|
|
||
|
config CONFIG_BIGINT_SLIDING_WINDOW
|
||
|
bool "Sliding Window Exponentiation"
|
||
|
default y
|
||
|
help
|
||
|
Allow Sliding-Window Exponentiation to be used.
|
||
|
|
||
|
Potentially processes more than 1 bit at a time when doing
|
||
|
exponentiation. The sliding-window technique reduces the number of
|
||
|
precomputations compared to other precomputed techniques.
|
||
|
|
||
|
It results in a considerable performance improvement with it enabled
|
||
|
(it halves the decryption time) and so should be selected.
|
||
|
|
||
|
config CONFIG_BIGINT_SQUARE
|
||
|
bool "Square Algorithm"
|
||
|
default y
|
||
|
help
|
||
|
Allow squaring to be used instead of a multiplication. It uses
|
||
|
1/2 of the standard multiplies to obtain its performance.
|
||
|
It gives a 20% speed improvement overall and so should be selected.
|
||
|
|
||
|
config CONFIG_BIGINT_CHECK_ON
|
||
|
bool "BigInt Integrity Checking"
|
||
|
default n if !CONFIG_DEBUG
|
||
|
default y if CONFIG_DEBUG
|
||
|
help
|
||
|
This is used when developing bigint algorithms. It performs a sanity
|
||
|
check on all operations at the expense of speed.
|
||
|
|
||
|
This option is only selected when developing and should normally be
|
||
|
turned off.
|
||
|
|
||
|
choice
|
||
|
prompt "Integer Size"
|
||
|
default CONFIG_INTEGER_32BIT
|
||
|
|
||
|
config CONFIG_INTEGER_32BIT
|
||
|
bool "32"
|
||
|
help
|
||
|
The native integer size is 32 bits or higher.
|
||
|
|
||
|
|
||
|
config CONFIG_INTEGER_16BIT
|
||
|
bool "16"
|
||
|
help
|
||
|
The native integer size is 16 bits.
|
||
|
|
||
|
config CONFIG_INTEGER_8BIT
|
||
|
bool "8"
|
||
|
help
|
||
|
The native integer size is 8 bits.
|
||
|
|
||
|
endchoice
|
||
|
endmenu
|
||
|
|