Home | History | Annotate | Download | only in ec

Lines Matching refs:key

163 	/*  copy the public key */
174 /* copy the private key */
383 int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, BIGNUM *y)
390 if (!key || !key->group || !x || !y)
400 point = EC_POINT_new(key->group);
405 tmp_nid = EC_METHOD_get_field_type(EC_GROUP_method_of(key->group));
415 if (!EC_POINT_set_affine_coordinates_GF2m(key->group, point,
418 if (!EC_POINT_get_affine_coordinates_GF2m(key->group, point,
425 if (!EC_POINT_set_affine_coordinates_GFp(key->group, point,
428 if (!EC_POINT_get_affine_coordinates_GFp(key->group, point,
442 if (!EC_KEY_set_public_key(key, point))
445 if (EC_KEY_check_key(key) == 0)
459 const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key)
461 return key->group;
464 int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group)
466 if (key->group != NULL)
467 EC_GROUP_free(key->group);
468 key->group = EC_GROUP_dup(group);
469 return (key->group == NULL) ? 0 : 1;
472 const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key)
474 return key->priv_key;
477 int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *priv_key)
479 if (key->priv_key)
480 BN_clear_free(key->priv_key);
481 key->priv_key = BN_dup(priv_key);
482 return (key->priv_key == NULL) ? 0 : 1;
485 const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key)
487 return key->pub_key;
490 int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub_key)
492 if (key->pub_key != NULL)
493 EC_POINT_free(key->pub_key);
494 key->pub_key = EC_POINT_dup(pub_key, key->group);
495 return (key->pub_key == NULL) ? 0 : 1;
498 unsigned int EC_KEY_get_enc_flags(const EC_KEY *key)
500 return key->enc_flag;
503 void EC_KEY_set_enc_flags(EC_KEY *key, unsigned int flags)
505 key->enc_flag = flags;
508 point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key)
510 return key->conv_form;
513 void EC_KEY_set_conv_form(EC_KEY *key, point_conversion_form_t cform)
515 key->conv_form = cform;
516 if (key->group != NULL)
517 EC_GROUP_set_point_conversion_form(key->group, cform);
520 void *EC_KEY_get_key_method_data(EC_KEY *key,
523 return EC_EX_DATA_get_data(key->method_data, dup_func, free_func, clear_free_func);
526 void EC_KEY_insert_key_method_data(EC_KEY *key, void *data,
531 ex_data = EC_EX_DATA_get_data(key->method_data, dup_func, free_func, clear_free_func);
533 EC_EX_DATA_set_data(&key->method_data, data, dup_func, free_func, clear_free_func);
537 void EC_KEY_set_asn1_flag(EC_KEY *key, int flag)
539 if (key->group != NULL)
540 EC_GROUP_set_asn1_flag(key->group, flag);
543 int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx)
545 if (key->group == NULL)
547 return EC_GROUP_precompute_mult(key->group, ctx);
550 int EC_KEY_get_flags(const EC_KEY *key)
552 return key->flags;
555 void EC_KEY_set_flags(EC_KEY *key, int flags)
557 key->flags |= flags;
560 void EC_KEY_clear_flags(EC_KEY *key, int flags)
562 key->flags &= ~flags;