Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@chromium.org>2015-02-25 22:46:32 +0300
committerAdam Langley <agl@google.com>2015-02-26 00:44:24 +0300
commit03741f61d96b96a4373505c7651a2d4dc70a3d8a (patch)
treef93b83d1ea7f5251b345f8fdb9e03ad38ddb44ed
parent09bdb2a2c3d40646ac4b20f5e73421307a80185f (diff)
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>
-rw-r--r--crypto/ec/ec_key.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/crypto/ec/ec_key.c b/crypto/ec/ec_key.c
index 7f4ffe6b..050d77f4 100644
--- a/crypto/ec/ec_key.c
+++ b/crypto/ec/ec_key.c
@@ -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 */