From 7ba101b07e54c7ee08579a8c55300f1f5c515393 Mon Sep 17 00:00:00 2001 From: riastradh Date: Thu, 5 Dec 2019 03:22:02 +0000 Subject: [PATCH] Nuke crypto/arc4. Has not been used since 2003. Will not be missed. --- sys/conf/files | 3 +- sys/crypto/arc4/arc4.c | 120 ------------------------------------- sys/crypto/arc4/arc4.h | 49 --------------- sys/crypto/arc4/files.arc4 | 5 -- 4 files changed, 1 insertion(+), 176 deletions(-) delete mode 100644 sys/crypto/arc4/arc4.c delete mode 100644 sys/crypto/arc4/arc4.h delete mode 100644 sys/crypto/arc4/files.arc4 diff --git a/sys/conf/files b/sys/conf/files index e9d132f501a7..ec88ea489b22 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $NetBSD: files,v 1.1244 2019/11/14 16:23:52 maxv Exp $ +# $NetBSD: files,v 1.1245 2019/12/05 03:22:02 riastradh Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 version 20171118 @@ -191,7 +191,6 @@ defflag opt_machdep.h MACHDEP # use it. # Individual crypto transforms -include "crypto/arc4/files.arc4" include "crypto/des/files.des" include "crypto/blowfish/files.blowfish" include "crypto/cast128/files.cast128" diff --git a/sys/crypto/arc4/arc4.c b/sys/crypto/arc4/arc4.c deleted file mode 100644 index 10fb561fc37d..000000000000 --- a/sys/crypto/arc4/arc4.c +++ /dev/null @@ -1,120 +0,0 @@ -/* $NetBSD: arc4.c,v 1.7 2014/08/10 16:44:35 tls Exp $ */ - -/* - * ARC4 implementation - * A Stream Cipher Encryption Algorithm "Arcfour" - * - */ - -/* This code illustrates a sample implementation - * of the Arcfour algorithm - * Copyright (c) April 29, 1997 Kalle Kaukonen. - * All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that this copyright - * notice and disclaimer are retained. - * - * THIS SOFTWARE IS PROVIDED BY KALLE KAUKONEN AND CONTRIBUTORS ``AS - * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KALLE - * KAUKONEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__KERNEL_RCSID(0, "$NetBSD: arc4.c,v 1.7 2014/08/10 16:44:35 tls Exp $"); - -#include - -#include - -int -arc4_ctxlen(void) -{ - return sizeof(struct arc4_ctx); -} - -void -arc4_setkey(void *ctxp, const u_char *key, u_int keylen) -{ - struct arc4_ctx *ctx = ctxp; - unsigned int i, t, u, ki, si; - unsigned int *state; - - state = ctx->state; - ctx->x = 0; - ctx->y = 0; - for (i = 0; i < 256; i++) - state[i] = i; - ki = si = 0; - for (i = 0; i < 256; i++) { - t = state[i]; - si = (si + key[ki] + t) & 0xff; - u = state[si]; - state[si] = t; - state[i] = u; - if (++ki >= keylen) - ki = 0; - } -} - -void -arc4_encrypt(void *ctxp, u_char *dst, const u_char *src, int len) -{ - struct arc4_ctx *ctx = ctxp; - unsigned int x, y, sx, sy; - unsigned int *state; - const unsigned char *endsrc; - - state = ctx->state; - x = ctx->x; - y = ctx->y; - for (endsrc = src + len; src != endsrc; src++, dst++) { - x = (x + 1) & 0xff; - sx = state[x]; - y = (sx + y) & 0xff; - state[x] = sy = state[y]; - state[y] = sx; - *dst = *src ^ state[(sx + sy) & 0xff]; - } - ctx->x = x; - ctx->y = y; -} - -void -arc4_stream(void *ctxp, u_char *dst, int len) -{ - struct arc4_ctx *ctx = ctxp; - unsigned int x, y, sx, sy; - unsigned int *state; - const unsigned char *enddst; - - state = ctx->state; - x = ctx->x; - y = ctx->y; - - for (enddst = dst + len; dst != enddst; dst++) { - x = (x + 1) & 0xff; - sx = state[x]; - y = (sx + y) & 0xff; - state[x] = sy = state[y]; - state[y]= sx; - *dst = state[(sx + sy) & 0xff]; - } - ctx->x = x; - ctx->y = y; -} - -void -arc4_decrypt(void *ctxp, u_char *dst, const u_char *src, int len) -{ - arc4_encrypt(ctxp, dst, src, len); -} diff --git a/sys/crypto/arc4/arc4.h b/sys/crypto/arc4/arc4.h deleted file mode 100644 index 5d95b8f3c057..000000000000 --- a/sys/crypto/arc4/arc4.h +++ /dev/null @@ -1,49 +0,0 @@ -/* $NetBSD: arc4.h,v 1.5 2014/08/10 16:44:35 tls Exp $ */ - -/* - * ARC4 implementation - * A Stream Cipher Encryption Algorithm "Arcfour" - * - */ - -/* This code illustrates a sample implementation - * of the Arcfour algorithm - * Copyright (c) April 29, 1997 Kalle Kaukonen. - * All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that this copyright - * notice and disclaimer are retained. - * - * THIS SOFTWARE IS PROVIDED BY KALLE KAUKONEN AND CONTRIBUTORS ``AS - * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KALLE - * KAUKONEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _CRYPTO_ARC4_H_ -#define _CRYPTO_ARC4_H_ - -typedef struct arc4_ctx { - unsigned int x; - unsigned int y; - unsigned int state[256]; - /* was unsigned char, changed to int for performance -- onoe */ -} arc4_ctx_t; - -int arc4_ctxlen(void); -void arc4_setkey(void *, const u_char *, unsigned int); -void arc4_encrypt(void *, u_char *, const u_char *, int); -void arc4_decrypt(void *, u_char *, const u_char *, int); - -void arc4_stream(void *, u_char *, int); - -#endif /* _CRYPTO_ARC4_H_ */ diff --git a/sys/crypto/arc4/files.arc4 b/sys/crypto/arc4/files.arc4 deleted file mode 100644 index cde98e1f7ca5..000000000000 --- a/sys/crypto/arc4/files.arc4 +++ /dev/null @@ -1,5 +0,0 @@ -# $NetBSD: files.arc4,v 1.2 2014/08/10 16:44:35 tls Exp $ - -define arc4 - -file crypto/arc4/arc4.c