]> git.ipfire.org Git - pakfire.git/commitdiff
key: Create its own type
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 27 Jun 2025 14:11:10 +0000 (14:11 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 27 Jun 2025 14:11:10 +0000 (14:11 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
12 files changed:
src/cli/lib/repo_compose.c
src/pakfire/key.c
src/pakfire/key.h
src/pakfire/repo.c
src/pakfire/repo.h
src/pakfire/transaction.c
src/pakfire/transaction.h
src/python/key.c
src/python/key.h
src/python/pakfire.c
src/python/repo.c
tests/libpakfire/key.c

index f481da4ead2be041686521d4a0cb98e6a6f402b4..b39a5890c70cb7f376e48b5e0c5bd48c6459ea44 100644 (file)
@@ -76,7 +76,7 @@ static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
        return 0;
 }
 
-static int cli_import_key(struct pakfire_key** key,
+static int cli_import_key(pakfire_key** key,
                pakfire_ctx* ctx, const char* path) {
        FILE* f = NULL;
        int r;
@@ -105,7 +105,7 @@ int cli_repo_compose(void* data, int argc, char* argv[]) {
        struct cli_global_args* global_args = data;
        struct cli_local_args local_args = {};
        struct pakfire* pakfire = NULL;
-       struct pakfire_key* key = NULL;
+       pakfire_key* key = NULL;
        int r;
 
        // Parse the command line
index 58b2402db8435f8cee195fb0c2354c7cfb60795b..bfcb26d6e2a8e453cedcfcc62ba672c00cc6e5a3 100644 (file)
@@ -65,38 +65,38 @@ struct pakfire_key {
        char comment[COMMENT_MAX];
 };
 
-struct pakfire_key_public_key {
+typedef struct pakfire_key_public_key {
        unsigned char sig_algo[2];
        pakfire_key_id id;
        unsigned char pubkey[32];
-};
+} pakfire_key_public_key;
 
-struct pakfire_key_private_key {
+typedef struct pakfire_key_private_key {
        unsigned char sig_algo[2];
-    unsigned char kdf_algo[2];
+       unsigned char kdf_algo[2];
        uint32_t kdf_rounds;
-    unsigned char kdf_salt[16];
+       unsigned char kdf_salt[16];
        unsigned char checksum[8];
        pakfire_key_id id;
        struct {
                unsigned char secret[32];
                unsigned char public[32];
        } keys;
-};
+} pakfire_key_private_key;
 
-struct pakfire_key_signature {
+typedef struct pakfire_key_signature {
        unsigned char sig_algo[2];
        pakfire_key_id key_id;
        unsigned char signature[64];
-};
+} pakfire_key_signature;
 
 static int pakfire_key_id_equals(const pakfire_key_id* id1, const pakfire_key_id* id2) {
        return !memcmp(*id1, *id2, sizeof(*id1));
 }
 
-static int pakfire_key_create(struct pakfire_key** key, pakfire_ctx* ctx,
+static int pakfire_key_create(pakfire_key** key, pakfire_ctx* ctx,
                const pakfire_key_algo_t algo, const pakfire_key_id id, EVP_PKEY* pkey, const char* comment) {
-       struct pakfire_key* k = NULL;
+       pakfire_key* k = NULL;
        int r = 0;
 
        if (!pkey)
@@ -152,7 +152,7 @@ ERROR:
        return r;
 }
 
-static void pakfire_key_free(struct pakfire_key* key) {
+static void pakfire_key_free(pakfire_key* key) {
        // Free the key
        if (key->pkey)
                EVP_PKEY_free(key->pkey);
@@ -161,13 +161,13 @@ static void pakfire_key_free(struct pakfire_key* key) {
        free(key);
 }
 
-struct pakfire_key* pakfire_key_ref(struct pakfire_key* key) {
+pakfire_key* pakfire_key_ref(pakfire_key* key) {
        ++key->nrefs;
 
        return key;
 }
 
-struct pakfire_key* pakfire_key_unref(struct pakfire_key* key) {
+pakfire_key* pakfire_key_unref(pakfire_key* key) {
        if (--key->nrefs > 0)
                return key;
 
@@ -175,11 +175,11 @@ struct pakfire_key* pakfire_key_unref(struct pakfire_key* key) {
        return NULL;
 }
 
-pakfire_key_id* pakfire_key_get_id(struct pakfire_key* key) {
+pakfire_key_id* pakfire_key_get_id(pakfire_key* key) {
        return &key->id;
 }
 
-const char* pakfire_key_get_algo(struct pakfire_key* key) {
+const char* pakfire_key_get_algo(pakfire_key* key) {
        switch (key->algo) {
                case PAKFIRE_KEY_ALGO_ED25519:
                        return "Ed255919";
@@ -191,11 +191,11 @@ const char* pakfire_key_get_algo(struct pakfire_key* key) {
        return NULL;
 }
 
-const char* pakfire_key_get_comment(struct pakfire_key* key) {
+const char* pakfire_key_get_comment(pakfire_key* key) {
        return key->comment;
 }
 
-int pakfire_key_generate(struct pakfire_key** key, pakfire_ctx* ctx,
+int pakfire_key_generate(pakfire_key** key, pakfire_ctx* ctx,
                const pakfire_key_algo_t algo, const char* comment) {
        EVP_PKEY* pkey = NULL;
        EVP_PKEY_CTX* pctx = NULL;
@@ -271,9 +271,9 @@ ERROR:
        Import
 */
 
-static int pakfire_key_import_secret_key(struct pakfire_key** key,
+static int pakfire_key_import_secret_key(pakfire_key** key,
                pakfire_ctx* ctx, const char* comment,
-               const struct pakfire_key_private_key* buffer) {
+               const pakfire_key_private_key* buffer) {
        const pakfire_key_algo_t algo = PAKFIRE_KEY_ALGO_ED25519;
        EVP_PKEY* pkey = NULL;
        char error[ERROR_MAX];
@@ -346,9 +346,9 @@ ERROR:
        return r;
 }
 
-static int pakfire_key_import_public_key(struct pakfire_key** key,
+static int pakfire_key_import_public_key(pakfire_key** key,
                pakfire_ctx* ctx, const char* comment,
-               const struct pakfire_key_public_key* buffer) {
+               const pakfire_key_public_key* buffer) {
        const pakfire_key_algo_t algo = PAKFIRE_KEY_ALGO_ED25519;
        EVP_PKEY* pkey = NULL;
        char error[ERROR_MAX];
@@ -388,7 +388,7 @@ ERROR:
        return r;
 }
 
-int pakfire_key_import(struct pakfire_key** key,
+int pakfire_key_import(pakfire_key** key,
                pakfire_ctx* ctx, FILE* f) {
        unsigned char* buffer = NULL;
        size_t buffer_length = 0;
@@ -439,17 +439,17 @@ int pakfire_key_import(struct pakfire_key** key,
                                // What kind of key do we have?
                                switch (buffer_length) {
                                        // Public Key
-                                       case sizeof(struct pakfire_key_public_key):
+                                       case sizeof(pakfire_key_public_key):
                                                r = pakfire_key_import_public_key(key, ctx, comment,
-                                                       (struct pakfire_key_public_key*)buffer);
+                                                       (pakfire_key_public_key*)buffer);
                                                if (r < 0)
                                                        goto ERROR;
                                                break;
 
                                        // Private Key
-                                       case sizeof(struct pakfire_key_private_key):
+                                       case sizeof(pakfire_key_private_key):
                                                r = pakfire_key_import_secret_key(key, ctx, comment,
-                                                       (struct pakfire_key_private_key*)buffer);
+                                                       (pakfire_key_private_key*)buffer);
                                                if (r < 0)
                                                        goto ERROR;
                                                break;
@@ -482,7 +482,7 @@ ERROR:
        return r;
 }
 
-int pakfire_key_import_from_string(struct pakfire_key** key,
+int pakfire_key_import_from_string(pakfire_key** key,
                pakfire_ctx* ctx, const char* data, const size_t length) {
        FILE* f = NULL;
        int r;
@@ -505,7 +505,7 @@ ERROR:
        return r;
 }
 
-static int pakfire_key_get_public_key(struct pakfire_key* key,
+static int pakfire_key_get_public_key(pakfire_key* key,
                unsigned char* buffer, const size_t length) {
        char error[ERROR_MAX];
        int r;
@@ -529,7 +529,7 @@ static int pakfire_key_get_public_key(struct pakfire_key* key,
        return 0;
 }
 
-static int pakfire_key_get_secret_key(struct pakfire_key* key,
+static int pakfire_key_get_secret_key(pakfire_key* key,
                unsigned char* buffer, const size_t length) {
        char error[ERROR_MAX];
        int r;
@@ -557,8 +557,8 @@ static int pakfire_key_get_secret_key(struct pakfire_key* key,
        Export
 */
 
-static int pakfire_key_export_private_key(struct pakfire_key* key,
-               struct pakfire_key_private_key* buffer) {
+static int pakfire_key_export_private_key(pakfire_key* key,
+               pakfire_key_private_key* buffer) {
        unsigned char checksum[64];
        unsigned int length = sizeof(checksum);
        int r;
@@ -618,8 +618,8 @@ static int pakfire_key_export_private_key(struct pakfire_key* key,
        return 0;
 }
 
-static int pakfire_key_export_public_key(struct pakfire_key* key,
-               struct pakfire_key_public_key* buffer) {
+static int pakfire_key_export_public_key(pakfire_key* key,
+               pakfire_key_public_key* buffer) {
        int r;
 
        // Write the algorithm
@@ -648,10 +648,10 @@ static int pakfire_key_export_public_key(struct pakfire_key* key,
        return 0;
 }
 
-int pakfire_key_export(struct pakfire_key* key, FILE* f,
+int pakfire_key_export(pakfire_key* key, FILE* f,
                const pakfire_key_export_mode_t mode) {
-       struct pakfire_key_public_key public_key = { 0 };
-       struct pakfire_key_private_key private_key = { 0 };
+       pakfire_key_public_key public_key = { 0 };
+       pakfire_key_private_key private_key = { 0 };
        int r;
 
        BIO* bio = NULL;
@@ -738,7 +738,7 @@ ERROR:
        return r;
 }
 
-int pakfire_key_export_string(struct pakfire_key* self, char** buffer, size_t* length) {
+int pakfire_key_export_string(pakfire_key* self, char** buffer, size_t* length) {
        FILE* f = NULL;
        int r;
 
@@ -768,8 +768,8 @@ ERROR:
        Sign
 */
 
-static int __pakfire_key_sign(struct pakfire_key* key,
-               struct pakfire_key_signature* signature, const void* data, const size_t length) {
+static int __pakfire_key_sign(pakfire_key* key,
+               pakfire_key_signature* signature, const void* data, const size_t length) {
        EVP_MD_CTX* mdctx = NULL;
        char error[ERROR_MAX];
        int r;
@@ -822,9 +822,9 @@ ERROR:
        return r;
 }
 
-int pakfire_key_sign_string(struct pakfire_key* key,
+int pakfire_key_sign_string(pakfire_key* key,
                FILE* f, const void* data, const size_t length, const char* comment) {
-       struct pakfire_key_signature signature = { 0 };
+       pakfire_key_signature signature = { 0 };
        char* buffer = NULL;
        int r;
 
@@ -869,7 +869,7 @@ ERROR:
        return r;
 }
 
-int pakfire_key_sign(struct pakfire_key* key, FILE* s, FILE* f, const char* comment) {
+int pakfire_key_sign(pakfire_key* key, FILE* s, FILE* f, const char* comment) {
        char* buffer = NULL;
        size_t length = 0;
        int r;
@@ -889,8 +889,8 @@ ERROR:
        return r;
 }
 
-static int pakfire_key_read_signature(struct pakfire_key* key,
-               struct pakfire_key_signature* signature, FILE* f) {
+static int pakfire_key_read_signature(pakfire_key* key,
+               pakfire_key_signature* signature, FILE* f) {
        unsigned char* buffer = NULL;
        size_t buffer_length = 0;
        int r;
@@ -957,8 +957,8 @@ ERROR:
        return r;
 }
 
-static int pakfire_key_verify_signature(struct pakfire_key* key,
-               const struct pakfire_key_signature* signature, const void* data, const size_t length) {
+static int pakfire_key_verify_signature(pakfire_key* key,
+               const pakfire_key_signature* signature, const void* data, const size_t length) {
        EVP_MD_CTX* mdctx = NULL;
        int r;
 
@@ -1016,9 +1016,9 @@ ERROR:
        return r;
 }
 
-int pakfire_key_verify(struct pakfire_key* key, FILE* f,
+int pakfire_key_verify(pakfire_key* key, FILE* f,
                const void* data, const size_t length) {
-       struct pakfire_key_signature signature = { 0 };
+       pakfire_key_signature signature = { 0 };
        int r;
 
        // Read the signature
index c69ecaf8699a32072515a6f91795e4e1b6ff6b89..a5fc4e2f944e1366bec8d376b66e365014fa7852 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <time.h>
 
-struct pakfire_key;
+typedef struct pakfire_key pakfire_key;
 
 #include <pakfire/ctx.h>
 
@@ -39,28 +39,28 @@ typedef enum pakfire_key_export_mode {
 
 typedef unsigned char pakfire_key_id[8];
 
-struct pakfire_key* pakfire_key_ref(struct pakfire_key* key);
-struct pakfire_key* pakfire_key_unref(struct pakfire_key* key);
+pakfire_key* pakfire_key_ref(pakfire_key* key);
+pakfire_key* pakfire_key_unref(pakfire_key* key);
 
 // Access key properties
-pakfire_key_id* pakfire_key_get_id(struct pakfire_key* key);
-const char* pakfire_key_get_algo(struct pakfire_key* key);
-const char* pakfire_key_get_comment(struct pakfire_key* key);
+pakfire_key_id* pakfire_key_get_id(pakfire_key* key);
+const char* pakfire_key_get_algo(pakfire_key* key);
+const char* pakfire_key_get_comment(pakfire_key* key);
 
-int pakfire_key_generate(struct pakfire_key** key, pakfire_ctx* ctx,
+int pakfire_key_generate(pakfire_key** key, pakfire_ctx* ctx,
        const pakfire_key_algo_t algo, const char* comment);
-int pakfire_key_export(struct pakfire_key* key, FILE* f, const pakfire_key_export_mode_t mode);
-int pakfire_key_export_string(struct pakfire_key* self, char** buffer, size_t* length);
-int pakfire_key_import(struct pakfire_key** key, pakfire_ctx* ctx, FILE* f);
+int pakfire_key_export(pakfire_key* key, FILE* f, const pakfire_key_export_mode_t mode);
+int pakfire_key_export_string(pakfire_key* self, char** buffer, size_t* length);
+int pakfire_key_import(pakfire_key** key, pakfire_ctx* ctx, FILE* f);
 
 // Sign
-int pakfire_key_sign(struct pakfire_key* key, FILE* s, FILE* f, const char* comment);
-int pakfire_key_sign_string(struct pakfire_key* key,
+int pakfire_key_sign(pakfire_key* key, FILE* s, FILE* f, const char* comment);
+int pakfire_key_sign_string(pakfire_key* key,
        FILE* s, const void* data, const size_t length, const char* comment);
-int pakfire_key_verify(struct pakfire_key* key,
+int pakfire_key_verify(pakfire_key* key,
        FILE* f, const void* data, const size_t length);
 
-int pakfire_key_import_from_string(struct pakfire_key** key,
+int pakfire_key_import_from_string(pakfire_key** key,
        pakfire_ctx* ctx, const char* data, const size_t length);
 
 #endif /* PAKFIRE_KEY_H */
index e35f79c0a5326683e6da0c824e32997b97fcb651..5bc79440174bf50f23850f70a13244cd379a9baa 100644 (file)
@@ -104,7 +104,7 @@ struct pakfire_repo_appdata {
        time_t refresh;
 
        // Key
-       struct pakfire_key* key;
+       pakfire_key* key;
 
        // Mirrorlist
        struct pakfire_mirrorlist* mirrorlist;
@@ -131,7 +131,7 @@ struct pakfire_repo {
        Repo* repo;
        struct pakfire_repo_appdata* appdata;
 
-       struct pakfire_key* key;
+       pakfire_key* key;
 };
 
 static const char* pakfire_repo_get_expanded_baseurl(struct pakfire_repo* repo);
@@ -314,7 +314,7 @@ ERROR:
 }
 
 static int pakfire_repo_import_key(struct pakfire_repo* self, const char* data) {
-       struct pakfire_key* key = NULL;
+       pakfire_key* key = NULL;
        int r;
 
        // Free any formerly imported keys (this should not happen)
@@ -1711,7 +1711,7 @@ const char* pakfire_repo_get_path(struct pakfire_repo* repo) {
        return baseurl + strlen("file://");
 }
 
-struct pakfire_key* pakfire_repo_get_key(struct pakfire_repo* self) {
+pakfire_key* pakfire_repo_get_key(struct pakfire_repo* self) {
        if (self->appdata->key)
                return pakfire_key_ref(self->appdata->key);
 
@@ -1731,7 +1731,7 @@ int pakfire_repo_set_mirrorlist_url(struct pakfire_repo* repo, const char* url)
 
 int pakfire_repo_write_config(struct pakfire_repo* repo, FILE* f) {
        pakfire_config* config = NULL;
-       struct pakfire_key* key = NULL;
+       pakfire_key* key = NULL;
        char* section = NULL;
        char* buffer = NULL;
        char refresh[1024];
@@ -2462,7 +2462,7 @@ static int pakfire_repo_make_metadata(struct pakfire_repo* self, struct json_obj
        return 0;
 }
 
-int pakfire_repo_write_metadata(struct pakfire_repo* self, struct pakfire_key* key) {
+int pakfire_repo_write_metadata(struct pakfire_repo* self, pakfire_key* key) {
        struct json_object* repomd = NULL;
        char repomd_path[PATH_MAX];
        char sigpath[PATH_MAX];
@@ -2553,7 +2553,7 @@ ERROR:
 }
 
 int pakfire_repo_compose(struct pakfire* pakfire, const char* path,
-               struct pakfire_key* key, const char** files) {
+               pakfire_key* key, const char** files) {
        pakfire_archive* archive = NULL;
        struct pakfire_repo* repo = NULL;
        char realpath[PATH_MAX];
index 22d2426c4fc63a55ab5eb54fb9e0f7b3274ff52c..18a2d60c16627f9897190d1b3bf3c3326a9ea2e3 100644 (file)
@@ -64,7 +64,7 @@ void pakfire_repo_set_priority(struct pakfire_repo* repo, int priority);
 const char* pakfire_repo_get_baseurl(struct pakfire_repo* repo);
 int pakfire_repo_set_baseurl(struct pakfire_repo* repo, const char* baseurl);
 
-struct pakfire_key* pakfire_repo_get_key(struct pakfire_repo* repo);
+pakfire_key* pakfire_repo_get_key(struct pakfire_repo* repo);
 
 const char* pakfire_repo_get_mirrorlist_url(struct pakfire_repo* repo);
 int pakfire_repo_set_mirrorlist_url(struct pakfire_repo* repo, const char* url);
@@ -103,10 +103,10 @@ int pakfire_repo_refresh(struct pakfire_repo* repo, int force);
 
 // Compose
 
-int pakfire_repo_write_metadata(struct pakfire_repo* repo, struct pakfire_key* key);
+int pakfire_repo_write_metadata(struct pakfire_repo* repo, pakfire_key* key);
 
 int pakfire_repo_compose(struct pakfire* pakfire, const char* path,
-       struct pakfire_key* key, const char** files);
+       pakfire_key* key, const char** files);
 
 #define PAKFIRE_REPO_COMMANDLINE               "@commandline"
 #define PAKFIRE_REPO_DUMMY                             "@dummy"
index cb21e6c5d52068589dbdcffdaa996d63897a2e4e..17262e9647f2f70c884d76ac54ae59dd295b9293 100644 (file)
@@ -2082,7 +2082,7 @@ ERROR:
 }
 
 int pakfire_transaction_compose_repo(struct pakfire_transaction* transaction,
-               struct pakfire_key* key, const char* path) {
+               pakfire_key* key, const char* path) {
        pakfire_archive* archive = NULL;
        int r;
 
index faf6b3e6aed6529152d35390242872013f10ae14..bd5a21960c3f058f6afb05a35e1638b002b4e91b 100644 (file)
@@ -86,6 +86,6 @@ int pakfire_transaction_download(struct pakfire_transaction* transaction);
 Solver* pakfire_transaction_get_solver(struct pakfire_transaction* transaction);
 
 int pakfire_transaction_compose_repo(struct pakfire_transaction* transaction,
-       struct pakfire_key* key, const char* path);
+       pakfire_key* key, const char* path);
 
 #endif /* PAKFIRE_TRANSACTION_H */
index fe772c4a15638c67f743639c6d4a8bbe340ad2b0..08ab8f6a2d74fb4d266ded593c00048c831e61a1 100644 (file)
@@ -28,7 +28,7 @@
 #include "pakfire.h"
 #include "util.h"
 
-PyObject* new_key(PyTypeObject* type, struct pakfire_key* key) {
+PyObject* new_key(PyTypeObject* type, pakfire_key* key) {
        KeyObject* self = (KeyObject *)type->tp_alloc(type, 0);
        if (self) {
                self->key = pakfire_key_ref(key);
index fe637f3018ea01fb99f08b1d309ef7c076ea7b15..a75b6169ae3cb77ea445e408c25b11f81ae6c385 100644 (file)
 
 typedef struct {
        PyObject_HEAD
-       struct pakfire_key* key;
+       pakfire_key* key;
 } KeyObject;
 
 extern PyTypeObject KeyType;
 
-PyObject* new_key(PyTypeObject* type, struct pakfire_key* key);
+PyObject* new_key(PyTypeObject* type, pakfire_key* key);
 
 #endif /* PYTHON_PAKFIRE_KEY_H */
index 58cc029b38ba2d81f83d7333cbb58f04022a3524..ddd1352118fe17096434a101bdf43fbff8bb3f51 100644 (file)
@@ -173,7 +173,7 @@ static PyObject* Pakfire_get_repo(PakfireObject* self, PyObject* args) {
 */
 static PyObject* Pakfire_generate_key(PakfireObject* self, PyObject* args, PyObject* kwds) {
        const char* kwlist[] = { "algorithm", "comment", NULL };
-       struct pakfire_key* key = NULL;
+       pakfire_key* key = NULL;
        pakfire_key_algo_t algo = PAKFIRE_KEY_ALGO_NULL;
        const char* comment = NULL;
 
@@ -196,7 +196,7 @@ static PyObject* Pakfire_generate_key(PakfireObject* self, PyObject* args, PyObj
        XXX This could be moved out of here as this no longer depends on Pakfire
 */
 static PyObject* Pakfire_import_key(PakfireObject* self, PyObject* args) {
-       struct pakfire_key* key = NULL;
+       pakfire_key* key = NULL;
        PyObject* object = NULL;
        char* data = NULL;
        Py_ssize_t data_length = 0;
index 41904ddd50934d88934b553281f6832d49efdf42..f48257144505be1dd0740e4f1649a9ab39f7c540 100644 (file)
@@ -185,7 +185,7 @@ static int Repo_set_baseurl(RepoObject* self, PyObject* value) {
 }
 
 static PyObject* Repo_get_key(RepoObject* self) {
-       struct pakfire_key* key = pakfire_repo_get_key(self->repo);
+       pakfire_key* key = pakfire_repo_get_key(self->repo);
 
        if (key) {
                PyObject* ret = new_key(&KeyType, key);
index 5ca1cb62bc310725a135e58cbf3b805349b74737..88cac34cec6fb516961ad9e0b18db5b43d76b65d 100644 (file)
@@ -30,7 +30,7 @@ const char DATA[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 const size_t DATA_LENGTH = sizeof(DATA);
 
 static int test_generate(const struct test* t) {
-       struct pakfire_key* key = NULL;
+       pakfire_key* key = NULL;
        int r = EXIT_FAILURE;
 
        // Try to call pakfire_key_generate() with some invalid inputs
@@ -57,7 +57,7 @@ FAIL:
 }
 
 static int test_sign_and_verify(const struct test* t) {
-       struct pakfire_key* key = NULL;
+       pakfire_key* key = NULL;
        int r = EXIT_FAILURE;
        FILE* f = NULL;
 
@@ -96,7 +96,7 @@ FAIL:
 }
 
 static int test_import_public(const struct test* t) {
-       struct pakfire_key* key = NULL;
+       pakfire_key* key = NULL;
        FILE* f = NULL;
        int r = EXIT_FAILURE;
 
@@ -122,7 +122,7 @@ FAIL:
 }
 
 static int test_import_secret(const struct test* t) {
-       struct pakfire_key* key = NULL;
+       pakfire_key* key = NULL;
        FILE* f = NULL;
        int r = EXIT_FAILURE;