OpenBSD manual page server

Manual Page Search Parameters

EC_GROUP_GET_CURVE_NAME(3) Library Functions Manual EC_GROUP_GET_CURVE_NAME(3)

EC_GROUP_get_curve_name, EC_GROUP_set_curve_name, EC_GROUP_get_asn1_flag, EC_GROUP_set_asn1_flag, EC_GROUP_get0_seed, EC_GROUP_get_seed_len, EC_GROUP_set_seed, EC_GROUP_get_point_conversion_form, EC_GROUP_set_point_conversion_form, EC_GROUP_get_basis_typeconfigure and inspect details of the ASN.1 encoding of EC_GROUP and related objects

#include <openssl/ec.h>

int
EC_GROUP_get_curve_name(const EC_GROUP *group);

void
EC_GROUP_set_curve_name(EC_GROUP *group, int nid);

int
EC_GROUP_get_asn1_flag(const EC_GROUP *group);

void
EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag);

unsigned char *
EC_GROUP_get0_seed(const EC_GROUP *group);

size_t
EC_GROUP_get_seed_len(const EC_GROUP *group);

size_t
EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *seed, size_t len);

typedef enum {
	POINT_CONVERSION_COMPRESSED = 2,
	POINT_CONVERSION_UNCOMPRESSED = 4,
	POINT_CONVERSION_HYBRID = 6
} point_conversion_form_t;


point_conversion_form_t
EC_GROUP_get_point_conversion_form(const EC_GROUP *group);

void
EC_GROUP_set_point_conversion_form(EC_GROUP *group, point_conversion_form_t form);

Deprecated:


int
EC_GROUP_get_basis_type(const EC_GROUP *group);

The functions in this manual affect or allow the inspection of the details of the ASN.1 encoding produced by the i2d_ECPKParameters(3) family of functions. Modern applications use named curves and uncompressed point encoding, which are the default for EC_GROUP_new_by_curve_name(3).

In this library, Elliptic curve parameters are either encoded as a , using an ASN.1 Object Identifier (OID) to refer to standardized parameters that need to be built into the library, or using where the field, the curve equation, the base point's coordinates and other data are encoded explicitly. The variant is not supported.

() gets the Numerical Identifier (NID) representation of the ASN.1 Object Identifier used for the named curve encoding of group. () sets it to nid.

() retrieves the value of the asn1_flag member of group. If the bit corresponding to OPENSSL_EC_NAMED_CURVE is set, named curve encoding is used for group, otherwise explicit encoding is used. () sets the asn1_flag member of group to flag, which should be either OPENSSL_EC_NAMED_CURVE to use named curve encoding or OPENSSL_EC_EXPLICIT_CURVE to use explicit encoding.

The ASN.1 encoding of explicit curve parameters includes an optional seed value for parameters generated verifiably at random. If a seed value is set on group, () returns a pointer to the internal byte string whose length is returned by ().

() first clears any seed and length already stored in group. If seed is not NULL and len is not zero, it stores a copy of them in group. The seed should be a random byte string of len at least 20 bytes. The seed can be unset by passing NULL as a seed and a len of zero. The library does not perform any computation or validation with this seed, it only includes it in its ASN.1 encoded parameters, whether it contains a sensible value or not.

Points on an elliptic curve, such as the generator or a public key, can be encoded in compressed form, uncompressed form, or in a hybrid form encompassing both, see EC_POINT_point2oct(3). () retrieves the encoding used for points on group and () sets it to form.

The deprecated () only makes sense for curves over binary fields. It is provided for compatibility only.

EC_GROUP_get_curve_name() returns the NID to be used for named curve encoding of group or NID_undef if no NID is set.

EC_GROUP_get_asn1_flag() returns the value most recently set by EC_GROUP_set_asn1_flag() on group.

EC_GROUP_get0_seed() returns an internal pointer to the seed on group or NULL if none is set.

EC_GROUP_get_seed_len() returns the byte length of the seed set on group or zero if none is set.

EC_GROUP_set_seed() returns 0 on memory allocation failure. It returns len on success unless seed is NULL or len is zero, in which case it returns 1.

EC_GROUP_get_point_conversion_form() returns the point conversion form last set by EC_GROUP_set_point_conversion_form() on group.

EC_GROUP_get_basis_type() always returns NID_undef.

crypto(3), d2i_ECPKParameters(3), EC_GROUP_check(3), EC_GROUP_new_by_curve_name(3), EC_GROUP_new_curve_GFp(3), EC_KEY_METHOD_new(3), EC_KEY_new(3), EC_POINT_add(3), EC_POINT_get_affine_coordinates(3), EC_POINT_new(3), EC_POINT_point2oct(3), ECDH_compute_key(3), ECDSA_SIG_new(3), OBJ_obj2nid(3)

These functions first appeared in OpenSSL 0.9.8 and have been available since OpenBSD 4.5.

Most of the setters cannot report errors and none of them perform proper input validation and accept most of the values passed in. This can result in invalid or nonsensical ASN.1 encoding produced by i2d_ECPKParameters(3) and related functions.

April 26, 2025 OpenBSD-current