diff options
author | Tobias Fella <[email protected]> | 2024-01-03 13:21:41 +0000 |
---|---|---|
committer | Tobias Fella <[email protected]> | 2024-05-22 08:16:19 +0000 |
commit | e42b72bc2ba0b5cacfd5df625df6011b8819fbce (patch) | |
tree | 83de7a6e18acf8b6b2dfeae3cb091641076bf711 /src/genkey.c | |
parent | tests: Fix segv in t-json.c (diff) | |
download | gpgme-e42b72bc2ba0b5cacfd5df625df6011b8819fbce.tar.gz gpgme-e42b72bc2ba0b5cacfd5df625df6011b8819fbce.zip |
core: Implement adding ADSKs through gpgme_createsubkey
* src/engine-gpg.c: Add and use function for adding ADSKs.
* src/genkey.c: Prevent error due to no status line.
* src/gpgme.h.in: Add flag GPGME_CREATE_ADSK
* doc/gpgme.texi: Add documentation for ADSKs
* tests/run-genkey.c: Add test for adding ADSKs
--
This adds the ability to add ADSKs through
the gpgme_createsubkey interface.
The function must be called with NULL userid,
the ADSK fingerprint in algo
and the GPGME_CREATE_ADSK flag.
Diffstat (limited to 'src/genkey.c')
-rw-r--r-- | src/genkey.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/genkey.c b/src/genkey.c index 89e1d985..11ca5cbe 100644 --- a/src/genkey.c +++ b/src/genkey.c @@ -48,6 +48,9 @@ typedef struct /* The key parameters passed to the crypto engine. */ gpgme_data_t key_parameter; + + /* Flag to indicate that an ADSK is to be added. */ + unsigned int adskmode : 1; } *op_data_t; @@ -180,7 +183,7 @@ genkey_status_handler (void *priv, gpgme_status_code_t code, char *args) case GPGME_STATUS_EOF: if (opd->error_code) return opd->error_code; - else if (!opd->uidmode && !opd->result.primary && !opd->result.sub) + else if (!opd->uidmode && !opd->adskmode && !opd->result.primary && !opd->result.sub) return gpg_error (GPG_ERR_GENERAL); else if (opd->failure_code) return opd->failure_code; @@ -445,6 +448,9 @@ createsubkey_start (gpgme_ctx_t ctx, int synchronous, return err; } + if (flags & GPGME_CREATE_ADSK) + opd->adskmode = 1; + return _gpgme_engine_op_genkey (ctx->engine, NULL, algo, reserved, expires, key, flags, |