2018-03-07 20:57:14 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Intel Corporation. All rights reserved.
|
|
|
|
*
|
2018-05-26 01:49:13 +08:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2018-03-07 20:57:14 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <rtl.h>
|
2018-07-13 04:14:13 +08:00
|
|
|
#include <hkdf.h>
|
2018-03-07 20:57:14 +08:00
|
|
|
|
|
|
|
int hkdf_sha256(uint8_t *out_key, size_t out_len,
|
|
|
|
const uint8_t *secret, size_t secret_len,
|
2018-05-18 12:01:06 +08:00
|
|
|
__unused const uint8_t *salt, __unused size_t salt_len,
|
|
|
|
__unused const uint8_t *info, __unused size_t info_len)
|
2018-03-07 20:57:14 +08:00
|
|
|
{
|
2018-05-18 12:01:06 +08:00
|
|
|
/* FIXME: currently, we only support one AaaG/Trusty
|
|
|
|
* instance, so just simply copy the h/w seed to Trusty.
|
|
|
|
* In the future, we will choose another crypto library
|
|
|
|
* to derive multiple seeds in order to support multiple
|
|
|
|
* AaaG/Trusty instances.
|
|
|
|
*/
|
2018-07-05 13:32:01 +08:00
|
|
|
(void)memcpy_s(out_key, out_len, secret, secret_len);
|
2018-03-07 20:57:14 +08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|