|
@@ -33,6 +33,12 @@
|
|
|
#include <nettle/pbkdf2.h>
|
|
#include <nettle/pbkdf2.h>
|
|
|
#include "iridium-crypto.h"
|
|
#include "iridium-crypto.h"
|
|
|
|
|
|
|
|
|
|
+GQuark
|
|
|
|
|
+iridium_crypto_error_quark (void)
|
|
|
|
|
+{
|
|
|
|
|
+ return g_quark_from_static_string ("iridium-crypto-error-quark");
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
IridiumAuthParams *
|
|
IridiumAuthParams *
|
|
|
iridium_crypto_auth_params_new (void)
|
|
iridium_crypto_auth_params_new (void)
|
|
|
{
|
|
{
|
|
@@ -194,10 +200,16 @@ iridium_crypto_decrypt_item (const gchar *enc_content,
|
|
|
gsize enc_key_size;
|
|
gsize enc_key_size;
|
|
|
gchar *content;
|
|
gchar *content;
|
|
|
|
|
|
|
|
- enc_auth_key = iridium_crypto_decrypt (enc_item_key, uuid, params->keys.master, params->keys.auth, sizeof (params->keys.master));
|
|
|
|
|
|
|
+ enc_auth_key =
|
|
|
|
|
+ iridium_crypto_decrypt(enc_item_key, uuid, params->keys.master,
|
|
|
|
|
+ params->keys.auth, sizeof(params->keys.master));
|
|
|
|
|
|
|
|
- if (enc_auth_key == NULL)
|
|
|
|
|
|
|
+ if (enc_auth_key == NULL) {
|
|
|
|
|
+ g_set_error(error, IRIDIUM_CRYPTO_ERROR,
|
|
|
|
|
+ IRIDIUM_CRYPTO_ERROR_DECRYPT_ENCRYPTION_KEY,
|
|
|
|
|
+ "Could not decrypt encryption key for %s", uuid);
|
|
|
return NULL;
|
|
return NULL;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
enc_key = (gchar *) enc_auth_key;
|
|
enc_key = (gchar *) enc_auth_key;
|
|
|
enc_key_size = strlen (enc_auth_key) / 2 - 8;
|
|
enc_key_size = strlen (enc_auth_key) / 2 - 8;
|
|
@@ -206,7 +218,8 @@ iridium_crypto_decrypt_item (const gchar *enc_content,
|
|
|
enc_key_bytes = iridium_crypto_unhexlify (enc_key, enc_key_size);
|
|
enc_key_bytes = iridium_crypto_unhexlify (enc_key, enc_key_size);
|
|
|
auth_key_bytes = iridium_crypto_unhexlify (auth_key, enc_key_size);
|
|
auth_key_bytes = iridium_crypto_unhexlify (auth_key, enc_key_size);
|
|
|
|
|
|
|
|
- content = iridium_crypto_decrypt (enc_content, uuid, enc_key_bytes, auth_key_bytes, enc_key_size / 2);
|
|
|
|
|
|
|
+ content = iridium_crypto_decrypt(enc_content, uuid, enc_key_bytes,
|
|
|
|
|
+ auth_key_bytes, enc_key_size / 2);
|
|
|
|
|
|
|
|
g_free (enc_key_bytes);
|
|
g_free (enc_key_bytes);
|
|
|
g_free (auth_key_bytes);
|
|
g_free (auth_key_bytes);
|