1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
.TH LIBRECRYPT_TEST_SUPPORTED 3 LIBRECRYPT
.SH NAME
librecrypt_test_supported - Check whether an algorithm chain is supported
.SH SYNOPSIS
.nf
#include <librecrypt.h>
int \fBlibrecrypt_test_supported\fP(const char *\fIphrase\fP, size_t \fIlen\fP, int \fItext\fP,
const char *\fIsettings\fP, LIBRECRYPT_CONTEXT *\fIctx\fP);
.fi
.PP
Link with
.IR -lrecrypt .
Static linking may require additional flags
depending on enabled hash algorithms.
.SH DESCRIPTION
The
.BR librecrypt_test_supported ()
function checks whether a hash algorithm chain is
supported for the given input, and that each
algorithm configuration is valid.
.PP
The
.I settings
argument is a password hash string. Algorithm
tuning parameters and the hash result may be omitted.
.PP
The
.I phrase
argument is the password to hash.
It may contain null bytes and may be
.IR NULL
even if
.I len
is non-zero. If
.I phrase
is
.IR NULL ,
the function checks whether the specified length
is supported and assumes an arbitrary byte
sequence if
.I text
is zero. If
.I text
is non-zero, UTF-8 without null bytes is assumed.
.PP
The
.I ctx
parameter is used for providing library
configurations, see
.BR librecrypt_create_context (3)
for more information; used
.I NULL
for default configurations.
.PP
If
.I phrase
is not
.IR NULL ,
.I text
is ignored.
.PP
.I settings
must not be
.IR NULL .
.SH RETURN VALUES
The
.BR librecrypt_test_supported ()
function returns 1 if the configuration is supported,
and 0 otherwise.
.SH ERRORS
The
.BR librecrypt_test_supported ()
function cannot fail.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.PP
.TS
allbox;
lb lb lb
l l l.
Interface Attribute Value
T{
.BR librecrypt_test_supported ()
T} Thread safety MT-Safe
T{
.BR librecrypt_test_supported ()
T} Async-signal safety AS-Safe
.TE
.sp
.SH HISTORY
The
.BR librecrypt_test_supported ()
function was introduced in version 1.0 of
.BR librecrypt .
Since version 1.1 of the
.BR librecrypt_test_supported ()
function, the
.I ctx
parameter (previously called
.IR reserved )
has the type
.B LIBRECRYPT_CONTEXT *
(previously
.BR "void *" ),
and setting it to
.RI non- NULL
no longer causes failure with
.I errno
set to
.IR EINVAL .
.SH SEE ALSO
.BR librecrypt (7),
.BR librecrypt_test_supported (3),
.BR librecrypt_hash_binary (3),
.BR librecrypt_hash (3),
.BR librecrypt_crypt (3),
.BR librecrypt_verify (3)
|