aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/ec/ec_lib.c
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2002-06-18 08:38:59 +0000
committerBodo Möller <bodo@openssl.org>2002-06-18 08:38:59 +0000
commit5f3d6f70f693474df58863f1e51d436242f16405 (patch)
tree427fff77c70e9a00870a5156355313b6e90605f7 /crypto/ec/ec_lib.c
parentece0bdf1fda9d3695ea9feca57c0f516c85f8bf2 (diff)
downloadopenssl-5f3d6f70f693474df58863f1e51d436242f16405.tar.gz
Implement handling of EC parameter seeds (new functions
EC_GROUP_set_seed(), EC_GROUP_get0_seed(), EC_GROUP_get_seed_len()). New functions ECPKParameters_print(), ECPKParameters_print_fp(). Submitted by: Nils Larsch
Diffstat (limited to 'crypto/ec/ec_lib.c')
-rw-r--r--crypto/ec/ec_lib.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c
index 965c229dea..751f8c99e0 100644
--- a/crypto/ec/ec_lib.c
+++ b/crypto/ec/ec_lib.c
@@ -100,7 +100,7 @@ EC_GROUP *EC_GROUP_new(const EC_METHOD *meth)
ret->curve_name = 0;
ret->asn1_flag = 0;
- ret->asn1_form = POINT_CONVERSION_COMPRESSED;
+ ret->asn1_form = POINT_CONVERSION_UNCOMPRESSED;
ret->seed = NULL;
ret->seed_len = 0;
@@ -345,6 +345,39 @@ point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *group
}
+size_t EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *p, size_t len)
+ {
+ if (group->seed)
+ {
+ OPENSSL_free(group->seed);
+ group->seed = NULL;
+ group->seed_len = 0;
+ }
+
+ if (!len || !p)
+ return 1;
+
+ if ((group->seed = OPENSSL_malloc(len)) == NULL)
+ return 0;
+ memcpy(group->seed, p, len);
+ group->seed_len = len;
+
+ return len;
+ }
+
+
+unsigned char *EC_GROUP_get0_seed(const EC_GROUP *group)
+ {
+ return group->seed;
+ }
+
+
+size_t EC_GROUP_get_seed_len(const EC_GROUP *group)
+ {
+ return group->seed_len;
+ }
+
+
int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
{
if (group->meth->group_set_curve_GFp == 0)