summaryrefslogtreecommitdiff
path: root/firmware/2lib/include/2hmac.h
blob: 2f8d8f7c6be9a44417a58e0aa6842977aa197b78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* Copyright 2016 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef VBOOT_REFERENCE_2HMAC_H_
#define VBOOT_REFERENCE_2HMAC_H_

#include <stdint.h>
#include "2crypto.h"

/**
 * Compute HMAC
 *
 * @param alg		Hash algorithm ID
 * @param key		HMAC key
 * @param key_size	HMAC key size
 * @param msg		Message to compute HMAC for
 * @param msg_size	Message size
 * @param mac		Computed message authentication code
 * @param mac_size	Size of the buffer pointed by <mac>
 * @return
 */
int hmac(enum vb2_hash_algorithm alg,
	 const void *key, uint32_t key_size,
	 const void *msg, uint32_t msg_size,
	 uint8_t *mac, uint32_t mac_size);

#endif  /* VBOOT_REFERENCE_2HMAC_H_ */