From da8d83338b7daa2bbd2e940f94d6515d69568800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Fri, 9 Oct 2020 16:14:38 +0300 Subject: [PATCH] add missing apk_trust.h --- src/apk_trust.h | 42 ++++++++++++++++++++++++++++++++++++++++++ src/app_version.c | 4 ++-- 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 src/apk_trust.h diff --git a/src/apk_trust.h b/src/apk_trust.h new file mode 100644 index 0000000..89c5d7a --- /dev/null +++ b/src/apk_trust.h @@ -0,0 +1,42 @@ +/* apk_trust.h - Alpine Package Keeper (APK) + * + * Copyright (C) 2020 Timo Teräs + * All rights reserved. + * + * SPDX-License-Identifier: GPL-2.0-only + */ + +#ifndef APK_TRUST +#define APK_TRUST + +#include +#include "apk_blob.h" + +struct apk_pkey { + uint8_t id[16]; + EVP_PKEY *key; +}; + +int apk_pkey_init(struct apk_pkey *pkey, EVP_PKEY *key); +void apk_pkey_free(struct apk_pkey *pkey); +int apk_pkey_load(struct apk_pkey *pkey, int dirfd, const char *fn); + +struct apk_trust_key { + struct list_head key_node; + struct apk_pkey key; + char *filename; + +}; + +struct apk_trust { + EVP_MD_CTX *mdctx; + struct list_head trusted_key_list; + struct list_head private_key_list; + int allow_untrusted : 1; +}; + +int apk_trust_init(struct apk_trust *trust, int keysfd, struct apk_string_array *); +void apk_trust_free(struct apk_trust *trust); +struct apk_pkey *apk_trust_key_by_name(struct apk_trust *trust, const char *filename); + +#endif diff --git a/src/app_version.c b/src/app_version.c index 4dfbf35..a42ab63 100644 --- a/src/app_version.c +++ b/src/app_version.c @@ -86,7 +86,7 @@ static int option_parse_applet(void *ctx, struct apk_ctx *ac, int opt, const cha break; case OPT_VERSION_check: ictx->action = ver_validate; - ac->open_flags = 0; + ac->open_flags |= APK_OPENF_NO_STATE | APK_OPENF_NO_REPOS; break; case OPT_VERSION_indexes: ictx->action = ver_indexes; @@ -96,7 +96,7 @@ static int option_parse_applet(void *ctx, struct apk_ctx *ac, int opt, const cha break; case OPT_VERSION_test: ictx->action = ver_test; - ac->open_flags = 0; + ac->open_flags |= APK_OPENF_NO_STATE | APK_OPENF_NO_REPOS; break; default: return -ENOTSUP;