Add custom_data field for EC_POINT, EC_KEY.
authorDr. Stephen Henson <steve@openssl.org>
Mon, 1 Feb 2016 18:22:35 +0000 (18:22 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sun, 28 Feb 2016 22:54:53 +0000 (22:54 +0000)
In some cases the EC_POINT and EC_KEY BIGNUM components are suboptimal
or inappropriate. Add an "custom_data" field which curves can populate with
a custom structure to suit their needs.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
crypto/ec/ec_lcl.h

index e3b1c5d..742e90a 100644 (file)
@@ -297,6 +297,12 @@ struct ec_key_st {
     EC_GROUP *group;
     EC_POINT *pub_key;
     BIGNUM *priv_key;
+    /*
+     * Arbitrary extra data.
+     * For example in X25519 this contains the raw private key in a 32 byte
+     * buffer.
+     */
+    void *custom_data;
     unsigned int enc_flag;
     point_conversion_form_t conv_form;
     int references;
@@ -316,6 +322,11 @@ struct ec_point_st {
                                  * Z) represents (X/Z^2, Y/Z^3) if Z != 0 */
     int Z_is_one;               /* enable optimized point arithmetics for
                                  * special case */
+    /*
+     * Arbitrary extra data.
+     * For example in X25519 this contains the public key in a 32 byte buffer.
+     */
+    void *custom_data;
 } /* EC_POINT */ ;
 
 NISTP224_PRE_COMP *EC_nistp224_pre_comp_dup(NISTP224_PRE_COMP *);