Export new ECC API so that tests and |bssl speed| can use them.

This commit is contained in:
Brian Smith 2015-10-08 18:52:13 -10:00
parent 4ef4095398
commit 28e98f3270
2 changed files with 21 additions and 6 deletions

View File

@ -155,6 +155,13 @@ OPENSSL_EXPORT int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key,
BIGNUM *x,
BIGNUM *y);
/* EC_KEY_public_key_to_oct serialises the public key point of |key| into the
* X9.62 uncompressed form at |out|, writing at most |out_len| bytes. It
* returns the number of bytes written or zero on error if |out| is non-NULL,
* else the number of bytes needed. */
OPENSSL_EXPORT size_t EC_KEY_public_key_to_oct(const EC_KEY *key, uint8_t *out,
size_t out_len);
/* Key generation. */
@ -163,6 +170,11 @@ OPENSSL_EXPORT int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key,
* or zero otherwise. */
OPENSSL_EXPORT int EC_KEY_generate_key(EC_KEY *key);
/* EC_KEY_generate_key_ex generates a random private key and calculates the
* corresponding public key. It returns the generated key pair on success or
* NULL on failure. */
OPENSSL_EXPORT EC_KEY *EC_KEY_generate_key_ex(EC_GROUP_new_fn ec_group_new);
#if defined(__cplusplus)
} /* extern C */

View File

@ -97,13 +97,16 @@ OPENSSL_EXPORT int ECDH_compute_key(void *out, size_t outlen,
* point in |peer_pub_point_bytes| with length |peer_pub_point_bytes_len| is on
* the curve. |max_out_len| must be at least
* |(EC_GROUP_get_degree(group) + 7) / 8|, and at most that many bytes of the
* computed shared key are copied directly to |out|. The number of bytes
* computed shared key are copied directly to |out|. (This differs from what
* the OpenSSL |ECDH_compute_key| function does.) The number of bytes
* written to |out| is returned in |out_len|. It returns 1 on success and 0 on
* error. */
int ECDH_compute_key_ex(uint8_t *out, size_t *out_len, size_t max_out_len,
EC_KEY *priv_key, int peer_pub_point_curve_nid,
const uint8_t *peer_pub_point_bytes,
size_t peer_pub_point_bytes_len);
* error. (This differs from what the OpenSSL |ECDH_compute_key| function
* returns.) */
OPENSSL_EXPORT int ECDH_compute_key_ex(uint8_t *out, size_t *out_len,
size_t max_out_len, EC_KEY *priv_key,
int peer_pub_point_curve_nid,
const uint8_t *peer_pub_point_bytes,
size_t peer_pub_point_bytes_len);
#if defined(__cplusplus)