summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/seed/seed_cfb.c
diff options
context:
space:
mode:
authordjm <>2010-10-01 22:54:18 +0000
committerdjm <>2010-10-01 22:54:18 +0000
commitf6ca1ae73bb9eabfb510df2cffc2599db98d35a9 (patch)
treedef8296400903465cb96345535c0a56935eb05a4 /src/lib/libcrypto/seed/seed_cfb.c
parent0229f29a33371533962d8b0b8264882afac53d70 (diff)
downloadopenbsd-f6ca1ae73bb9eabfb510df2cffc2599db98d35a9.tar.gz
openbsd-f6ca1ae73bb9eabfb510df2cffc2599db98d35a9.tar.bz2
openbsd-f6ca1ae73bb9eabfb510df2cffc2599db98d35a9.zip
import OpenSSL-1.0.0a
Diffstat (limited to 'src/lib/libcrypto/seed/seed_cfb.c')
-rw-r--r--src/lib/libcrypto/seed/seed_cfb.c34
1 files changed, 3 insertions, 31 deletions
diff --git a/src/lib/libcrypto/seed/seed_cfb.c b/src/lib/libcrypto/seed/seed_cfb.c
index 07d878a788..694597dd06 100644
--- a/src/lib/libcrypto/seed/seed_cfb.c
+++ b/src/lib/libcrypto/seed/seed_cfb.c
@@ -105,40 +105,12 @@
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
111void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, 111void SEED_cfb128_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, int enc) 113 unsigned char ivec[SEED_BLOCK_SIZE], int *num, int enc)
114 { 114 {
115 int n; 115 CRYPTO_cfb128_encrypt(in,out,len,ks,ivec,num,enc,(block128_f)SEED_encrypt);
116 unsigned char c;
117
118 n = *num;
119
120 if (enc)
121 {
122 while (len--)
123 {
124 if (n == 0)
125 SEED_encrypt(ivec, ivec, ks);
126 ivec[n] = *(out++) = *(in++) ^ ivec[n];
127 n = (n+1) % SEED_BLOCK_SIZE;
128 }
129 }
130 else
131 {
132 while (len--)
133 {
134 if (n == 0)
135 SEED_encrypt(ivec, ivec, ks);
136 c = *(in);
137 *(out++) = *(in++) ^ ivec[n];
138 ivec[n] = c;
139 n = (n+1) % SEED_BLOCK_SIZE;
140 }
141 }
142
143 *num = n;
144 } 116 }