blob: 223444a6d94bd1d58e38e265934fd96ff08945c7 [file] [log] [blame]
Alexandre Lision51140e12013-12-02 10:54:09 -05001/*
2 Copyright (C) 2009, 2006, 2005, 2004 Erik Eliasson, Johan Bilien, Werner Dittmann
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18*/
19
20/**
21 * Methods to compute a SHA384 HMAC.
22 *
23 * @author Erik Eliasson <eliasson@it.kth.se>
24 * @author Johan Bilien <jobi@via.ecp.fr>
25 * @author Werner Dittmann <Werner.Dittmann@t-online.de>
26 */
27
28#ifndef HMAC_SHA384_H
29#define HMAC_SHA384_H
30
31/**
32 * @file hmac384.h
33 * @brief Function that provide SHA384 HMAC support
34 *
35 * @ingroup GNU_ZRTP
36 * @{
37 */
38
39#include <stdint.h>
40
41#ifndef SHA384_DIGEST_LENGTH
42#define SHA384_DIGEST_LENGTH 48
43#endif
44
45/**
46 * Compute SHA384 HMAC.
47 *
48 * This functions takes one data chunk and computes its SHA384 HMAC.
49 *
50 * @param key
51 * The MAC key.
52 * @param key_length
53 * Lneght of the MAC key in bytes
54 * @param data
55 * Points to the data chunk.
56 * @param data_length
57 * Length of the data in bytes
58 * @param mac
59 * Points to a buffer that receives the computed digest. This
60 * buffer must have a size of at least 48 bytes (SHA384_DIGEST_LENGTH).
61 * @param mac_length
62 * Point to an integer that receives the length of the computed HMAC.
63 */
64void hmac_sha384( uint8_t* key, uint32_t key_length,
65 uint8_t* data, int32_t data_length,
66 uint8_t* mac, uint32_t* mac_length );
67
68/**
69 * Compute SHA384 HMAC over several data cunks.
70 *
71 * This functions takes several data chunk and computes the SHA384 HAMAC. It
72 * uses the openSSL HAMAC SHA384 implementation.
73 *
74 * @param key
75 * The MAC key.
76 * @param key_length
77 * Lneght of the MAC key in bytes
78 * @param data
79 * Points to an array of pointers that point to the data chunks. A NULL
80 * pointer in an array element terminates the data chunks.
81 * @param data_length
82 * Points to an array of integers that hold the length of each data chunk.
83 * @param mac
84 * Points to a buffer that receives the computed digest. This
85 * buffer must have a size of at least 48 bytes (SHA384_DIGEST_LENGTH).
86 * @param mac_length
87 * Point to an integer that receives the length of the computed HMAC.
88 */
89
90void hmac_sha384( uint8_t* key, uint32_t key_length,
91 uint8_t* data[], uint32_t data_length[],
92 uint8_t* mac, uint32_t* mac_length );
93/**
94 * @}
95 */
96#endif