Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / crypto / rijndael / rijndael.c
blobb9b4120b193421c0eb372fb31226a0a4c77db27d
1 /* $NetBSD: rijndael.c,v 1.6.4.4 2005/03/04 16:40:52 skrll Exp $ */
3 /**
4 * rijndael-alg-fst.c
6 * @version 3.0 (December 2000)
8 * Optimised ANSI C code for the Rijndael cipher (now AES)
10 * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be>
11 * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be>
12 * @author Paulo Barreto <paulo.barreto@terra.com.br>
14 * This code is hereby placed in the public domain.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
17 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #include <sys/cdefs.h>
30 __KERNEL_RCSID(0, "$NetBSD: rijndael.c,v 1.6.4.4 2005/03/04 16:40:52 skrll Exp $");
32 #include <sys/types.h>
33 #include <sys/systm.h>
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);