commit 25de30cff4ca738aab683b873ef218aac17a6438
parent 4ecf19685e189ee062c8e20462070541c6b1e390
Author: Robin Bron <finwo@pm.me>
Date: Thu, 16 Sep 2021 00:26:27 +0200
Added manpage and 'make install'
Diffstat:
4 files changed, 73 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
@@ -1,4 +1,4 @@
-VERSION=v0.0.0
+include config.mk
# Ourselves
CFLAGS?=
@@ -50,6 +50,13 @@ lib/ed25519:
curl -sL https://github.com/orlp/ed25519/archive/refs/heads/master.tar.gz | tar xzv -C lib/ed25519 --strip-components=1
bash -c 'cd lib/ed25519 && patch -p1 < ../../patch/ed25519/00-single-file-compile.patch'
+.PHONY: install
+install: supercop
+ install -d ${DESTDIR}${PREFIX}/bin
+ install -m 755 supercop ${DESTDIR}${PREFIX}/bin
+ install -d ${DESTDIR}${MANPREFIX}/man1
+ install -m 644 $(wildcard man/*.1) ${DESTDIR}${MANPREFIX}/man1
+
.PHONY: clean
clean:
rm -rf $(OBJ)
diff --git a/config.mk b/config.mk
@@ -0,0 +1,4 @@
+VERSION=v0.0.0
+
+PREFIX?=/usr/local
+MANPREFIX?=${PREFIX}/share/man
diff --git a/man/supercop.1 b/man/supercop.1
@@ -0,0 +1,59 @@
+.TH supercop 1 "Sep 16, 2021" "" "FINWO"
+
+.SH NAME
+supercop - Simplified CLI for supercop-ref10
+
+.SH SYNOPSIS
+\fBsupercop\fR \fI<operation>\fR [\fB-k\fR \fIkeyfile\fR] [\fB-m\fR \fImessage\fR] [\fB-M\fR \fImessage-file\fR] [\fB-s\fR \fIsignature\fR]
+
+.SH DESCRIPTION
+This program allows easy signing and signature verification for the supercop-ref10 implementation of the ed25519 signature scheme.
+
+.SH OPERATIONS
+.TP
+.B \-\-printkey
+Print contents of key file
+.TP
+.B \-\-generate
+Generate a new key
+.TP
+.B \-\-sign
+Sign a message
+.TP
+.B \-\-verify
+Verify a message signature
+.TP
+.B \-\-version
+Show version number and exit
+
+.SH OPTIONS
+.TP
+.B \-h, \-\-help
+Show usage and exit
+.TP
+.B \-k, \-\-key\-file\fR \fIpath\fR
+Select key file to use for the operation
+.TP
+.B \-m, \-\-message\fR \fImessage_string\fR
+Message to sign or verify (defaults to stdin)
+.TP
+.B \-M, \-\-message\-file\fR \fIpath\fR
+Message file to sign or verify (defaults to stdin)
+.TP
+.B \-s, \-\-signature\fR \fIsignature_string\fR
+Signature to verify the message against
+
+.SH RETURN VALUE
+Here are the possible return values:
+.RS
+.IP \(bu 2
+.B 0 \fR Everything went fine or the signature was valid
+.IP \(bu 2
+.B 1 \fR Signature was invalid or an error occurred, see stderr for an explanation
+.RE
+
+.SH ENVIRONMENT
+supercop doesn't follow any environment variables
+
+.SH AUTHOR
+finwo (https://finwo.nl)
diff --git a/src/main.c b/src/main.c
@@ -192,12 +192,14 @@ int main(int argc, const char **argv) {
OPT_BIT(0, "sign" , &command, "Sign a message" , NULL, COMMAND_SIGN ),
OPT_BIT(0, "verify" , &command, "Verify a message signature" , NULL, COMMAND_VERIFY ),
OPT_BIT(0, "version" , &command, "Show version number and exit", NULL, COMMAND_VERSION ),
+ // TODO: key-exchange (would be cool, questionable usability though
OPT_GROUP("Basic options"),
OPT_HELP(),
OPT_STRING('k', "key-file" , &keyFile , "Select key file to use for the operation"),
OPT_STRING('m', "message" , &message , "Message to sign or verify (defaults to stdin)"),
OPT_STRING('M', "message-file", &messageFile , "Message file to sign or verify (defaults to stdin)"),
OPT_STRING('s', "signature" , &verifySignature, "Signature to verify"),
+ // TODO: signature-file (for both sign & verify)
OPT_END(),
};