EC_GROUP_dup cannot fail.
We've since ref-counted it. Change-Id: I5589e79f5bbba35b02ae659c7aa6ac76ba0082a3 Reviewed-on: https://boringssl-review.googlesource.com/27669 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
32e0d10069
commit
ec4f0ddafc
@ -206,13 +206,7 @@ static int ec_missing_parameters(const EVP_PKEY *pkey) {
|
||||
}
|
||||
|
||||
static int ec_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from) {
|
||||
EC_GROUP *group = EC_GROUP_dup(EC_KEY_get0_group(from->pkey.ec));
|
||||
if (group == NULL ||
|
||||
EC_KEY_set_group(to->pkey.ec, group) == 0) {
|
||||
return 0;
|
||||
}
|
||||
EC_GROUP_free(group);
|
||||
return 1;
|
||||
return EC_KEY_set_group(to->pkey.ec, EC_KEY_get0_group(from->pkey.ec));
|
||||
}
|
||||
|
||||
static int ec_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b) {
|
||||
|
@ -623,25 +623,18 @@ unsigned EC_GROUP_get_degree(const EC_GROUP *group) {
|
||||
}
|
||||
|
||||
EC_POINT *EC_POINT_new(const EC_GROUP *group) {
|
||||
EC_POINT *ret;
|
||||
|
||||
if (group == NULL) {
|
||||
OPENSSL_PUT_ERROR(EC, ERR_R_PASSED_NULL_PARAMETER);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = OPENSSL_malloc(sizeof *ret);
|
||||
EC_POINT *ret = OPENSSL_malloc(sizeof *ret);
|
||||
if (ret == NULL) {
|
||||
OPENSSL_PUT_ERROR(EC, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret->group = EC_GROUP_dup(group);
|
||||
if (ret->group == NULL) {
|
||||
OPENSSL_free(ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ec_GFp_simple_point_init(ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -114,11 +114,10 @@ typedef enum {
|
||||
// more modern primitives.
|
||||
OPENSSL_EXPORT EC_GROUP *EC_GROUP_new_by_curve_name(int nid);
|
||||
|
||||
// EC_GROUP_free frees |group| and the data that it points to.
|
||||
// EC_GROUP_free releases a reference to |group|.
|
||||
OPENSSL_EXPORT void EC_GROUP_free(EC_GROUP *group);
|
||||
|
||||
// EC_GROUP_dup returns a fresh |EC_GROUP| which is equal to |a| or NULL on
|
||||
// error.
|
||||
// EC_GROUP_dup takes a reference to |a| and returns it.
|
||||
OPENSSL_EXPORT EC_GROUP *EC_GROUP_dup(const EC_GROUP *a);
|
||||
|
||||
// EC_GROUP_cmp returns zero if |a| and |b| are the same group and non-zero
|
||||
|
Loading…
Reference in New Issue
Block a user