xref: /freebsd/share/man/man9/rijndael.9 (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1.\"
2.\" Copyright (c) 2002
3.\"	Mark R V Murray.  All rights reserved.
4.\"
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26.\"
27.\" $FreeBSD$
28.\" "
29.Dd February 6, 2002
30.Dt RIJNDAEL 9
31.Os
32.Sh NAME
33.Nm rijndael_makeKey ,
34.Nm rijndael_cipherInit ,
35.Nm rijndael_blockEncrypt ,
36.Nm rijndael_padEncrypt ,
37.Nm rijndael_blockDecrypt ,
38.Nm rijndael_padDecrypt
39.Nd AES encryption
40.Sh SYNOPSIS
41.In sys/types.h
42.In crypto/rijndael.h
43.Ft int
44.Fo rijndael_makeKey
45.Fa "keyInstance *key"
46.Fa "uint8_t direction"
47.Fa "int keyLen"
48.Fa "char *keyMaterial"
49.Fc
50.Ft int
51.Fo rijndael_cipherInit
52.Fa "cipherInstance *cipher"
53.Fa "uint8_t mode"
54.Fa "char *IV"
55.Fc
56.Ft int
57.Fo rijndael_blockEncrypt
58.Fa "cipherInstance *cipher"
59.Fa "keyInstance *key"
60.Fa "uint8_t *input"
61.Fa "int inputLen"
62.Fa "uint8_t *outBuffer"
63.Fc
64.Ft int
65.Fo rijndael_padEncrypt
66.Fa "cipherInstance *cipher"
67.Fa "keyInstance *key"
68.Fa "uint8_t *input"
69.Fa "int inputOctets"
70.Fa "uint8_t *outBuffer"
71.Fc
72.Ft int
73.Fo rijndael_blockDecrypt
74.Fa "cipherInstance *cipher"
75.Fa "keyInstance *key"
76.Fa "uint8_t *input"
77.Fa "int inputLen"
78.Fa "uint8_t *outBuffer"
79.Fc
80.Ft int
81.Fo rijndael_padDecrypt
82.Fa "cipherInstance *cipher"
83.Fa "keyInstance *key"
84.Fa "uint8_t *input"
85.Fa "int inputOctets"
86.Fa "uint8_t *outBuffer"
87.Fc
88.Sh DESCRIPTION
89The
90.Fn rijndael_makeKey
91function is used to set up the key schedule in
92.Fa key .
93The
94.Fa direction
95(which may be
96.Dv DIR_ENCRYPT
97or
98.Dv DIR_DECRYPT )
99specifies the intended use of the key.
100The length of the key (in bits) is given in
101.Fa keyLen ,
102and must be 128, 192 or 256.
103The actual key is supplied in the buffer pointed to by
104.Fa keyMaterial .
105This material may be raw binary data,
106or an ASCII string containing a hexadecimal rendition
107of the raw binary data,
108dependent on a compile-time option in the
109.Nm
110sources,
111.Dv BINARY_KEY_MATERIAL .
112.Sh RETURN VALUES
113The
114.Fn rijndael_makeKey
115function will return
116.Dv BAD_KEY_INSTANCE
117if a
118.Dv NULL
119.Fa key
120is passed,
121.Dv BAD_KEY_DIR
122if
123.Fa direction
124is not
125.Dv DIR_ENCRYPT
126or
127.Dv DIR_DECRYPT ,
128.Dv BAD_KEY_MAT
129if the key materials are not a hexadecimal string
130(and binary keys are not set),
131and
132.Dv TRUE
133otherwise.
134.Sh AUTHORS
135.An Mark R V Murray
136