1 /*
2 * Copyright (c) 2004 X-Way Rights BV
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 /*!\file hmacsha384.c
21 * \brief HMAC-SHA-384 message digest algorithm.
22 * \author Bob Deblier <bob.deblier@telenet.be>
23 * \ingroup HMAC_m HMAC_sha384_m
24 */
25
26 #define BEECRYPT_DLL_EXPORT
27
28 #if HAVE_CONFIG_H
29 # include "config.h"
30 #endif
31
32 #include "beecrypt/hmacsha384.h"
33
34 /*!\addtogroup HMAC_sha384_m
35 * \{
36 */
37
38 const keyedHashFunction hmacsha384 = {
39 "HMAC-SHA-384",
40 sizeof(hmacsha384Param),
41 128,
42 48,
43 64,
44 512,
45 32,
46 (keyedHashFunctionSetup) hmacsha384Setup,
47 (keyedHashFunctionReset) hmacsha384Reset,
48 (keyedHashFunctionUpdate) hmacsha384Update,
49 (keyedHashFunctionDigest) hmacsha384Digest
50 };
51
hmacsha384Setup(hmacsha384Param * sp,const byte * key,size_t keybits)52 int hmacsha384Setup (hmacsha384Param* sp, const byte* key, size_t keybits)
53 {
54 return hmacSetup(sp->kxi, sp->kxo, &sha384, &sp->sparam, key, keybits);
55 }
56
hmacsha384Reset(hmacsha384Param * sp)57 int hmacsha384Reset (hmacsha384Param* sp)
58 {
59 return hmacReset(sp->kxi, &sha384, &sp->sparam);
60 }
61
hmacsha384Update(hmacsha384Param * sp,const byte * data,size_t size)62 int hmacsha384Update(hmacsha384Param* sp, const byte* data, size_t size)
63 {
64 return hmacUpdate(&sha384, &sp->sparam, data, size);
65 }
66
hmacsha384Digest(hmacsha384Param * sp,byte * data)67 int hmacsha384Digest(hmacsha384Param* sp, byte* data)
68 {
69 return hmacDigest(sp->kxo, &sha384, &sp->sparam, data);
70 }
71
72 /*!\}
73 */
74