|
Botan 3.12.0
Crypto and TLS for C&
|
#include <botan/ffi.h>#include <botan/internal/ffi_ec.h>#include <botan/internal/ffi_mp.h>#include <botan/internal/ffi_oid.h>#include <botan/internal/ffi_rng.h>#include <botan/internal/ffi_util.h>#include <functional>Go to the source code of this file.
| int botan_ec_group_destroy | ( | botan_ec_group_t | ec_group | ) |
Definition at line 21 of file ffi_ec.cpp.
References BOTAN_FFI_CHECKED_DELETE.
| int botan_ec_group_equal | ( | botan_ec_group_t | curve1, |
| botan_ec_group_t | curve2 ) |
Definition at line 190 of file ffi_ec.cpp.
References BOTAN_FFI_VISIT, and Botan_FFI::safe_get().
| int botan_ec_group_from_ber | ( | botan_ec_group_t * | ec_group, |
| const uint8_t * | ber, | ||
| size_t | ber_len ) |
Decode a BER encoded ECC domain parameter set
| EC Group | the new object will be placed here |
| ber | encoding |
| ber_len | size of the encoding in bytes |
Definition at line 72 of file ffi_ec.cpp.
References BOTAN_FFI_ERROR_NULL_POINTER, Botan_FFI::ffi_guard_thunk(), and Botan_FFI::ffi_new_object().
| int botan_ec_group_from_name | ( | botan_ec_group_t * | ec_group, |
| const char * | name ) |
Initialize an EC Group from a common group name (eg "secp256r1")
| EC Group | the new object will be placed here |
| name | a known group name |
Definition at line 111 of file ffi_ec.cpp.
References BOTAN_FFI_ERROR_NULL_POINTER, Botan_FFI::ffi_guard_thunk(), Botan_FFI::ffi_new_object(), and Botan::EC_Group::from_name().
| int botan_ec_group_from_oid | ( | botan_ec_group_t * | ec_group, |
| botan_asn1_oid_t | oid ) |
Initialize an EC Group from a group named by an object identifier
| EC Group | the new object will be placed here |
| oid | a known OID |
Definition at line 98 of file ffi_ec.cpp.
References BOTAN_FFI_ERROR_NULL_POINTER, Botan_FFI::ffi_guard_thunk(), Botan_FFI::ffi_new_object(), Botan::EC_Group::from_OID(), and Botan_FFI::safe_get().
| int botan_ec_group_from_params | ( | botan_ec_group_t * | ec_group, |
| botan_asn1_oid_t | oid, | ||
| botan_mp_t | p, | ||
| botan_mp_t | a, | ||
| botan_mp_t | b, | ||
| botan_mp_t | base_x, | ||
| botan_mp_t | base_y, | ||
| botan_mp_t | order ) |
Create a new EC Group from parameters
| EC Group | the new object will be placed here |
| p | the elliptic curve prime (at most 521 bits) |
| a | the elliptic curve a param |
| b | the elliptic curve b param |
| base_x | the x coordinate of the group generator |
| base_y | the y coordinate of the group generator |
| order | the order of the group |
Definition at line 51 of file ffi_ec.cpp.
References BOTAN_FFI_ERROR_NULL_POINTER, Botan_FFI::ffi_guard_thunk(), Botan_FFI::ffi_new_object(), and Botan_FFI::safe_get().
| int botan_ec_group_from_pem | ( | botan_ec_group_t * | ec_group, |
| const char * | pem ) |
Initialize an EC Group from the PEM/ASN.1 encoding
Definition at line 85 of file ffi_ec.cpp.
References BOTAN_FFI_ERROR_NULL_POINTER, Botan_FFI::ffi_guard_thunk(), Botan_FFI::ffi_new_object(), and Botan::EC_Group::from_PEM().
| int botan_ec_group_get_a | ( | botan_mp_t * | a, |
| botan_ec_group_t | ec_group ) |
Get the a parameter of the elliptic curve equation
Definition at line 167 of file ffi_ec.cpp.
| int botan_ec_group_get_b | ( | botan_mp_t * | b, |
| botan_ec_group_t | ec_group ) |
Get the b parameter of the elliptic curve equation
Definition at line 171 of file ffi_ec.cpp.
| int botan_ec_group_get_curve_oid | ( | botan_asn1_oid_t * | oid, |
| botan_ec_group_t | ec_group ) |
Get the curve OID of an EC Group
Definition at line 139 of file ffi_ec.cpp.
References BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, and Botan_FFI::ffi_new_object().
| int botan_ec_group_get_g_x | ( | botan_mp_t * | g_x, |
| botan_ec_group_t | ec_group ) |
Get the x coordinate of the base point
Definition at line 175 of file ffi_ec.cpp.
| int botan_ec_group_get_g_y | ( | botan_mp_t * | g_y, |
| botan_ec_group_t | ec_group ) |
Get the y coordinate of the base point
Definition at line 180 of file ffi_ec.cpp.
| int botan_ec_group_get_order | ( | botan_mp_t * | order, |
| botan_ec_group_t | ec_group ) |
Get the order of the base point
Definition at line 185 of file ffi_ec.cpp.
| int botan_ec_group_get_p | ( | botan_mp_t * | p, |
| botan_ec_group_t | ec_group ) |
Get the prime modulus of the field
Definition at line 163 of file ffi_ec.cpp.
| int botan_ec_group_supports_application_specific_group | ( | int * | out | ) |
Checks if in this build configuration it is possible to register an application specific elliptic curve and sets
| out | to 1 if so, 0 otherwise |
Definition at line 25 of file ffi_ec.cpp.
References BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, and Botan::EC_Group::supports_application_specific_group().
| int botan_ec_group_supports_named_group | ( | const char * | name, |
| int * | out ) |
Checks if in this build configuration botan_ec_group_from_name(group_ptr, name) will succeed and sets
| out | to 1 if so, 0 otherwise. |
Definition at line 37 of file ffi_ec.cpp.
References BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, Botan_FFI::ffi_guard_thunk(), and Botan::EC_Group::supports_named_group().
| int botan_ec_group_unregister | ( | botan_asn1_oid_t | oid | ) |
Unregister a previously registered group.
| oid | the oid associated with the group to unregister |
Using this is discouraged for normal use. This is only useful or necessary if you are registering a very large number of distinct groups, and need to worry about memory constraints.
Definition at line 124 of file ffi_ec.cpp.
References BOTAN_FFI_VISIT, and Botan::EC_Group::unregister().
| int botan_ec_group_view_der | ( | botan_ec_group_t | ec_group, |
| botan_view_ctx | ctx, | ||
| botan_view_bin_fn | view ) |
View an EC Group in DER encoding
Definition at line 128 of file ffi_ec.cpp.
References BOTAN_FFI_VISIT, and Botan_FFI::invoke_view_callback().
| int botan_ec_group_view_pem | ( | botan_ec_group_t | ec_group, |
| botan_view_ctx | ctx, | ||
| botan_view_str_fn | view ) |
View an EC Group in PEM encoding
Definition at line 133 of file ffi_ec.cpp.
References BOTAN_FFI_VISIT, Botan_FFI::invoke_view_callback(), and Botan::NamedCurve.
| int botan_ec_point_add | ( | botan_ec_point_t * | result, |
| botan_ec_point_t | x_w, | ||
| botan_ec_point_t | y_w ) |
Definition at line 346 of file ffi_ec.cpp.
References Botan::EC_AffinePoint::add(), Botan::any_null_pointers(), BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, Botan_FFI::ffi_new_object(), and Botan_FFI::safe_get().
| int botan_ec_point_destroy | ( | botan_ec_point_t | ec_point | ) |
Definition at line 230 of file ffi_ec.cpp.
References BOTAN_FFI_CHECKED_DELETE.
| int botan_ec_point_equal | ( | botan_ec_point_t | x, |
| botan_ec_point_t | y ) |
| x | == |
| y | else 0 otherwise |
Definition at line 319 of file ffi_ec.cpp.
References BOTAN_FFI_VISIT, and Botan_FFI::safe_get().
| int botan_ec_point_from_bytes | ( | botan_ec_point_t * | ec_point, |
| botan_ec_group_t | ec_group, | ||
| const uint8_t * | bytes, | ||
| size_t | bytes_len ) |
Create a point from a SEC1 compressed or uncompressed format.
Definition at line 267 of file ffi_ec.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, and Botan_FFI::ffi_new_object().
| int botan_ec_point_from_xy | ( | botan_ec_point_t * | ec_point, |
| botan_ec_group_t | ec_group, | ||
| botan_mp_t | x, | ||
| botan_mp_t | y ) |
Create a point from a pair (x,y) of integers The integers must be within the field and must satisfy the curve equation
Definition at line 252 of file ffi_ec.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_BAD_PARAMETER, BOTAN_FFI_ERROR_NULL_POINTER, Botan_FFI::ffi_guard_thunk(), Botan_FFI::ffi_new_object(), Botan::EC_AffinePoint::from_bigint_xy(), and Botan_FFI::safe_get().
| int botan_ec_point_generator | ( | botan_ec_point_t * | ec_point, |
| botan_ec_group_t | ec_group ) |
Create a point set to the standard group generator
Definition at line 243 of file ffi_ec.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, Botan_FFI::ffi_new_object(), and Botan::EC_AffinePoint::generator().
| int botan_ec_point_identity | ( | botan_ec_point_t * | ec_point, |
| botan_ec_group_t | ec_group ) |
Create a point set to the identity element of the group
Definition at line 234 of file ffi_ec.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, Botan_FFI::ffi_new_object(), and Botan::EC_AffinePoint::identity().
| int botan_ec_point_is_identity | ( | botan_ec_point_t | ec_point | ) |
| ec_point | is the identity element, else 0 |
Definition at line 315 of file ffi_ec.cpp.
References BOTAN_FFI_VISIT.
| int botan_ec_point_mul | ( | botan_ec_point_t * | result, |
| botan_ec_point_t | ec_point, | ||
| botan_ec_scalar_t | ec_scalar, | ||
| botan_rng_t | rng ) |
Definition at line 323 of file ffi_ec.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, Botan_FFI::ffi_new_object(), Botan::EC_AffinePoint::mul(), and Botan_FFI::safe_get().
| int botan_ec_point_negate | ( | botan_ec_point_t * | result, |
| botan_ec_point_t | ec_point ) |
| ec_point | point to negate |
| result | contains the result |
Definition at line 336 of file ffi_ec.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, Botan_FFI::ffi_new_object(), and Botan::EC_AffinePoint::negate().
| int botan_ec_point_view_compressed | ( | botan_ec_point_t | ec_point, |
| botan_view_ctx | ctx, | ||
| botan_view_bin_fn | view ) |
View the fixed length SEC1 compressed encoding
Definition at line 308 of file ffi_ec.cpp.
References BOTAN_FFI_VISIT, and Botan_FFI::invoke_view_callback().
| int botan_ec_point_view_uncompressed | ( | botan_ec_point_t | ec_point, |
| botan_view_ctx | ctx, | ||
| botan_view_bin_fn | view ) |
View the fixed length SEC1 uncompressed encoding
Definition at line 301 of file ffi_ec.cpp.
References BOTAN_FFI_VISIT, and Botan_FFI::invoke_view_callback().
| int botan_ec_point_view_x_bytes | ( | botan_ec_point_t | ec_point, |
| botan_view_ctx | ctx, | ||
| botan_view_bin_fn | view ) |
View the fixed length encoding of the affine x coordinate
Definition at line 280 of file ffi_ec.cpp.
References BOTAN_FFI_VISIT, and Botan_FFI::invoke_view_callback().
| int botan_ec_point_view_xy_bytes | ( | botan_ec_point_t | ec_point, |
| botan_view_ctx | ctx, | ||
| botan_view_bin_fn | view ) |
View the fixed length encoding of the affine x and y coordinates
Definition at line 294 of file ffi_ec.cpp.
References BOTAN_FFI_VISIT, and Botan_FFI::invoke_view_callback().
| int botan_ec_point_view_y_bytes | ( | botan_ec_point_t | ec_point, |
| botan_view_ctx | ctx, | ||
| botan_view_bin_fn | view ) |
View the fixed length encoding of the affine y coordinate
Definition at line 287 of file ffi_ec.cpp.
References BOTAN_FFI_VISIT, and Botan_FFI::invoke_view_callback().
| int botan_ec_scalar_destroy | ( | botan_ec_scalar_t | ec_scalar | ) |
Definition at line 196 of file ffi_ec.cpp.
References BOTAN_FFI_CHECKED_DELETE.
| int botan_ec_scalar_from_mp | ( | botan_ec_scalar_t * | ec_scalar, |
| botan_ec_group_t | ec_group, | ||
| botan_mp_t | mp ) |
Convert from an MPI to a scalar
Definition at line 209 of file ffi_ec.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, Botan_FFI::ffi_new_object(), Botan::EC_Scalar::from_bigint(), and Botan_FFI::safe_get().
| int botan_ec_scalar_random | ( | botan_ec_scalar_t * | ec_scalar, |
| botan_ec_group_t | ec_group, | ||
| botan_rng_t | rng ) |
Create a new random scalar value
Definition at line 200 of file ffi_ec.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, Botan_FFI::ffi_new_object(), Botan::EC_Scalar::random(), and Botan_FFI::safe_get().
| int botan_ec_scalar_to_mp | ( | botan_ec_scalar_t | ec_scalar, |
| botan_mp_t * | mp ) |
Convert from a scalar to an MPI
Definition at line 219 of file ffi_ec.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, and Botan_FFI::ffi_new_object().