From 6b94ed8a7ac353298c4bb7ab1f247b1b1584784e Mon Sep 17 00:00:00 2001 From: Timo Teras Date: Thu, 13 Aug 2009 14:33:43 +0300 Subject: fix: parse pkgfile properly (fixes #132) accept also pkgfile in addition to pkgname. make also the signature verification stuff work properly again with non-repository files. --- src/package.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/package.c') diff --git a/src/package.c b/src/package.c index 4445aa6..9e74854 100644 --- a/src/package.c +++ b/src/package.c @@ -352,11 +352,6 @@ void apk_sign_ctx_init(struct apk_sign_ctx *ctx, int action, ctx->keys_fd = keys_fd; ctx->action = action; switch (action) { - case APK_SIGN_NONE: - ctx->md = EVP_md_null(); - ctx->control_started = 1; - ctx->data_started = 1; - break; case APK_SIGN_VERIFY: ctx->md = EVP_md_null(); break; @@ -377,10 +372,14 @@ void apk_sign_ctx_init(struct apk_sign_ctx *ctx, int action, break; case APK_SIGN_GENERATE: case APK_SIGN_VERIFY_AND_GENERATE: - default: - action = APK_SIGN_GENERATE; ctx->md = EVP_sha1(); break; + default: + action = APK_SIGN_NONE; + ctx->md = EVP_md_null(); + ctx->control_started = 1; + ctx->data_started = 1; + break; } EVP_MD_CTX_init(&ctx->mdctx); EVP_DigestInit_ex(&ctx->mdctx, ctx->md, NULL); @@ -421,7 +420,8 @@ int apk_sign_ctx_process_file(struct apk_sign_ctx *ctx, ctx->num_signatures++; /* Found already a trusted key */ - if (ctx->action != APK_SIGN_VERIFY || + if ((ctx->action != APK_SIGN_VERIFY && + ctx->action != APK_SIGN_VERIFY_AND_GENERATE) || ctx->signature.pkey != NULL) return 0; -- cgit v1.2.3