[OpenSEED-CVSlog] [Commit] openseed/src seed_ofb.c
Status: Beta
Brought to you by:
perky
|
From: Chang <pe...@us...> - 2001-11-16 04:37:12
|
perky 01/11/15 20:37:11
Modified: src seed_ofb.c
Log:
complete OFB implementation
Revision Changes Path
1.2 +11 -10 openseed/src/seed_ofb.c
Index: seed_ofb.c
===================================================================
RCS file: /cvsroot/openseed/openseed/src/seed_ofb.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- seed_ofb.c 2001/11/16 03:00:52 1.1
+++ seed_ofb.c 2001/11/16 04:37:11 1.2
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: seed_ofb.c,v 1.1 2001/11/16 03:00:52 perky Exp $
+ * $Id: seed_ofb.c,v 1.2 2001/11/16 04:37:11 perky Exp $
*/
#include <stdlib.h>
@@ -36,7 +36,6 @@
static const unsigned char NULLIV [SEED_BLOCK]={0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0};
-#if 0
void
seed_ofb_encrypt(const unsigned char *in, unsigned char *out, size_t length,
SEED_KEY_SCHEDULE ks, SEED_IV iv)
@@ -48,12 +47,14 @@
else prev = iv;
for(; in < e_in; in += SEED_BLOCK, out += SEED_BLOCK) {
- XOR_SEEDBLOCK(out, prev, in);
- seed_encrypt(out, ks);
+ seed_encrypt(out, in, ks);
+ XOR_SEEDBLOCK(out, out, prev);
prev = out;
}
- if (iv) memcpy(iv, prev, SEED_BLOCK);
+ if (iv) {
+ MOV_SEEDBLOCK(iv, prev);
+ }
/* XXX: Padding ?? */
}
@@ -68,16 +69,16 @@
else prev = iv;
for(; in < e_in; in += SEED_BLOCK, out += SEED_BLOCK) {
- MOV_SEEDBLOCK(out, in);
- seed_decrypt(out, ks);
- XOR_SEEDBLOCK(out, out, prev);
+ XOR_SEEDBLOCK(out, in, prev);
+ seed_decrypt(out, out, ks);
prev = in;
}
- if (iv) memcpy(iv, prev, SEED_BLOCK);
+ if (iv) {
+ MOV_SEEDBLOCK(iv, prev);
+ }
/* XXX: Padding ?? */
}
-#endif
/*
* ex:ts=4
|