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
path: root/crypto/ec
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@chromium.org>2015-12-31 05:39:34 +0300
committerAdam Langley <agl@google.com>2016-02-02 22:04:33 +0300
commit6014ea624831b656fabdc2600c7b0d891a5ae8cc (patch)
tree1ff19f321fb3d67f15518467cc54912d421b6859 /crypto/ec
parentdd31c4eba2eeb370ab4305ab4cb8ecb48065d42c (diff)
Add EC_POINT_point2cbb.
This slightly simplifies the SSL_ECDH code and will be useful later on in reimplementing the key parsing logic. Change-Id: Ie41ea5fd3a9a734b3879b715fbf57bd991e23799 Reviewed-on: https://boringssl-review.googlesource.com/6858 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/ec')
-rw-r--r--crypto/ec/oct.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/crypto/ec/oct.c b/crypto/ec/oct.c
index e39337dd..9e18535a 100644
--- a/crypto/ec/oct.c
+++ b/crypto/ec/oct.c
@@ -68,6 +68,7 @@
#include <openssl/ec.h>
#include <openssl/bn.h>
+#include <openssl/bytestring.h>
#include <openssl/err.h>
#include "internal.h"
@@ -268,6 +269,17 @@ size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *point,
return ec_GFp_simple_point2oct(group, point, form, buf, len, ctx);
}
+int EC_POINT_point2cbb(CBB *out, const EC_GROUP *group, const EC_POINT *point,
+ point_conversion_form_t form, BN_CTX *ctx) {
+ size_t len = EC_POINT_point2oct(group, point, form, NULL, 0, ctx);
+ if (len == 0) {
+ return 0;
+ }
+ uint8_t *p;
+ return CBB_add_space(out, &p, len) &&
+ EC_POINT_point2oct(group, point, form, p, len, ctx) == len;
+}
+
int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group,
EC_POINT *point, const BIGNUM *x_,
int y_bit, BN_CTX *ctx) {