Skip to content

Commit

Permalink
[mod] prefixed public sphinx fns
Browse files Browse the repository at this point in the history
  • Loading branch information
stef committed Mar 14, 2018
1 parent d3a155e commit a884d9f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/sphinx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/sphinx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions src/tests/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit a884d9f

Please sign in to comment.