ObjFW
Toggle main menu visibility
Loading...
Searching...
No Matches
OFPBKDF2.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008-2026 Jonathan Schleifer <js@nil.im>
3
*
4
* All rights reserved.
5
*
6
* This program is free software: you can redistribute it and/or modify it
7
* under the terms of the GNU Lesser General Public License version 3.0 only,
8
* as published by the Free Software Foundation.
9
*
10
* This program is distributed in the hope that it will be useful, but WITHOUT
11
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13
* version 3.0 for more details.
14
*
15
* You should have received a copy of the GNU Lesser General Public License
16
* version 3.0 along with this program. If not, see
17
* <https://www.gnu.org/licenses/>.
18
*/
19
20
#ifndef __STDC_LIMIT_MACROS
21
# define __STDC_LIMIT_MACROS
22
#endif
23
#ifndef __STDC_CONSTANT_MACROS
24
# define __STDC_CONSTANT_MACROS
25
#endif
26
27
#import "
macros.h
"
28
29
OF_ASSUME_NONNULL_BEGIN
30
32
33
@class
OFHMAC
;
34
38
typedef
struct
{
40
__unsafe_unretained
OFHMAC
*
HMAC
;
42
size_t
iterations
;
44
const
unsigned
char
*
salt
;
46
size_t
saltLength
;
48
const
char
*
password
;
50
size_t
passwordLength
;
52
unsigned
char
*
key
;
58
size_t
keyLength
;
60
bool
allowsSwappableMemory
;
61
}
OFPBKDF2Parameters
;
62
63
#ifdef __cplusplus
64
extern
"C"
{
65
#endif
75
extern
void
OFPBKDF2
(
OFPBKDF2Parameters
parameters);
76
#ifdef __cplusplus
77
}
78
#endif
79
80
OF_ASSUME_NONNULL_END
OFPBKDF2
void OFPBKDF2(OFPBKDF2Parameters parameters)
Derives a key from a password and a salt using PBKDF2.
Definition
OFPBKDF2.m:33
OFHMAC
A class which provides methods to calculate an HMAC.
Definition
OFHMAC.h:32
macros.h
OFPBKDF2Parameters
The parameters for OFPBKDF2.
Definition
OFPBKDF2.h:38
OFPBKDF2Parameters::passwordLength
size_t passwordLength
The length of the password.
Definition
OFPBKDF2.h:50
OFPBKDF2Parameters::saltLength
size_t saltLength
The length of the salt.
Definition
OFPBKDF2.h:46
OFPBKDF2Parameters::key
unsigned char * key
The buffer to write the key to.
Definition
OFPBKDF2.h:52
OFPBKDF2Parameters::allowsSwappableMemory
bool allowsSwappableMemory
Whether data may be stored in swappable memory.
Definition
OFPBKDF2.h:60
OFPBKDF2Parameters::keyLength
size_t keyLength
The desired length for the derived key.
Definition
OFPBKDF2.h:58
OFPBKDF2Parameters::iterations
size_t iterations
The number of iterations to perform.
Definition
OFPBKDF2.h:42
OFPBKDF2Parameters::HMAC
__unsafe_unretained OFHMAC * HMAC
The HMAC to use to derive a key.
Definition
OFPBKDF2.h:40
OFPBKDF2Parameters::password
const char * password
The password to derive a key from.
Definition
OFPBKDF2.h:48
OFPBKDF2Parameters::salt
const unsigned char * salt
The salt to derive a key with.
Definition
OFPBKDF2.h:44
src
OFPBKDF2.h
Generated by
1.17.0