]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add crypto_ec_point_cmp()
authorJouni Malinen <j@w1.fi>
Tue, 23 Jun 2015 19:29:23 +0000 (22:29 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 23 Jun 2015 19:29:23 +0000 (22:29 +0300)
This is needed to allow SAE to check whether ECC elements are identical.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/crypto/crypto.h
src/crypto/crypto_openssl.c

index f2d5662ff01e2f3baf8cf98d96d6a60045f08bea..5fd1768580099d1e4235d2f8a8d4d87848e26d47 100644 (file)
@@ -776,4 +776,15 @@ int crypto_ec_point_is_at_infinity(struct crypto_ec *e,
 int crypto_ec_point_is_on_curve(struct crypto_ec *e,
                                const struct crypto_ec_point *p);
 
+/**
+ * crypto_ec_point_cmp - Compare two EC points
+ * @e: EC context from crypto_ec_init()
+ * @a: EC point
+ * @b: EC point
+ * Returns: 0 on equal, non-zero otherwise
+ */
+int crypto_ec_point_cmp(const struct crypto_ec *e,
+                       const struct crypto_ec_point *a,
+                       const struct crypto_ec_point *b);
+
 #endif /* CRYPTO_H */
index 9834b25c69f6e8c8d7da45b7708ab9e59b302939..33e3c4fd964e5bbab99fd082f4f8a6c58d116f78 100644 (file)
@@ -1326,4 +1326,13 @@ int crypto_ec_point_is_on_curve(struct crypto_ec *e,
        return EC_POINT_is_on_curve(e->group, (const EC_POINT *) p, e->bnctx);
 }
 
+
+int crypto_ec_point_cmp(const struct crypto_ec *e,
+                       const struct crypto_ec_point *a,
+                       const struct crypto_ec_point *b)
+{
+       return EC_POINT_cmp(e->group, (const EC_POINT *) a,
+                           (const EC_POINT *) b, e->bnctx);
+}
+
 #endif /* CONFIG_ECC */