openssl: Extract helper function to derive a shared DH secret

This commit is contained in:
Tobias Brunner
2021-01-20 17:53:35 +01:00
parent 86fb24c2c5
commit 5fdc979770
3 changed files with 55 additions and 45 deletions
@@ -36,6 +36,16 @@
*/
#define EC_FIELD_ELEMENT_LEN(group) ((EC_GROUP_get_degree(group) + 7) / 8)
/**
* Derives a shared DH secret from the given keys.
*
* @param priv private key
* @param pub public key
* @param shared shared secret
* @return TRUE on success, FALSE otherwise
*/
bool openssl_compute_shared_key(EVP_PKEY *priv, EVP_PKEY *pub, chunk_t *shared);
/**
* Creates a hash of a given type of a chunk of data.
*