]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OpenSSL: Silence a compiler warning with OpenSSL 0.9.7
authorJouni Malinen <j@w1.fi>
Thu, 16 Aug 2012 19:56:19 +0000 (22:56 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 16 Aug 2012 19:56:19 +0000 (22:56 +0300)
The PKCS5_PBKDF2_HMAC_SHA1() function in OpenSSL 0.9.7 did not mark
the salt parameter const even though it was not modified. Hide the
compiler warning with a type cast when an old OpenSSL version is
used.

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

src/crypto/crypto_openssl.c

index 24e4fb7a8d5a644014001dcabbd572d99c91b5fc..5cc32d1651836c0177fd2ebb159ebc419da02474 100644 (file)
@@ -698,9 +698,16 @@ int crypto_hash_finish(struct crypto_hash *ctx, u8 *mac, size_t *len)
 int pbkdf2_sha1(const char *passphrase, const u8 *ssid, size_t ssid_len,
                int iterations, u8 *buf, size_t buflen)
 {
+#if OPENSSL_VERSION_NUMBER < 0x00908000
+       if (PKCS5_PBKDF2_HMAC_SHA1(passphrase, os_strlen(passphrase),
+                                  (unsigned char *) ssid,
+                                  ssid_len, 4096, buflen, buf) != 1)
+               return -1;
+#else /* openssl < 0.9.8 */
        if (PKCS5_PBKDF2_HMAC_SHA1(passphrase, os_strlen(passphrase), ssid,
                                   ssid_len, 4096, buflen, buf) != 1)
                return -1;
+#endif /* openssl < 0.9.8 */
        return 0;
 }