• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2015 The Weave Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef LIBUWEAVE_SRC_CRYPTO_HMAC_H_
6 #define LIBUWEAVE_SRC_CRYPTO_HMAC_H_
7 
8 #include <stdbool.h>
9 #include <stddef.h>
10 #include <stdint.h>
11 
12 typedef struct {
13   const uint8_t* bytes;
14   size_t num_bytes;
15 } UwCryptoHmacMsg;
16 
17 /**
18  * Compute HMAC over a list of messages, which is equivalent to computing HMAC
19  * over the concatenation of all the messages. The HMAC output will be truncated
20  * to the desired length truncated_digest_len, and written into trucated_digest.
21  */
22 bool uw_crypto_hmac_(const uint8_t* key,
23                      size_t key_len,
24                      const UwCryptoHmacMsg messages[],
25                      size_t num_messages,
26                      uint8_t* truncated_digest,
27                      size_t truncated_digest_len);
28 
29 #endif  // LIBUWEAVE_SRC_CRYPTO_HMAC_H_
30