fixing database access
authorVolker Birk <vb@pep-project.org>
Fri, 08 May 2015 16:53:39 +0200
changeset 25971d6c073fda4
parent 258 8e8eec84418b
child 260 75481f577114
fixing database access
src/cryptotech.c
src/cryptotech.h
src/message_api.c
src/message_api.h
src/pEpEngine.c
src/pgp_gpg_internal.h
src/transport.c
src/transport.h
test/message_api_test.cc
     1.1 --- a/src/cryptotech.c	Fri May 08 10:27:54 2015 +0200
     1.2 +++ b/src/cryptotech.c	Fri May 08 16:53:39 2015 +0200
     1.3 @@ -10,9 +10,10 @@
     1.4  #include <memory.h>
     1.5  #include <assert.h>
     1.6  
     1.7 +PEP_cryptotech_t cryptotech[PEP_crypt__count];
     1.8 +
     1.9  PEP_STATUS init_cryptotech(PEP_SESSION session, bool in_first)
    1.10  {
    1.11 -    static PEP_cryptotech_t cryptotech[PEP_crypt__count];
    1.12      PEP_STATUS status = PEP_STATUS_OK;
    1.13  
    1.14      assert(PEP_crypt__count == 2);
     2.1 --- a/src/cryptotech.h	Fri May 08 10:27:54 2015 +0200
     2.2 +++ b/src/cryptotech.h	Fri May 08 16:53:39 2015 +0200
     2.3 @@ -84,6 +84,8 @@
     2.4      key_expired_t key_expired;
     2.5  } PEP_cryptotech_t;
     2.6  
     2.7 +extern PEP_cryptotech_t cryptotech[PEP_crypt__count];
     2.8 +
     2.9  typedef uint64_t cryptotech_mask;
    2.10  
    2.11  PEP_STATUS init_cryptotech(PEP_SESSION session, bool in_first);
     3.1 --- a/src/message_api.c	Fri May 08 10:27:54 2015 +0200
     3.2 +++ b/src/message_api.c	Fri May 08 16:53:39 2015 +0200
     3.3 @@ -363,37 +363,10 @@
     3.4      if (!(session && src && dst && (enc_format >= PEP_enc_pieces)))
     3.5          return PEP_ILLEGAL_VALUE;
     3.6  
     3.7 -    *dst = NULL;
     3.8 -
     3.9 +    import_attached_keys(session, src);
    3.10      determine_encryption_format(src);
    3.11 -    import_attached_keys(session, src);
    3.12  
    3.13 -    if (src->enc_format >= PEP_enc_pieces) {
    3.14 -        if (src->enc_format == enc_format) {
    3.15 -            assert(0); // the message is encrypted this way already
    3.16 -            msg = message_dup(src);
    3.17 -            if (msg == NULL)
    3.18 -                goto enomem;
    3.19 -            *dst = msg;
    3.20 -            return PEP_STATUS_OK;
    3.21 -        }
    3.22 -        else {
    3.23 -            // decrypt and re-encrypt again
    3.24 -            message * _dst = NULL;
    3.25 -            stringlist_t *_keylist = NULL;
    3.26 -            PEP_MIME_format mime = (enc_format == PEP_enc_PEP) ? PEP_MIME :
    3.27 -                    PEP_MIME_fields_omitted;
    3.28 -
    3.29 -            PEP_color color;
    3.30 -            status = decrypt_message(session, src, mime, &_dst, &_keylist, &color);
    3.31 -            if (status != PEP_STATUS_OK)
    3.32 -                goto pep_error;
    3.33 -            free_stringlist(_keylist);
    3.34 -
    3.35 -            src = _dst;
    3.36 -            free_src = true;
    3.37 -        }
    3.38 -    }
    3.39 +    *dst = NULL;
    3.40  
    3.41      status = myself(session, src->from);
    3.42      if (status != PEP_STATUS_OK)
    3.43 @@ -792,13 +765,13 @@
    3.44      if (!(session && src && dst && keylist && color))
    3.45          return PEP_ILLEGAL_VALUE;
    3.46  
    3.47 +    import_attached_keys(session, src);
    3.48 +    PEP_cryptotech crypto = determine_encryption_format(src);
    3.49 +
    3.50      *dst = NULL;
    3.51      *keylist = NULL;
    3.52      *color = PEP_rating_undefined;
    3.53   
    3.54 -    determine_encryption_format(src);
    3.55 -    import_attached_keys(session, src);
    3.56 -
    3.57      if (src->mime == PEP_MIME_fields_omitted || src->mime == PEP_MIME) {
    3.58          message *_src = NULL;
    3.59          status = mime_decode_message(src->longmsg, &_src);
    3.60 @@ -820,26 +793,40 @@
    3.61      // src message is not MIME encoded (any more)
    3.62      assert(src->mime == PEP_MIME_none);
    3.63  
    3.64 -    if (!is_PGP_message_text(src->longmsg)) {
    3.65 -        status = PEP_UNENCRYPTED;
    3.66 -    }
    3.67 -    else {
    3.68 +    if (crypto) {
    3.69          ctext = src->longmsg;
    3.70          csize = strlen(src->longmsg);
    3.71  
    3.72 -        status = decrypt_and_verify(session, ctext, csize, &ptext, &psize,
    3.73 -                &_keylist);
    3.74 +        status = cryptotech[crypto].decrypt_and_verify(session, ctext, csize,
    3.75 +                &ptext, &psize, &_keylist);
    3.76          if (status > PEP_CANNOT_DECRYPT_UNKNOWN)
    3.77              goto pep_error;
    3.78      }
    3.79 +    else {
    3.80 +        status = PEP_UNENCRYPTED;
    3.81 +    }
    3.82  
    3.83      *color = decrypt_color(status);
    3.84 -    if (*color != PEP_rating_under_attack && _keylist) {
    3.85 -        PEP_color _color = keylist_color(session, _keylist);
    3.86 -        if (_color == PEP_rating_under_attack)
    3.87 +
    3.88 +    if (*color != PEP_rating_under_attack) {
    3.89 +        PEP_color kl_color = PEP_rating_undefined;
    3.90 +
    3.91 +        if (_keylist)
    3.92 +            kl_color = keylist_color(session, _keylist);
    3.93 +
    3.94 +        if (kl_color == PEP_rating_under_attack)
    3.95              *color = PEP_rating_under_attack;
    3.96 +
    3.97 +        else if (*color == PEP_rating_reliable &&
    3.98 +                kl_color >= PEP_rating_trusted)
    3.99 +            *color = kl_color;
   3.100 +
   3.101 +        else if (*color == PEP_rating_reliable &&
   3.102 +                kl_color < PEP_rating_reliable)
   3.103 +            *color = PEP_rating_unreliable;
   3.104 +
   3.105          else
   3.106 -            *color = MIN(*color, _color);
   3.107 +            *color = MIN(*color, kl_color);
   3.108      }
   3.109  
   3.110      if (ptext) {
     4.1 --- a/src/message_api.h	Fri May 08 10:27:54 2015 +0200
     4.2 +++ b/src/message_api.h	Fri May 08 16:53:39 2015 +0200
     4.3 @@ -3,6 +3,7 @@
     4.4  #include "pEpEngine.h"
     4.5  #include "keymanagement.h"
     4.6  #include "message.h"
     4.7 +#include "cryptotech.h"
     4.8  
     4.9  #ifdef __cplusplus
    4.10  extern "C" {
     5.1 --- a/src/pEpEngine.c	Fri May 08 10:27:54 2015 +0200
     5.2 +++ b/src/pEpEngine.c	Fri May 08 16:53:39 2015 +0200
     5.3 @@ -725,8 +725,8 @@
     5.4      result = sqlite3_step(session->get_trust);
     5.5      switch (result) {
     5.6      case SQLITE_ROW: {
     5.7 -        const char * user_id = (const char *) sqlite3_column_text(session->get_trust, 1);
     5.8 -        int comm_type = (PEP_comm_type) sqlite3_column_int(session->get_trust, 2);
     5.9 +        const char * user_id = (const char *) sqlite3_column_text(session->get_trust, 0);
    5.10 +        int comm_type = (PEP_comm_type) sqlite3_column_int(session->get_trust, 1);
    5.11  
    5.12          if (strcmp(user_id, identity->user_id) != 0) {
    5.13              free(identity->user_id);
    5.14 @@ -755,12 +755,13 @@
    5.15  {
    5.16      PEP_STATUS status = PEP_STATUS_OK;
    5.17      int result;
    5.18 -    PEP_comm_type _comm_type = PEP_ct_unknown;
    5.19  
    5.20      assert(session);
    5.21      assert(fpr);
    5.22      assert(comm_type);
    5.23  
    5.24 +    *comm_type = PEP_ct_unknown;
    5.25 +
    5.26      if (!(session && fpr && comm_type))
    5.27          return PEP_ILLEGAL_VALUE;
    5.28  
    5.29 @@ -770,8 +771,8 @@
    5.30      result = sqlite3_step(session->least_trust);
    5.31      switch (result) {
    5.32          case SQLITE_ROW: {
    5.33 -            *comm_type = (PEP_comm_type)
    5.34 -                    sqlite3_column_int(session->get_identity, 1);
    5.35 +            int _comm_type = sqlite3_column_int(session->least_trust, 0);
    5.36 +            *comm_type = (PEP_comm_type) _comm_type;
    5.37              break;
    5.38          }
    5.39          default:
     6.1 --- a/src/pgp_gpg_internal.h	Fri May 08 10:27:54 2015 +0200
     6.2 +++ b/src/pgp_gpg_internal.h	Fri May 08 16:53:39 2015 +0200
     6.3 @@ -1,118 +1,119 @@
     6.4 -#pragma once
     6.5 -
     6.6 -#include <gpgme.h>
     6.7 -
     6.8 -// init
     6.9 -
    6.10 -typedef const char * (*gpgme_check_version_t)(const char*);
    6.11 -typedef gpgme_error_t(*gpgme_set_locale_t)(gpgme_ctx_t CTX, int CATEGORY,
    6.12 -    const char *VALUE);
    6.13 -typedef gpgme_error_t(*gpgme_new_t)(gpgme_ctx_t *CTX);
    6.14 -typedef void(*gpgme_release_t)(gpgme_ctx_t CTX);
    6.15 -typedef gpgme_error_t(*gpgme_set_protocol_t)(gpgme_ctx_t CTX,
    6.16 -    gpgme_protocol_t PROTO);
    6.17 -typedef void(*gpgme_set_armor_t)(gpgme_ctx_t CTX, int YES);
    6.18 -
    6.19 -// data
    6.20 -
    6.21 -typedef gpgme_error_t(*gpgme_data_new_t)(gpgme_data_t *DH);
    6.22 -typedef gpgme_error_t(*gpgme_data_new_from_mem_t)(gpgme_data_t *DH,
    6.23 -    const char *BUFFER, size_t SIZE, int COPY);
    6.24 -typedef gpgme_error_t (*gpgme_data_new_from_cbs_t)(gpgme_data_t *DH,
    6.25 -        gpgme_data_cbs_t CBS, void *HANDLE);
    6.26 -typedef void(*gpgme_data_release_t)(gpgme_data_t DH);
    6.27 -typedef gpgme_data_type_t(*gpgme_data_identify_t)(gpgme_data_t DH);
    6.28 -typedef size_t(*gpgme_data_seek_t)(gpgme_data_t DH, size_t OFFSET,
    6.29 -    int WHENCE);
    6.30 -typedef size_t(*gpgme_data_read_t)(gpgme_data_t DH, void *BUFFER,
    6.31 -    size_t LENGTH);
    6.32 -
    6.33 -// encrypt and decrypt
    6.34 -
    6.35 -typedef gpgme_error_t(*gpgme_op_decrypt_t)(gpgme_ctx_t CTX,
    6.36 -    gpgme_data_t CIPHER, gpgme_data_t PLAIN);
    6.37 -typedef gpgme_error_t(*gpgme_op_verify_t)(gpgme_ctx_t CTX, gpgme_data_t SIG,
    6.38 -    gpgme_data_t SIGNED_TEXT, gpgme_data_t PLAIN);
    6.39 -typedef gpgme_error_t(*gpgme_op_decrypt_verify_t)(gpgme_ctx_t CTX,
    6.40 -    gpgme_data_t CIPHER, gpgme_data_t PLAIN);
    6.41 -typedef gpgme_decrypt_result_t(*gpgme_op_decrypt_result_t)(gpgme_ctx_t CTX);
    6.42 -typedef gpgme_error_t(*gpgme_op_encrypt_sign_t)(gpgme_ctx_t CTX,
    6.43 -    gpgme_key_t RECP[], gpgme_encrypt_flags_t FLAGS, gpgme_data_t PLAIN,
    6.44 -    gpgme_data_t CIPHER);
    6.45 -typedef gpgme_verify_result_t(*gpgme_op_verify_result_t)(gpgme_ctx_t CTX);
    6.46 -typedef void(*gpgme_signers_clear_t)(gpgme_ctx_t CTX);
    6.47 -typedef gpgme_error_t(*gpgme_signers_add_t)(gpgme_ctx_t CTX, const gpgme_key_t KEY);
    6.48 -
    6.49 -// keys
    6.50 -
    6.51 -typedef gpgme_error_t(*gpgme_get_key_t)(gpgme_ctx_t CTX, const char *FPR,
    6.52 -    gpgme_key_t *R_KEY, int SECRET);
    6.53 -typedef gpgme_error_t(*gpgme_op_genkey_t)(gpgme_ctx_t CTX, const char *PARMS,
    6.54 -    gpgme_data_t PUBLIC, gpgme_data_t SECRET);
    6.55 -typedef gpgme_genkey_result_t(*gpgme_op_genkey_result_t)(gpgme_ctx_t CTX);
    6.56 -typedef gpgme_error_t(*gpgme_op_delete_t)(gpgme_ctx_t CTX,
    6.57 -    const gpgme_key_t KEY, int ALLOW_SECRET);
    6.58 -typedef gpgme_error_t(*gpgme_op_import_t)(gpgme_ctx_t CTX,
    6.59 -    gpgme_data_t KEYDATA);
    6.60 -typedef gpgme_error_t(*gpgme_op_export_t)(gpgme_ctx_t CTX,
    6.61 -    const char *PATTERN, gpgme_export_mode_t MODE, gpgme_data_t KEYDATA);
    6.62 -typedef gpgme_error_t(*gpgme_set_keylist_mode_t)(gpgme_ctx_t CTX,
    6.63 -    gpgme_keylist_mode_t MODE);
    6.64 -typedef gpgme_keylist_mode_t(*gpgme_get_keylist_mode_t)(gpgme_ctx_t CTX);
    6.65 -typedef gpgme_error_t(*gpgme_op_keylist_start_t)(gpgme_ctx_t CTX,
    6.66 -    const char *PATTERN, int SECRET_ONLY);
    6.67 -typedef gpgme_error_t(*gpgme_op_keylist_next_t)(gpgme_ctx_t CTX,
    6.68 -    gpgme_key_t *R_KEY);
    6.69 -typedef gpgme_error_t(*gpgme_op_keylist_end_t)(gpgme_ctx_t CTX);
    6.70 -typedef gpgme_error_t(*gpgme_op_import_keys_t)(gpgme_ctx_t CTX,
    6.71 -    gpgme_key_t *KEYS);
    6.72 -typedef void(*gpgme_key_ref_t)(gpgme_key_t KEY);
    6.73 -typedef void(*gpgme_key_unref_t)(gpgme_key_t KEY);
    6.74 -typedef gpgme_error_t (*gpgme_op_edit_t)(gpgme_ctx_t CTX, gpgme_key_t KEY,
    6.75 -        gpgme_edit_cb_t FNC, void *HANDLE, gpgme_data_t OUT);
    6.76 +#pragma once
    6.77 +
    6.78 +#include <gpgme.h>
    6.79 +
    6.80 +// init
    6.81 +
    6.82 +typedef const char * (*gpgme_check_version_t)(const char*);
    6.83 +typedef gpgme_error_t(*gpgme_set_locale_t)(gpgme_ctx_t CTX, int CATEGORY,
    6.84 +    const char *VALUE);
    6.85 +typedef gpgme_error_t(*gpgme_new_t)(gpgme_ctx_t *CTX);
    6.86 +typedef void(*gpgme_release_t)(gpgme_ctx_t CTX);
    6.87 +typedef gpgme_error_t(*gpgme_set_protocol_t)(gpgme_ctx_t CTX,
    6.88 +    gpgme_protocol_t PROTO);
    6.89 +typedef void(*gpgme_set_armor_t)(gpgme_ctx_t CTX, int YES);
    6.90 +
    6.91 +// data
    6.92 +
    6.93 +typedef gpgme_error_t(*gpgme_data_new_t)(gpgme_data_t *DH);
    6.94 +typedef gpgme_error_t(*gpgme_data_new_from_mem_t)(gpgme_data_t *DH,
    6.95 +    const char *BUFFER, size_t SIZE, int COPY);
    6.96 +typedef gpgme_error_t (*gpgme_data_new_from_cbs_t)(gpgme_data_t *DH,
    6.97 +        gpgme_data_cbs_t CBS, void *HANDLE);
    6.98 +typedef void(*gpgme_data_release_t)(gpgme_data_t DH);
    6.99 +typedef gpgme_data_type_t(*gpgme_data_identify_t)(gpgme_data_t DH);
   6.100 +typedef size_t(*gpgme_data_seek_t)(gpgme_data_t DH, size_t OFFSET,
   6.101 +    int WHENCE);
   6.102 +typedef size_t(*gpgme_data_read_t)(gpgme_data_t DH, void *BUFFER,
   6.103 +    size_t LENGTH);
   6.104 +
   6.105 +// encrypt and decrypt
   6.106 +
   6.107 +typedef gpgme_error_t(*gpgme_op_decrypt_t)(gpgme_ctx_t CTX,
   6.108 +    gpgme_data_t CIPHER, gpgme_data_t PLAIN);
   6.109 +typedef gpgme_error_t(*gpgme_op_verify_t)(gpgme_ctx_t CTX, gpgme_data_t SIG,
   6.110 +    gpgme_data_t SIGNED_TEXT, gpgme_data_t PLAIN);
   6.111 +typedef gpgme_error_t(*gpgme_op_decrypt_verify_t)(gpgme_ctx_t CTX,
   6.112 +    gpgme_data_t CIPHER, gpgme_data_t PLAIN);
   6.113 +typedef gpgme_decrypt_result_t(*gpgme_op_decrypt_result_t)(gpgme_ctx_t CTX);
   6.114 +typedef gpgme_error_t(*gpgme_op_encrypt_sign_t)(gpgme_ctx_t CTX,
   6.115 +    gpgme_key_t RECP[], gpgme_encrypt_flags_t FLAGS, gpgme_data_t PLAIN,
   6.116 +    gpgme_data_t CIPHER);
   6.117 +typedef gpgme_verify_result_t(*gpgme_op_verify_result_t)(gpgme_ctx_t CTX);
   6.118 +typedef void(*gpgme_signers_clear_t)(gpgme_ctx_t CTX);
   6.119 +typedef gpgme_error_t(*gpgme_signers_add_t)(gpgme_ctx_t CTX, const gpgme_key_t KEY);
   6.120 +
   6.121 +// keys
   6.122 +
   6.123 +typedef gpgme_error_t(*gpgme_get_key_t)(gpgme_ctx_t CTX, const char *FPR,
   6.124 +    gpgme_key_t *R_KEY, int SECRET);
   6.125 +typedef gpgme_error_t(*gpgme_op_genkey_t)(gpgme_ctx_t CTX, const char *PARMS,
   6.126 +    gpgme_data_t PUBLIC, gpgme_data_t SECRET);
   6.127 +typedef gpgme_genkey_result_t(*gpgme_op_genkey_result_t)(gpgme_ctx_t CTX);
   6.128 +typedef gpgme_error_t(*gpgme_op_delete_t)(gpgme_ctx_t CTX,
   6.129 +    const gpgme_key_t KEY, int ALLOW_SECRET);
   6.130 +typedef gpgme_error_t(*gpgme_op_import_t)(gpgme_ctx_t CTX,
   6.131 +    gpgme_data_t KEYDATA);
   6.132 +typedef gpgme_error_t(*gpgme_op_export_t)(gpgme_ctx_t CTX,
   6.133 +    const char *PATTERN, gpgme_export_mode_t MODE, gpgme_data_t KEYDATA);
   6.134 +typedef gpgme_error_t(*gpgme_set_keylist_mode_t)(gpgme_ctx_t CTX,
   6.135 +    gpgme_keylist_mode_t MODE);
   6.136 +typedef gpgme_keylist_mode_t(*gpgme_get_keylist_mode_t)(gpgme_ctx_t CTX);
   6.137 +typedef gpgme_error_t(*gpgme_op_keylist_start_t)(gpgme_ctx_t CTX,
   6.138 +    const char *PATTERN, int SECRET_ONLY);
   6.139 +typedef gpgme_error_t(*gpgme_op_keylist_next_t)(gpgme_ctx_t CTX,
   6.140 +    gpgme_key_t *R_KEY);
   6.141 +typedef gpgme_error_t(*gpgme_op_keylist_end_t)(gpgme_ctx_t CTX);
   6.142 +typedef gpgme_error_t(*gpgme_op_import_keys_t)(gpgme_ctx_t CTX,
   6.143 +    gpgme_key_t *KEYS);
   6.144 +typedef void(*gpgme_key_ref_t)(gpgme_key_t KEY);
   6.145 +typedef void(*gpgme_key_unref_t)(gpgme_key_t KEY);
   6.146 +typedef gpgme_error_t (*gpgme_op_edit_t)(gpgme_ctx_t CTX, gpgme_key_t KEY,
   6.147 +        gpgme_edit_cb_t FNC, void *HANDLE, gpgme_data_t OUT);
   6.148  typedef gpgme_ssize_t (*gpgme_io_write_t)(int fd, const void *buffer,
   6.149          size_t count);
   6.150 -
   6.151 -struct gpg_s {
   6.152 -    const char * version;
   6.153 -    gpgme_check_version_t gpgme_check;
   6.154 -    gpgme_set_locale_t gpgme_set_locale;
   6.155 -    gpgme_new_t gpgme_new;
   6.156 -    gpgme_release_t gpgme_release;
   6.157 -    gpgme_set_protocol_t gpgme_set_protocol;
   6.158 -    gpgme_set_armor_t gpgme_set_armor;
   6.159 -
   6.160 -    gpgme_data_new_t gpgme_data_new;
   6.161 -    gpgme_data_new_from_mem_t gpgme_data_new_from_mem;
   6.162 -    gpgme_data_new_from_cbs_t gpgme_data_new_from_cbs;
   6.163 -    gpgme_data_release_t gpgme_data_release;
   6.164 -    gpgme_data_identify_t gpgme_data_identify;
   6.165 -    gpgme_data_seek_t gpgme_data_seek;
   6.166 -    gpgme_data_read_t gpgme_data_read;
   6.167 -
   6.168 -    gpgme_op_decrypt_t gpgme_op_decrypt;
   6.169 -    gpgme_op_verify_t gpgme_op_verify;
   6.170 -    gpgme_op_decrypt_verify_t gpgme_op_decrypt_verify;
   6.171 -    gpgme_op_decrypt_result_t gpgme_op_decrypt_result;
   6.172 -    gpgme_op_encrypt_sign_t gpgme_op_encrypt_sign;
   6.173 -    gpgme_op_verify_result_t gpgme_op_verify_result;
   6.174 -    gpgme_signers_clear_t gpgme_signers_clear;
   6.175 -    gpgme_signers_add_t gpgme_signers_add;
   6.176 -
   6.177 -    gpgme_get_key_t gpgme_get_key;
   6.178 -    gpgme_op_genkey_t gpgme_op_genkey;
   6.179 -    gpgme_op_genkey_result_t gpgme_op_genkey_result;
   6.180 -    gpgme_op_delete_t gpgme_op_delete;
   6.181 -    gpgme_op_import_t gpgme_op_import;
   6.182 -    gpgme_op_export_t gpgme_op_export;
   6.183 -    gpgme_set_keylist_mode_t gpgme_set_keylist_mode;
   6.184 -    gpgme_get_keylist_mode_t gpgme_get_keylist_mode;
   6.185 -    gpgme_op_keylist_start_t gpgme_op_keylist_start;
   6.186 -    gpgme_op_keylist_next_t gpgme_op_keylist_next;
   6.187 -    gpgme_op_keylist_end_t gpgme_op_keylist_end;
   6.188 -    gpgme_op_import_keys_t gpgme_op_import_keys;
   6.189 -    gpgme_key_ref_t gpgme_key_ref;
   6.190 -    gpgme_key_unref_t gpgme_key_unref;
   6.191 -    gpgme_op_edit_t gpgme_op_edit;
   6.192 -    gpgme_io_write_t gpgme_io_write;
   6.193 -};
   6.194 +
   6.195 +struct gpg_s {
   6.196 +    const char * version;
   6.197 +    gpgme_check_version_t gpgme_check;
   6.198 +    gpgme_set_locale_t gpgme_set_locale;
   6.199 +    gpgme_new_t gpgme_new;
   6.200 +    gpgme_release_t gpgme_release;
   6.201 +    gpgme_set_protocol_t gpgme_set_protocol;
   6.202 +    gpgme_set_armor_t gpgme_set_armor;
   6.203 +
   6.204 +    gpgme_data_new_t gpgme_data_new;
   6.205 +    gpgme_data_new_from_mem_t gpgme_data_new_from_mem;
   6.206 +    gpgme_data_new_from_cbs_t gpgme_data_new_from_cbs;
   6.207 +    gpgme_data_release_t gpgme_data_release;
   6.208 +    gpgme_data_identify_t gpgme_data_identify;
   6.209 +    gpgme_data_seek_t gpgme_data_seek;
   6.210 +    gpgme_data_read_t gpgme_data_read;
   6.211 +
   6.212 +    gpgme_op_decrypt_t gpgme_op_decrypt;
   6.213 +    gpgme_op_verify_t gpgme_op_verify;
   6.214 +    gpgme_op_decrypt_verify_t gpgme_op_decrypt_verify;
   6.215 +    gpgme_op_decrypt_result_t gpgme_op_decrypt_result;
   6.216 +    gpgme_op_encrypt_sign_t gpgme_op_encrypt_sign;
   6.217 +    gpgme_op_verify_result_t gpgme_op_verify_result;
   6.218 +    gpgme_signers_clear_t gpgme_signers_clear;
   6.219 +    gpgme_signers_add_t gpgme_signers_add;
   6.220 +
   6.221 +    gpgme_get_key_t gpgme_get_key;
   6.222 +    gpgme_op_genkey_t gpgme_op_genkey;
   6.223 +    gpgme_op_genkey_result_t gpgme_op_genkey_result;
   6.224 +    gpgme_op_delete_t gpgme_op_delete;
   6.225 +    gpgme_op_import_t gpgme_op_import;
   6.226 +    gpgme_op_export_t gpgme_op_export;
   6.227 +    gpgme_set_keylist_mode_t gpgme_set_keylist_mode;
   6.228 +    gpgme_get_keylist_mode_t gpgme_get_keylist_mode;
   6.229 +    gpgme_op_keylist_start_t gpgme_op_keylist_start;
   6.230 +    gpgme_op_keylist_next_t gpgme_op_keylist_next;
   6.231 +    gpgme_op_keylist_end_t gpgme_op_keylist_end;
   6.232 +    gpgme_op_import_keys_t gpgme_op_import_keys;
   6.233 +    gpgme_key_ref_t gpgme_key_ref;
   6.234 +    gpgme_key_unref_t gpgme_key_unref;
   6.235 +    gpgme_op_edit_t gpgme_op_edit;
   6.236 +    gpgme_io_write_t gpgme_io_write;
   6.237 +};
   6.238 +
     7.1 --- a/src/transport.c	Fri May 08 10:27:54 2015 +0200
     7.2 +++ b/src/transport.c	Fri May 08 16:53:39 2015 +0200
     7.3 @@ -4,10 +4,10 @@
     7.4  #include <memory.h>
     7.5  #include <assert.h>
     7.6  
     7.7 +PEP_transport_t transports[PEP_trans__count];
     7.8 +    
     7.9  PEP_STATUS init_transport_system(PEP_SESSION session, bool in_first)
    7.10  {
    7.11 -    static PEP_transport_t transports[PEP_trans__count];
    7.12 -    
    7.13      assert(session);
    7.14      session->transports = transports;
    7.15  
     8.1 --- a/src/transport.h	Fri May 08 10:27:54 2015 +0200
     8.2 +++ b/src/transport.h	Fri May 08 16:53:39 2015 +0200
     8.3 @@ -33,6 +33,8 @@
     8.4      PEP_text_format native_text_format;     // native format of the transport
     8.5  };
     8.6  
     8.7 +extern PEP_transport_t transports[PEP_trans__count];
     8.8 +
     8.9  typedef uint64_t transports_mask;
    8.10  
    8.11  #ifdef __cplusplus
     9.1 --- a/test/message_api_test.cc	Fri May 08 10:27:54 2015 +0200
     9.2 +++ b/test/message_api_test.cc	Fri May 08 16:53:39 2015 +0200
     9.3 @@ -68,7 +68,7 @@
     9.4      stringlist_t *keylist4;
     9.5      PEP_color color;
     9.6      PEP_STATUS status4 = decrypt_message(session, enc_msg2, PEP_MIME_none, &msg4, &keylist4, &color);
     9.7 -    assert(status4 == PEP_STATUS_OK);
     9.8 +    assert(status4 == PEP_DECRYPTED_AND_VERIFIED);
     9.9      assert(msg4);
    9.10      assert(keylist4);
    9.11