diff options
author | Werner Koch <[email protected]> | 2019-01-29 17:19:05 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2019-01-29 17:19:05 +0000 |
commit | 4a1558d0c7190cf13d35385e47291a7aa121be3e (patch) | |
tree | cfdd7a37f062ed9769b351b9eac64078d5eb81dc /common/t-openpgp-oid.c | |
parent | card: Support factory reset for Yubikey PIV application. (diff) | |
download | gnupg-4a1558d0c7190cf13d35385e47291a7aa121be3e.tar.gz gnupg-4a1558d0c7190cf13d35385e47291a7aa121be3e.zip |
common: New helper functions for OpenPGP curve OIDs.
* common/openpgp-oid.c (openpgp_oidbuf_to_str): Factor most code out
to ...
(openpgp_oidbuf_to_str): new.
(openpgp_oidbuf_is_ed25519): New.
(openpgp_oidbuf_is_cv25519): New.
--
At some places it is more convenient (and faster) to directly work on
buffers and avoid the way via opaque MPIs. These 3 new functions
allow for that.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'common/t-openpgp-oid.c')
-rw-r--r-- | common/t-openpgp-oid.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/common/t-openpgp-oid.c b/common/t-openpgp-oid.c index cb5709d98..fd9de5dde 100644 --- a/common/t-openpgp-oid.c +++ b/common/t-openpgp-oid.c @@ -142,7 +142,15 @@ test_openpgp_oid_to_str (void) fail (idx, 0); xfree (string); gcry_mpi_release (a); - } + + /* Again using the buffer variant. */ + string = openpgp_oidbuf_to_str (samples[idx].der, samples[idx].der[0]+1); + if (!string) + fail (idx, gpg_error_from_syserror ()); + if (strcmp (string, samples[idx].string)) + fail (idx, 0); + xfree (string); +} } |