1169425Sgnn/* 2169425Sgnn * 3169425Sgnn * Copyright (c) 2006 4169425Sgnn * NTT (Nippon Telegraph and Telephone Corporation) . All rights reserved. 5169425Sgnn * 6169425Sgnn * Redistribution and use in source and binary forms, with or without 7169425Sgnn * modification, are permitted provided that the following conditions 8169425Sgnn * are met: 9169425Sgnn * 1. Redistributions of source code must retain the above copyright 10169425Sgnn * notice, this list of conditions and the following disclaimer as 11169425Sgnn * the first lines of this file unmodified. 12169425Sgnn * 2. Redistributions in binary form must reproduce the above copyright 13169425Sgnn * notice, this list of conditions and the following disclaimer in the 14169425Sgnn * documentation and/or other materials provided with the distribution. 15169425Sgnn * 16169425Sgnn * THIS SOFTWARE IS PROVIDED BY NTT ``AS IS'' AND ANY EXPRESS OR 17169425Sgnn * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18169425Sgnn * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19169425Sgnn * IN NO EVENT SHALL NTT BE LIABLE FOR ANY DIRECT, INDIRECT, 20169425Sgnn * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21169425Sgnn * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22169425Sgnn * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23169425Sgnn * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24169425Sgnn * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25169425Sgnn * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26169425Sgnn * 27169425Sgnn * $FreeBSD$ 28169425Sgnn */ 29169425Sgnn 30169425Sgnn#include <sys/cdefs.h> 31169425Sgnn 32169425Sgnn#include <sys/types.h> 33169425Sgnn#ifdef _KERNEL 34169425Sgnn#include <sys/systm.h> 35169425Sgnn#endif 36169425Sgnn#include <crypto/camellia/camellia.h> 37169425Sgnn 38169425Sgnnvoid 39169425Sgnncamellia_set_key(camellia_ctx *ctx, const u_char *key, int bits) 40169425Sgnn{ 41169425Sgnn 42169425Sgnn Camellia_Ekeygen(bits, key, ctx->subkey); 43169425Sgnn ctx->bits = bits; 44169425Sgnn} 45169425Sgnn 46169425Sgnnvoid 47169425Sgnncamellia_decrypt(const camellia_ctx *ctx, const u_char *src, u_char *dst) 48169425Sgnn{ 49169425Sgnn 50169425Sgnn Camellia_DecryptBlock(ctx->bits, src, ctx->subkey, dst); 51169425Sgnn} 52169425Sgnn 53169425Sgnnvoid 54169425Sgnncamellia_encrypt(const camellia_ctx *ctx, const u_char *src, u_char *dst) 55169425Sgnn{ 56169425Sgnn 57169425Sgnn Camellia_EncryptBlock(ctx->bits, src, ctx->subkey, dst); 58169425Sgnn} 59