summaryrefslogtreecommitdiffstats
path: root/src/package.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-08-13 14:33:43 +0300
committerTimo Teras <timo.teras@iki.fi>2009-08-13 14:33:43 +0300
commit6b94ed8a7ac353298c4bb7ab1f247b1b1584784e (patch)
tree04950f4b127c65dfac2cf9363cabba442246d9e2 /src/package.c
parent279513bfbe8f0f37c6fb7f38dc331f0290b19b2f (diff)
downloadapk-tools-6b94ed8a7ac353298c4bb7ab1f247b1b1584784e.tar.bz2
apk-tools-6b94ed8a7ac353298c4bb7ab1f247b1b1584784e.tar.xz
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.
Diffstat (limited to 'src/package.c')
-rw-r--r--src/package.c16
1 files changed, 8 insertions, 8 deletions
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;