001-wolfssl-init-RNG-with-ECC-key.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From 21ce83b4ae2b9563175fdb4fc4312096cc399cf8 Mon Sep 17 00:00:00 2001
  2. From: David Bauer <[email protected]>
  3. Date: Wed, 5 May 2021 00:44:34 +0200
  4. Subject: [PATCH] wolfssl: add RNG to EC key
  5. Since upstream commit 6467de5a8840 ("Randomize z ordinates in
  6. scalar mult when timing resistant") WolfSSL requires a RNG for
  7. the EC key when built hardened which is the default.
  8. Set the RNG for the EC key to fix connections for OWE clients.
  9. Signed-off-by: David Bauer <[email protected]>
  10. ---
  11. src/crypto/crypto_wolfssl.c | 4 ++++
  12. 1 file changed, 4 insertions(+)
  13. --- a/src/crypto/crypto_wolfssl.c
  14. +++ b/src/crypto/crypto_wolfssl.c
  15. @@ -1340,6 +1340,7 @@ int ecc_projective_add_point(ecc_point *
  16. struct crypto_ec {
  17. ecc_key key;
  18. + WC_RNG rng;
  19. mp_int a;
  20. mp_int prime;
  21. mp_int order;
  22. @@ -1394,6 +1395,8 @@ struct crypto_ec * crypto_ec_init(int gr
  23. return NULL;
  24. if (wc_ecc_init(&e->key) != 0 ||
  25. + wc_InitRng(&e->rng) != 0 ||
  26. + wc_ecc_set_rng(&e->key, &e->rng) != 0 ||
  27. wc_ecc_set_curve(&e->key, 0, curve_id) != 0 ||
  28. mp_init(&e->a) != MP_OKAY ||
  29. mp_init(&e->prime) != MP_OKAY ||
  30. @@ -1425,6 +1428,7 @@ void crypto_ec_deinit(struct crypto_ec*
  31. mp_clear(&e->order);
  32. mp_clear(&e->prime);
  33. mp_clear(&e->a);
  34. + wc_FreeRng(&e->rng);
  35. wc_ecc_free(&e->key);
  36. os_free(e);
  37. }