From a884d9fec53d227369f6663ddceab6d7d6c4e6c5 Mon Sep 17 00:00:00 2001 From: stf <7o5rfu92t@ctrlc.hu> Date: Wed, 14 Mar 2018 14:51:25 +0100 Subject: [PATCH] [mod] prefixed public sphinx fns --- src/sphinx.c | 6 +++--- src/sphinx.h | 6 +++--- src/tests/test.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/sphinx.c b/src/sphinx.c index 93d1366..3cff173 100644 --- a/src/sphinx.c +++ b/src/sphinx.c @@ -26,7 +26,7 @@ * bfac: (output) pointer to array of DECAF_255_SCALAR_BYTES (32) bytes - the blinding factor * chal: (output) pointer to array of DECAF_255_SER_BYTES (32) bytes - the challenge */ -void challenge(const uint8_t *pwd, const size_t p_len, uint8_t *bfac, uint8_t *chal) { +void sphinx_challenge(const uint8_t *pwd, const size_t p_len, uint8_t *bfac, uint8_t *chal) { unsigned char hash[DECAF_255_HASH_BYTES]; crypto_generichash(hash, sizeof hash, pwd, p_len, 0, 0); // hashed_to_point with elligator the password hash @@ -58,7 +58,7 @@ void challenge(const uint8_t *pwd, const size_t p_len, uint8_t *bfac, uint8_t *c * resp: (output) the response, DECAF_255_SER_BYTES (32) bytes array * returns 1 on error, 0 on success */ -int respond(const uint8_t *chal, const uint8_t *secret, uint8_t *resp) { +int sphinx_respond(const uint8_t *chal, const uint8_t *secret, uint8_t *resp) { // deserialize challenge into C decaf_255_point_t C, R; if(DECAF_SUCCESS!=decaf_255_point_decode(C, chal, DECAF_FALSE)) return 1; @@ -82,7 +82,7 @@ int respond(const uint8_t *chal, const uint8_t *secret, uint8_t *resp) { * rwd: (output) the derived password, DECAF_255_SER_BYTES (32) bytes array * returns 1 on error, 0 on success */ -int finish(const uint8_t *bfac, const uint8_t *resp, uint8_t *rwd) { +int sphinx_finish(const uint8_t *bfac, const uint8_t *resp, uint8_t *rwd) { // decode blinding factor into scalar decaf_255_scalar_t b; decaf_255_scalar_decode_long(b, bfac, DECAF_255_SCALAR_BYTES); diff --git a/src/sphinx.h b/src/sphinx.h index 9837a84..870d04f 100644 --- a/src/sphinx.h +++ b/src/sphinx.h @@ -7,8 +7,8 @@ #define SPHINX_255_SCALAR_BYTES 32 #define SPHINX_255_SER_BYTES 32 -void challenge(const uint8_t *pwd, const size_t p_len, uint8_t *bfac, uint8_t *chal); -int respond(const uint8_t *chal, const uint8_t *secret, uint8_t *resp); -int finish(const uint8_t *bfac, const uint8_t *resp, uint8_t *rwd); +void sphinx_challenge(const uint8_t *pwd, const size_t p_len, uint8_t *bfac, uint8_t *chal); +int sphinx_respond(const uint8_t *chal, const uint8_t *secret, uint8_t *resp); +int sphinx_finish(const uint8_t *bfac, const uint8_t *resp, uint8_t *rwd); #endif // sphinx_h diff --git a/src/tests/test.c b/src/tests/test.c index 466bf12..13905c8 100644 --- a/src/tests/test.c +++ b/src/tests/test.c @@ -10,11 +10,11 @@ int main(void) { resp[SPHINX_255_SER_BYTES], rwd[SPHINX_255_SER_BYTES]; - challenge(pwd, sizeof pwd, bfac, chal); - if(0!=respond(chal, secret, resp)) { + sphinx_challenge(pwd, sizeof pwd, bfac, chal); + if(0!=sphinx_respond(chal, secret, resp)) { return 1; } - if(0!=finish(bfac, resp, rwd)) { + if(0!=sphinx_finish(bfac, resp, rwd)) { return 1; }