xref: /freebsd/share/man/man9/rijndael.9 (revision d37eb51047221dc3322b34db1038ff3aa533883f)
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.Dd February 6, 2002
28.Dt RIJNDAEL 9
29.Os
30.Sh NAME
31.Nm rijndael_makeKey ,
32.Nm rijndael_cipherInit ,
33.Nm rijndael_blockEncrypt ,
34.Nm rijndael_padEncrypt ,
35.Nm rijndael_blockDecrypt ,
36.Nm rijndael_padDecrypt
37.Nd AES encryption
38.Sh SYNOPSIS
39.In sys/types.h
40.In crypto/rijndael.h
41.Ft int
42.Fo rijndael_makeKey
43.Fa "keyInstance *key"
44.Fa "uint8_t direction"
45.Fa "int keyLen"
46.Fa "char *keyMaterial"
47.Fc
48.Ft int
49.Fo rijndael_cipherInit
50.Fa "cipherInstance *cipher"
51.Fa "uint8_t mode"
52.Fa "char *IV"
53.Fc
54.Ft int
55.Fo rijndael_blockEncrypt
56.Fa "cipherInstance *cipher"
57.Fa "keyInstance *key"
58.Fa "uint8_t *input"
59.Fa "int inputLen"
60.Fa "uint8_t *outBuffer"
61.Fc
62.Ft int
63.Fo rijndael_padEncrypt
64.Fa "cipherInstance *cipher"
65.Fa "keyInstance *key"
66.Fa "uint8_t *input"
67.Fa "int inputOctets"
68.Fa "uint8_t *outBuffer"
69.Fc
70.Ft int
71.Fo rijndael_blockDecrypt
72.Fa "cipherInstance *cipher"
73.Fa "keyInstance *key"
74.Fa "uint8_t *input"
75.Fa "int inputLen"
76.Fa "uint8_t *outBuffer"
77.Fc
78.Ft int
79.Fo rijndael_padDecrypt
80.Fa "cipherInstance *cipher"
81.Fa "keyInstance *key"
82.Fa "uint8_t *input"
83.Fa "int inputOctets"
84.Fa "uint8_t *outBuffer"
85.Fc
86.Sh DESCRIPTION
87The
88.Fn rijndael_makeKey
89function is used to set up the key schedule in
90.Fa key .
91The
92.Fa direction
93(which may be
94.Dv DIR_ENCRYPT
95or
96.Dv DIR_DECRYPT )
97specifies the intended use of the key.
98The length of the key (in bits) is given in
99.Fa keyLen ,
100and must be 128, 192 or 256.
101The actual key is supplied in the buffer pointed to by
102.Fa keyMaterial .
103This material may be raw binary data,
104or an ASCII string containing a hexadecimal rendition
105of the raw binary data,
106dependent on a compile-time option in the
107.Nm
108sources,
109.Dv BINARY_KEY_MATERIAL .
110.Sh RETURN VALUES
111The
112.Fn rijndael_makeKey
113function will return
114.Dv BAD_KEY_INSTANCE
115if a
116.Dv NULL
117.Fa key
118is passed,
119.Dv BAD_KEY_DIR
120if
121.Fa direction
122is not
123.Dv DIR_ENCRYPT
124or
125.Dv DIR_DECRYPT ,
126.Dv BAD_KEY_MAT
127if the key materials are not a hexadecimal string
128(and binary keys are not set),
129and
130.Dv TRUE
131otherwise.
132.Sh AUTHORS
133.An Mark R V Murray
134