This gets rid of one more direct OpenSSL call in the DPP implementation.
Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
goto fail;
dpp_debug_print_key("DPP: Received netAccessKey", key);
- if (EVP_PKEY_cmp((EVP_PKEY *) key,
- (EVP_PKEY *) auth->own_protocol_key) != 1) {
+ if (crypto_ec_key_cmp(key, auth->own_protocol_key)) {
wpa_printf(MSG_DEBUG,
"DPP: netAccessKey in connector does not match own protocol key");
#ifdef CONFIG_TESTING_OPTIONS
*/
int crypto_ec_key_group(struct crypto_ec_key *key);
+/**
+ * crypto_ec_key_cmp - Compare two EC public keys
+ * @key1: Key 1
+ * @key2: Key 2
+ * Returns: 0 if public keys are identical, -1 otherwise
+ */
+int crypto_ec_key_cmp(struct crypto_ec_key *key1, struct crypto_ec_key *key2);
+
#endif /* CRYPTO_H */
return -1;
}
+
+int crypto_ec_key_cmp(struct crypto_ec_key *key1, struct crypto_ec_key *key2)
+{
+ if (EVP_PKEY_cmp((EVP_PKEY *) key1, (EVP_PKEY *) key2) != 1)
+ return -1;
+ return 0;
+}
+
#endif /* CONFIG_ECC */