aboutsummaryrefslogtreecommitdiffstats
path: root/agent/protect.c
diff options
context:
space:
mode:
Diffstat (limited to 'agent/protect.c')
-rw-r--r--agent/protect.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/agent/protect.c b/agent/protect.c
index db6caa48c..3a983e2bd 100644
--- a/agent/protect.c
+++ b/agent/protect.c
@@ -73,6 +73,8 @@ hash_passphrase (const char *passphrase, int hashalgo,
const unsigned char *s2ksalt, unsigned long s2kcount,
unsigned char *key, size_t keylen);
+
+
/* Get the process time and store it in DATA. */
static void
calibrate_get_time (struct calibrate_time_s *data)
@@ -1076,6 +1078,19 @@ hash_passphrase (const char *passphrase, int hashalgo,
}
+gpg_error_t
+s2k_hash_passphrase (const char *passphrase, int hashalgo,
+ int s2kmode,
+ const unsigned char *s2ksalt,
+ unsigned int s2kcount,
+ unsigned char *key, size_t keylen)
+{
+ return hash_passphrase (passphrase, hashalgo, s2kmode, s2ksalt,
+ (16ul + (s2kcount & 15)) << ((s2kcount >> 4) + 6),
+ key, keylen);
+}
+
+
/* Create an canonical encoded S-expression with the shadow info from