diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-12-31 01:04:41 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-12-31 01:04:41 +0100 |
commit | 8a64413eca370d914c1520dfeaa1359cd7f16517 (patch) | |
tree | 4ebffb057a15e4c854c80c12d945b662d09cb616 | |
parent | 57f8b6ec7591007ff22627038b51c4f4aa2a9be8 (diff) |
aux/wpa: get rid of custom Hfmt() routine, just use encodefmt. use %E for mac addresses
-rw-r--r-- | sys/src/cmd/aux/wpa.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/sys/src/cmd/aux/wpa.c b/sys/src/cmd/aux/wpa.c index c0ef0af3e..9a8d84f64 100644 --- a/sys/src/cmd/aux/wpa.c +++ b/sys/src/cmd/aux/wpa.c @@ -535,21 +535,6 @@ out: return ret; } -int -Hfmt(Fmt *f) -{ - uchar *p, *e; - - p = va_arg(f->args, uchar*); - e = p; - if(f->prec >= 0) - e += f->prec; - for(; p != e; p++) - if(fmtprint(f, "%.2x", *p) < 0) - return -1; - return 0; -} - void dumpkeydescr(Keydescr *kd) { @@ -1180,7 +1165,7 @@ main(int argc, char *argv[]) int n, try; quotefmtinstall(); - fmtinstall('H', Hfmt); + fmtinstall('H', encodefmt); fmtinstall('E', eipfmt); rsne = nil; @@ -1492,7 +1477,7 @@ Connect: rsc = 0LL; } /* install pairwise receive key (PTK) */ - if(fprint(cfd, "rxkey %.*H %s:%.*H@%llux", Eaddrlen, conn.amac, + if(fprint(cfd, "rxkey %E %s:%.*H@%llux", conn.amac, peercipher->name, peercipher->keylen, ptk+32, tsc) < 0) sysfatal("write rxkey: %r"); @@ -1504,7 +1489,7 @@ Connect: tsc = 0LL; /* install pairwise transmit key (PTK) */ - if(fprint(cfd, "txkey %.*H %s:%.*H@%llux", Eaddrlen, conn.amac, + if(fprint(cfd, "txkey %E %s:%.*H@%llux", conn.amac, peercipher->name, peercipher->keylen, ptk+32, tsc) < 0) sysfatal("write txkey: %r"); newptk = 0; /* prevent PTK re-installation on (replayed) retransmits */ @@ -1528,8 +1513,8 @@ Connect: continue; /* install group key (GTK) */ if(gtklen >= groupcipher->keylen && gtkkid != -1) - if(fprint(cfd, "rxkey%d %.*H %s:%.*H@%llux", - gtkkid, Eaddrlen, conn.amac, + if(fprint(cfd, "rxkey%d %E %s:%.*H@%llux", + gtkkid, conn.amac, groupcipher->name, groupcipher->keylen, gtk, rsc) < 0) sysfatal("write rxkey%d: %r", gtkkid); } |