summaryrefslogtreecommitdiffstats
path: root/sm/certdump.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2020-05-13 21:21:24 +0200
committerWerner Koch <wk@gnupg.org>2020-05-13 21:22:28 +0200
commitb1694987bb6484405d41d34046a5290176feadd0 (patch)
tree0318ab518dd1ed0eb6aeb70615be28b1c81ffb13 /sm/certdump.c
parentsm: Support signing using ECDSA. (diff)
downloadgnupg2-b1694987bb6484405d41d34046a5290176feadd0.tar.xz
gnupg2-b1694987bb6484405d41d34046a5290176feadd0.zip
sm: Support import and verification of EdDSA certificates.
* sm/certdump.c (gpgsm_get_serial): New. * sm/certcheck.c (gpgsm_check_cert_sig): Support EdDSA signatures. -- Note that this does not work with the self-signed RFC-8410 sample certificate; see the code for comments. The Ed488 case has not been tested due to a lack of support in Libgcrypt. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'sm/certdump.c')
-rw-r--r--sm/certdump.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/sm/certdump.c b/sm/certdump.c
index ef60358d7..7d0dfdbf9 100644
--- a/sm/certdump.c
+++ b/sm/certdump.c
@@ -48,6 +48,28 @@ struct dn_array_s {
};
+/* Get the first first element from the s-expression SN and return a
+ * pointer to it. Stores the length at R_LENGTH. Returns NULL for no
+ * value or an invalid expression. */
+const void *
+gpgsm_get_serial (ksba_const_sexp_t sn, size_t *r_length)
+{
+ const char *p = (const char *)sn;
+ unsigned long n;
+ char *endp;
+
+ if (!p || *p != '(')
+ return NULL;
+ p++;
+ n = strtoul (p, &endp, 10);
+ p = endp;
+ if (*p++ != ':')
+ return NULL;
+ *r_length = n;
+ return p;
+}
+
+
/* Print the first element of an S-Expression. */
void
gpgsm_print_serial (estream_t fp, ksba_const_sexp_t sn)