Skip to content
Snippets Groups Projects
Commit c284ea4a authored by Niels Möller's avatar Niels Möller
Browse files

* x86/arcfour-crypt.asm (nettle_arcfour_crypt): Bug fix, half of

the S array swap was forgotten.
* arcfour.c (arcfour_stream): Likewise.
* arcfour-crypt.c (arcfour_crypt): Likewise.

Rev: src/nettle/ChangeLog:1.233
Rev: src/nettle/arcfour-crypt.c:1.2
Rev: src/nettle/arcfour.c:1.6
Rev: src/nettle/x86/arcfour-crypt.asm:1.5
parent e2c15604
No related branches found
No related tags found
No related merge requests found
2004-02-05 Niels Mller <nisse@lysator.liu.se>
* testsuite/arcfour-test.c (test_main): Use test_cipher_stream.
* testsuite/testutils.c (test_cipher_stream): New function, that
tries dividing the input into varying size blocks before
processing.
* x86/arcfour-crypt.asm (nettle_arcfour_crypt): Bug fix, half of
the S array swap was forgotten.
* arcfour.c (arcfour_stream): Likewise.
* arcfour-crypt.c (arcfour_crypt): Likewise.
2004-02-05 Niels Mller <niels@s3.kth.se> 2004-02-05 Niels Mller <niels@s3.kth.se>
* x86/arcfour-crypt.asm (nettle_arcfour_crypt): Must store the new * x86/arcfour-crypt.asm (nettle_arcfour_crypt): Must store the new
......
...@@ -46,6 +46,7 @@ arcfour_crypt(struct arcfour_ctx *ctx, ...@@ -46,6 +46,7 @@ arcfour_crypt(struct arcfour_ctx *ctx,
si = ctx->S[i]; si = ctx->S[i];
j += si; j &= 0xff; j += si; j &= 0xff;
sj = ctx->S[i] = ctx->S[j]; sj = ctx->S[i] = ctx->S[j];
ctx->S[j] = si;
*dst++ = *src++ ^ ctx->S[ (si + sj) & 0xff ]; *dst++ = *src++ ^ ctx->S[ (si + sj) & 0xff ];
} }
ctx->i = i; ctx->j = j; ctx->i = i; ctx->j = j;
......
...@@ -70,6 +70,7 @@ arcfour_stream(struct arcfour_ctx *ctx, ...@@ -70,6 +70,7 @@ arcfour_stream(struct arcfour_ctx *ctx,
si = ctx->S[i]; si = ctx->S[i];
j += si; j &= 0xff; j += si; j &= 0xff;
sj = ctx->S[i] = ctx->S[j]; sj = ctx->S[i] = ctx->S[j];
ctx->S[j] = si;
*dst++ = ctx->S[ (si + sj) & 0xff ]; *dst++ = ctx->S[ (si + sj) & 0xff ];
} }
ctx->i = i; ctx->j = j; ctx->i = i; ctx->j = j;
......
...@@ -54,7 +54,8 @@ nettle_arcfour_crypt: ...@@ -54,7 +54,8 @@ nettle_arcfour_crypt:
movzbl (%ebp, %eax), %ecx C si. Clears high bytes movzbl (%ebp, %eax), %ecx C si. Clears high bytes
addb %cl, %bl addb %cl, %bl
movb (%ebp, %ebx), %ch C sj movb (%ebp, %ebx), %ch C sj
movb %ch, (%ebp, %eax) movb %ch, (%ebp, %eax) C S[i] = sj
movb %cl, (%ebp, %ebx) C C[j] = si
addb %ch, %cl addb %ch, %cl
xorb %ch, %ch C Clear, so it can be used xorb %ch, %ch C Clear, so it can be used
C for indexing. C for indexing.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment