-/* $OpenBSD: ec.h,v 1.24 2021/05/10 16:58:19 tb Exp $ */
+/* $OpenBSD: ec.h,v 1.25 2021/09/08 17:29:21 tb Exp $ */
/*
* Originally written by Bodo Moeller for the OpenSSL project.
*/
*/
int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx);
+#if defined(LIBRESSL_INTERNAL)
+int EC_GROUP_order_bits(const EC_GROUP *group);
+#endif
+
/** Gets the cofactor of a EC_GROUP
* \param group EC_GROUP object
* \param cofactor BIGNUM to which the cofactor is copied
-/* $OpenBSD: ec2_smpl.c,v 1.22 2021/04/20 17:16:37 tb Exp $ */
+/* $OpenBSD: ec2_smpl.c,v 1.23 2021/09/08 17:29:21 tb Exp $ */
/* ====================================================================
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
*
.group_set_curve = ec_GF2m_simple_group_set_curve,
.group_get_curve = ec_GF2m_simple_group_get_curve,
.group_get_degree = ec_GF2m_simple_group_get_degree,
+ .group_order_bits = ec_group_simple_order_bits,
.group_check_discriminant =
- ec_GF2m_simple_group_check_discriminant,
+ ec_GF2m_simple_group_check_discriminant,
.point_init = ec_GF2m_simple_point_init,
.point_finish = ec_GF2m_simple_point_finish,
.point_clear_finish = ec_GF2m_simple_point_clear_finish,
.point_copy = ec_GF2m_simple_point_copy,
.point_set_to_infinity = ec_GF2m_simple_point_set_to_infinity,
.point_set_affine_coordinates =
- ec_GF2m_simple_point_set_affine_coordinates,
+ ec_GF2m_simple_point_set_affine_coordinates,
.point_get_affine_coordinates =
- ec_GF2m_simple_point_get_affine_coordinates,
+ ec_GF2m_simple_point_get_affine_coordinates,
.add = ec_GF2m_simple_add,
.dbl = ec_GF2m_simple_dbl,
.invert = ec_GF2m_simple_invert,
-/* $OpenBSD: ec_lcl.h,v 1.17 2021/04/20 17:32:57 tb Exp $ */
+/* $OpenBSD: ec_lcl.h,v 1.18 2021/09/08 17:29:21 tb Exp $ */
/*
* Originally written by Bodo Moeller for the OpenSSL project.
*/
/* used by EC_GROUP_get_degree: */
int (*group_get_degree)(const EC_GROUP *);
-
+ /* used by EC_GROUP_order_bits: */
+ int (*group_order_bits)(const EC_GROUP *);
/* used by EC_GROUP_check: */
int (*group_check_discriminant)(const EC_GROUP *, BN_CTX *);
void EC_EX_DATA_free_all_data(EC_EXTRA_DATA **);
void EC_EX_DATA_clear_free_all_data(EC_EXTRA_DATA **);
-
+int ec_group_simple_order_bits(const EC_GROUP *group);
struct ec_point_st {
const EC_METHOD *meth;
int Z_is_one; /* enable optimized point arithmetics for special case */
} /* EC_POINT */;
-
-
/* method functions in ec_mult.c
* (ec_lib.c uses these as defaults if group->method->mul is 0) */
int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
-/* $OpenBSD: ec_lib.c,v 1.39 2021/04/20 17:29:21 tb Exp $ */
+/* $OpenBSD: ec_lib.c,v 1.40 2021/09/08 17:29:21 tb Exp $ */
/*
* Originally written by Bodo Moeller for the OpenSSL project.
*/
return !BN_is_zero(order);
}
+int
+EC_GROUP_order_bits(const EC_GROUP *group)
+{
+ return group->meth->group_order_bits(group);
+}
int
EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx)
* been performed */
}
+int
+ec_group_simple_order_bits(const EC_GROUP *group)
+{
+ /* XXX change group->order to a pointer? */
+#if 0
+ if (group->order == NULL)
+ return 0;
+#endif
+ return BN_num_bits(&group->order);
+}
+
EC_KEY *
ECParameters_dup(EC_KEY *key)
{
-/* $OpenBSD: ecp_mont.c,v 1.19 2021/04/20 17:38:02 tb Exp $ */
+/* $OpenBSD: ecp_mont.c,v 1.20 2021/09/08 17:29:21 tb Exp $ */
/*
* Originally written by Bodo Moeller for the OpenSSL project.
*/
.group_set_curve = ec_GFp_mont_group_set_curve,
.group_get_curve = ec_GFp_simple_group_get_curve,
.group_get_degree = ec_GFp_simple_group_get_degree,
+ .group_order_bits = ec_group_simple_order_bits,
.group_check_discriminant =
ec_GFp_simple_group_check_discriminant,
.point_init = ec_GFp_simple_point_init,
-/* $OpenBSD: ecp_nist.c,v 1.17 2021/04/20 17:38:02 tb Exp $ */
+/* $OpenBSD: ecp_nist.c,v 1.18 2021/09/08 17:29:21 tb Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
.group_set_curve = ec_GFp_nist_group_set_curve,
.group_get_curve = ec_GFp_simple_group_get_curve,
.group_get_degree = ec_GFp_simple_group_get_degree,
+ .group_order_bits = ec_group_simple_order_bits,
.group_check_discriminant =
ec_GFp_simple_group_check_discriminant,
.point_init = ec_GFp_simple_point_init,
-/* $OpenBSD: ecp_nistp224.c,v 1.26 2021/04/20 17:38:02 tb Exp $ */
+/* $OpenBSD: ecp_nistp224.c,v 1.27 2021/09/08 17:29:21 tb Exp $ */
/*
* Written by Emilia Kasper (Google) for the OpenSSL project.
*/
.group_set_curve = ec_GFp_nistp224_group_set_curve,
.group_get_curve = ec_GFp_simple_group_get_curve,
.group_get_degree = ec_GFp_simple_group_get_degree,
+ .group_order_bits = ec_group_simple_order_bits,
.group_check_discriminant =
ec_GFp_simple_group_check_discriminant,
.point_init = ec_GFp_simple_point_init,
-/* $OpenBSD: ecp_nistp256.c,v 1.25 2021/04/20 17:38:02 tb Exp $ */
+/* $OpenBSD: ecp_nistp256.c,v 1.26 2021/09/08 17:29:21 tb Exp $ */
/*
* Written by Adam Langley (Google) for the OpenSSL project
*/
.group_set_curve = ec_GFp_nistp256_group_set_curve,
.group_get_curve = ec_GFp_simple_group_get_curve,
.group_get_degree = ec_GFp_simple_group_get_degree,
+ .group_order_bits = ec_group_simple_order_bits,
.group_check_discriminant =
ec_GFp_simple_group_check_discriminant,
.point_init = ec_GFp_simple_point_init,
-/* $OpenBSD: ecp_nistp521.c,v 1.26 2021/04/20 17:38:02 tb Exp $ */
+/* $OpenBSD: ecp_nistp521.c,v 1.27 2021/09/08 17:29:21 tb Exp $ */
/*
* Written by Adam Langley (Google) for the OpenSSL project
*/
.group_set_curve = ec_GFp_nistp521_group_set_curve,
.group_get_curve = ec_GFp_simple_group_get_curve,
.group_get_degree = ec_GFp_simple_group_get_degree,
+ .group_order_bits = ec_group_simple_order_bits,
.group_check_discriminant =
ec_GFp_simple_group_check_discriminant,
.point_init = ec_GFp_simple_point_init,
-/* $OpenBSD: ecp_nistz256.c,v 1.9 2021/04/20 17:28:18 tb Exp $ */
+/* $OpenBSD: ecp_nistz256.c,v 1.10 2021/09/08 17:29:21 tb Exp $ */
/* Copyright (c) 2014, Intel Corporation.
*
* Permission to use, copy, modify, and/or distribute this software for any
.group_set_curve = ec_GFp_mont_group_set_curve,
.group_get_curve = ec_GFp_simple_group_get_curve,
.group_get_degree = ec_GFp_simple_group_get_degree,
+ .group_order_bits = ec_group_simple_order_bits,
.group_check_discriminant =
ec_GFp_simple_group_check_discriminant,
.point_init = ec_GFp_simple_point_init,
-/* $OpenBSD: ecp_smpl.c,v 1.32 2021/04/20 17:38:02 tb Exp $ */
+/* $OpenBSD: ecp_smpl.c,v 1.33 2021/09/08 17:29:21 tb Exp $ */
/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de>
* for the OpenSSL project.
* Includes code written by Bodo Moeller for the OpenSSL project.
.group_set_curve = ec_GFp_simple_group_set_curve,
.group_get_curve = ec_GFp_simple_group_get_curve,
.group_get_degree = ec_GFp_simple_group_get_degree,
+ .group_order_bits = ec_group_simple_order_bits,
.group_check_discriminant =
ec_GFp_simple_group_check_discriminant,
.point_init = ec_GFp_simple_point_init,