Trivial changes: whitespace and modes.
Remote whitespace at the ends of lines. Remove blank lines from the ends of files. Change modes on source files so that they are not executable. Signed-off-by: Dan Cross <cross@gajendra.net>
This commit is contained in:
parent
77a0a5b519
commit
fa325e9b42
1021 changed files with 5688 additions and 6193 deletions
|
|
@ -35,7 +35,7 @@ main(int argc, char **argv)
|
|||
sysfatal("%r");
|
||||
|
||||
s = smprint("key %A p=%lB q=%lB alpha=%lB key=%lB\n",
|
||||
a,
|
||||
a,
|
||||
key->pub.p, key->pub.q, key->pub.alpha, key->pub.key);
|
||||
if(s == nil)
|
||||
sysfatal("smprint: %r");
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ main(int argc, char **argv)
|
|||
DSApriv *k;
|
||||
char *comment;
|
||||
uchar buf[8192], *p;
|
||||
|
||||
|
||||
fmtinstall('B', mpfmt);
|
||||
fmtinstall('[', encodefmt);
|
||||
comment = "";
|
||||
|
|
|
|||
|
|
@ -43,6 +43,6 @@ main(int argc, char **argv)
|
|||
|
||||
if(write(1, s, strlen(s)) != strlen(s))
|
||||
sysfatal("write: %r");
|
||||
|
||||
|
||||
exits(nil);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,10 +30,10 @@ threadmain(int argc, char **argv)
|
|||
uchar digest[SHA1dlen];
|
||||
AuthRpc *rpc;
|
||||
Fmt fmt;
|
||||
|
||||
|
||||
fmtinstall('[', encodefmt);
|
||||
fmtinstall('H', encodefmt);
|
||||
|
||||
|
||||
verify = 0;
|
||||
id = "";
|
||||
ARGBEGIN{
|
||||
|
|
@ -46,7 +46,7 @@ threadmain(int argc, char **argv)
|
|||
default:
|
||||
usage();
|
||||
}ARGEND
|
||||
|
||||
|
||||
if(argc != 1)
|
||||
usage();
|
||||
key = argv[0];
|
||||
|
|
@ -68,7 +68,7 @@ threadmain(int argc, char **argv)
|
|||
auth_freerpc(rpc);
|
||||
threadexits("rpc");
|
||||
}
|
||||
|
||||
|
||||
print("+%s\n", id);
|
||||
|
||||
Binit(&b, 0, OREAD);
|
||||
|
|
@ -96,7 +96,7 @@ keytomp(Attr *a, char *name)
|
|||
{
|
||||
char *p;
|
||||
mpint *m;
|
||||
|
||||
|
||||
p = _strfindattr(a, name);
|
||||
if(p == nil)
|
||||
sysfatal("missing key attribute %s", name);
|
||||
|
|
@ -117,7 +117,7 @@ doVerify(void)
|
|||
Attr *a;
|
||||
DSAsig dsig;
|
||||
DSApub dkey;
|
||||
|
||||
|
||||
a = _parseattr(key);
|
||||
if(a == nil)
|
||||
sysfatal("invalid key");
|
||||
|
|
@ -159,7 +159,7 @@ end:
|
|||
|
||||
if(dsaverify(&dkey, &dsig, betomp(digest, sizeof digest, nil)) < 0)
|
||||
sysfatal("signature failed to verify: %r");
|
||||
|
||||
|
||||
write(1, text, strlen(text));
|
||||
threadexitsall(0);
|
||||
}
|
||||
|
|
@ -169,7 +169,7 @@ getline(int *np)
|
|||
{
|
||||
char *p;
|
||||
int n;
|
||||
|
||||
|
||||
if((p = Brdline(&b, '\n')) == nil)
|
||||
return nil;
|
||||
n = Blinelen(&b);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
* S -> C: ok
|
||||
*
|
||||
* Note that this is the protocol between factotum and the local
|
||||
* program, not between the two factotums. The information
|
||||
* program, not between the two factotums. The information
|
||||
* exchanged here is wrapped in the APOP protocol by the local
|
||||
* programs.
|
||||
*
|
||||
|
|
@ -42,7 +42,7 @@ apopclient(Conv *c)
|
|||
Attr *attr;
|
||||
DigestState *ds;
|
||||
Key *k;
|
||||
|
||||
|
||||
chal = nil;
|
||||
k = nil;
|
||||
res = nil;
|
||||
|
|
@ -328,7 +328,7 @@ apopresp(ServerState *s, char *user, char *resp)
|
|||
}
|
||||
|
||||
static Role
|
||||
apoproles[] =
|
||||
apoproles[] =
|
||||
{
|
||||
"client", apopclient,
|
||||
"server", apopserver,
|
||||
|
|
@ -350,4 +350,3 @@ Proto cram = {
|
|||
apopcheck,
|
||||
nil
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ addattrs(Attr *a, Attr *b)
|
|||
break;
|
||||
}
|
||||
}
|
||||
return a;
|
||||
return a;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -201,7 +201,7 @@ matchattr(Attr *pat, Attr *a0, Attr *a1)
|
|||
break;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Attr*
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* CHAP, MSCHAP
|
||||
*
|
||||
*
|
||||
* The client does not authenticate the server, hence no CAI
|
||||
*
|
||||
* Protocol:
|
||||
|
|
@ -51,7 +51,7 @@ nthash(uchar hash[MShashlen], char *passwd)
|
|||
{
|
||||
uchar buf[512];
|
||||
int i;
|
||||
|
||||
|
||||
for(i=0; *passwd && i<sizeof(buf); passwd++) {
|
||||
buf[i++] = *passwd;
|
||||
buf[i++] = 0;
|
||||
|
|
@ -96,7 +96,7 @@ mschalresp(uchar resp[MSresplen], uchar hash[MShashlen], uchar chal[MSchallen])
|
|||
{
|
||||
int i;
|
||||
uchar buf[21];
|
||||
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
memcpy(buf, hash, MShashlen);
|
||||
|
||||
|
|
@ -404,7 +404,7 @@ chapresp(ServerState *s, char *user, char *resp)
|
|||
}
|
||||
|
||||
static Role
|
||||
chaproles[] =
|
||||
chaproles[] =
|
||||
{
|
||||
"client", chapclient,
|
||||
"server", chapserver,
|
||||
|
|
@ -424,5 +424,3 @@ Proto mschap = {
|
|||
"user? !password?",
|
||||
chapcheck
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -268,4 +268,3 @@ convbadkey(Conv *c, Key *k, char *msg, Attr *a)
|
|||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ main(int argc, char **argv)
|
|||
/* start up a process to pass along notes */
|
||||
lclnoteproc(data);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Wait for the other end to execute and start our file service
|
||||
* of /mnt/term
|
||||
*/
|
||||
|
|
@ -246,7 +246,7 @@ old9p(int fd)
|
|||
close(fd);
|
||||
close(p[0]);
|
||||
}
|
||||
return p[1];
|
||||
return p[1];
|
||||
}
|
||||
|
||||
/* Invoked with stdin, stdout and stderr connected to the network connection */
|
||||
|
|
@ -392,7 +392,7 @@ readstr(int fd, char *str, int len)
|
|||
|
||||
while(len) {
|
||||
n = read(fd, str, 1);
|
||||
if(n < 0)
|
||||
if(n < 0)
|
||||
return -1;
|
||||
if(*str == '\0')
|
||||
return 0;
|
||||
|
|
@ -659,7 +659,7 @@ rmtnoteproc(void)
|
|||
syslog(0, "cpu", "cpu -R: can't open %s", rmtnotefile);
|
||||
_exits(0);
|
||||
}
|
||||
|
||||
|
||||
for(;;){
|
||||
n = read(fd, buf, sizeof(buf)-1);
|
||||
if(n <= 0){
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ struct Conv
|
|||
Req *req; /* 9P call to read response */
|
||||
|
||||
Channel *keywait; /* wait here for key confirmation */
|
||||
|
||||
|
||||
};
|
||||
|
||||
struct Key
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/*
|
||||
* DSA signing and verification
|
||||
*
|
||||
*
|
||||
* Sign:
|
||||
* start p=xxx q=xxx alpha=xxx key=xxx
|
||||
* write msg
|
||||
|
|
@ -14,10 +14,10 @@
|
|||
* write msg
|
||||
* write signature(msg)
|
||||
* read ok or fail
|
||||
*
|
||||
*
|
||||
* all numbers are hexadecimal bigints parsable with strtomp.
|
||||
*/
|
||||
|
||||
|
||||
static int
|
||||
xdsasign(Conv *c)
|
||||
{
|
||||
|
|
@ -58,7 +58,7 @@ xdsasign(Conv *c)
|
|||
}
|
||||
|
||||
/*
|
||||
* convert to canonical form (lower case)
|
||||
* convert to canonical form (lower case)
|
||||
* for use in attribute matches.
|
||||
*/
|
||||
static void
|
||||
|
|
@ -78,11 +78,11 @@ readdsapriv(Key *k)
|
|||
|
||||
priv = dsaprivalloc();
|
||||
|
||||
if((a=strfindattr(k->attr, "p"))==nil
|
||||
if((a=strfindattr(k->attr, "p"))==nil
|
||||
|| (priv->pub.p=strtomp(a, nil, 16, nil))==nil)
|
||||
goto Error;
|
||||
strlwr(a);
|
||||
if((a=strfindattr(k->attr, "q"))==nil
|
||||
if((a=strfindattr(k->attr, "q"))==nil
|
||||
|| (priv->pub.q=strtomp(a, nil, 16, nil))==nil)
|
||||
goto Error;
|
||||
strlwr(a);
|
||||
|
|
@ -90,15 +90,15 @@ readdsapriv(Key *k)
|
|||
werrstr("dsa: p or q not prime");
|
||||
goto Error;
|
||||
}
|
||||
if((a=strfindattr(k->attr, "alpha"))==nil
|
||||
if((a=strfindattr(k->attr, "alpha"))==nil
|
||||
|| (priv->pub.alpha=strtomp(a, nil, 16, nil))==nil)
|
||||
goto Error;
|
||||
strlwr(a);
|
||||
if((a=strfindattr(k->attr, "key"))==nil
|
||||
if((a=strfindattr(k->attr, "key"))==nil
|
||||
|| (priv->pub.key=strtomp(a, nil, 16, nil))==nil)
|
||||
goto Error;
|
||||
strlwr(a);
|
||||
if((a=strfindattr(k->privattr, "!secret"))==nil
|
||||
if((a=strfindattr(k->privattr, "!secret"))==nil
|
||||
|| (priv->secret=strtomp(a, nil, 16, nil))==nil)
|
||||
goto Error;
|
||||
strlwr(a);
|
||||
|
|
@ -113,7 +113,7 @@ static int
|
|||
dsacheck(Key *k)
|
||||
{
|
||||
static int first = 1;
|
||||
|
||||
|
||||
if(first){
|
||||
fmtinstall('B', mpfmt);
|
||||
first = 0;
|
||||
|
|
@ -134,7 +134,7 @@ dsaclose(Key *k)
|
|||
}
|
||||
|
||||
static Role
|
||||
dsaroles[] =
|
||||
dsaroles[] =
|
||||
{
|
||||
"sign", xdsasign,
|
||||
0
|
||||
|
|
@ -147,4 +147,3 @@ Proto dsa = {
|
|||
dsacheck,
|
||||
dsaclose
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ rootdirgen(int n, Dir *dir, void *v)
|
|||
|
||||
if(n > 0)
|
||||
return -1;
|
||||
|
||||
|
||||
fillstat(dir, factname, QTDIR, Qfactotum, DMDIR|0555);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -224,7 +224,7 @@ convlist(int i, char *a, uint nn)
|
|||
memmove(a, buf, n);
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
fskickreply(Conv *c)
|
||||
{
|
||||
|
|
@ -250,7 +250,7 @@ fskickreply(Conv *c)
|
|||
respond(r, nil);
|
||||
c->nreply = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Some of the file system work happens in the fs proc, but
|
||||
* fsopen, fsread, fswrite, fsdestroyfid, and fsflush happen in
|
||||
|
|
@ -305,7 +305,7 @@ fsopen(Req *r)
|
|||
c->kickreply = fskickreply;
|
||||
r->fid->aux = c;
|
||||
}
|
||||
|
||||
|
||||
respond(r, nil);
|
||||
}
|
||||
|
||||
|
|
@ -538,4 +538,3 @@ fsinit0(void)
|
|||
fs.destroyfid = fssendclunk;
|
||||
fs.start = fsstart;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* HTTPDIGEST - MD5 challenge/response authentication (RFC 2617)
|
||||
*
|
||||
* Client protocol:
|
||||
* write challenge: nonce method uri
|
||||
* write challenge: nonce method uri
|
||||
* read response: 2*MD5dlen hex digits
|
||||
*
|
||||
* Server protocol:
|
||||
|
|
@ -22,10 +22,10 @@ hdclient(Conv *c)
|
|||
char *realm, *passwd, *user, *f[4], *s, resp[MD5dlen*2+1];
|
||||
int ret;
|
||||
Key *k;
|
||||
|
||||
|
||||
ret = -1;
|
||||
s = nil;
|
||||
|
||||
|
||||
c->state = "keylookup";
|
||||
k = keyfetch(c, "%A", c->attr);
|
||||
if(k == nil)
|
||||
|
|
@ -45,7 +45,7 @@ hdclient(Conv *c)
|
|||
digest(user, realm, passwd, f[0], f[1], f[2], resp);
|
||||
convwrite(c, resp, strlen(resp));
|
||||
ret = 0;
|
||||
|
||||
|
||||
out:
|
||||
free(s);
|
||||
keyclose(k);
|
||||
|
|
@ -103,7 +103,7 @@ digest(char *user, char *realm, char *passwd,
|
|||
strtolower(dig);
|
||||
}
|
||||
|
||||
static Role hdroles[] =
|
||||
static Role hdroles[] =
|
||||
{
|
||||
"client", hdclient,
|
||||
0
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ keyreplace(Conv *c, Key *k, char *fmt, ...)
|
|||
sysfatal("out of memory");
|
||||
va_end(arg);
|
||||
|
||||
/* replace prompted values with prompts */
|
||||
/* replace prompted values with prompts */
|
||||
a = copyattr(k->attr);
|
||||
bp = parseattr(k->proto->keyprompt);
|
||||
for(b=bp; b; b=b->next){
|
||||
|
|
@ -204,7 +204,7 @@ keyevict(Conv *c, Key *k, char *fmt, ...)
|
|||
sysfatal("out of memory");
|
||||
va_end(arg);
|
||||
|
||||
/* replace prompted values with prompts */
|
||||
/* replace prompted values with prompts */
|
||||
a = copyattr(k->attr);
|
||||
bp = parseattr(k->proto->keyprompt);
|
||||
for(b=bp; b; b=b->next){
|
||||
|
|
|
|||
|
|
@ -118,4 +118,3 @@ flog(char *fmt, ...)
|
|||
lbvappend(&logbuf, fmt, arg);
|
||||
va_end(arg);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ sendkey(Attr *attr)
|
|||
int rv;
|
||||
char buf[8192];
|
||||
CFid *fid;
|
||||
|
||||
|
||||
fid = nsopen("factotum", nil, "ctl", OWRITE);
|
||||
if(fid == nil)
|
||||
sysfatal("opening factotum/ctl: %r");
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
* C->S: proto dom NUL
|
||||
* [negotiated proto continues]
|
||||
*/
|
||||
|
||||
|
||||
extern Proto p9sk1, p9sk2, p9cr;
|
||||
|
||||
static Proto* okproto[] =
|
||||
|
|
@ -111,7 +111,7 @@ p9anyserver(Conv *c)
|
|||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
|
||||
out:
|
||||
free(s);
|
||||
freeattr(attr);
|
||||
|
|
@ -222,7 +222,7 @@ found:
|
|||
/* f[i] is the chosen protocol, q the chosen domain */
|
||||
attr = addattr(attr, "proto=%q dom=%q", f[i], q);
|
||||
c->state = "write choice";
|
||||
|
||||
|
||||
/* have a key: go for it */
|
||||
choice = estrappend(nil, "%q %q", f[i], q);
|
||||
if(convwrite(c, choice, strlen(choice)+1) < 0){
|
||||
|
|
@ -258,7 +258,7 @@ out:
|
|||
}
|
||||
|
||||
static Role
|
||||
p9anyroles[] =
|
||||
p9anyroles[] =
|
||||
{
|
||||
"client", p9anyclient,
|
||||
"server", p9anyserver,
|
||||
|
|
@ -269,4 +269,3 @@ Proto p9any = {
|
|||
"p9any",
|
||||
p9anyroles
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
* S -> C: ok or bad
|
||||
*
|
||||
* Note that this is the protocol between factotum and the local
|
||||
* program, not between the two factotums. The information
|
||||
* program, not between the two factotums. The information
|
||||
* exchanged here is wrapped in other protocols by the local
|
||||
* programs.
|
||||
*/
|
||||
|
|
@ -317,7 +317,7 @@ p9crresp(ServerState *s, uchar *resp, int resplen)
|
|||
|
||||
static int
|
||||
p9response(char *pw, uchar *chal, uchar *resp)
|
||||
{
|
||||
{
|
||||
char key[DESKEYLEN];
|
||||
uchar buf[8];
|
||||
ulong x;
|
||||
|
|
@ -338,7 +338,7 @@ static int
|
|||
vncresponse(char *pw, uchar *chal, uchar *resp)
|
||||
{
|
||||
DESstate des;
|
||||
|
||||
|
||||
memmove(resp, chal, MAXCHAL);
|
||||
setupDESstate(&des, 0, nil); // XXX put key in for 0
|
||||
desECBencrypt(resp, MAXCHAL, &des);
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ p9skclient(Conv *c)
|
|||
k = keyfetch(c, "%A", a);
|
||||
if(k == nil)
|
||||
goto out;
|
||||
|
||||
|
||||
/* relay ticket request to auth server, get tickets */
|
||||
strcpy(tr.hostid, strfindattr(k->attr, "user"));
|
||||
if(speakfor)
|
||||
|
|
@ -329,7 +329,7 @@ p9sk1close(Key *k)
|
|||
}
|
||||
|
||||
static Role
|
||||
p9sk1roles[] =
|
||||
p9sk1roles[] =
|
||||
{
|
||||
"client", p9skclient,
|
||||
"server", p9skserver,
|
||||
|
|
@ -337,7 +337,7 @@ p9sk1roles[] =
|
|||
};
|
||||
|
||||
static Role
|
||||
p9sk2roles[] =
|
||||
p9sk2roles[] =
|
||||
{
|
||||
"client", p9skclient,
|
||||
"server", p9skserver,
|
||||
|
|
@ -356,4 +356,3 @@ Proto p9sk2 = {
|
|||
"p9sk2",
|
||||
p9sk2roles
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ static int
|
|||
passproto(Conv *c)
|
||||
{
|
||||
Key *k;
|
||||
|
||||
|
||||
k = keyfetch(c, "%A", c->attr);
|
||||
if(k == nil)
|
||||
return -1;
|
||||
c->state = "write";
|
||||
convprint(c, "%q %q",
|
||||
convprint(c, "%q %q",
|
||||
strfindattr(k->attr, "user"),
|
||||
strfindattr(k->privattr, "!password"));
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
*
|
||||
* We sign hashes of messages instead of the messages
|
||||
* themselves.
|
||||
*
|
||||
*
|
||||
* The hashes are encoded in ASN.1 DER to identify
|
||||
* the signature type, and then prefixed with 0x01 PAD 0x00
|
||||
* where PAD is as many 0xFF bytes as desired.
|
||||
|
|
@ -138,7 +138,7 @@ mptoberjust(mpint *b, uchar *buf, uint len)
|
|||
#define O3(x) \
|
||||
(((x)>>14)&0x7F)|0x80, \
|
||||
(((x)>>7)&0x7F)|0x80, \
|
||||
((x)&0x7F)
|
||||
((x)&0x7F)
|
||||
uchar oidsha1[] = { O0(1, 3), 14, 3, 2, 26 };
|
||||
uchar oidmd2[] = { O0(1, 2), O2(840), O3(113549), 2, 2 };
|
||||
uchar oidmd5[] = { O0(1, 2), O2(840), O3(113549), 2, 5 };
|
||||
|
|
@ -174,11 +174,11 @@ mkasn1(uchar *asn1, DigestAlg *alg, uchar *d, uint dlen)
|
|||
sysfatal("bad alg in mkasn1");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
p = asn1;
|
||||
*p++ = 0x30; /* sequence */
|
||||
p++;
|
||||
|
||||
|
||||
*p++ = 0x30; /* another sequence */
|
||||
p++;
|
||||
|
||||
|
|
@ -186,12 +186,12 @@ mkasn1(uchar *asn1, DigestAlg *alg, uchar *d, uint dlen)
|
|||
*p++ = olen;
|
||||
memmove(p, obj, olen);
|
||||
p += olen;
|
||||
|
||||
|
||||
*p++ = 0x05; /* null */
|
||||
*p++ = 0;
|
||||
|
||||
|
||||
asn1[3] = p - (asn1+4); /* end of inner sequence */
|
||||
|
||||
|
||||
*p++ = 0x04; /* octet string */
|
||||
*p++ = dlen;
|
||||
memmove(p, d, dlen);
|
||||
|
|
@ -200,4 +200,3 @@ mkasn1(uchar *asn1, DigestAlg *alg, uchar *d, uint dlen)
|
|||
asn1[1] = p - (asn1+2); /* end of outer sequence */
|
||||
return p-asn1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
* done [haveai] - authentication is done [haveai: you can get an ai with authinfo]
|
||||
*/
|
||||
|
||||
char *rpcname[] =
|
||||
char *rpcname[] =
|
||||
{
|
||||
"unknown",
|
||||
"authinfo",
|
||||
|
|
@ -196,7 +196,7 @@ rpcexec(Conv *c)
|
|||
rpcrespond(c, "error conversation not successful");
|
||||
else{
|
||||
/* make up an auth info using the attr */
|
||||
p = convAI2M((uchar*)c->reply+3, sizeof c->reply-3,
|
||||
p = convAI2M((uchar*)c->reply+3, sizeof c->reply-3,
|
||||
strfindattr(c->attr, "cuid"),
|
||||
strfindattr(c->attr, "suid"),
|
||||
strfindattr(c->attr, "cap"),
|
||||
|
|
@ -341,4 +341,3 @@ convAI2M(uchar *p, int n, char *cuid, char *suid, char *cap, char *hex)
|
|||
werrstr("authinfo too big");
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/*
|
||||
* RSA authentication.
|
||||
*
|
||||
*
|
||||
* Encrypt/Decrypt:
|
||||
* start n=xxx ek=xxx
|
||||
* write msg
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* start n=xxx ek=xxx
|
||||
* write hash(msg)
|
||||
* read signature(hash(msg))
|
||||
*
|
||||
*
|
||||
* Verify:
|
||||
* start n=xxx ek=xxx
|
||||
* write hash(msg)
|
||||
|
|
@ -44,14 +44,14 @@ xrsadecrypt(Conv *c)
|
|||
if(k == nil)
|
||||
goto out;
|
||||
key = k->priv;
|
||||
|
||||
|
||||
/* make sure have private half if needed */
|
||||
role = strfindattr(c->attr, "role");
|
||||
if(strcmp(role, "decrypt") == 0 && !key->c2){
|
||||
werrstr("missing private half of key -- cannot decrypt");
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
/* read text */
|
||||
c->state = "read";
|
||||
if((n=convreadm(c, &txt)) < 0)
|
||||
|
|
@ -60,7 +60,7 @@ xrsadecrypt(Conv *c)
|
|||
convprint(c, "data too short");
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
/* encrypt/decrypt */
|
||||
m = betomp((uchar*)txt, n, nil);
|
||||
if(m == nil)
|
||||
|
|
@ -72,7 +72,7 @@ xrsadecrypt(Conv *c)
|
|||
if(mm == nil)
|
||||
goto out;
|
||||
n = mptobe(mm, (uchar*)buf, sizeof buf, nil);
|
||||
|
||||
|
||||
/* send response */
|
||||
c->state = "write";
|
||||
convwrite(c, buf, n);
|
||||
|
|
@ -98,7 +98,7 @@ xrsasign(Conv *c)
|
|||
char *sig2;
|
||||
|
||||
ret = -1;
|
||||
|
||||
|
||||
/* fetch key */
|
||||
c->state = "keylookup";
|
||||
k = keylookup("%A", c->attr);
|
||||
|
|
@ -112,7 +112,7 @@ xrsasign(Conv *c)
|
|||
werrstr("missing private half of key -- cannot sign");
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
/* get hash type from key */
|
||||
hash = strfindattr(k->attr, "hash");
|
||||
if(hash == nil)
|
||||
|
|
@ -144,7 +144,7 @@ xrsasign(Conv *c)
|
|||
/* read signature */
|
||||
if((n = convreadm(c, &sig2)) < 0)
|
||||
goto out;
|
||||
|
||||
|
||||
/* verify */
|
||||
if(rsaverify(&key->pub, hashfn, digest, dlen, (uchar*)sig2, n) == 0)
|
||||
convprint(c, "ok");
|
||||
|
|
@ -160,7 +160,7 @@ out:
|
|||
}
|
||||
|
||||
/*
|
||||
* convert to canonical form (lower case)
|
||||
* convert to canonical form (lower case)
|
||||
* for use in attribute matches.
|
||||
*/
|
||||
static void
|
||||
|
|
@ -180,22 +180,22 @@ readrsapriv(Key *k)
|
|||
|
||||
priv = rsaprivalloc();
|
||||
|
||||
if((a=strfindattr(k->attr, "ek"))==nil
|
||||
if((a=strfindattr(k->attr, "ek"))==nil
|
||||
|| (priv->pub.ek=strtomp(a, nil, 16, nil))==nil)
|
||||
goto Error;
|
||||
strlwr(a);
|
||||
if((a=strfindattr(k->attr, "n"))==nil
|
||||
if((a=strfindattr(k->attr, "n"))==nil
|
||||
|| (priv->pub.n=strtomp(a, nil, 16, nil))==nil)
|
||||
goto Error;
|
||||
strlwr(a);
|
||||
if(k->privattr == nil) /* only public half */
|
||||
return priv;
|
||||
|
||||
if((a=strfindattr(k->privattr, "!p"))==nil
|
||||
if((a=strfindattr(k->privattr, "!p"))==nil
|
||||
|| (priv->p=strtomp(a, nil, 16, nil))==nil)
|
||||
goto Error;
|
||||
strlwr(a);
|
||||
if((a=strfindattr(k->privattr, "!q"))==nil
|
||||
if((a=strfindattr(k->privattr, "!q"))==nil
|
||||
|| (priv->q=strtomp(a, nil, 16, nil))==nil)
|
||||
goto Error;
|
||||
strlwr(a);
|
||||
|
|
@ -203,19 +203,19 @@ readrsapriv(Key *k)
|
|||
werrstr("rsa: p or q not prime");
|
||||
goto Error;
|
||||
}
|
||||
if((a=strfindattr(k->privattr, "!kp"))==nil
|
||||
if((a=strfindattr(k->privattr, "!kp"))==nil
|
||||
|| (priv->kp=strtomp(a, nil, 16, nil))==nil)
|
||||
goto Error;
|
||||
strlwr(a);
|
||||
if((a=strfindattr(k->privattr, "!kq"))==nil
|
||||
if((a=strfindattr(k->privattr, "!kq"))==nil
|
||||
|| (priv->kq=strtomp(a, nil, 16, nil))==nil)
|
||||
goto Error;
|
||||
strlwr(a);
|
||||
if((a=strfindattr(k->privattr, "!c2"))==nil
|
||||
if((a=strfindattr(k->privattr, "!c2"))==nil
|
||||
|| (priv->c2=strtomp(a, nil, 16, nil))==nil)
|
||||
goto Error;
|
||||
strlwr(a);
|
||||
if((a=strfindattr(k->privattr, "!dk"))==nil
|
||||
if((a=strfindattr(k->privattr, "!dk"))==nil
|
||||
|| (priv->dk=strtomp(a, nil, 16, nil))==nil)
|
||||
goto Error;
|
||||
strlwr(a);
|
||||
|
|
@ -230,7 +230,7 @@ static int
|
|||
rsacheck(Key *k)
|
||||
{
|
||||
static int first = 1;
|
||||
|
||||
|
||||
if(first){
|
||||
fmtinstall('B', mpfmt);
|
||||
first = 0;
|
||||
|
|
@ -251,7 +251,7 @@ rsaclose(Key *k)
|
|||
}
|
||||
|
||||
static Role
|
||||
rsaroles[] =
|
||||
rsaroles[] =
|
||||
{
|
||||
"sign", xrsasign,
|
||||
"verify", xrsasign, /* public operation */
|
||||
|
|
|
|||
|
|
@ -659,4 +659,3 @@ Out:
|
|||
free(sta);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,4 +7,3 @@
|
|||
#include <thread.h>
|
||||
#include <fcall.h>
|
||||
#include <9p.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -50,5 +50,3 @@ estrappend(char *s, char *fmt, ...)
|
|||
free(t);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ wepclient(Conv *c)
|
|||
char *dev, buf[128], *p, *kp;
|
||||
Key *k;
|
||||
int ret, fd, cfd;
|
||||
|
||||
|
||||
fd = cfd = -1;
|
||||
ret = -1;
|
||||
dev = nil;
|
||||
|
||||
|
||||
if((k = keylookup("%A !key1?", c->attr)) == nil
|
||||
&& (k = keylookup("%A !key2?", c->attr)) == nil
|
||||
&& (k = keylookup("%A !key3?", c->attr)) == nil){
|
||||
|
|
@ -73,7 +73,7 @@ static Role weproles[] = {
|
|||
0
|
||||
};
|
||||
|
||||
Proto wep =
|
||||
Proto wep =
|
||||
{
|
||||
"wep",
|
||||
weproles,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ xioproc(void)
|
|||
{
|
||||
Ioproc *c;
|
||||
int i;
|
||||
|
||||
|
||||
for(i=0; i<ncache; i++){
|
||||
if(c = cache[i]){
|
||||
cache[i] = nil;
|
||||
|
|
@ -162,4 +162,3 @@ xioasgetticket(int fd, char *trbuf, char *tbuf)
|
|||
n = 0;
|
||||
return n;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ void
|
|||
readln(char *prompt, char *buf, int nbuf, int secret)
|
||||
{
|
||||
char *p;
|
||||
|
||||
|
||||
p = readcons(prompt, nil, secret);
|
||||
if(p == nil)
|
||||
sysfatal("user terminated input");
|
||||
|
|
|
|||
|
|
@ -30,5 +30,3 @@ main(int argc, char **argv)
|
|||
write(1, buf, n);
|
||||
print("\n");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -109,27 +109,27 @@ getkey(int argc, char **argv, int needprivate, Attr **pa)
|
|||
}
|
||||
if((key->kp = strtomp(p, &p, 16, nil)) == nil || *p != 0){
|
||||
fprint(2, "warning: bad !kp\n");
|
||||
regen = 1;
|
||||
regen = 1;
|
||||
goto regen;
|
||||
}
|
||||
if((p = _strfindattr(a, "!kq")) == nil){
|
||||
fprint(2, "warning: no !kq\n");
|
||||
regen = 1;
|
||||
regen = 1;
|
||||
goto regen;
|
||||
}
|
||||
if((key->kq = strtomp(p, &p, 16, nil)) == nil || *p != 0){
|
||||
fprint(2, "warning: bad !kq\n");
|
||||
regen = 1;
|
||||
regen = 1;
|
||||
goto regen;
|
||||
}
|
||||
if((p = _strfindattr(a, "!c2")) == nil){
|
||||
fprint(2, "warning: no !c2\n");
|
||||
regen = 1;
|
||||
regen = 1;
|
||||
goto regen;
|
||||
}
|
||||
if((key->c2 = strtomp(p, &p, 16, nil)) == nil || *p != 0){
|
||||
fprint(2, "warning: bad !c2\n");
|
||||
regen = 1;
|
||||
regen = 1;
|
||||
goto regen;
|
||||
}
|
||||
regen:
|
||||
|
|
@ -285,7 +285,7 @@ uchar*
|
|||
putmp2(uchar *p, mpint *b)
|
||||
{
|
||||
int bits, n;
|
||||
|
||||
|
||||
if(mpcmp(b, mpzero) == 0)
|
||||
return put4(p, 0);
|
||||
bits = mpsignif(b);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ main(int argc, char **argv)
|
|||
sysfatal("%r");
|
||||
|
||||
s = smprint("key %A size=%d ek=%lB n=%lB\n",
|
||||
a,
|
||||
a,
|
||||
mpsignif(key->pub.n), key->pub.ek, key->pub.n);
|
||||
if(s == nil)
|
||||
sysfatal("smprint: %r");
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ main(int argc, char **argv)
|
|||
{
|
||||
RSApriv *k;
|
||||
char *comment;
|
||||
|
||||
|
||||
fmtinstall('B', mpfmt);
|
||||
fmtinstall('[', encodefmt);
|
||||
comment = "";
|
||||
|
|
@ -42,7 +42,7 @@ main(int argc, char **argv)
|
|||
|
||||
if(ssh2){
|
||||
uchar buf[8192], *p;
|
||||
|
||||
|
||||
p = buf;
|
||||
p = put4(p, 7);
|
||||
p = putn(p, "ssh-rsa", 7);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ main(int argc, char **argv)
|
|||
sysfatal("%r");
|
||||
|
||||
s = smprint("key %A size=%d ek=%lB !dk=%lB n=%lB !p=%lB !q=%lB !kp=%lB !kq=%lB !c2=%lB\n",
|
||||
a,
|
||||
a,
|
||||
mpsignif(key->pub.n), key->pub.ek,
|
||||
key->dk, key->pub.n, key->p, key->q,
|
||||
key->kp, key->kq, key->c2);
|
||||
|
|
|
|||
|
|
@ -55,6 +55,6 @@ main(int argc, char **argv)
|
|||
|
||||
if(write(1, s, strlen(s)) != strlen(s))
|
||||
sysfatal("write: %r");
|
||||
|
||||
|
||||
exits(nil);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,4 +211,3 @@ readstr(SConn *conn, char *s)
|
|||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,4 +23,3 @@ extern int readstr(SConn*, char*); /* call with buf of size Maxmsg+1 */
|
|||
extern void *emalloc(ulong); /* dies on failure; clears memory */
|
||||
extern void *erealloc(void *, ulong);
|
||||
extern char *estrdup(char *);
|
||||
|
||||
|
|
|
|||
|
|
@ -84,4 +84,3 @@ dirls(char *path)
|
|||
free(dirbuf);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -341,4 +341,3 @@ done:
|
|||
mpfree(H);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -133,4 +133,3 @@ freePW(PW *pw)
|
|||
mpfree(pw->Hi);
|
||||
free(pw);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ getfile(SConn *conn, char *gf, uchar **buf, ulong *buflen, uchar *key, int nkey)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* conn is already encrypted against wiretappers,
|
||||
/* conn is already encrypted against wiretappers,
|
||||
but gf is also encrypted against server breakin. */
|
||||
if(buf == nil && (fd =create(gf, OWRITE, 0600)) < 0){
|
||||
fprint(2, "can't open %s: %r\n", gf);
|
||||
|
|
@ -197,7 +197,7 @@ putfile(SConn *conn, char *pf, uchar *buf, ulong len, uchar *key, int nkey)
|
|||
return -1;
|
||||
}
|
||||
}else{
|
||||
if((n = len - bufi) > Maxmsg-ivo)
|
||||
if((n = len - bufi) > Maxmsg-ivo)
|
||||
n = Maxmsg-ivo;
|
||||
memcpy(b+ivo, buf+bufi, n);
|
||||
bufi += n;
|
||||
|
|
@ -578,4 +578,3 @@ main(int argc, char **argv)
|
|||
exits("");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,4 +28,3 @@ char *PAK_Hi(char *, char *, mpint *, mpint *);
|
|||
#define LOG "secstore"
|
||||
|
||||
extern char *SECSTORE_DIR;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ usage(void)
|
|||
static int
|
||||
getdir(SConn *conn, char *id)
|
||||
{
|
||||
char *ls, *s;
|
||||
char *ls, *s;
|
||||
uchar *msg;
|
||||
int n, len;
|
||||
|
||||
|
|
@ -417,4 +417,3 @@ main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ secureidcheck(char *user, char *response)
|
|||
resp = nil;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
switch(resp->code){
|
||||
case R_AccessAccept:
|
||||
syslog(0, AUTHLOG, "%s accepted ruser=%s", dest, ruser);
|
||||
|
|
|
|||
|
|
@ -241,4 +241,3 @@ userinput(char *buf, int blen)
|
|||
exits("input too large");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ enum /* agent protocol packet types */
|
|||
SSH_AGENTC_ADD_RSA_IDENTITY,
|
||||
SSH_AGENTC_REMOVE_RSA_IDENTITY,
|
||||
SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES,
|
||||
|
||||
|
||||
SSH2_AGENTC_REQUEST_IDENTITIES = 11,
|
||||
SSH2_AGENT_IDENTITIES_ANSWER,
|
||||
SSH2_AGENTC_SIGN_REQUEST,
|
||||
|
|
@ -42,12 +42,12 @@ enum /* agent protocol packet types */
|
|||
SSH_AGENTC_ADD_RSA_ID_CONSTRAINED,
|
||||
SSH2_AGENTC_ADD_ID_CONSTRAINED,
|
||||
SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED,
|
||||
|
||||
|
||||
SSH_AGENT_CONSTRAIN_LIFETIME = 1,
|
||||
SSH_AGENT_CONSTRAIN_CONFIRM = 2,
|
||||
|
||||
SSH2_AGENT_FAILURE = 30,
|
||||
|
||||
|
||||
SSH_COM_AGENT2_FAILURE = 102,
|
||||
SSH_AGENT_OLD_SIGNATURE = 0x01
|
||||
};
|
||||
|
|
@ -121,12 +121,12 @@ threadmain(int argc, char **argv)
|
|||
default:
|
||||
usage();
|
||||
}ARGEND
|
||||
|
||||
|
||||
if(argc > 1)
|
||||
usage();
|
||||
if(argc == 1)
|
||||
factotum = argv[0];
|
||||
|
||||
|
||||
if(dotextlist)
|
||||
listkeystext();
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ threadmain(int argc, char **argv)
|
|||
|
||||
if((afd = announce(addr, adir)) < 0)
|
||||
sysfatal("announce %s: %r", addr);
|
||||
|
||||
|
||||
print("SSH_AUTH_SOCK=%s;\n", sock);
|
||||
if(export)
|
||||
print("export SSH_AUTH_SOCK;\n");
|
||||
|
|
@ -178,7 +178,7 @@ agentproc(void *v)
|
|||
{
|
||||
Aconn *a;
|
||||
int n;
|
||||
|
||||
|
||||
a = v;
|
||||
a->fd = accept(a->ctl, a->dir);
|
||||
close(a->ctl);
|
||||
|
|
@ -209,7 +209,7 @@ int
|
|||
get2(Msg *m)
|
||||
{
|
||||
uint x;
|
||||
|
||||
|
||||
if(m->p+2 > m->ep)
|
||||
return 0;
|
||||
x = (m->p[0]<<8)|m->p[1];
|
||||
|
|
@ -232,7 +232,7 @@ uchar*
|
|||
getn(Msg *m, uint n)
|
||||
{
|
||||
uchar *p;
|
||||
|
||||
|
||||
if(m->p+n > m->ep)
|
||||
return nil;
|
||||
p = m->p;
|
||||
|
|
@ -261,7 +261,7 @@ getmp(Msg *m)
|
|||
{
|
||||
int n;
|
||||
uchar *p;
|
||||
|
||||
|
||||
n = (get2(m)+7)/8;
|
||||
if((p=getn(m, n)) == nil)
|
||||
return nil;
|
||||
|
|
@ -273,7 +273,7 @@ getmp2(Msg *m)
|
|||
{
|
||||
int n;
|
||||
uchar *p;
|
||||
|
||||
|
||||
n = get4(m);
|
||||
if((p = getn(m, n)) == nil)
|
||||
return nil;
|
||||
|
|
@ -301,7 +301,7 @@ getm(Msg *m, Msg *mm)
|
|||
{
|
||||
uint n;
|
||||
uchar *p;
|
||||
|
||||
|
||||
n = get4(m);
|
||||
if((p = getn(m, n)) == nil)
|
||||
return nil;
|
||||
|
|
@ -347,7 +347,7 @@ void
|
|||
put4(Msg *m, uint n)
|
||||
{
|
||||
uchar *p;
|
||||
|
||||
|
||||
p = ensure(m, 4);
|
||||
p[0] = (n>>24)&0xFF;
|
||||
p[1] = (n>>16)&0xFF;
|
||||
|
|
@ -359,7 +359,7 @@ void
|
|||
put2(Msg *m, uint n)
|
||||
{
|
||||
uchar *p;
|
||||
|
||||
|
||||
p = ensure(m, 2);
|
||||
p[0] = (n>>8)&0xFF;
|
||||
p[1] = n&0xFF;
|
||||
|
|
@ -369,7 +369,7 @@ void
|
|||
put1(Msg *m, uint n)
|
||||
{
|
||||
uchar *p;
|
||||
|
||||
|
||||
p = ensure(m, 1);
|
||||
p[0] = n&0xFF;
|
||||
}
|
||||
|
|
@ -378,7 +378,7 @@ void
|
|||
putn(Msg *m, void *a, uint n)
|
||||
{
|
||||
uchar *p;
|
||||
|
||||
|
||||
p = ensure(m, n);
|
||||
memmove(p, a, n);
|
||||
}
|
||||
|
|
@ -388,7 +388,7 @@ putmp(Msg *m, mpint *b)
|
|||
{
|
||||
int bits, n;
|
||||
uchar *p;
|
||||
|
||||
|
||||
bits = mpsignif(b);
|
||||
put2(m, bits);
|
||||
n = (bits+7)/8;
|
||||
|
|
@ -401,7 +401,7 @@ putmp2(Msg *m, mpint *b)
|
|||
{
|
||||
int bits, n;
|
||||
uchar *p;
|
||||
|
||||
|
||||
if(mpcmp(b, mpzero) == 0){
|
||||
put4(m, 0);
|
||||
return;
|
||||
|
|
@ -421,7 +421,7 @@ void
|
|||
putstr(Msg *m, char *s)
|
||||
{
|
||||
int n;
|
||||
|
||||
|
||||
n = strlen(s);
|
||||
put4(m, n);
|
||||
putn(m, s, n);
|
||||
|
|
@ -431,7 +431,7 @@ void
|
|||
putm(Msg *m, Msg *mm)
|
||||
{
|
||||
uint n;
|
||||
|
||||
|
||||
n = mm->p - mm->bp;
|
||||
put4(m, n);
|
||||
putn(m, mm->bp, n);
|
||||
|
|
@ -450,7 +450,7 @@ reply(Aconn *a, Msg *m)
|
|||
{
|
||||
uint n;
|
||||
uchar *p;
|
||||
|
||||
|
||||
n = (m->p - m->bp) - 4;
|
||||
p = m->bp;
|
||||
p[0] = (n>>24)&0xFF;
|
||||
|
|
@ -513,7 +513,7 @@ void
|
|||
printattr(char **f, int nf)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
print("#");
|
||||
for(i=0; i<nf; i++)
|
||||
print(" %s", f[i]);
|
||||
|
|
@ -571,7 +571,7 @@ RSApub*
|
|||
getrsapub(Msg *m)
|
||||
{
|
||||
RSApub *k;
|
||||
|
||||
|
||||
k = rsapuballoc();
|
||||
if(k == nil)
|
||||
return nil;
|
||||
|
|
@ -624,7 +624,7 @@ putkey2(Msg *m, int (*put)(Msg*,char**,int), char **f, int nf)
|
|||
{
|
||||
char *p;
|
||||
Msg mm;
|
||||
|
||||
|
||||
newmsg(&mm);
|
||||
if(put(&mm, f, nf) < 0)
|
||||
return -1;
|
||||
|
|
@ -642,7 +642,7 @@ printkey(char *type, int (*put)(Msg*,char**,int), char **f, int nf)
|
|||
{
|
||||
Msg m;
|
||||
char *p;
|
||||
|
||||
|
||||
newmsg(&m);
|
||||
if(put(&m, f, nf) < 0)
|
||||
return -1;
|
||||
|
|
@ -660,7 +660,7 @@ DSApub*
|
|||
getdsapub(Msg *m)
|
||||
{
|
||||
DSApub *k;
|
||||
|
||||
|
||||
k = dsapuballoc();
|
||||
if(k == nil)
|
||||
return nil;
|
||||
|
|
@ -825,7 +825,7 @@ dorsa(Aconn *a, mpint *mod, mpint *exp, mpint *chal, uchar chalbuf[32])
|
|||
auth_freerpc(rpc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
p = mptoa(chal, 16, nil, 0);
|
||||
if(p == nil){
|
||||
fprint(2, "ssh-agent: dorsa: mptoa: %r\n");
|
||||
|
|
@ -874,7 +874,7 @@ keysign(Msg *mkey, Msg *mdata, Msg *msig)
|
|||
DSApub *dsa;
|
||||
char buf[4096];
|
||||
uchar digest[SHA1dlen];
|
||||
|
||||
|
||||
s = getstr(mkey);
|
||||
if(strcmp(s, "ssh-rsa") == 0){
|
||||
rsa = getrsapub(mkey);
|
||||
|
|
@ -935,7 +935,7 @@ runmsg(Aconn *a)
|
|||
uint len, flags;
|
||||
DigestState *s;
|
||||
Msg m, mkey, mdata, msig;
|
||||
|
||||
|
||||
if(a->ndata < 4)
|
||||
return 0;
|
||||
len = (a->data[0]<<24)|(a->data[1]<<16)|(a->data[2]<<8)|a->data[3];
|
||||
|
|
@ -993,7 +993,7 @@ runmsg(Aconn *a)
|
|||
goto Failchal;
|
||||
md5(sessid, 16, digest, s);
|
||||
print("md5 %.*H %.*H => %.*H\n", 32, chalbuf, 16, sessid, MD5dlen, digest);
|
||||
|
||||
|
||||
newreply(&m, SSH_AGENT_RSA_RESPONSE);
|
||||
putn(&m, digest, 16);
|
||||
reply(a, &m);
|
||||
|
|
@ -1020,22 +1020,22 @@ runmsg(Aconn *a)
|
|||
mreset(&msig);
|
||||
reply(a, &m);
|
||||
break;
|
||||
|
||||
|
||||
case SSH_AGENTC_ADD_RSA_IDENTITY:
|
||||
/*
|
||||
msg: n[4] mod[mp] pubexp[exp] privexp[mp]
|
||||
p^-1 mod q[mp] p[mp] q[mp] comment[str]
|
||||
*/
|
||||
goto Failure;
|
||||
|
||||
|
||||
case SSH_AGENTC_REMOVE_RSA_IDENTITY:
|
||||
/*
|
||||
msg: n[4] mod[mp] pubexp[mp]
|
||||
*/
|
||||
goto Failure;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
a->ndata -= 4+len;
|
||||
memmove(a->data, a->data+4+len, a->ndata);
|
||||
return 1;
|
||||
|
|
@ -1064,4 +1064,3 @@ erealloc(void *v, int n)
|
|||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue