Skip to content
This repository was archived by the owner on Jan 31, 2025. It is now read-only.

Commit a884d9f

Browse files
committed
[mod] prefixed public sphinx fns
1 parent d3a155e commit a884d9f

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/sphinx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* bfac: (output) pointer to array of DECAF_255_SCALAR_BYTES (32) bytes - the blinding factor
2727
* chal: (output) pointer to array of DECAF_255_SER_BYTES (32) bytes - the challenge
2828
*/
29-
void challenge(const uint8_t *pwd, const size_t p_len, uint8_t *bfac, uint8_t *chal) {
29+
void sphinx_challenge(const uint8_t *pwd, const size_t p_len, uint8_t *bfac, uint8_t *chal) {
3030
unsigned char hash[DECAF_255_HASH_BYTES];
3131
crypto_generichash(hash, sizeof hash, pwd, p_len, 0, 0);
3232
// 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
5858
* resp: (output) the response, DECAF_255_SER_BYTES (32) bytes array
5959
* returns 1 on error, 0 on success
6060
*/
61-
int respond(const uint8_t *chal, const uint8_t *secret, uint8_t *resp) {
61+
int sphinx_respond(const uint8_t *chal, const uint8_t *secret, uint8_t *resp) {
6262
// deserialize challenge into C
6363
decaf_255_point_t C, R;
6464
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) {
8282
* rwd: (output) the derived password, DECAF_255_SER_BYTES (32) bytes array
8383
* returns 1 on error, 0 on success
8484
*/
85-
int finish(const uint8_t *bfac, const uint8_t *resp, uint8_t *rwd) {
85+
int sphinx_finish(const uint8_t *bfac, const uint8_t *resp, uint8_t *rwd) {
8686
// decode blinding factor into scalar
8787
decaf_255_scalar_t b;
8888
decaf_255_scalar_decode_long(b, bfac, DECAF_255_SCALAR_BYTES);

src/sphinx.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
#define SPHINX_255_SCALAR_BYTES 32
88
#define SPHINX_255_SER_BYTES 32
99

10-
void challenge(const uint8_t *pwd, const size_t p_len, uint8_t *bfac, uint8_t *chal);
11-
int respond(const uint8_t *chal, const uint8_t *secret, uint8_t *resp);
12-
int finish(const uint8_t *bfac, const uint8_t *resp, uint8_t *rwd);
10+
void sphinx_challenge(const uint8_t *pwd, const size_t p_len, uint8_t *bfac, uint8_t *chal);
11+
int sphinx_respond(const uint8_t *chal, const uint8_t *secret, uint8_t *resp);
12+
int sphinx_finish(const uint8_t *bfac, const uint8_t *resp, uint8_t *rwd);
1313

1414
#endif // sphinx_h

src/tests/test.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ int main(void) {
1010
resp[SPHINX_255_SER_BYTES],
1111
rwd[SPHINX_255_SER_BYTES];
1212

13-
challenge(pwd, sizeof pwd, bfac, chal);
14-
if(0!=respond(chal, secret, resp)) {
13+
sphinx_challenge(pwd, sizeof pwd, bfac, chal);
14+
if(0!=sphinx_respond(chal, secret, resp)) {
1515
return 1;
1616
}
17-
if(0!=finish(bfac, resp, rwd)) {
17+
if(0!=sphinx_finish(bfac, resp, rwd)) {
1818
return 1;
1919
}
2020

0 commit comments

Comments
 (0)