Tidy up EC_POINT_dup.
The old one was written somewhat weirdly. Change-Id: I414185971a7d70105fded558da6d165570429d31 Reviewed-on: https://boringssl-review.googlesource.com/10345 CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org> Commit-Queue: David Benjamin <davidben@google.com> Commit-Queue: Adam Langley <agl@google.com> Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
bcb65b90fe
commit
86aa5dab14
@ -662,25 +662,18 @@ int EC_POINT_copy(EC_POINT *dest, const EC_POINT *src) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EC_POINT *EC_POINT_dup(const EC_POINT *a, const EC_GROUP *group) {
|
EC_POINT *EC_POINT_dup(const EC_POINT *a, const EC_GROUP *group) {
|
||||||
EC_POINT *t;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
if (a == NULL) {
|
if (a == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
t = EC_POINT_new(group);
|
EC_POINT *ret = EC_POINT_new(group);
|
||||||
if (t == NULL) {
|
if (ret == NULL ||
|
||||||
OPENSSL_PUT_ERROR(EC, ERR_R_MALLOC_FAILURE);
|
!EC_POINT_copy(ret, a)) {
|
||||||
|
EC_POINT_free(ret);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
r = EC_POINT_copy(t, a);
|
|
||||||
if (!r) {
|
return ret;
|
||||||
EC_POINT_free(t);
|
|
||||||
return NULL;
|
|
||||||
} else {
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point) {
|
int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point) {
|
||||||
|
Loading…
Reference in New Issue
Block a user