Skip to content

Commit

Permalink
Use faster primality testing in libtomcrypt
Browse files Browse the repository at this point in the history
This can only be used if DSS is disabled
  • Loading branch information
mkj committed Nov 10, 2022
1 parent cdaf52a commit 0e70732
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions default_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ IMPORTANT: Some options will require "make clean" after changes */
* is not recommended for new keys.
* See: RSA_PRIV_FILENAME and DSS_PRIV_FILENAME */
#define DROPBEAR_RSA 1
/* RSA key generation will be faster with bundled libtommath
* if DROPBEAR_DSS is disabled.
* https://github.com/mkj/dropbear/issues/174#issuecomment-1267374858
*/
#define DROPBEAR_DSS 1
/* ECDSA is significantly faster than RSA or DSS. Compiling in ECC
* code (either ECDSA or ECDH) increases binary size - around 30kB
Expand Down
9 changes: 9 additions & 0 deletions sysoptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,15 @@
#define DROPBEAR_RSA_SHA256 DROPBEAR_RSA
#endif

/* Miller-Rabin primality testing is sufficient for RSA but not DSS.
* It's a compile-time setting for libtommath, we can get a speedup
* for key generation if DSS is disabled.
* https://github.com/mkj/dropbear/issues/174#issuecomment-1267374858
*/
#ifndef DROPBEAR_DSS
#define LTM_USE_ONLY_MR 1
#endif

/* hashes which will be linked and registered */
#define DROPBEAR_SHA1 (DROPBEAR_RSA_SHA1 || DROPBEAR_DSS \
|| DROPBEAR_SHA1_HMAC || DROPBEAR_SHA1_96_HMAC \
Expand Down

0 comments on commit 0e70732

Please sign in to comment.