ENGINE-157 subkey check function in ENGINE-157
authorKrista Grothoff <krista@pep-project.org>
Mon, 09 Jan 2017 10:56:33 +0100
branchENGINE-157
changeset 153469a4e0933b0d
parent 1533 ca90b6245a51
ENGINE-157 subkey check function in
src/pgp_gpg.c
     1.1 --- a/src/pgp_gpg.c	Mon Jan 09 10:28:02 2017 +0100
     1.2 +++ b/src/pgp_gpg.c	Mon Jan 09 10:56:33 2017 +0100
     1.3 @@ -391,12 +391,12 @@
     1.4  PEP_STATUS _first_viable_subkey_fpr(PEP_SESSION session,
     1.5                                      gpgme_key_t key,
     1.6                                      char** ret_fpr) {
     1.7 -    *ref_fpr = NULL;
     1.8 +    *ret_fpr = NULL;
     1.9      
    1.10      if (key && key->subkeys) {
    1.11          gpgme_subkey_t subkey = key->subkeys;
    1.12  
    1.13 -        switch (subkeys->protocol) {
    1.14 +        switch (key->protocol) {
    1.15              case GPGME_PROTOCOL_OpenPGP:
    1.16              case GPGME_PROTOCOL_DEFAULT:
    1.17              case GPGME_PROTOCOL_CMS:
    1.18 @@ -408,7 +408,7 @@
    1.19          while (subkey) {
    1.20              if (!(subkey->revoked || subkey->expired ||
    1.21                  subkey->disabled || subkey->invalid)) {
    1.22 -
    1.23 +#if GPGME_VERSION_NUMBER >= 0x020100
    1.24                  if (gpgme_check_version("2.1.0")) {
    1.25                      switch (subkey->pubkey_algo) {
    1.26                          case PUBKEY_ALGO_ECDH:
    1.27 @@ -420,6 +420,7 @@
    1.28                              break;
    1.29                      }
    1.30                  }    
    1.31 +#endif
    1.32                  break;
    1.33              }
    1.34              subkey = subkey->next;