aboutsummaryrefslogblamecommitdiffstats
path: root/hmac_update.c
blob: 160a2936501aa95a5a123f4ca4f211b660efb495 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                                                                   
                                                                                                     




                                                    
/* See LICENSE file for copyright and license details. */
#include "common.h"


/**
 * Feed data into the HMAC algorithm
 * 
 * @param  state  The state of the algorithm
 * @param  data   Data to feed into the algorithm
 * @param  n      The number of bytes to feed into the
 *                algorithm, this must be a multiple of 8
 */
void
libsha1_hmac_update(struct libsha1_hmac_state *restrict state, const void *restrict data, size_t n)
{
	if (!state->inited) {
		libsha1_init(&state->sha1_state, state->sha1_state.algorithm);
		libsha1_update(&state->sha1_state, state->ipad, sizeof(state->sha1_state.chunk) * 8);
		state->inited = 1;
	}

	libsha1_update(&state->sha1_state, data, n);
}