From 54a91861df5782fdc62ac72f8c8f3ce192f6396f Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sat, 22 Aug 2015 00:21:11 +0200 Subject: [PATCH] remove convkeys2 --- sys/man/8/auth | 14 +---- sys/src/cmd/auth/convkeys2.c | 114 ----------------------------------- sys/src/cmd/auth/mkfile | 1 - 3 files changed, 1 insertion(+), 128 deletions(-) delete mode 100644 sys/src/cmd/auth/convkeys2.c diff --git a/sys/man/8/auth b/sys/man/8/auth index 72b370a35..37c06f6dd 100644 --- a/sys/man/8/auth +++ b/sys/man/8/auth @@ -1,6 +1,6 @@ .TH AUTH 8 .SH NAME -changeuser, convkeys, convkeys2, printnetkey, status, enable, disable, authsrv, guard.srv, debug, wrkey, login, newns, none, as \- maintain or query authentication databases +changeuser, convkeys, printnetkey, status, enable, disable, authsrv, guard.srv, debug, wrkey, login, newns, none, as \- maintain or query authentication databases .SH SYNOPSIS .B auth/changeuser .RB [ -np ] @@ -10,10 +10,6 @@ changeuser, convkeys, convkeys2, printnetkey, status, enable, disable, authsrv, .RB [ -pa ] .I keyfile .PP -.B auth/convkeys2 -.RB [ -p ] -.I keyfile -.PP .B auth/printnetkey .I user .PP @@ -159,14 +155,6 @@ The format of is described in .IR keyfs (4). .PP -The format of the key file changed between Release 2 -and 3 of Plan 9. -.I Convkeys2 -is like -.IR convkeys . -However, in addition to rekeying, it converts from -the previous format to the Release 3 format. -.PP .I Printnetkey displays the network key as it should be entered into the hand-held Securenet box. diff --git a/sys/src/cmd/auth/convkeys2.c b/sys/src/cmd/auth/convkeys2.c deleted file mode 100644 index 5d06e1f20..000000000 --- a/sys/src/cmd/auth/convkeys2.c +++ /dev/null @@ -1,114 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "authcmdlib.h" - -Authkey authkey; -int verb; -int usepass; - -int convert(char*, char*, Authkey*, int); -void usage(void); - -void -main(int argc, char *argv[]) -{ - Dir *d; - Authkey key; - char *p, *np, *file; - int fd, len; - - ARGBEGIN{ - case 'v': - verb = 1; - break; - case 'p': - usepass = 1; - break; - default: - usage(); - }ARGEND - - if(argc != 1) - usage(); - file = argv[0]; - - /* get original key */ - if(usepass){ - print("enter password file is encoded with\n"); - getpass(&authkey, nil, 0, 1); - } else - getauthkey(&authkey); - print("enter password to reencode with\n"); - getpass(&key, nil, 0, 1); - - fd = open(file, ORDWR); - if(fd < 0) - error("can't open %s: %r\n", file); - d = dirfstat(fd); - if(d == nil) - error("can't stat %s: %r\n", file); - len = d->length; - p = malloc(len); - if(!p) - error("out of memory"); - np = malloc((len/OKEYDBLEN)*KEYDBLEN + KEYDBOFF); - if(!np) - error("out of memory"); - if(read(fd, p, len) != len) - error("can't read key file: %r\n"); - len = convert(p, np, &key, len); - if(verb) - exits(0); - if(pwrite(fd, np, len, 0) != len) - error("can't write key file: %r\n"); - close(fd); - exits(0); -} - -void -oldCBCencrypt(char *key7, char *p, int len) -{ - uchar ivec[8]; - uchar key[8]; - DESstate s; - - memset(ivec, 0, 8); - des56to64((uchar*)key7, key); - setupDESstate(&s, key, ivec); - desCBCencrypt((uchar*)p, len, &s); -} - -int -convert(char *p, char *np, Authkey *key, int len) -{ - int i, off, noff; - - if(len % OKEYDBLEN) - fprint(2, "convkeys2: file odd length; not converting %d bytes\n", - len % KEYDBLEN); - len /= OKEYDBLEN; - for(i = 0; i < len; i ++){ - off = i*OKEYDBLEN; - noff = KEYDBOFF+i*(KEYDBLEN); - decrypt(authkey.des, &p[off], OKEYDBLEN); - memmove(&np[noff], &p[off], OKEYDBLEN); - memset(&np[noff-SECRETLEN], 0, SECRETLEN); - if(verb) - print("%s\n", &p[off]); - } - genrandom((uchar*)np, KEYDBOFF); - len = (len*KEYDBLEN) + KEYDBOFF; - oldCBCencrypt(key->des, np, len); - return len; -} - -void -usage(void) -{ - fprint(2, "usage: convkeys2 keyfile\n"); - exits("usage"); -} diff --git a/sys/src/cmd/auth/mkfile b/sys/src/cmd/auth/mkfile index eb539fc91..3bb30b84f 100644 --- a/sys/src/cmd/auth/mkfile +++ b/sys/src/cmd/auth/mkfile @@ -8,7 +8,6 @@ TARG=\ asn12rsa\ authsrv\ changeuser\ - convkeys2\ convkeys\ cron\ debug\