created structs Client and Server
This commit is contained in:
@@ -11,7 +11,7 @@ Result(void) RSA_generateKeyPair(u32 key_size,
|
||||
br_rsa_private_key* sk, br_rsa_public_key* pk,
|
||||
const br_prng_class** rng_vtable_ptr)
|
||||
{
|
||||
Deferral(8);
|
||||
Deferral(4);
|
||||
bool success = false;
|
||||
|
||||
void* sk_buf = malloc(BR_RSA_KBUF_PRIV_SIZE(key_size));
|
||||
@@ -34,7 +34,7 @@ Result(void) RSA_generateKeyPair(u32 key_size,
|
||||
Result(void) RSA_generateKeyPairFromSystemRandom(u32 key_size,
|
||||
br_rsa_private_key* sk, br_rsa_public_key* pk)
|
||||
{
|
||||
Deferral(8);
|
||||
Deferral(4);
|
||||
br_hmac_drbg_context time_based_rng = { .vtable = &br_hmac_drbg_vtable };
|
||||
rng_init_sha256_seedFromSystem(&time_based_rng.vtable);
|
||||
try_void(RSA_generateKeyPair(key_size, sk, pk, &time_based_rng.vtable));
|
||||
@@ -44,7 +44,7 @@ Result(void) RSA_generateKeyPairFromSystemRandom(u32 key_size,
|
||||
Result(void) RSA_generateKeyPairFromPassword(u32 key_size,
|
||||
br_rsa_private_key* sk, br_rsa_public_key* pk, str password)
|
||||
{
|
||||
Deferral(8);
|
||||
Deferral(4);
|
||||
br_hmac_drbg_context password_based_rng = { .vtable = &br_hmac_drbg_vtable };
|
||||
br_hmac_drbg_init(&password_based_rng, &br_sha256_vtable, password.data, password.size);
|
||||
try_void(RSA_generateKeyPair(key_size, sk, pk, &password_based_rng.vtable));
|
||||
@@ -52,7 +52,7 @@ Result(void) RSA_generateKeyPairFromPassword(u32 key_size,
|
||||
}
|
||||
|
||||
Result(void) RSA_computePublicKey(const br_rsa_private_key* sk, br_rsa_public_key* pk){
|
||||
Deferral(8);
|
||||
Deferral(4);
|
||||
br_rsa_compute_modulus compute_modulus = br_rsa_i31_compute_modulus;
|
||||
br_rsa_compute_pubexp compute_pubexp = br_rsa_i31_compute_pubexp;
|
||||
|
||||
@@ -112,7 +112,7 @@ str RSA_serializePublicKey_base64(const br_rsa_public_key* pk){
|
||||
}
|
||||
|
||||
Result(void) RSA_parsePublicKey_base64(cstr src, br_rsa_public_key* pk){
|
||||
Deferral(8);
|
||||
Deferral(4);
|
||||
u32 n_bitlen = 0;
|
||||
if(sscanf(src, "RSA-Public-%u:", &n_bitlen) != 1){
|
||||
Return RESULT_ERROR("can't parse key size", false);
|
||||
@@ -142,7 +142,7 @@ Result(void) RSA_parsePublicKey_base64(cstr src, br_rsa_public_key* pk){
|
||||
}
|
||||
|
||||
Result(void) RSA_parsePrivateKey_base64(cstr src, br_rsa_private_key* sk){
|
||||
Deferral(8);
|
||||
Deferral(4);
|
||||
u32 n_bitlen = 0;
|
||||
if(sscanf(src, "RSA-Private-%u:", &n_bitlen) != 1){
|
||||
Return RESULT_ERROR("can't parse key size", false);
|
||||
|
||||
Reference in New Issue
Block a user