new function EC_GROUP_cmp() (used by EVP_PKEY_cmp())
[openssl.git] / crypto / ec / ec.h
index f68963e66f77ce594c278828960ea855faed78f5..dcffc8c049049e077ae9cedd38d4fd26e9376746 100644 (file)
@@ -72,6 +72,8 @@
 #ifndef HEADER_EC_H
 #define HEADER_EC_H
 
+#include <openssl/opensslconf.h>
+
 #ifdef OPENSSL_NO_EC
 #error EC is disabled.
 #endif
@@ -164,6 +166,9 @@ int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx);
  * elliptic curve is not zero, 0 otherwise */
 int EC_GROUP_check_discriminant(const EC_GROUP *, BN_CTX *);
 
+/* EC_GROUP_cmp() returns 0 if both groups are equal and 1 otherwise */
+int EC_GROUP_cmp(const EC_GROUP *, const EC_GROUP *, BN_CTX *);
+
 /* EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*()
  * after choosing an appropriate EC_METHOD */
 EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *);
@@ -319,16 +324,16 @@ int EC_KEY_generate_key(EC_KEY *);
 /* EC_KEY_check_key() */
 int EC_KEY_check_key(const EC_KEY *);
 
-/* de- and encode functions for the SEC1 ECPrivateKey */
+/* de- and encoding functions for SEC1 ECPrivateKey */
 EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len);
 int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out);
-/* de- and encode functions for the elliptic curve parameters */
+/* de- and encoding functions for EC parameters */
 EC_KEY *d2i_ECParameters(EC_KEY **a, const unsigned char **in, long len);
 int i2d_ECParameters(EC_KEY *a, unsigned char **out);
-
-EC_KEY *ECPublicKey_set_octet_string(EC_KEY **a, const unsigned char **in, 
-                                       long len);
-int ECPublicKey_get_octet_string(EC_KEY *a, unsigned char **out);
+/* de- and encoding functions for EC public key
+ * (octet string, not DER -- hence 'o2i' and 'i2o') */
+EC_KEY *o2i_ECPublicKey(EC_KEY **a, const unsigned char **in, long len);
+int i2o_ECPublicKey(EC_KEY *a, unsigned char **out);
 
 #ifndef OPENSSL_NO_BIO
 int    ECParameters_print(BIO *bp, const EC_KEY *x);
@@ -359,8 +364,6 @@ void ERR_load_EC_strings(void);
 #define EC_F_ECPARAMETERS_PRINT_FP                      148
 #define EC_F_ECPKPARAMETERS_PRINT                       149
 #define EC_F_ECPKPARAMETERS_PRINT_FP                    150
-#define EC_F_ECPUBLICKEY_GET_OCTET                      151
-#define EC_F_ECPUBLICKEY_SET_OCTET                      152
 #define EC_F_ECP_NIST_MOD_192                           203
 #define EC_F_ECP_NIST_MOD_224                           204
 #define EC_F_ECP_NIST_MOD_256                           205
@@ -455,6 +458,8 @@ void ERR_load_EC_strings(void);
 #define EC_F_I2D_ECPARAMETERS                           190
 #define EC_F_I2D_ECPKPARAMETERS                                 191
 #define EC_F_I2D_ECPRIVATEKEY                           192
+#define EC_F_I2O_ECPUBLICKEY                            151
+#define EC_F_O2I_ECPUBLICKEY                            152
 
 /* Reason codes. */
 #define EC_R_ASN1_ERROR                                         115