Libav
hmac.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Martin Storsjo
3  *
4  * This file is part of Libav.
5  *
6  * Libav is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * Libav is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with Libav; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef AVUTIL_HMAC_H
22 #define AVUTIL_HMAC_H
23 
24 #include <stdint.h>
25 
32 enum AVHMACType {
37 };
38 
39 typedef struct AVHMAC AVHMAC;
40 
45 AVHMAC *av_hmac_alloc(enum AVHMACType type);
46 
51 void av_hmac_free(AVHMAC *ctx);
52 
59 void av_hmac_init(AVHMAC *ctx, const uint8_t *key, unsigned int keylen);
60 
67 void av_hmac_update(AVHMAC *ctx, const uint8_t *data, unsigned int len);
68 
76 int av_hmac_final(AVHMAC *ctx, uint8_t *out, unsigned int outlen);
77 
89 int av_hmac_calc(AVHMAC *ctx, const uint8_t *data, unsigned int len,
90  const uint8_t *key, unsigned int keylen,
91  uint8_t *out, unsigned int outlen);
92 
97 #endif /* AVUTIL_HMAC_H */
int av_hmac_calc(AVHMAC *ctx, const uint8_t *data, unsigned int len, const uint8_t *key, unsigned int keylen, uint8_t *out, unsigned int outlen)
Hash an array of data with a key.
Definition: hmac.c:153
AVHMAC * av_hmac_alloc(enum AVHMACType type)
Allocate an AVHMAC context.
Definition: hmac.c:52
AVHMACType
Definition: hmac.h:32
uint8_t
const char data[16]
Definition: mxf.c:70
void av_hmac_update(AVHMAC *ctx, const uint8_t *data, unsigned int len)
Hash data with the HMAC.
Definition: hmac.c:130
Definition: hmac.c:32
void av_hmac_init(AVHMAC *ctx, const uint8_t *key, unsigned int keylen)
Initialize an AVHMAC context with an authentication key.
Definition: hmac.c:109
AVFormatContext * ctx
Definition: movenc.c:48
uint8_t key[MAX_BLOCKLEN]
Definition: hmac.c:38
int av_hmac_final(AVHMAC *ctx, uint8_t *out, unsigned int outlen)
Finish hashing and output the HMAC digest.
Definition: hmac.c:135
int keylen
Definition: hmac.c:39
void av_hmac_free(AVHMAC *ctx)
Free an AVHMAC context.
Definition: hmac.c:101
int len
FILE * out
Definition: movenc.c:54