mirror of
https://github.com/weechat/weechat.git
synced 2026-07-02 15:53:12 +02:00
core: add algorithms sha512-224, sha512-256, sha3-*, blake2b-* and blake2s-*` in option sec.crypt.hash_algo (closes #2008)
This commit is contained in:
+28
-8
@@ -6109,7 +6109,7 @@ COMMAND_CALLBACK(save)
|
||||
|
||||
COMMAND_CALLBACK(secure)
|
||||
{
|
||||
int passphrase_was_set, count_encrypted;
|
||||
int passphrase_was_set, count_encrypted, rc;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) pointer;
|
||||
@@ -6140,7 +6140,33 @@ COMMAND_CALLBACK(secure)
|
||||
gui_chat_printf (NULL, _("All encrypted data has been deleted"));
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
if (secure_decrypt_data_not_decrypted (argv_eol[2]) > 0)
|
||||
rc = secure_decrypt_data_not_decrypted (argv_eol[2]);
|
||||
if (rc == -2)
|
||||
{
|
||||
gui_chat_printf (
|
||||
NULL,
|
||||
_("%sFailed to decrypt data: hash algorithm \"%s\" is not "
|
||||
"available (ligbcrypt version is too old?)"),
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
|
||||
config_file_option_string (secure_config_crypt_hash_algo));
|
||||
}
|
||||
else if (rc == -3)
|
||||
{
|
||||
gui_chat_printf (
|
||||
NULL,
|
||||
_("%sFailed to decrypt data: cipher \"%s\" is not "
|
||||
"available (ligbcrypt version is too old?)"),
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
|
||||
config_file_option_string (secure_config_crypt_cipher));
|
||||
}
|
||||
else if ((rc == -1) || (rc == 0))
|
||||
{
|
||||
gui_chat_printf (NULL,
|
||||
_("%sFailed to decrypt data: wrong passphrase?"),
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_chat_printf (NULL,
|
||||
_("Encrypted data has been successfully decrypted"));
|
||||
@@ -6148,12 +6174,6 @@ COMMAND_CALLBACK(secure)
|
||||
free (secure_passphrase);
|
||||
secure_passphrase = strdup (argv_eol[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_chat_printf (NULL,
|
||||
_("%sFailed to decrypt data (wrong passphrase?)"),
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
|
||||
}
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user