Show duration of PBKDF2 computation in debug output.
authorAndrej Kacian <ticho@claws-mail.org>
Mon, 11 Apr 2016 16:30:18 +0000 (18:30 +0200)
committerAndrej Kacian <ticho@claws-mail.org>
Mon, 11 Apr 2016 16:30:18 +0000 (18:30 +0200)
src/password.c

index 461a5b7fa960cf65683570a18f36cd0a0b98e69c..6cef02128cff31f11c5072abe5cdbe5c0485c6d7 100644 (file)
@@ -41,6 +41,7 @@
 #include "common/passcrypt.h"
 #include "common/plugin.h"
 #include "common/pkcs5_pbkdf2.h"
 #include "common/passcrypt.h"
 #include "common/plugin.h"
 #include "common/pkcs5_pbkdf2.h"
+#include "common/timing.h"
 #include "common/utils.h"
 #include "account.h"
 #include "alertpanel.h"
 #include "common/utils.h"
 #include "account.h"
 #include "alertpanel.h"
@@ -126,8 +127,10 @@ static guchar *_make_key_deriv(const gchar *passphrase, guint rounds)
        salt = g_base64_decode(saltpref, &saltlen);
        kd = g_malloc0(KD_LENGTH);
 
        salt = g_base64_decode(saltpref, &saltlen);
        kd = g_malloc0(KD_LENGTH);
 
+       START_TIMING("PBKDF2");
        ret = pkcs5_pbkdf2(passphrase, strlen(passphrase), salt, saltlen,
                        kd, KD_LENGTH, rounds);
        ret = pkcs5_pbkdf2(passphrase, strlen(passphrase), salt, saltlen,
                        kd, KD_LENGTH, rounds);
+       END_TIMING();
 
        g_free(salt);
 
 
        g_free(salt);