summaryrefslogtreecommitdiffstats
path: root/src/crypto/ec/oct.c
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2015-11-05 20:20:27 +0000
committerKenny Root <kroot@google.com>2015-11-05 20:20:27 +0000
commit03bcf618b7ed811b305845461fbb5497dfe55ac3 (patch)
tree24150183cfed2ad79eb2258cf525b4fc4544bd2d /src/crypto/ec/oct.c
parentfdeb488e6332a17729db5a04236e48a46a019272 (diff)
downloadexternal_boringssl-03bcf618b7ed811b305845461fbb5497dfe55ac3.zip
external_boringssl-03bcf618b7ed811b305845461fbb5497dfe55ac3.tar.gz
external_boringssl-03bcf618b7ed811b305845461fbb5497dfe55ac3.tar.bz2
Revert "external/boringssl: sync with upstream."
This reverts commit fdeb488e6332a17729db5a04236e48a46a019272. This breaks trusty since it doesn't have setjmp.h Change-Id: I960e25aa0bb2eef1237743b1567f7cb7f6d40497
Diffstat (limited to 'src/crypto/ec/oct.c')
-rw-r--r--src/crypto/ec/oct.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/crypto/ec/oct.c b/src/crypto/ec/oct.c
index 365dc3d..cb50e17 100644
--- a/src/crypto/ec/oct.c
+++ b/src/crypto/ec/oct.c
@@ -277,21 +277,39 @@ err:
int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point,
const uint8_t *buf, size_t len, BN_CTX *ctx) {
+ if (group->meth->oct2point == 0 &&
+ !(group->meth->flags & EC_FLAGS_DEFAULT_OCT)) {
+ OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
+ return 0;
+ }
if (group->meth != point->meth) {
OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
return 0;
}
- return ec_GFp_simple_oct2point(group, point, buf, len, ctx);
+ if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) {
+ return ec_GFp_simple_oct2point(group, point, buf, len, ctx);
+ }
+
+ return group->meth->oct2point(group, point, buf, len, ctx);
}
size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *point,
point_conversion_form_t form, uint8_t *buf,
size_t len, BN_CTX *ctx) {
+ if (group->meth->point2oct == 0 &&
+ !(group->meth->flags & EC_FLAGS_DEFAULT_OCT)) {
+ OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
+ return 0;
+ }
if (group->meth != point->meth) {
OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
return 0;
}
- return ec_GFp_simple_point2oct(group, point, form, buf, len, ctx);
+ if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) {
+ return ec_GFp_simple_point2oct(group, point, form, buf, len, ctx);
+ }
+
+ return group->meth->point2oct(group, point, form, buf, len, ctx);
}
int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group,
@@ -434,9 +452,19 @@ err:
int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group,
EC_POINT *point, const BIGNUM *x,
int y_bit, BN_CTX *ctx) {
+ if (group->meth->point_set_compressed_coordinates == 0 &&
+ !(group->meth->flags & EC_FLAGS_DEFAULT_OCT)) {
+ OPENSSL_PUT_ERROR(EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
+ return 0;
+ }
if (group->meth != point->meth) {
OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
return 0;
}
- return ec_GFp_simple_set_compressed_coordinates(group, point, x, y_bit, ctx);
+ if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) {
+ return ec_GFp_simple_set_compressed_coordinates(group, point, x, y_bit,
+ ctx);
+ }
+ return group->meth->point_set_compressed_coordinates(group, point, x, y_bit,
+ ctx);
}