1211026Sgavin/* $NetBSD$ */ 2211026Sgavin 3211026Sgavin/* 4211026Sgavin * 5211026Sgavin * Copyright (c) 2006 6211026Sgavin * NTT (Nippon Telegraph and Telephone Corporation) . All rights reserved. 7211026Sgavin * 8211026Sgavin * Redistribution and use in source and binary forms, with or without 9211026Sgavin * modification, are permitted provided that the following conditions 10211026Sgavin * are met: 11211026Sgavin * 1. Redistributions of source code must retain the above copyright 12211026Sgavin * notice, this list of conditions and the following disclaimer as 13211026Sgavin * the first lines of this file unmodified. 14211026Sgavin * 2. Redistributions in binary form must reproduce the above copyright 15211026Sgavin * notice, this list of conditions and the following disclaimer in the 16211026Sgavin * documentation and/or other materials provided with the distribution. 17211026Sgavin * 18211026Sgavin * THIS SOFTWARE IS PROVIDED BY NTT ``AS IS'' AND ANY EXPRESS OR 19211026Sgavin * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20211026Sgavin * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21211026Sgavin * IN NO EVENT SHALL NTT BE LIABLE FOR ANY DIRECT, INDIRECT, 22211026Sgavin * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23211026Sgavin * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24211026Sgavin * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25211026Sgavin * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26211026Sgavin * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27211026Sgavin * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28211026Sgavin */ 29211026Sgavin 30211026Sgavin#include <sys/cdefs.h> 31211026Sgavin 32211026Sgavin#include <sys/types.h> 33211026Sgavin#include <crypto/camellia/camellia.h> 34211026Sgavin 35211026Sgavinvoid 36211026Sgavincamellia_set_key(camellia_ctx *ctx, const u_char *key, int bits) 37211026Sgavin{ 38211026Sgavin 39211026Sgavin Camellia_Ekeygen(bits, key, ctx->subkey); 40211026Sgavin ctx->bits = bits; 41211026Sgavin} 42211026Sgavin 43211026Sgavinvoid 44211026Sgavincamellia_decrypt(const camellia_ctx *ctx, const u_char *src, u_char *dst) 45211026Sgavin{ 46211026Sgavin 47211026Sgavin Camellia_DecryptBlock(ctx->bits, src, ctx->subkey, dst); 48211026Sgavin} 49211026Sgavin 50211026Sgavinvoid 51211026Sgavincamellia_encrypt(const camellia_ctx *ctx, const u_char *src, u_char *dst) 52211026Sgavin{ 53211026Sgavin 54211026Sgavin Camellia_EncryptBlock(ctx->bits, src, ctx->subkey, dst); 55211026Sgavin} 56211026Sgavin