X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=common%2Fauth.h;h=630b87a834d2e9667732185471f19c0e1bd24ef8;hb=d67dd1bf5a247e20141b9907f5a452da73624235;hp=651813f6c0e3a74577b64ba867808d628cf10b0b;hpb=46a8b671b3c707db689868d9b6544d272aa711a7;p=blerg.git diff --git a/common/auth.h b/common/auth.h index 651813f..630b87a 100644 --- a/common/auth.h +++ b/common/auth.h @@ -4,6 +4,8 @@ #ifndef _AUTH_H #define _AUTH_H +#include + #define TOKEN_SIZE 16 #define MAX_PASSWORD_LENGTH 64 #define SCRYPT_SALT_SIZE 8 @@ -12,13 +14,23 @@ #define SCRYPT_r 8 #define SCRYPT_p 1 -int auth_set_password(const char *, const char *); -int auth_get_password_version(const char *); -int auth_get_password(const char *, char *); -int auth_get_salt(const char *, char *); -int auth_check_password(const char *, const char *); +struct auth_header { + uint8_t version; + uint8_t reserved1; + uint16_t reserved2; +}; + +struct auth_v2 { + struct auth_header header; + uint8_t password[SCRYPT_OUTPUT_SIZE]; + uint8_t salt[SCRYPT_SALT_SIZE]; +}; + +int auth_set_password(const char *username, const char *password); +int auth_check_password(const char *username, const char *password); char * auth_login(const char *username, const char *password); int auth_logout(const char *username, const char *token); int auth_check_token(const char *username, const char *given_token); +int auth_get_counter(const char *username, uint32_t *counter); #endif //_AUTH_H