]> git.ipfire.org Git - thirdparty/openssl.git/blame - crypto/camellia/cmll_cfb.c
Remove /* foo.c */ comments
[thirdparty/openssl.git] / crypto / camellia / cmll_cfb.c
CommitLineData
67912e00
BM
1/* ====================================================================
2 * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
0f113f3e 9 * notice, this list of conditions and the following disclaimer.
67912e00
BM
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 *
16 * 3. All advertising materials mentioning features or use of this
17 * software must display the following acknowledgment:
18 * "This product includes software developed by the OpenSSL Project
19 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
20 *
21 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
22 * endorse or promote products derived from this software without
23 * prior written permission. For written permission, please contact
24 * openssl-core@openssl.org.
25 *
26 * 5. Products derived from this software may not be called "OpenSSL"
27 * nor may "OpenSSL" appear in their names without prior written
28 * permission of the OpenSSL Project.
29 *
30 * 6. Redistributions of any form whatsoever must retain the following
31 * acknowledgment:
32 * "This product includes software developed by the OpenSSL Project
33 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
34 *
35 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
36 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
38 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
39 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
41 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
42 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
43 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
44 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
46 * OF THE POSSIBILITY OF SUCH DAMAGE.
47 * ====================================================================
48 *
49 */
50/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
51 * All rights reserved.
52 *
53 * This package is an SSL implementation written
54 * by Eric Young (eay@cryptsoft.com).
55 * The implementation was written so as to conform with Netscapes SSL.
0f113f3e 56 *
67912e00
BM
57 * This library is free for commercial and non-commercial use as long as
58 * the following conditions are aheared to. The following conditions
59 * apply to all code found in this distribution, be it the RC4, RSA,
60 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
61 * included with this distribution is covered by the same copyright terms
62 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
0f113f3e 63 *
67912e00
BM
64 * Copyright remains Eric Young's, and as such any Copyright notices in
65 * the code are not to be removed.
66 * If this package is used in a product, Eric Young should be given attribution
67 * as the author of the parts of the library used.
68 * This can be in the form of a textual message at program startup or
69 * in documentation (online or textual) provided with the package.
0f113f3e 70 *
67912e00
BM
71 * Redistribution and use in source and binary forms, with or without
72 * modification, are permitted provided that the following conditions
73 * are met:
74 * 1. Redistributions of source code must retain the copyright
75 * notice, this list of conditions and the following disclaimer.
76 * 2. Redistributions in binary form must reproduce the above copyright
77 * notice, this list of conditions and the following disclaimer in the
78 * documentation and/or other materials provided with the distribution.
79 * 3. All advertising materials mentioning features or use of this software
80 * must display the following acknowledgement:
81 * "This product includes cryptographic software written by
82 * Eric Young (eay@cryptsoft.com)"
83 * The word 'cryptographic' can be left out if the rouines from the library
84 * being used are not cryptographic related :-).
0f113f3e 85 * 4. If you include any Windows specific code (or a derivative thereof) from
67912e00
BM
86 * the apps directory (application code) you must include an acknowledgement:
87 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
0f113f3e 88 *
67912e00
BM
89 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
90 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
91 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
92 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
93 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
94 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
95 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
96 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
97 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
98 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
99 * SUCH DAMAGE.
0f113f3e 100 *
67912e00
BM
101 * The licence and distribution terms for any publically available version or
102 * derivative of this code cannot be changed. i.e. this code cannot simply be
103 * copied and put under another distribution licence
104 * [including the GNU Public Licence.]
105 */
106
67912e00 107#include <openssl/camellia.h>
5d48a66a 108#include <openssl/modes.h>
67912e00 109
0f113f3e
MC
110/*
111 * The input and output encrypted as though 128bit cfb mode is being used.
112 * The extra state information to record how much of the 128bit block we have
113 * used is contained in *num;
67912e00
BM
114 */
115
116void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out,
0f113f3e
MC
117 size_t length, const CAMELLIA_KEY *key,
118 unsigned char *ivec, int *num, const int enc)
119{
67912e00 120
0f113f3e
MC
121 CRYPTO_cfb128_encrypt(in, out, length, key, ivec, num, enc,
122 (block128_f) Camellia_encrypt);
123}
67912e00
BM
124
125/* N.B. This expects the input to be packed, MS bit first */
126void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out,
0f113f3e
MC
127 size_t length, const CAMELLIA_KEY *key,
128 unsigned char *ivec, int *num, const int enc)
129{
130 CRYPTO_cfb128_1_encrypt(in, out, length, key, ivec, num, enc,
131 (block128_f) Camellia_encrypt);
132}
67912e00
BM
133
134void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out,
0f113f3e
MC
135 size_t length, const CAMELLIA_KEY *key,
136 unsigned char *ivec, int *num, const int enc)
137{
138 CRYPTO_cfb128_8_encrypt(in, out, length, key, ivec, num, enc,
139 (block128_f) Camellia_encrypt);
140}