summaryrefslogtreecommitdiff
path: root/src/journal/journal-authenticate.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-01-28 18:24:27 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-02-11 13:12:40 -0500
commit91e023d896dd5ca49dd440276f2241570acffd96 (patch)
treed1703b47d0765d60276c87d4e6826ba76cf3e7de /src/journal/journal-authenticate.c
parent75f32f047cc380bdb648faf3ee277f7dc3cdd007 (diff)
Move initialize_libgcrypt to separate file
It's annoying to have the exact same function in three places. It's stored in src/shared, but it's not added to the library to avoid the dependency on libgcrypt.
Diffstat (limited to 'src/journal/journal-authenticate.c')
-rw-r--r--src/journal/journal-authenticate.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/journal/journal-authenticate.c b/src/journal/journal-authenticate.c
index aeec83da1e..45d7f4b340 100644
--- a/src/journal/journal-authenticate.c
+++ b/src/journal/journal-authenticate.c
@@ -24,6 +24,7 @@
#include "fd-util.h"
#include "fsprg.h"
+#include "gcrypt-util.h"
#include "hexdecoct.h"
#include "journal-authenticate.h"
#include "journal-def.h"
@@ -426,25 +427,13 @@ finish:
return r;
}
-static void initialize_libgcrypt(void) {
- const char *p;
-
- if (gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P))
- return;
-
- p = gcry_check_version("1.4.5");
- assert(p);
-
- gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
-}
-
int journal_file_hmac_setup(JournalFile *f) {
gcry_error_t e;
if (!f->seal)
return 0;
- initialize_libgcrypt();
+ initialize_libgcrypt(true);
e = gcry_md_open(&f->hmac, GCRY_MD_SHA256, GCRY_MD_FLAG_HMAC);
if (e != 0)