summaryrefslogtreecommitdiff
path: root/libsylph/ssl.c
diff options
context:
space:
mode:
Diffstat (limited to 'libsylph/ssl.c')
-rw-r--r--libsylph/ssl.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/libsylph/ssl.c b/libsylph/ssl.c
index 44b2935..e782b0e 100644
--- a/libsylph/ssl.c
+++ b/libsylph/ssl.c
@@ -446,7 +446,7 @@ static gint secure_derive_key(guchar *key,
446 OPENSSL_free(buffer); 446 OPENSSL_free(buffer);
447 EVP_MD_CTX_destroy(mdctx); 447 EVP_MD_CTX_destroy(mdctx);
448 448
449 return RC_OK; 449 return SSL_RC_OK;
450 450
451} 451}
452 452
@@ -472,7 +472,7 @@ gint encrypt_data(gchar **encrypted,
472 EVP_CIPHER_CTX *ctx; 472 EVP_CIPHER_CTX *ctx;
473 EVP_MD_CTX *mdctx; 473 EVP_MD_CTX *mdctx;
474 474
475 rc = RC_ERROR; 475 rc = SSL_RC_ERROR;
476 476
477 if (length_data < 1) { 477 if (length_data < 1) {
478 return -1; 478 return -1;
@@ -492,7 +492,7 @@ gint encrypt_data(gchar **encrypted,
492 if (secure_derive_key(key, 492 if (secure_derive_key(key,
493 key_size, 493 key_size,
494 passphrase, 494 passphrase,
495 salt) != RC_OK) { 495 salt) != SSL_RC_OK) {
496 OPENSSL_cleanse(key, key_size); 496 OPENSSL_cleanse(key, key_size);
497 debug_print("Could not generate secure key\n"); 497 debug_print("Could not generate secure key\n");
498 goto cleanup; 498 goto cleanup;
@@ -594,7 +594,7 @@ gint encrypt_data(gchar **encrypted,
594 *encrypted = g_base64_encode(total_buffer, length_total); 594 *encrypted = g_base64_encode(total_buffer, length_total);
595 *length_encrypted = strlen(*encrypted); 595 *length_encrypted = strlen(*encrypted);
596 596
597 rc = RC_OK; 597 rc = SSL_RC_OK;
598 598
599cleanup: 599cleanup:
600 /* key */ 600 /* key */
@@ -740,7 +740,7 @@ gint decrypt_data(gchar **decrypted,
740 (const gchar*) cleartext_buffer, 740 (const gchar*) cleartext_buffer,
741 length_hash) != 0) { 741 length_hash) != 0) {
742 debug_print("Invalid hash\n"); 742 debug_print("Invalid hash\n");
743 rc = RC_WRONG_HASH_OR_KEY; 743 rc = SSL_RC_WRONG_HASH_OR_KEY;
744 goto cleanup; 744 goto cleanup;
745 } 745 }
746 746
@@ -755,7 +755,7 @@ gint decrypt_data(gchar **decrypted,
755 *decrypted = OPENSSL_malloc(length_decrypted); 755 *decrypted = OPENSSL_malloc(length_decrypted);
756 memcpy(*decrypted, data_payload_buffer + 2, length_decrypted); 756 memcpy(*decrypted, data_payload_buffer + 2, length_decrypted);
757 757
758 rc = RC_OK; 758 rc = SSL_RC_OK;
759 759
760cleanup: 760cleanup:
761 761
@@ -793,7 +793,7 @@ gint generate_password_hash(gchar **password_hash,
793 if (salt == NULL) { 793 if (salt == NULL) {
794 if (RAND_bytes(lsalt, SALT_SIZE) != 1) { 794 if (RAND_bytes(lsalt, SALT_SIZE) != 1) {
795 debug_print("Random problems...\n"); 795 debug_print("Random problems...\n");
796 return RC_ERROR; 796 return SSL_RC_ERROR;
797 } 797 }
798 } else { 798 } else {
799 memcpy(lsalt, salt, SALT_SIZE); 799 memcpy(lsalt, salt, SALT_SIZE);
@@ -827,7 +827,7 @@ gint generate_password_hash(gchar **password_hash,
827 OPENSSL_cleanse(salt_b64, strlen(salt_b64)); 827 OPENSSL_cleanse(salt_b64, strlen(salt_b64));
828 OPENSSL_free(salt_b64); 828 OPENSSL_free(salt_b64);
829 829
830 return RC_OK; 830 return SSL_RC_OK;
831 831
832} 832}
833 833
@@ -838,7 +838,7 @@ gint check_password(const gchar *password, const gchar *password_hash) {
838 gchar **tokens, *new_hash; 838 gchar **tokens, *new_hash;
839 gsize salt_length; 839 gsize salt_length;
840 840
841 rc = RC_ERROR; 841 rc = SSL_RC_ERROR;
842 tokens = g_strsplit(password_hash, 842 tokens = g_strsplit(password_hash,
843 "$", 843 "$",
844 -1); 844 -1);
@@ -858,7 +858,7 @@ gint check_password(const gchar *password, const gchar *password_hash) {
858 goto cleanup; 858 goto cleanup;
859 } 859 }
860 860
861 if (generate_password_hash(&new_hash, password, salt) != RC_OK) { 861 if (generate_password_hash(&new_hash, password, salt) != SSL_RC_OK) {
862 debug_print("Password hash generation failed\n"); 862 debug_print("Password hash generation failed\n");
863 goto cleanup; 863 goto cleanup;
864 } 864 }