summaryrefslogtreecommitdiff
path: root/libsylph/ssl.c
diff options
context:
space:
mode:
authorSimeon Simeonov2018-03-07 09:20:45 +0100
committerSimeon Simeonov2018-03-07 09:20:45 +0100
commit50ad277f9a7cbc3d2dc5b6b9ab80a49b88ea3d80 (patch)
tree2a29abd12f5d5ca2e77087ed7aad0c085cf2ebbc /libsylph/ssl.c
parent8c56039d67bd910a334b2ddd009c6df4bb01cc8b (diff)
Master password hash (read and write) implemented
Diffstat (limited to 'libsylph/ssl.c')
-rw-r--r--libsylph/ssl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libsylph/ssl.c b/libsylph/ssl.c
index 21686e1..5042f74 100644
--- a/libsylph/ssl.c
+++ b/libsylph/ssl.c
@@ -794,7 +794,7 @@ gint generate_password_hash(gchar **password_hash,
794 794
795 if (salt == NULL) { 795 if (salt == NULL) {
796 if (RAND_bytes(lsalt, SALT_SIZE) != 1) { 796 if (RAND_bytes(lsalt, SALT_SIZE) != 1) {
797 g_fprintf(stderr, "Random problems...\n"); 797 debug_print("Random problems...\n");
798 return RC_ERROR; 798 return RC_ERROR;
799 } 799 }
800 } else { 800 } else {
@@ -850,18 +850,18 @@ gint check_password(const gchar *password, const gchar *password_hash) {
850 } 850 }
851 851
852 if (token_counter != 4) { 852 if (token_counter != 4) {
853 g_fprintf(stderr, "Invalid password hash...\n"); 853 debug_print("Invalid password hash...\n");
854 goto cleanup; 854 goto cleanup;
855 } 855 }
856 856
857 salt = g_base64_decode(*(tokens + 2), &salt_length); 857 salt = g_base64_decode(*(tokens + 2), &salt_length);
858 if (salt_length != SALT_SIZE) { 858 if (salt_length != SALT_SIZE) {
859 g_fprintf(stderr, "Salt size does not match\n"); 859 debug_print("Salt size does not match\n");
860 goto cleanup; 860 goto cleanup;
861 } 861 }
862 862
863 if (generate_password_hash(&new_hash, password, salt) != RC_OK) { 863 if (generate_password_hash(&new_hash, password, salt) != RC_OK) {
864 g_fprintf(stderr, "Password hash generation failed\n"); 864 debug_print("Password hash generation failed\n");
865 goto cleanup; 865 goto cleanup;
866 } 866 }
867 867