aboutsummaryrefslogtreecommitdiff
path: root/crypto/ec/ec_lib.c
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2002-08-26 11:25:54 +0000
committerBodo Möller <bodo@openssl.org>2002-08-26 11:25:54 +0000
commit7e31164ae08fdc00fb62f749f7b6d18aaa75523e (patch)
treeed4cdd4f23ae521bfa8eabe9f834d1ba49fd2b9b /crypto/ec/ec_lib.c
parentad55f581f93592705617039cd4b5ed8dc02b6192 (diff)
downloadopenssl-7e31164ae08fdc00fb62f749f7b6d18aaa75523e.zip
openssl-7e31164ae08fdc00fb62f749f7b6d18aaa75523e.tar.gz
openssl-7e31164ae08fdc00fb62f749f7b6d18aaa75523e.tar.bz2
ASN1 for binary curves
Submitted by: Nils Larsch
Diffstat (limited to 'crypto/ec/ec_lib.c')
-rw-r--r--crypto/ec/ec_lib.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c
index 9669f42..9bccb07 100644
--- a/crypto/ec/ec_lib.c
+++ b/crypto/ec/ec_lib.c
@@ -537,6 +537,45 @@ void EC_GROUP_clear_free_extra_data(EC_GROUP *group)
}
+int EC_GROUP_get_basis_type(const EC_GROUP *group, unsigned int *k1,
+ unsigned int *k2, unsigned int *k3)
+ {
+ int i = 0;
+
+ if (group == NULL)
+ return 0;
+
+ if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) !=
+ NID_X9_62_characteristic_two_field)
+ /* everything else is currently not supported */
+ return 0;
+
+ while (group->poly[i] != 0)
+ i++;
+
+ if (i == 4)
+ {
+ if (k1)
+ *k1 = group->poly[3];
+ if (k2)
+ *k2 = group->poly[2];
+ if (k3)
+ *k3 = group->poly[1];
+
+ return NID_X9_62_ppBasis;
+ }
+ else if (i == 2)
+ {
+ if (k1)
+ *k1 = group->poly[1];
+
+ return NID_X9_62_tpBasis;
+ }
+ else
+ /* everything else is currently not supported */
+ return 0;
+ }
+
/* functions for EC_POINT objects */
EC_POINT *EC_POINT_new(const EC_GROUP *group)