mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-07-15 01:23:14 -07:00
KBKDF
This commit is contained in:
parent
70648d006d
commit
44dd52d08f
3 changed files with 47 additions and 13 deletions
|
@ -32,6 +32,12 @@
|
|||
|
||||
#define ZT_HMACSHA384_LEN 48
|
||||
|
||||
#define ZT_PROTO_KBKDF_LABEL_KEY_USE_HMAC 'H'
|
||||
#define ZT_PROTO_KBKDF_LABEL_KEY_USE_AES_GMAC_SIV_K1 '1'
|
||||
#define ZT_PROTO_KBKDF_LABEL_KEY_USE_AES_GMAC_SIV_K2 '2'
|
||||
#define ZT_PROTO_KBKDF_LABEL_KEY_USE_AES_GMAC_SIV_K3 '3'
|
||||
#define ZT_PROTO_KBKDF_LABEL_KEY_USE_AES_GMAC_SIV_K4 '4'
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
@ -102,6 +108,17 @@ void SHA384(void *digest,const void *data0,unsigned int len0,const void *data1,u
|
|||
*/
|
||||
void HMACSHA384(const uint8_t key[32],const void *msg,const unsigned int msglen,uint8_t mac[48]);
|
||||
|
||||
/**
|
||||
* Compute KBKDF (key-based key derivation function) using HMAC-SHA-384 as a PRF
|
||||
*
|
||||
* @param key Source master key
|
||||
* @param label A label indicating the key's purpose in the ZeroTier system
|
||||
* @param context An arbitrary "context" or zero if not applicable
|
||||
* @param iter Key iteration for generation of multiple keys for the same label/context
|
||||
* @param out Output to receive derived key
|
||||
*/
|
||||
void KBKDFHMACSHA384(const uint8_t key[32],const char label,const char context,const uint32_t iter,uint8_t out[32]);
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue