kernel - Fix races created by a comedy of circumstansces (3)
[dragonfly.git] / sys / crypto / rijndael / rijndael-api.c
blobb99803703b3e77b402b38502b32d3be91385d560
1 /* $FreeBSD: src/sys/crypto/rijndael/rijndael-api.c,v 1.2 2008/01/15 18:34:47 sobomax Exp $ */
2 /* $KAME: rijndael.c,v 1.3 2003/08/28 14:20:22 itojun Exp $ */
4 /*
5 * rijndael-alg-fst.c
7 * @version 3.0 (December 2000)
9 * Optimised ANSI C code for the Rijndael cipher (now AES)
11 * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be>
12 * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be>
13 * @author Paulo Barreto <paulo.barreto@terra.com.br>
15 * This code is hereby placed in the public domain.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
18 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #include <sys/types.h>
31 #ifdef _KERNEL
32 #include <sys/systm.h>
33 #endif
35 #include <crypto/rijndael/rijndael.h>
37 void
38 rijndael_set_key(rijndael_ctx *ctx, const u_char *key, int bits)
41 ctx->Nr = rijndaelKeySetupEnc(ctx->ek, key, bits);
42 rijndaelKeySetupDec(ctx->dk, key, bits);
45 void
46 rijndael_decrypt(const rijndael_ctx *ctx, const u_char *src, u_char *dst)
49 rijndaelDecrypt(ctx->dk, ctx->Nr, src, dst);
52 void
53 rijndael_encrypt(const rijndael_ctx *ctx, const u_char *src, u_char *dst)
56 rijndaelEncrypt(ctx->ek, ctx->Nr, src, dst);