mirror of
https://github.com/AuxXxilium/eudev.git
synced 2024-12-24 18:56:59 +07:00
journal: initialize libgcrypt explicitly, before using HMAC
This commit is contained in:
parent
89fef99014
commit
72fbdd3349
@ -413,12 +413,26 @@ 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();
|
||||
|
||||
e = gcry_md_open(&f->hmac, GCRY_MD_SHA256, GCRY_MD_FLAG_HMAC);
|
||||
if (e != 0)
|
||||
return -ENOTSUP;
|
||||
|
Loading…
Reference in New Issue
Block a user