diff options
Diffstat (limited to 'cipher/arcfour.c')
-rw-r--r-- | cipher/arcfour.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/cipher/arcfour.c b/cipher/arcfour.c index c19d282d..e9db410b 100644 --- a/cipher/arcfour.c +++ b/cipher/arcfour.c @@ -41,7 +41,19 @@ typedef struct { static void -encrypt_stream( ARCFOUR_context *ctx, +burn_stack (int bytes) +{ + char buf[64]; + + memset (buf, 0, sizeof buf); + bytes -= sizeof buf; + if (bytes > 0) + burn_stack (bytes); +} + + +static void +do_encrypt_stream( ARCFOUR_context *ctx, byte *outbuf, const byte *inbuf, unsigned int length ) { int t; @@ -60,9 +72,18 @@ encrypt_stream( ARCFOUR_context *ctx, ctx->idx_j = j; } +static void +encrypt_stream( ARCFOUR_context *ctx, + byte *outbuf, const byte *inbuf, unsigned int length ) +{ + + do_encrypt_stream (ctx, outbuf, inbuf, length ); + burn_stack (64); +} + static int -arcfour_setkey( ARCFOUR_context *ctx, const byte *key, unsigned int keylen ) +do_arcfour_setkey( ARCFOUR_context *ctx, const byte *key, unsigned int keylen ) { static int initialized; static const char* selftest_failed; @@ -98,6 +119,14 @@ arcfour_setkey( ARCFOUR_context *ctx, const byte *key, unsigned int keylen ) return 0; } +static int +arcfour_setkey ( ARCFOUR_context *ctx, const byte *key, unsigned int keylen ) +{ + int rc = do_arcfour_setkey (ctx, key, keylen ); + burn_stack (300); + return rc; +} + static const char* selftest(void) |