cmll_cbc.c revision 296373
167754Smsmith/* crypto/camellia/camellia_cbc.c */ 267754Smsmith/* ==================================================================== 377424Smsmith * Copyright (c) 2006 The OpenSSL Project. All rights reserved. 467754Smsmith * 567754Smsmith * Redistribution and use in source and binary forms, with or without 667754Smsmith * modification, are permitted provided that the following conditions 7316303Sjkim * are met: 8316303Sjkim * 9316303Sjkim * 1. Redistributions of source code must retain the above copyright 10316303Sjkim * notice, this list of conditions and the following disclaimer. 11316303Sjkim * 1270243Smsmith * 2. Redistributions in binary form must reproduce the above copyright 1367754Smsmith * notice, this list of conditions and the following disclaimer in 14316303Sjkim * the documentation and/or other materials provided with the 15316303Sjkim * distribution. 16316303Sjkim * 17316303Sjkim * 3. All advertising materials mentioning features or use of this 18316303Sjkim * software must display the following acknowledgment: 19316303Sjkim * "This product includes software developed by the OpenSSL Project 20316303Sjkim * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 21316303Sjkim * 22316303Sjkim * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23316303Sjkim * endorse or promote products derived from this software without 24316303Sjkim * prior written permission. For written permission, please contact 25316303Sjkim * openssl-core@openssl.org. 26316303Sjkim * 27316303Sjkim * 5. Products derived from this software may not be called "OpenSSL" 28316303Sjkim * nor may "OpenSSL" appear in their names without prior written 29316303Sjkim * permission of the OpenSSL Project. 30316303Sjkim * 31316303Sjkim * 6. Redistributions of any form whatsoever must retain the following 32316303Sjkim * acknowledgment: 33316303Sjkim * "This product includes software developed by the OpenSSL Project 34316303Sjkim * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 35316303Sjkim * 36316303Sjkim * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37316303Sjkim * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38316303Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39316303Sjkim * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40316303Sjkim * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41316303Sjkim * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42316303Sjkim * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43316303Sjkim * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44316303Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45316303Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46316303Sjkim * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47316303Sjkim * OF THE POSSIBILITY OF SUCH DAMAGE. 48316303Sjkim * ==================================================================== 49316303Sjkim * 50316303Sjkim */ 51316303Sjkim 52316303Sjkim#include <openssl/camellia.h> 53316303Sjkim#include <openssl/modes.h> 54316303Sjkim 55316303Sjkimvoid Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out, 56316303Sjkim size_t len, const CAMELLIA_KEY *key, 57316303Sjkim unsigned char *ivec, const int enc) 58316303Sjkim{ 59316303Sjkim 60316303Sjkim if (enc) 61316303Sjkim CRYPTO_cbc128_encrypt(in, out, len, key, ivec, 62316303Sjkim (block128_f) Camellia_encrypt); 63316303Sjkim else 64316303Sjkim CRYPTO_cbc128_decrypt(in, out, len, key, ivec, 65316303Sjkim (block128_f) Camellia_decrypt); 66316303Sjkim} 67316303Sjkim