]>
Commit | Line | Data |
---|---|---|
f281a955 ZF |
1 | /* balloon-sha1.c |
2 | ||
3 | Balloon password-hashing algorithm. | |
4 | ||
5 | Copyright (C) 2022 Zoltan Fridrich | |
dec8ac5e | 6 | Copyright (C) 2022 Red Hat, Inc. |
f281a955 ZF |
7 | |
8 | This file is part of GNU Nettle. | |
9 | ||
10 | GNU Nettle is free software: you can redistribute it and/or | |
11 | modify it under the terms of either: | |
12 | ||
13 | * the GNU Lesser General Public License as published by the Free | |
14 | Software Foundation; either version 3 of the License, or (at your | |
15 | option) any later version. | |
16 | ||
17 | or | |
18 | ||
19 | * the GNU General Public License as published by the Free | |
20 | Software Foundation; either version 2 of the License, or (at your | |
21 | option) any later version. | |
22 | ||
23 | or both in parallel, as here. | |
24 | ||
25 | GNU Nettle is distributed in the hope that it will be useful, | |
26 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
27 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
28 | General Public License for more details. | |
29 | ||
30 | You should have received copies of the GNU General Public License and | |
31 | the GNU Lesser General Public License along with this program. If | |
32 | not, see http://www.gnu.org/licenses/. | |
33 | */ | |
34 | ||
35 | #if HAVE_CONFIG_H | |
36 | # include "config.h" | |
37 | #endif | |
38 | ||
39 | #include "balloon.h" | |
40 | #include "sha1.h" | |
41 | ||
42 | void | |
43 | balloon_sha1(size_t s_cost, size_t t_cost, | |
44 | size_t passwd_length, const uint8_t *passwd, | |
45 | size_t salt_length, const uint8_t *salt, | |
46 | uint8_t *scratch, uint8_t *dst) | |
47 | { | |
48 | struct sha1_ctx ctx; | |
49 | sha1_init(&ctx); | |
50 | balloon(&ctx, | |
51 | (nettle_hash_update_func*)sha1_update, | |
52 | (nettle_hash_digest_func*)sha1_digest, | |
53 | SHA1_DIGEST_SIZE, s_cost, t_cost, | |
54 | passwd_length, passwd, salt_length, salt, scratch, dst); | |
55 | } |