Skip to content

Commit

Permalink
consistency in naming
Browse files Browse the repository at this point in the history
  • Loading branch information
jakemas committed Dec 24, 2024
1 parent f96096f commit 436dde3
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 139 deletions.
60 changes: 30 additions & 30 deletions crypto/dilithium/ml_dsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ int ml_dsa_44_keypair(uint8_t *public_key /* OUT */,
uint8_t *private_key /* OUT */) {
ml_dsa_params params;
ml_dsa_44_params_init(&params);
return (mldsa_keypair(&params, public_key, private_key) == 0);
return (ml_dsa_keypair(&params, public_key, private_key) == 0);
}

int ml_dsa_44_keypair_internal(uint8_t *public_key /* OUT */,
uint8_t *private_key /* OUT */,
const uint8_t *seed /* IN */) {
ml_dsa_params params;
ml_dsa_44_params_init(&params);
return mldsa_keypair_internal(&params, public_key, private_key, seed) == 0;
return ml_dsa_keypair_internal(&params, public_key, private_key, seed) == 0;
}

int ml_dsa_44_sign(const uint8_t *private_key /* IN */,
Expand All @@ -47,8 +47,8 @@ int ml_dsa_44_sign(const uint8_t *private_key /* IN */,
size_t ctx_string_len /* IN */) {
ml_dsa_params params;
ml_dsa_44_params_init(&params);
return mldsa_signature(&params, sig, sig_len, message, message_len,
ctx_string, ctx_string_len, private_key) == 0;
return ml_dsa_signature(&params, sig, sig_len, message, message_len,
ctx_string, ctx_string_len, private_key) == 0;
}

int ml_dsa_44_sign_internal(const uint8_t *private_key /* IN */,
Expand All @@ -61,8 +61,8 @@ int ml_dsa_44_sign_internal(const uint8_t *private_key /* IN */,
uint8_t *rnd /* IN */) {
ml_dsa_params params;
ml_dsa_44_params_init(&params);
return mldsa_signature_internal(&params, sig, sig_len, message, message_len,
pre, pre_len, rnd, private_key) == 0;
return ml_dsa_signature_internal(&params, sig, sig_len, message, message_len,
pre, pre_len, rnd, private_key) == 0;
}

int ml_dsa_44_verify(const uint8_t *public_key /* IN */,
Expand All @@ -74,8 +74,8 @@ int ml_dsa_44_verify(const uint8_t *public_key /* IN */,
size_t ctx_string_len /* IN */) {
ml_dsa_params params;
ml_dsa_44_params_init(&params);
return mldsa_verify(&params, sig, sig_len, message, message_len,
ctx_string, ctx_string_len, public_key) == 0;
return ml_dsa_verify(&params, sig, sig_len, message, message_len,
ctx_string, ctx_string_len, public_key) == 0;
}

int ml_dsa_44_verify_internal(const uint8_t *public_key /* IN */,
Expand All @@ -87,23 +87,23 @@ int ml_dsa_44_verify_internal(const uint8_t *public_key /* IN */,
size_t pre_len /* IN */) {
ml_dsa_params params;
ml_dsa_44_params_init(&params);
return mldsa_verify_internal(&params, sig, sig_len, message, message_len,
pre, pre_len, public_key) == 0;
return ml_dsa_verify_internal(&params, sig, sig_len, message, message_len,
pre, pre_len, public_key) == 0;
}

int ml_dsa_65_keypair(uint8_t *public_key /* OUT */,
uint8_t *private_key /* OUT */) {
ml_dsa_params params;
ml_dsa_65_params_init(&params);
return (mldsa_keypair(&params, public_key, private_key) == 0);
return (ml_dsa_keypair(&params, public_key, private_key) == 0);
}

int ml_dsa_65_keypair_internal(uint8_t *public_key /* OUT */,
uint8_t *private_key /* OUT */,
const uint8_t *seed /* IN */) {
ml_dsa_params params;
ml_dsa_65_params_init(&params);
return mldsa_keypair_internal(&params, public_key, private_key, seed) == 0;
return ml_dsa_keypair_internal(&params, public_key, private_key, seed) == 0;
}

int ml_dsa_65_sign(const uint8_t *private_key /* IN */,
Expand All @@ -115,8 +115,8 @@ int ml_dsa_65_sign(const uint8_t *private_key /* IN */,
size_t ctx_string_len /* IN */) {
ml_dsa_params params;
ml_dsa_65_params_init(&params);
return mldsa_signature(&params, sig, sig_len, message, message_len,
ctx_string, ctx_string_len, private_key) == 0;
return ml_dsa_signature(&params, sig, sig_len, message, message_len,
ctx_string, ctx_string_len, private_key) == 0;
}

int ml_dsa_65_sign_internal(const uint8_t *private_key /* IN */,
Expand All @@ -129,8 +129,8 @@ int ml_dsa_65_sign_internal(const uint8_t *private_key /* IN */,
uint8_t *rnd /* IN */) {
ml_dsa_params params;
ml_dsa_65_params_init(&params);
return mldsa_signature_internal(&params, sig, sig_len, message, message_len,
pre, pre_len, rnd, private_key) == 0;
return ml_dsa_signature_internal(&params, sig, sig_len, message, message_len,
pre, pre_len, rnd, private_key) == 0;
}

int ml_dsa_65_verify(const uint8_t *public_key /* IN */,
Expand All @@ -142,8 +142,8 @@ int ml_dsa_65_verify(const uint8_t *public_key /* IN */,
size_t ctx_string_len /* IN */) {
ml_dsa_params params;
ml_dsa_65_params_init(&params);
return mldsa_verify(&params, sig, sig_len, message, message_len,
ctx_string, ctx_string_len, public_key) == 0;
return ml_dsa_verify(&params, sig, sig_len, message, message_len,
ctx_string, ctx_string_len, public_key) == 0;
}

int ml_dsa_65_verify_internal(const uint8_t *public_key /* IN */,
Expand All @@ -155,23 +155,23 @@ int ml_dsa_65_verify_internal(const uint8_t *public_key /* IN */,
size_t pre_len /* IN */) {
ml_dsa_params params;
ml_dsa_65_params_init(&params);
return mldsa_verify_internal(&params, sig, sig_len, message, message_len,
pre, pre_len, public_key) == 0;
return ml_dsa_verify_internal(&params, sig, sig_len, message, message_len,
pre, pre_len, public_key) == 0;
}

int ml_dsa_87_keypair(uint8_t *public_key /* OUT */,
uint8_t *private_key /* OUT */) {
ml_dsa_params params;
ml_dsa_87_params_init(&params);
return (mldsa_keypair(&params, public_key, private_key) == 0);
return (ml_dsa_keypair(&params, public_key, private_key) == 0);
}

int ml_dsa_87_keypair_internal(uint8_t *public_key /* OUT */,
uint8_t *private_key /* OUT */,
const uint8_t *seed /* IN */) {
ml_dsa_params params;
ml_dsa_87_params_init(&params);
return mldsa_keypair_internal(&params, public_key, private_key, seed) == 0;
return ml_dsa_keypair_internal(&params, public_key, private_key, seed) == 0;
}

int ml_dsa_87_sign(const uint8_t *private_key /* IN */,
Expand All @@ -183,8 +183,8 @@ int ml_dsa_87_sign(const uint8_t *private_key /* IN */,
size_t ctx_string_len /* IN */) {
ml_dsa_params params;
ml_dsa_87_params_init(&params);
return mldsa_signature(&params, sig, sig_len, message, message_len,
ctx_string, ctx_string_len, private_key) == 0;
return ml_dsa_signature(&params, sig, sig_len, message, message_len,
ctx_string, ctx_string_len, private_key) == 0;
}

int ml_dsa_87_sign_internal(const uint8_t *private_key /* IN */,
Expand All @@ -197,8 +197,8 @@ int ml_dsa_87_sign_internal(const uint8_t *private_key /* IN */,
uint8_t *rnd /* IN */) {
ml_dsa_params params;
ml_dsa_87_params_init(&params);
return mldsa_signature_internal(&params, sig, sig_len, message, message_len,
pre, pre_len, rnd, private_key) == 0;
return ml_dsa_signature_internal(&params, sig, sig_len, message, message_len,
pre, pre_len, rnd, private_key) == 0;
}

int ml_dsa_87_verify(const uint8_t *public_key /* IN */,
Expand All @@ -210,8 +210,8 @@ int ml_dsa_87_verify(const uint8_t *public_key /* IN */,
size_t ctx_string_len /* IN */) {
ml_dsa_params params;
ml_dsa_87_params_init(&params);
return mldsa_verify(&params, sig, sig_len, message, message_len,
ctx_string, ctx_string_len, public_key) == 0;
return ml_dsa_verify(&params, sig, sig_len, message, message_len,
ctx_string, ctx_string_len, public_key) == 0;
}

int ml_dsa_87_verify_internal(const uint8_t *public_key /* IN */,
Expand All @@ -223,6 +223,6 @@ int ml_dsa_87_verify_internal(const uint8_t *public_key /* IN */,
size_t pre_len /* IN */) {
ml_dsa_params params;
ml_dsa_87_params_init(&params);
return mldsa_verify_internal(&params, sig, sig_len, message, message_len,
pre, pre_len, public_key) == 0;
return ml_dsa_verify_internal(&params, sig, sig_len, message, message_len,
pre, pre_len, public_key) == 0;
}
Loading

0 comments on commit 436dde3

Please sign in to comment.