10#include <botan/internal/ffi_rng.h>
11#include <botan/internal/ffi_util.h>
13#if defined(BOTAN_HAS_SRP6)
14 #include <botan/bigint.h>
15 #include <botan/dl_group.h>
16 #include <botan/rng.h>
17 #include <botan/srp6.h>
18 #include <botan/symkey.h>
25#if defined(BOTAN_HAS_SRP6)
32#if defined(BOTAN_HAS_SRP6)
34 __func__, [=]() ->
int {
return ffi_new_object(srp6, std::make_unique<Botan::SRP6_Server_Session>()); });
46#if defined(BOTAN_HAS_SRP6)
53 *group_p_bytes = group.p_bytes();
63 const uint8_t* verifier,
70#if defined(BOTAN_HAS_SRP6)
78 auto b_pub_bn = s.step1(v_bn, group_id, hash_id, rng);
87 BOTAN_UNUSED(srp6, verifier, verifier_len, group_id, hash_id, rng_obj, b_pub, b_pub_len);
94#if defined(BOTAN_HAS_SRP6)
101 auto key_sk = s.step2(a_bn);
114 const char* password,
115 const uint8_t salt[],
117 const char* group_id,
120 size_t* verifier_len) {
121#if defined(BOTAN_HAS_SRP6)
127 std::vector<uint8_t> salt_vec(salt, salt + salt_len);
142 const char* password,
143 const char* group_id,
145 const uint8_t salt[],
154#if defined(BOTAN_HAS_SRP6)
160 std::vector<uint8_t> saltv(salt, salt + salt_len);
178 BOTAN_UNUSED(identity, password, group_id, hash_id, rng_obj);
179 BOTAN_UNUSED(salt, salt_len, b, b_len, A, A_len, K, K_len);
static BigInt from_bytes(std::span< const uint8_t > bytes)
static DL_Group from_name(std::string_view name)
struct botan_srp6_server_session_struct * botan_srp6_server_session_t
struct botan_rng_struct * botan_rng_t
@ BOTAN_FFI_ERROR_NOT_IMPLEMENTED
@ BOTAN_FFI_ERROR_NULL_POINTER
@ BOTAN_FFI_ERROR_BAD_PARAMETER
int botan_srp6_server_session_step2(botan_srp6_server_session_t srp6, const uint8_t a[], size_t a_len, uint8_t key[], size_t *key_len)
int botan_srp6_server_session_init(botan_srp6_server_session_t *srp6)
int botan_srp6_server_session_destroy(botan_srp6_server_session_t srp6)
int botan_srp6_group_size(const char *group_id, size_t *group_p_bytes)
int botan_srp6_server_session_step1(botan_srp6_server_session_t srp6, const uint8_t *verifier, size_t verifier_len, const char *group_id, const char *hash_id, botan_rng_t rng_obj, uint8_t b_pub[], size_t *b_pub_len)
int botan_srp6_generate_verifier(const char *username, const char *password, const uint8_t salt[], size_t salt_len, const char *group_id, const char *hash_id, uint8_t verifier[], size_t *verifier_len)
int botan_srp6_client_agree(const char *identity, const char *password, const char *group_id, const char *hash_id, const uint8_t salt[], size_t salt_len, const uint8_t b[], size_t b_len, botan_rng_t rng_obj, uint8_t A[], size_t *A_len, uint8_t K[], size_t *K_len)
#define BOTAN_FFI_VISIT(obj, lambda)
#define BOTAN_FFI_CHECKED_DELETE(o)
#define BOTAN_FFI_DECLARE_DUMMY_STRUCT(NAME, MAGIC)
#define BOTAN_FFI_DECLARE_STRUCT(NAME, TYPE, MAGIC)
T & safe_get(botan_struct< T, M > *p)
BOTAN_FFI_ERROR ffi_new_object(T *obj, Args &&... args)
int ffi_guard_thunk(const char *func_name, T thunk)
int write_vec_output(uint8_t out[], size_t *out_len, std::span< const uint8_t > buf)
bool any_null_pointers(Ptrs... ptr)
std::pair< BigInt, SymmetricKey > srp6_client_agree(std::string_view identifier, std::string_view password, std::string_view group_id, std::string_view hash_id, const std::vector< uint8_t > &salt, const BigInt &B, RandomNumberGenerator &rng)
BigInt srp6_generate_verifier(std::string_view identifier, std::string_view password, const std::vector< uint8_t > &salt, std::string_view group_id, std::string_view hash_id)