- 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 --
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.
Tested with a basic patch for Kleopatra's key generation command
Unit Tests Skipped
Just a quick first comment: We usually commit core changes and cpp/qt/etc. changes separately. So please split this commit before merging it to master.
Another thing I noticed while browsing the changes: I'm missing a gpgme_op_addadsk_start. In fact, I think gpgme_op_addadsk is actually gpgme_op_addadsk_start and we lack a proper blocking gpgme_op_addadsk which calls _gpgme_wait_one (ctx) after starting the operation.
- Document the new flag/functionality in gpgme.texi
- Extend run-genkey.c, so that one can easily test this. (This also gives an example how it's used correctly.)
Use engine_gpg_t gpg instead of void *engine as gpg_adduid. void *engine should only be used for functions in the engine_ops interface (which receive an opaque engine pointer).
Also, I'd rename algo to adskfpr.
Mention this new mode in the comment preceding this if.
This looks like a nasty hack. uidmode is documented as "Flag to indicate that a UID is to be added." which is clearly not the case if an ADSK is added. Is this done because of the hack in genkey_status_handler? This sets the uid flag in the result which means "A user id was generated." which is also not the case.
Maybe you need to add a new flag to _gpgme_op_genkey_result. Or maybe we don't really need a result other than success/failure.
This is just for the hack in genkey_status_handler; without it, we always get a GPG_ERR_GENERAL. We don't care about the flag in _gpgme_op_genkey_result; I didn't notice that at first.
Looks good except for a nitpick and some documentation.
Regarding the error reporting: Check to status messages issued by gpg with gpg --status-fd 2 ‐‐quick‐add‐adsk fpr adskfpr. Sometimes printing a status message is missing in gpg if it wasn't needed until now.
The flag should also be documented together with all other GPGME_CREATE_* flags around line 4300.
This line is superfluous. Just name the function argument gpg. See the previous function.