annotate lib/libavutil/hmac.h @ 2556:91c75d202d30

Shooting bow sound & stats word wrap (bugfix submitted by default8p)
author a.parshin
date Thu, 14 May 2015 11:03:14 +0200
parents 992d2e6f907d
children
rev   line source
2134
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
1 /*
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
2 * Copyright (C) 2012 Martin Storsjo
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
3 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
4 * This file is part of FFmpeg.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
5 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
10 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
14 * Lesser General Public License for more details.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
15 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
19 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
20
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
21 #ifndef AVUTIL_HMAC_H
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
22 #define AVUTIL_HMAC_H
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
23
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
24 #include <stdint.h>
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
25
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
26 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
27 * @defgroup lavu_hmac HMAC
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
28 * @ingroup lavu_crypto
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
29 * @{
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
30 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
31
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
32 enum AVHMACType {
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
33 AV_HMAC_MD5,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
34 AV_HMAC_SHA1,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
35 };
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
36
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
37 typedef struct AVHMAC AVHMAC;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
38
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
39 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
40 * Allocate an AVHMAC context.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
41 * @param type The hash function used for the HMAC.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
42 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
43 AVHMAC *av_hmac_alloc(enum AVHMACType type);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
44
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
45 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
46 * Free an AVHMAC context.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
47 * @param ctx The context to free, may be NULL
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
48 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
49 void av_hmac_free(AVHMAC *ctx);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
50
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
51 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
52 * Initialize an AVHMAC context with an authentication key.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
53 * @param ctx The HMAC context
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
54 * @param key The authentication key
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
55 * @param keylen The length of the key, in bytes
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
56 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
57 void av_hmac_init(AVHMAC *ctx, const uint8_t *key, unsigned int keylen);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
58
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
59 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
60 * Hash data with the HMAC.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
61 * @param ctx The HMAC context
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
62 * @param data The data to hash
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
63 * @param len The length of the data, in bytes
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
64 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
65 void av_hmac_update(AVHMAC *ctx, const uint8_t *data, unsigned int len);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
66
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
67 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
68 * Finish hashing and output the HMAC digest.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
69 * @param ctx The HMAC context
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
70 * @param out The output buffer to write the digest into
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
71 * @param outlen The length of the out buffer, in bytes
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
72 * @return The number of bytes written to out, or a negative error code.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
73 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
74 int av_hmac_final(AVHMAC *ctx, uint8_t *out, unsigned int outlen);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
75
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
76 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
77 * Hash an array of data with a key.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
78 * @param ctx The HMAC context
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
79 * @param data The data to hash
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
80 * @param len The length of the data, in bytes
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
81 * @param key The authentication key
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
82 * @param keylen The length of the key, in bytes
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
83 * @param out The output buffer to write the digest into
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
84 * @param outlen The length of the out buffer, in bytes
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
85 * @return The number of bytes written to out, or a negative error code.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
86 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
87 int av_hmac_calc(AVHMAC *ctx, const uint8_t *data, unsigned int len,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
88 const uint8_t *key, unsigned int keylen,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
89 uint8_t *out, unsigned int outlen);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
90
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
91 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
92 * @}
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
93 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
94
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
95 #endif /* AVUTIL_HMAC_H */