1295009Sjkim/* crypto/seed/seed_ofb.c */
2183234Ssimon/* ====================================================================
3183234Ssimon * Copyright (c) 1998-2007 The OpenSSL Project.  All rights reserved.
4183234Ssimon *
5183234Ssimon * Redistribution and use in source and binary forms, with or without
6183234Ssimon * modification, are permitted provided that the following conditions
7183234Ssimon * are met:
8183234Ssimon *
9183234Ssimon * 1. Redistributions of source code must retain the above copyright
10280297Sjkim *    notice, this list of conditions and the following disclaimer.
11183234Ssimon *
12183234Ssimon * 2. Redistributions in binary form must reproduce the above copyright
13183234Ssimon *    notice, this list of conditions and the following disclaimer in
14183234Ssimon *    the documentation and/or other materials provided with the
15183234Ssimon *    distribution.
16183234Ssimon *
17183234Ssimon * 3. All advertising materials mentioning features or use of this
18183234Ssimon *    software must display the following acknowledgment:
19183234Ssimon *    "This product includes software developed by the OpenSSL Project
20183234Ssimon *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
21183234Ssimon *
22183234Ssimon * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23183234Ssimon *    endorse or promote products derived from this software without
24183234Ssimon *    prior written permission. For written permission, please contact
25183234Ssimon *    openssl-core@openssl.org.
26183234Ssimon *
27183234Ssimon * 5. Products derived from this software may not be called "OpenSSL"
28183234Ssimon *    nor may "OpenSSL" appear in their names without prior written
29183234Ssimon *    permission of the OpenSSL Project.
30183234Ssimon *
31183234Ssimon * 6. Redistributions of any form whatsoever must retain the following
32183234Ssimon *    acknowledgment:
33183234Ssimon *    "This product includes software developed by the OpenSSL Project
34183234Ssimon *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
35183234Ssimon *
36183234Ssimon * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37183234Ssimon * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38183234Ssimon * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39183234Ssimon * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
40183234Ssimon * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41183234Ssimon * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42183234Ssimon * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43183234Ssimon * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44183234Ssimon * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45183234Ssimon * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46183234Ssimon * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47183234Ssimon * OF THE POSSIBILITY OF SUCH DAMAGE.
48183234Ssimon * ====================================================================
49183234Ssimon *
50183234Ssimon */
51183234Ssimon/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
52183234Ssimon * All rights reserved.
53183234Ssimon *
54183234Ssimon * This package is an SSL implementation written
55183234Ssimon * by Eric Young (eay@cryptsoft.com).
56183234Ssimon * The implementation was written so as to conform with Netscapes SSL.
57280297Sjkim *
58183234Ssimon * This library is free for commercial and non-commercial use as long as
59183234Ssimon * the following conditions are aheared to.  The following conditions
60183234Ssimon * apply to all code found in this distribution, be it the RC4, RSA,
61183234Ssimon * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
62183234Ssimon * included with this distribution is covered by the same copyright terms
63183234Ssimon * except that the holder is Tim Hudson (tjh@cryptsoft.com).
64280297Sjkim *
65183234Ssimon * Copyright remains Eric Young's, and as such any Copyright notices in
66183234Ssimon * the code are not to be removed.
67183234Ssimon * If this package is used in a product, Eric Young should be given attribution
68183234Ssimon * as the author of the parts of the library used.
69183234Ssimon * This can be in the form of a textual message at program startup or
70183234Ssimon * in documentation (online or textual) provided with the package.
71280297Sjkim *
72183234Ssimon * Redistribution and use in source and binary forms, with or without
73183234Ssimon * modification, are permitted provided that the following conditions
74183234Ssimon * are met:
75183234Ssimon * 1. Redistributions of source code must retain the copyright
76183234Ssimon *    notice, this list of conditions and the following disclaimer.
77183234Ssimon * 2. Redistributions in binary form must reproduce the above copyright
78183234Ssimon *    notice, this list of conditions and the following disclaimer in the
79183234Ssimon *    documentation and/or other materials provided with the distribution.
80183234Ssimon * 3. All advertising materials mentioning features or use of this software
81183234Ssimon *    must display the following acknowledgement:
82183234Ssimon *    "This product includes cryptographic software written by
83183234Ssimon *     Eric Young (eay@cryptsoft.com)"
84183234Ssimon *    The word 'cryptographic' can be left out if the rouines from the library
85183234Ssimon *    being used are not cryptographic related :-).
86280297Sjkim * 4. If you include any Windows specific code (or a derivative thereof) from
87183234Ssimon *    the apps directory (application code) you must include an acknowledgement:
88183234Ssimon *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
89280297Sjkim *
90183234Ssimon * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
91183234Ssimon * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
92183234Ssimon * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
93183234Ssimon * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
94183234Ssimon * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
95183234Ssimon * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
96183234Ssimon * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
97183234Ssimon * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
98183234Ssimon * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
99183234Ssimon * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
100183234Ssimon * SUCH DAMAGE.
101280297Sjkim *
102183234Ssimon * The licence and distribution terms for any publically available version or
103183234Ssimon * derivative of this code cannot be changed.  i.e. this code cannot simply be
104183234Ssimon * copied and put under another distribution licence
105183234Ssimon * [including the GNU Public Licence.]
106183234Ssimon */
107183234Ssimon
108238405Sjkim#include <openssl/seed.h>
109238405Sjkim#include <openssl/modes.h>
110183234Ssimon
111183234Ssimonvoid SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out,
112183234Ssimon                         size_t len, const SEED_KEY_SCHEDULE *ks,
113183234Ssimon                         unsigned char ivec[SEED_BLOCK_SIZE], int *num)
114280297Sjkim{
115280297Sjkim    CRYPTO_ofb128_encrypt(in, out, len, ks, ivec, num,
116280297Sjkim                          (block128_f) SEED_encrypt);
117280297Sjkim}
118