Add ed25519 signing support to imgtool

This adds ed25519 signature support using the "prehash" method. Instead
of using the direct contents of the image and header payloads, a sha256
is generated and signed (SHA256-Ed25519). This allows for compatibility
with already existing tools that use the sha256 hash, like mcumgr, etc.

Signed-off-by: Fabio Utzig <utzig@apache.org>
diff --git a/scripts/imgtool/main.py b/scripts/imgtool/main.py
index 476884c..0a8fe0d 100755
--- a/scripts/imgtool/main.py
+++ b/scripts/imgtool/main.py
@@ -41,12 +41,17 @@
     print("TODO: p-224 not yet implemented")
 
 
+def gen_ed25519(keyfile, passwd):
+    keys.Ed25519.generate().export_private(path=keyfile)
+
+
 valid_langs = ['c', 'rust']
 keygens = {
     'rsa-2048':   gen_rsa2048,
     'rsa-3072':   gen_rsa3072,
     'ecdsa-p256': gen_ecdsa_p256,
     'ecdsa-p224': gen_ecdsa_p224,
+    'ed25519': gen_ed25519,
 }