Templatize util/domd
[openssl.git] / crypto / seed / seed_cfb.c
1 /* ====================================================================
2  * Copyright (c) 1998-2007 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
9  *    notice, this list of conditions and the following disclaimer.
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.
56  *
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).
63  *
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.
70  *
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 :-).
85  * 4. If you include any Windows specific code (or a derivative thereof) from
86  *    the apps directory (application code) you must include an acknowledgement:
87  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
88  *
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.
100  *
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
107 #include <openssl/seed.h>
108 #include <openssl/modes.h>
109
110 void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out,
111                          size_t len, const SEED_KEY_SCHEDULE *ks,
112                          unsigned char ivec[SEED_BLOCK_SIZE], int *num,
113                          int enc)
114 {
115     CRYPTO_cfb128_encrypt(in, out, len, ks, ivec, num, enc,
116                           (block128_f) SEED_encrypt);
117 }