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.

59 lines
1.8 KiB

  1. From 9a1846507ff043c397257206ff21adae90a122f4 Mon Sep 17 00:00:00 2001
  2. From: Thomas d'Otreppe <tdotreppe@aircrack-ng.org>
  3. Date: Wed, 21 Dec 2016 00:18:46 +0000
  4. Subject: [PATCH] Fixed compilation with OpenSSL 1.1.0 (Closes: #1711).
  5. git-svn-id: http://svn.aircrack-ng.org/trunk@2882 28c6078b-6c39-48e3-add9-af49d547ecab
  6. ---
  7. src/crypto.c | 23 +++++++++++++++++++++++
  8. 1 file changed, 23 insertions(+)
  9. diff --git a/src/crypto.c b/src/crypto.c
  10. index c3318753..46fa9c52 100644
  11. --- a/src/crypto.c
  12. +++ b/src/crypto.c
  13. @@ -288,7 +288,15 @@ void calc_pmk( char *key, char *essid_pre, unsigned char pmk[40] )
  14. void calc_mic (struct AP_info *ap, unsigned char pmk[32], unsigned char ptk[80], unsigned char mic[20]) {
  15. int i;
  16. unsigned char pke[100];
  17. + #if defined(USE_GCRYPT) || OPENSSL_VERSION_NUMBER < 0x10100000L
  18. + #define HMAC_USE_NO_PTR
  19. + #endif
  20. +
  21. + #ifdef HMAC_USE_NO_PTR
  22. HMAC_CTX ctx;
  23. + #else
  24. + HMAC_CTX * ctx;
  25. + #endif
  26. memcpy( pke, "Pairwise key expansion", 23 );
  27. @@ -314,6 +322,7 @@ void calc_mic (struct AP_info *ap, unsigned char pmk[32], unsigned char ptk[80],
  28. memcpy( pke + 67, ap->wpa.snonce, 32 );
  29. }
  30. + #ifdef HMAC_USE_NO_PTR
  31. HMAC_CTX_init(&ctx);
  32. HMAC_Init_ex(&ctx, pmk, 32, EVP_sha1(), NULL);
  33. for(i = 0; i < 4; i++ )
  34. @@ -325,6 +334,20 @@ void calc_mic (struct AP_info *ap, unsigned char pmk[32], unsigned char ptk[80],
  35. HMAC_Final(&ctx, ptk + i*20, NULL);
  36. }
  37. HMAC_CTX_cleanup(&ctx);
  38. + #else
  39. + ctx = HMAC_CTX_new();
  40. + HMAC_Init_ex(ctx, pmk, 32, EVP_sha1(), NULL);
  41. + for(i = 0; i < 4; i++ )
  42. + {
  43. + pke[99] = i;
  44. + //HMAC(EVP_sha1(), values[0], 32, pke, 100, ptk + i * 20, NULL);
  45. + HMAC_Init_ex(ctx, 0, 0, 0, 0);
  46. + HMAC_Update(ctx, pke, 100);
  47. + HMAC_Final(ctx, ptk + i*20, NULL);
  48. + }
  49. + HMAC_CTX_free(ctx);
  50. + #endif
  51. + #undef HMAC_USE_NO_PTR
  52. if( ap->wpa.keyver == 1 )
  53. {