aboutsummaryrefslogtreecommitdiff
path: root/third_party/libuweave/src/crypto_hmac.h
blob: bac634ab31c53466d1a48953ff9c66d8f3ec9a54 (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 2015 The Weave 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 LIBUWEAVE_SRC_CRYPTO_HMAC_H_
#define LIBUWEAVE_SRC_CRYPTO_HMAC_H_

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

// Return the minimum required number of bytes for the state_buffer used in the
// init, update and final functions.
size_t uw_crypto_hmac_required_buffer_size_();

bool uw_crypto_hmac_init_(uint8_t* state_buffer,
                          size_t state_buffer_len,
                          const uint8_t* key,
                          size_t key_len);
bool uw_crypto_hmac_update_(uint8_t* state_buffer,
                            size_t state_buffer_len,
                            const uint8_t* data,
                            size_t data_len);
bool uw_crypto_hmac_final_(uint8_t* state_buffer,
                           size_t state_buffer_len,
                           uint8_t* truncated_digest,
                           size_t truncated_digest_len);

#endif  // LIBUWEAVE_SRC_CRYPTO_HMAC_H_