You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.8 KiB

  1. From 1fad008e1adba5cb596da6f9ec6a244d49a585cf Mon Sep 17 00:00:00 2001
  2. From: Davide Beatrici <davidebeatrici@gmail.com>
  3. Date: Mon, 9 Apr 2018 22:02:34 +0200
  4. Subject: [PATCH] Encrypt: set default RSA key size to 1024 everywhere, using
  5. the RSA_KEY_SIZE macro
  6. This commit also fixes the problem described in #31, which was caused by the test key generated in RsaCheck() being too small for newer OpenSSL versions.
  7. ---
  8. src/Mayaqua/Encrypt.c | 8 ++++----
  9. src/Mayaqua/Encrypt.h | 2 +-
  10. 2 files changed, 5 insertions(+), 5 deletions(-)
  11. --- a/src/Mayaqua/Encrypt.c
  12. +++ b/src/Mayaqua/Encrypt.c
  13. @@ -2458,7 +2458,7 @@ bool RsaVerifyEx(void *data, UINT data_s
  14. }
  15. if (bits == 0)
  16. {
  17. - bits = 1024;
  18. + bits = RSA_KEY_SIZE;
  19. }
  20. // Hash the data
  21. @@ -2497,7 +2497,7 @@ bool RsaSignEx(void *dst, void *src, UIN
  22. }
  23. if (bits == 0)
  24. {
  25. - bits = 1024;
  26. + bits = RSA_KEY_SIZE;
  27. }
  28. Zero(dst, bits / 8);
  29. @@ -2684,7 +2684,7 @@ bool RsaCheck()
  30. BIO *bio;
  31. char errbuf[MAX_SIZE];
  32. UINT size = 0;
  33. - UINT bit = 32;
  34. + UINT bit = RSA_KEY_SIZE;
  35. // Validate arguments
  36. // Key generation
  37. @@ -2754,7 +2754,7 @@ bool RsaGen(K **priv, K **pub, UINT bit)
  38. }
  39. if (bit == 0)
  40. {
  41. - bit = 1024;
  42. + bit = RSA_KEY_SIZE;
  43. }
  44. // Key generation
  45. --- a/src/Mayaqua/Encrypt.h
  46. +++ b/src/Mayaqua/Encrypt.h
  47. @@ -128,7 +128,7 @@ void RAND_Free_For_SoftEther();
  48. #define DES_IV_SIZE 8 // DES IV size
  49. #define DES_BLOCK_SIZE 8 // DES block size
  50. #define DES3_KEY_SIZE (8 * 3) // 3DES key size
  51. -#define RSA_KEY_SIZE 128 // RSA key size
  52. +#define RSA_KEY_SIZE 1024 // RSA key size
  53. #define DH_KEY_SIZE 128 // DH key size
  54. #define RSA_MIN_SIGN_HASH_SIZE (15 + SHA1_HASH_SIZE) // Minimum RSA hash size
  55. #define RSA_SIGN_HASH_SIZE (RSA_MIN_SIGN_HASH_SIZE) // RSA hash size