OpenSSL  1.0.1c
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
ec_key.c File Reference
#include <string.h>
#include "ec_lcl.h"
#include <openssl/err.h>

Go to the source code of this file.

Functions

EC_KEYEC_KEY_new (void)
 
EC_KEYEC_KEY_new_by_curve_name (int nid)
 
void EC_KEY_free (EC_KEY *r)
 
EC_KEYEC_KEY_copy (EC_KEY *dest, const EC_KEY *src)
 
EC_KEYEC_KEY_dup (const EC_KEY *ec_key)
 
int EC_KEY_up_ref (EC_KEY *r)
 
int EC_KEY_generate_key (EC_KEY *eckey)
 
int EC_KEY_check_key (const EC_KEY *eckey)
 
int EC_KEY_set_public_key_affine_coordinates (EC_KEY *key, BIGNUM *x, BIGNUM *y)
 
const EC_GROUPEC_KEY_get0_group (const EC_KEY *key)
 
int EC_KEY_set_group (EC_KEY *key, const EC_GROUP *group)
 
const BIGNUMEC_KEY_get0_private_key (const EC_KEY *key)
 
int EC_KEY_set_private_key (EC_KEY *key, const BIGNUM *priv_key)
 
const EC_POINTEC_KEY_get0_public_key (const EC_KEY *key)
 
int EC_KEY_set_public_key (EC_KEY *key, const EC_POINT *pub_key)
 
unsigned int EC_KEY_get_enc_flags (const EC_KEY *key)
 
void EC_KEY_set_enc_flags (EC_KEY *key, unsigned int flags)
 
point_conversion_form_t EC_KEY_get_conv_form (const EC_KEY *key)
 
void EC_KEY_set_conv_form (EC_KEY *key, point_conversion_form_t cform)
 
voidEC_KEY_get_key_method_data (EC_KEY *key, void *(*dup_func)(void *), void(*free_func)(void *), void(*clear_free_func)(void *))
 
void EC_KEY_insert_key_method_data (EC_KEY *key, void *data, void *(*dup_func)(void *), void(*free_func)(void *), void(*clear_free_func)(void *))
 
void EC_KEY_set_asn1_flag (EC_KEY *key, int flag)
 
int EC_KEY_precompute_mult (EC_KEY *key, BN_CTX *ctx)
 
int EC_KEY_get_flags (const EC_KEY *key)
 
void EC_KEY_set_flags (EC_KEY *key, int flags)
 
void EC_KEY_clear_flags (EC_KEY *key, int flags)
 

Function Documentation

int EC_KEY_check_key ( const EC_KEY key)

Verifies that a private and/or public key is valid.

Parameters
keythe EC_KEY object
Returns
1 on success and 0 otherwise.

Definition at line 304 of file ec_key.c.

void EC_KEY_clear_flags ( EC_KEY key,
int  flags 
)

Definition at line 560 of file ec_key.c.

EC_KEY* EC_KEY_copy ( EC_KEY dst,
const EC_KEY src 
)

Copies a EC_KEY object.

Parameters
dstdestination EC_KEY object
srcsrc EC_KEY object
Returns
dst or NULL if an error occurred.

Definition at line 141 of file ec_key.c.

EC_KEY* EC_KEY_dup ( const EC_KEY src)

Creates a new EC_KEY object and copies the content from src to it.

Parameters
srcthe source EC_KEY object
Returns
newly created EC_KEY object or NULL if an error occurred.

Definition at line 208 of file ec_key.c.

void EC_KEY_free ( EC_KEY key)

Frees a EC_KEY object.

Parameters
keyEC_KEY object to be freed.

Definition at line 108 of file ec_key.c.

int EC_KEY_generate_key ( EC_KEY key)

Creates a new ec private (and optional a new public) key.

Parameters
keyEC_KEY object
Returns
1 on success and 0 if an error occurred.

Definition at line 237 of file ec_key.c.

const EC_GROUP* EC_KEY_get0_group ( const EC_KEY key)

Returns the EC_GROUP object of a EC_KEY object

Parameters
keyEC_KEY object
Returns
the EC_GROUP object (possibly NULL).

Definition at line 459 of file ec_key.c.

const BIGNUM* EC_KEY_get0_private_key ( const EC_KEY key)

Returns the private key of a EC_KEY object.

Parameters
keyEC_KEY object
Returns
a BIGNUM with the private key (possibly NULL).

Definition at line 472 of file ec_key.c.

const EC_POINT* EC_KEY_get0_public_key ( const EC_KEY key)

Returns the public key of a EC_KEY object.

Parameters
keythe EC_KEY object
Returns
a EC_POINT object with the public key (possibly NULL)

Definition at line 485 of file ec_key.c.

point_conversion_form_t EC_KEY_get_conv_form ( const EC_KEY key)

Definition at line 508 of file ec_key.c.

unsigned int EC_KEY_get_enc_flags ( const EC_KEY key)

Definition at line 498 of file ec_key.c.

int EC_KEY_get_flags ( const EC_KEY key)

Definition at line 550 of file ec_key.c.

void* EC_KEY_get_key_method_data ( EC_KEY key,
void *(*)(void *)  dup_func,
void(*)(void *)  free_func,
void(*)(void *)  clear_free_func 
)

Definition at line 520 of file ec_key.c.

void EC_KEY_insert_key_method_data ( EC_KEY key,
void data,
void *(*)(void *)  dup_func,
void(*)(void *)  free_func,
void(*)(void *)  clear_free_func 
)

Definition at line 526 of file ec_key.c.

EC_KEY* EC_KEY_new ( void  )

Creates a new EC_KEY object.

Returns
EC_KEY object or NULL if an error occurred.

Definition at line 71 of file ec_key.c.

EC_KEY* EC_KEY_new_by_curve_name ( int  nid)

Creates a new EC_KEY object using a named curve as underlying EC_GROUP object.

Parameters
nidNID of the named curve.
Returns
EC_KEY object or NULL if an error occurred.

Definition at line 94 of file ec_key.c.

int EC_KEY_precompute_mult ( EC_KEY key,
BN_CTX ctx 
)

Creates a table of pre-computed multiples of the generator to accelerate further EC_KEY operations.

Parameters
keyEC_KEY object
ctxBN_CTX object (optional)
Returns
1 on success and 0 if an error occurred.

Definition at line 543 of file ec_key.c.

void EC_KEY_set_asn1_flag ( EC_KEY key,
int  flag 
)

Definition at line 537 of file ec_key.c.

void EC_KEY_set_conv_form ( EC_KEY key,
point_conversion_form_t  cform 
)

Definition at line 513 of file ec_key.c.

void EC_KEY_set_enc_flags ( EC_KEY key,
unsigned int  flags 
)

Definition at line 503 of file ec_key.c.

void EC_KEY_set_flags ( EC_KEY key,
int  flags 
)

Definition at line 555 of file ec_key.c.

int EC_KEY_set_group ( EC_KEY key,
const EC_GROUP group 
)

Sets the EC_GROUP of a EC_KEY object.

Parameters
keyEC_KEY object
groupEC_GROUP to use in the EC_KEY object (note: the EC_KEY object will use an own copy of the EC_GROUP).
Returns
1 on success and 0 if an error occurred.

Definition at line 464 of file ec_key.c.

int EC_KEY_set_private_key ( EC_KEY key,
const BIGNUM prv 
)

Sets the private key of a EC_KEY object.

Parameters
keyEC_KEY object
prvBIGNUM with the private key (note: the EC_KEY object will use an own copy of the BIGNUM).
Returns
1 on success and 0 if an error occurred.

Definition at line 477 of file ec_key.c.

int EC_KEY_set_public_key ( EC_KEY key,
const EC_POINT pub 
)

Sets the public key of a EC_KEY object.

Parameters
keyEC_KEY object
pubEC_POINT object with the public key (note: the EC_KEY object will use an own copy of the EC_POINT object).
Returns
1 on success and 0 if an error occurred.

Definition at line 490 of file ec_key.c.

int EC_KEY_set_public_key_affine_coordinates ( EC_KEY key,
BIGNUM x,
BIGNUM y 
)

Sets a public key from affine coordindates performing neccessary NIST PKV tests.

Parameters
keythe EC_KEY object
xpublic key x coordinate
ypublic key y coordinate
Returns
1 on success and 0 otherwise.

Definition at line 383 of file ec_key.c.

int EC_KEY_up_ref ( EC_KEY key)

Increases the internal reference count of a EC_KEY object.

Parameters
keyEC_KEY object
Returns
1 on success and 0 if an error occurred.

Definition at line 221 of file ec_key.c.