diff options
author | Niels Möller <nisse@lysator.liu.se> | 2022-08-07 20:34:12 +0200 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2022-08-07 20:34:12 +0200 |
commit | 73bdcbe9d3b55c97f54820c1174ef8666c83be45 (patch) | |
tree | 13f0305ab9f5e3563efc744f4678f82285deb100 /arcfour.c | |
parent | 693820e1bad41f640159d8556b171e9a4f282c5e (diff) | |
download | nettle-delete-arcfour-asm.tar.gz |
Delete all arcfour assembly codedelete-arcfour-asm
Diffstat (limited to 'arcfour.c')
-rw-r--r-- | arcfour.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -69,3 +69,24 @@ arcfour128_set_key(struct arcfour_ctx *ctx, const uint8_t *key) { arcfour_set_key (ctx, ARCFOUR128_KEY_SIZE, key); } + +void +arcfour_crypt(struct arcfour_ctx *ctx, + size_t length, uint8_t *dst, + const uint8_t *src) +{ + register uint8_t i, j; + register int si, sj; + + i = ctx->i; j = ctx->j; + while(length--) + { + i++; i &= 0xff; + si = ctx->S[i]; + j += si; j &= 0xff; + sj = ctx->S[i] = ctx->S[j]; + ctx->S[j] = si; + *dst++ = *src++ ^ ctx->S[ (si + sj) & 0xff ]; + } + ctx->i = i; ctx->j = j; +} |