Ver a proveniência

Use EC_GROUP_dup and EC_POINT_dup in EC_KEY_copy.

They do the same thing. This removes all callers of EC_GROUP_copy outside
EC_GROUP_dup.

Change-Id: I65433ee36040de79e56483dfece774e01e2e2743
Reviewed-on: https://boringssl-review.googlesource.com/3630
Reviewed-by: Adam Langley <agl@google.com>
kris/onging/CECPQ3_patch15
David Benjamin há 9 anos
committed by Adam Langley
ascendente
cometimento
03741f61d9
1 ficheiros alterados com 4 adições e 12 eliminações
  1. +4
    -12
      crypto/ec/ec_key.c

+ 4
- 12
crypto/ec/ec_key.c Ver ficheiro

@@ -170,35 +170,27 @@ EC_KEY *EC_KEY_copy(EC_KEY *dest, const EC_KEY *src) {
OPENSSL_PUT_ERROR(EC, EC_KEY_copy, ERR_R_PASSED_NULL_PARAMETER);
return NULL;
}
/* copy the parameters */
/* Copy the parameters. */
if (src->group) {
/* TODO(fork): duplicating the group seems wasteful. */
const EC_METHOD *meth = src->group->meth;
/* clear the old group */
if (dest->group) {
EC_GROUP_free(dest->group);
}
dest->group = ec_group_new(meth);
dest->group = EC_GROUP_dup(src->group);
if (dest->group == NULL) {
return NULL;
}
if (!EC_GROUP_copy(dest->group, src->group)) {
return NULL;
}
}

/* copy the public key */
/* Copy the public key. */
if (src->pub_key && src->group) {
if (dest->pub_key) {
EC_POINT_free(dest->pub_key);
}
dest->pub_key = EC_POINT_new(src->group);
dest->pub_key = EC_POINT_dup(src->pub_key, src->group);
if (dest->pub_key == NULL) {
return NULL;
}
if (!EC_POINT_copy(dest->pub_key, src->pub_key)) {
return NULL;
}
}

/* copy the private key */


Carregando…
Cancelar
Guardar