Coverage Report

Created: 2019-06-19 13:33

/src/systemd/src/basic/gcrypt-util.h
Line
Count
Source (jump to first uncovered line)
1
/* SPDX-License-Identifier: LGPL-2.1+ */
2
3
#pragma once
4
5
#include <errno.h>
6
#include <stdbool.h>
7
#include <stddef.h>
8
9
#if HAVE_GCRYPT
10
#include <gcrypt.h>
11
12
#include "macro.h"
13
14
void initialize_libgcrypt(bool secmem);
15
int string_hashsum(const char *s, size_t len, int md_algorithm, char **out);
16
17
DEFINE_TRIVIAL_CLEANUP_FUNC(gcry_md_hd_t, gcry_md_close);
18
#endif
19
20
0
static inline int string_hashsum_sha224(const char *s, size_t len, char **out) {
21
0
#if HAVE_GCRYPT
22
0
        return string_hashsum(s, len, GCRY_MD_SHA224, out);
23
0
#else
24
0
        return -EOPNOTSUPP;
25
0
#endif
26
0
}
27
28
0
static inline int string_hashsum_sha256(const char *s, size_t len, char **out) {
29
0
#if HAVE_GCRYPT
30
0
        return string_hashsum(s, len, GCRY_MD_SHA256, out);
31
0
#else
32
0
        return -EOPNOTSUPP;
33
0
#endif
34
0
}