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