Coverage Report

Created: 2024-06-28 06:39

/src/nettle-with-libgmp/pbkdf2-hmac-sha384.c
Line
Count
Source
1
/* pbkdf2-hmac-sha384.c
2
3
   Copyright (C) 2012 Simon Josefsson
4
   Copyright (C) 2021 Nicolas Mora
5
6
   This file is part of GNU Nettle.
7
8
   GNU Nettle is free software: you can redistribute it and/or
9
   modify it under the terms of either:
10
11
     * the GNU Lesser General Public License as published by the Free
12
       Software Foundation; either version 3 of the License, or (at your
13
       option) any later version.
14
15
   or
16
17
     * the GNU General Public License as published by the Free
18
       Software Foundation; either version 2 of the License, or (at your
19
       option) any later version.
20
21
   or both in parallel, as here.
22
23
   GNU Nettle is distributed in the hope that it will be useful,
24
   but WITHOUT ANY WARRANTY; without even the implied warranty of
25
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
26
   General Public License for more details.
27
28
   You should have received copies of the GNU General Public License and
29
   the GNU Lesser General Public License along with this program.  If
30
   not, see http://www.gnu.org/licenses/.
31
*/
32
33
#if HAVE_CONFIG_H
34
# include "config.h"
35
#endif
36
37
#include "pbkdf2.h"
38
39
#include "hmac.h"
40
41
void
42
pbkdf2_hmac_sha384 (size_t key_length, const uint8_t *key,
43
        unsigned iterations,
44
        size_t salt_length, const uint8_t *salt,
45
        size_t length, uint8_t *dst)
46
42
{
47
42
  struct hmac_sha384_ctx sha384ctx;
48
49
42
  hmac_sha384_set_key (&sha384ctx, key_length, key);
50
42
  PBKDF2 (&sha384ctx, hmac_sha384_update, hmac_sha384_digest,
51
42
    SHA384_DIGEST_SIZE, iterations, salt_length, salt, length, dst);
52
42
}