mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 02:05:01 +00:00
This patch adds HMAC. HMAC will be used to sign/verify NVM structures. Hash algorithms can be selected from those supported by enum vb2_hash_algorithm (i.e. SHA1, SHA256, or SHA512). BUG=chrome-os-partner:51907 BRANCH=tot TEST=make runtests Change-Id: I6d349bc807874fe2a5512aabcd7fbf67a4eaa40a Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/342880 Reviewed-by: Randall Spangler <rspangler@chromium.org>
30 lines
762 B
C
30 lines
762 B
C
/* 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_VBOOT_2HMAC_H_
|
|
#define VBOOT_REFERENCE_VBOOT_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
|