]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OpenSSL: Use library function for PBKDF2 passphrase-to-PSK
authorJouni Malinen <j@w1.fi>
Thu, 16 Aug 2012 17:13:02 +0000 (20:13 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 16 Aug 2012 17:26:16 +0000 (20:26 +0300)
Use the OpenSSL PKCS5_PBKDF2_HMAC_SHA1() function instead of the
internal implementation in sha1-pbkdf2.c.

Signed-hostap: Jouni Malinen <j@w1.fi>

hostapd/Android.mk
hostapd/Makefile
src/crypto/crypto_openssl.c
wpa_supplicant/Android.mk
wpa_supplicant/Makefile

index eee13e30875ae129a6202040e41c4c3f74dedf9d..73caa88b6e5ca99da682c518ab5f3914106a77a1 100644 (file)
@@ -676,7 +676,9 @@ ifdef NEED_FIPS186_2_PRF
 SHA1OBJS += src/crypto/fips_prf_internal.c
 endif
 endif
+ifneq ($(CONFIG_TLS), openssl)
 SHA1OBJS += src/crypto/sha1-pbkdf2.c
+endif
 ifdef NEED_T_PRF
 SHA1OBJS += src/crypto/sha1-tprf.c
 endif
index f1154ab54ad2da407397804ff82ac07a773b1044..c58cc79355c28110f4f4bc1df5b757b215d3ba8d 100644 (file)
@@ -667,7 +667,9 @@ ifdef NEED_FIPS186_2_PRF
 SHA1OBJS += ../src/crypto/fips_prf_internal.o
 endif
 endif
+ifneq ($(CONFIG_TLS), openssl)
 SHA1OBJS += ../src/crypto/sha1-pbkdf2.o
+endif
 ifdef NEED_T_PRF
 SHA1OBJS += ../src/crypto/sha1-tprf.o
 endif
index 77ea7358644eaeaa00bbb3b8d9ae522739884196..66cf840840941045f5186e3d13c0cbc961b15224 100644 (file)
@@ -688,3 +688,13 @@ int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len)
 
        return -1;
 }
+
+
+int pbkdf2_sha1(const char *passphrase, const u8 *ssid, size_t ssid_len,
+               int iterations, u8 *buf, size_t buflen)
+{
+       if (PKCS5_PBKDF2_HMAC_SHA1(passphrase, os_strlen(passphrase), ssid,
+                                  ssid_len, 4096, buflen, buf) != 1)
+               return -1;
+       return 0;
+}
index c45a51096ede4f0a0e8617435ccc20ddaa7af05f..94a3d963dcd4b49cfe902c7e270905df1a2274af 100644 (file)
@@ -1064,8 +1064,10 @@ endif
 ifdef CONFIG_NO_WPA_PASSPHRASE
 L_CFLAGS += -DCONFIG_NO_PBKDF2
 else
+ifneq ($(CONFIG_TLS), openssl)
 SHA1OBJS += src/crypto/sha1-pbkdf2.c
 endif
+endif
 ifdef NEED_T_PRF
 SHA1OBJS += src/crypto/sha1-tprf.c
 endif
index cf525acf89dd31b62272a95a8928c1d668496b70..7a6d8a3002c31c63abd99b203664655ff2d2ae25 100644 (file)
@@ -1091,8 +1091,10 @@ endif
 ifdef CONFIG_NO_WPA_PASSPHRASE
 CFLAGS += -DCONFIG_NO_PBKDF2
 else
+ifneq ($(CONFIG_TLS), openssl)
 SHA1OBJS += ../src/crypto/sha1-pbkdf2.o
 endif
+endif
 ifdef NEED_T_PRF
 SHA1OBJS += ../src/crypto/sha1-tprf.o
 endif