summaryrefslogtreecommitdiffstats
path: root/src/basic/hmac.h
blob: a5682c439fe0ff3be1c324e99d6a3871fff6ec36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once

#include <stdint.h>
#include <stdlib.h>

#define SHA256_DIGEST_SIZE 32

/* Unoptimized implementation based on FIPS 198. 'res' has to be allocated by
 * the caller. Prefer external OpenSSL functions, and use this only when
 * linking to OpenSSL is not desirable (eg: libsystemd.so). */
void hmac_sha256(const void *key, size_t key_size, const void *input, size_t input_size, uint8_t res[static SHA256_DIGEST_SIZE]);