aboutsummaryrefslogtreecommitdiffstats
path: root/src/crypto
diff options
context:
space:
mode:
authorIlan Peer <ilan.peer@intel.com>2020-02-24 09:14:31 (GMT)
committerJouni Malinen <j@w1.fi>2020-02-29 21:26:26 (GMT)
commit94773d40fa95a25e03eb73f339d4f76956ce1054 (patch)
tree566fc321c80ed9f570e409cb5c44f358b23a18f7 /src/crypto
parente8ae97aebe71cf02e0aa480bfdaa6a3520ee5d74 (diff)
downloadhostap-94773d40fa95a25e03eb73f339d4f76956ce1054.zip
hostap-94773d40fa95a25e03eb73f339d4f76956ce1054.tar.gz
hostap-94773d40fa95a25e03eb73f339d4f76956ce1054.tar.bz2
crypto: Add a function to get the ECDH prime length
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>
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/crypto.h1
-rw-r--r--src/crypto/crypto_openssl.c6
-rw-r--r--src/crypto/crypto_wolfssl.c6
3 files changed, 13 insertions, 0 deletions
diff --git a/src/crypto/crypto.h b/src/crypto/crypto.h
index 440da03..7c7515f 100644
--- a/src/crypto/crypto.h
+++ b/src/crypto/crypto.h
@@ -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 */
diff --git a/src/crypto/crypto_openssl.c b/src/crypto/crypto_openssl.c
index 783b293..47b6ebb 100644
--- a/src/crypto/crypto_openssl.c
+++ b/src/crypto/crypto_openssl.c
@@ -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 */
diff --git a/src/crypto/crypto_wolfssl.c b/src/crypto/crypto_wolfssl.c
index 85ce565..dc68bd6 100644
--- a/src/crypto/crypto_wolfssl.c
+++ b/src/crypto/crypto_wolfssl.c
@@ -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 */