| OLD | NEW |
| 1 /* crypto/seed/seed_ofb.c -*- mode:C; c-file-style: "eay" -*- */ | 1 /* crypto/seed/seed_ofb.c -*- mode:C; c-file-style: "eay" -*- */ |
| 2 /* ==================================================================== | 2 /* ==================================================================== |
| 3 * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved. | 3 * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 98 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 99 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 99 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 100 * SUCH DAMAGE. | 100 * SUCH DAMAGE. |
| 101 * | 101 * |
| 102 * The licence and distribution terms for any publically available version or | 102 * The licence and distribution terms for any publically available version or |
| 103 * derivative of this code cannot be changed. i.e. this code cannot simply be | 103 * derivative of this code cannot be changed. i.e. this code cannot simply be |
| 104 * copied and put under another distribution licence | 104 * copied and put under another distribution licence |
| 105 * [including the GNU Public Licence.] | 105 * [including the GNU Public Licence.] |
| 106 */ | 106 */ |
| 107 | 107 |
| 108 #include "seed_locl.h" | 108 #include <openssl/seed.h> |
| 109 #include <string.h> | 109 #include <openssl/modes.h> |
| 110 | 110 |
| 111 void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, | 111 void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, |
| 112 size_t len, const SEED_KEY_SCHEDULE *ks, | 112 size_t len, const SEED_KEY_SCHEDULE *ks, |
| 113 unsigned char ivec[SEED_BLOCK_SIZE], int *num) | 113 unsigned char ivec[SEED_BLOCK_SIZE], int *num) |
| 114 { | 114 { |
| 115 » int n; | 115 » CRYPTO_ofb128_encrypt(in,out,len,ks,ivec,num,(block128_f)SEED_encrypt); |
| 116 | |
| 117 » n = *num; | |
| 118 » | |
| 119 » while (len--) | |
| 120 » » { | |
| 121 » » if (n == 0) | |
| 122 » » » SEED_encrypt(ivec, ivec, ks); | |
| 123 » » *(out++) = *(in++) ^ ivec[n]; | |
| 124 » » n = (n+1) % SEED_BLOCK_SIZE; | |
| 125 » » } | |
| 126 | |
| 127 » *num = n; | |
| 128 } | 116 } |
| OLD | NEW |