]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
crypto: Add a function to get the ECDH prime length
authorIlan Peer <ilan.peer@intel.com>
Mon, 24 Feb 2020 09:14:31 +0000 (11:14 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 29 Feb 2020 21:26:26 +0000 (23:26 +0200)
crypto_ecdh_prime_len() can now be used to fetch the length (in octets)
of the prime used in ECDH.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
src/crypto/crypto.h
src/crypto/crypto_openssl.c
src/crypto/crypto_wolfssl.c

index 440da0302967d469ba626d329e72ae168f260c5f..7c7515f6bccf5f29c4394ceaed7cc0852269ff65 100644 (file)
@@ -916,5 +916,6 @@ struct wpabuf * crypto_ecdh_get_pubkey(struct crypto_ecdh *ecdh, int inc_y);
 struct wpabuf * crypto_ecdh_set_peerkey(struct crypto_ecdh *ecdh, int inc_y,
                                        const u8 *key, size_t len);
 void crypto_ecdh_deinit(struct crypto_ecdh *ecdh);
+size_t crypto_ecdh_prime_len(struct crypto_ecdh *ecdh);
 
 #endif /* CRYPTO_H */
index 783b293e9b776d928f0226a12c23502a883ab8a4..47b6ebbd6ebee8b382b5f78e040f4b9e1e9bbd06 100644 (file)
@@ -2168,4 +2168,10 @@ void crypto_ecdh_deinit(struct crypto_ecdh *ecdh)
        }
 }
 
+
+size_t crypto_ecdh_prime_len(struct crypto_ecdh *ecdh)
+{
+       return crypto_ec_prime_len(ecdh->ec);
+}
+
 #endif /* CONFIG_ECC */
index 85ce565bdf5680ed9ba9d2bf8a0904bd63c3c67e..dc68bd651f5695c267aae11c9e2196d7708f3895 100644 (file)
@@ -1834,4 +1834,10 @@ fail:
        goto done;
 }
 
+
+size_t crypto_ecdh_prime_len(struct crypto_ecdh *ecdh)
+{
+       return crypto_ec_prime_len(ecdh->ec);
+}
+
 #endif /* CONFIG_ECC */