summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--appl/cmd/auth/dsagen.b62
-rw-r--r--dis/auth/dsagen.disbin0 -> 1197 bytes
-rw-r--r--include/version.h2
-rw-r--r--lib/proto/inferno1
5 files changed, 66 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index 16e9989c..5e74c1b3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+20080210
+ add auth/dsagen
20080204
emu/*/*ipif*.c and devip.c: try to allow local address to be set (changes so_bind signature in emu/ip.h)
20080201
diff --git a/appl/cmd/auth/dsagen.b b/appl/cmd/auth/dsagen.b
new file mode 100644
index 00000000..3e24df2f
--- /dev/null
+++ b/appl/cmd/auth/dsagen.b
@@ -0,0 +1,62 @@
+implement Dsagen;
+
+include "sys.m";
+ sys: Sys;
+
+include "draw.m";
+
+include "keyring.m";
+ kr: Keyring;
+ IPint, DSAsk, DSApk, DSAsig: import kr;
+
+include "arg.m";
+
+Dsagen: module
+{
+ init: fn(nil: ref Draw->Context, nil: list of string);
+};
+
+init(nil: ref Draw->Context, args: list of string)
+{
+ sys = load Sys Sys->PATH;
+ kr = load Keyring Keyring->PATH;
+
+ arg := load Arg Arg->PATH;
+ arg->init(args);
+ arg->setusage("auth/dsagen [-t 'attr=value attr=value ...']");
+ tag: string;
+ while((o := arg->opt()) != 0)
+ case o {
+ 't' =>
+ tag = arg->earg();
+ * =>
+ arg->usage();
+ }
+ args = arg->argv();
+ if(args != nil)
+ arg->usage();
+ arg = nil;
+
+ sk := DSAsk.gen(nil);
+ if(tag != nil)
+ tag = " "+tag;
+ s := add("p", sk.pk.p);
+ s += add("q", sk.pk.q);
+ s += add("alpha", sk.pk.alpha);
+ s += add("key", sk.pk.key);
+ s += add("!secret", sk.secret);
+ a := sys->aprint("key proto=dsa%s%s\n", tag, s);
+ if(sys->write(sys->fildes(1), a, len a) != len a)
+ error(sys->sprint("error writing key: %r"));
+}
+
+error(s: string)
+{
+ sys->fprint(sys->fildes(2), "dsagen: %s\n", s);
+ raise "fail:error";
+}
+
+add(name: string, b: ref IPint): string
+{
+ return " "+name+"="+b.iptostr(16);
+}
diff --git a/dis/auth/dsagen.dis b/dis/auth/dsagen.dis
new file mode 100644
index 00000000..758a1806
--- /dev/null
+++ b/dis/auth/dsagen.dis
Binary files differ
diff --git a/include/version.h b/include/version.h
index 9401ef14..337a504d 100644
--- a/include/version.h
+++ b/include/version.h
@@ -1 +1 @@
-#define VERSION "Fourth Edition (20080209)"
+#define VERSION "Fourth Edition (20080210)"
diff --git a/lib/proto/inferno b/lib/proto/inferno
index 25c8c4ac..d25b59e1 100644
--- a/lib/proto/inferno
+++ b/lib/proto/inferno
@@ -356,6 +356,7 @@ appl
countersigner.b
convpasswd.b
createsignerkey.b
+ dsagen.b
factotum
authio.m
mkfile