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