wpa_supplicant-0004-PKCS-1-Enforce-minimum-padding-for-decryption-in-int.patch 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. From 6c5be116dd6997f68e524247751cff53c74519d7 Mon Sep 17 00:00:00 2001
  2. From: Jouni Malinen <jouni@qca.qualcomm.com>
  3. Date: Mon, 19 May 2014 23:26:43 +0300
  4. Subject: [PATCH] PKCS #1: Enforce minimum padding for decryption in
  5. internal TLS
  6. Follow the PKCS #1 v1.5, 8.1 constraint of at least eight octets long PS
  7. for the case where the internal TLS implementation decrypts PKCS #1
  8. formatted data. Similar limit was already in place for signature
  9. validation, but not for this decryption routine.
  10. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
  11. ---
  12. src/tls/pkcs1.c | 5 +++++
  13. 1 file changed, 5 insertions(+)
  14. diff --git a/src/tls/pkcs1.c b/src/tls/pkcs1.c
  15. index af58a42987c6..ea3e6171a1d1 100644
  16. --- a/src/tls/pkcs1.c
  17. +++ b/src/tls/pkcs1.c
  18. @@ -113,6 +113,11 @@ int pkcs1_v15_private_key_decrypt(struct crypto_rsa_key *key,
  19. pos++;
  20. if (pos == end)
  21. return -1;
  22. + if (pos - out - 2 < 8) {
  23. + /* PKCS #1 v1.5, 8.1: At least eight octets long PS */
  24. + wpa_printf(MSG_INFO, "LibTomCrypt: Too short padding");
  25. + return -1;
  26. + }
  27. pos++;
  28. *outlen -= pos - out;
  29. --
  30. 2.0.0.rc2