summaryrefslogtreecommitdiffstats
path: root/src/package.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-07-22 21:04:54 +0300
committerTimo Teras <timo.teras@iki.fi>2009-07-22 21:04:54 +0300
commit79f43861e60e83d916c8499f247523dd73586248 (patch)
treef59a7de1067b0132bb8b3dc78cc58985ccee9161 /src/package.c
parent718ef3079ea18fcb588264d26e3316628ad18ba0 (diff)
downloadapk-tools-79f43861e60e83d916c8499f247523dd73586248.tar.bz2
apk-tools-79f43861e60e83d916c8499f247523dd73586248.tar.xz
signing: verify and generate identity
fixes verification of non-repository packages while installing them. this is final thing needed for full signing support (fixes #46).
Diffstat (limited to 'src/package.c')
-rw-r--r--src/package.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/package.c b/src/package.c
index 0ef1d59..1c9ff3d 100644
--- a/src/package.c
+++ b/src/package.c
@@ -311,6 +311,7 @@ void apk_sign_ctx_init(struct apk_sign_ctx *ctx, int action,
ctx->data_started = 1;
break;
case APK_SIGN_GENERATE:
+ case APK_SIGN_VERIFY_AND_GENERATE:
default:
action = APK_SIGN_GENERATE;
ctx->md = EVP_sha1();
@@ -466,6 +467,7 @@ int apk_sign_ctx_mpart_cb(void *ctx, int part, apk_blob_t data)
switch (sctx->action) {
case APK_SIGN_VERIFY:
+ case APK_SIGN_VERIFY_AND_GENERATE:
if (sctx->signature.pkey == NULL) {
if (apk_flags & APK_ALLOW_UNTRUSTED)
break;
@@ -502,6 +504,10 @@ int apk_sign_ctx_mpart_cb(void *ctx, int part, apk_blob_t data)
return -ECANCELED;
break;
}
+ if (sctx->action == APK_SIGN_VERIFY_AND_GENERATE) {
+ sctx->identity.type = EVP_MD_CTX_size(&sctx->mdctx);
+ EVP_DigestFinal_ex(&sctx->mdctx, sctx->identity.data, NULL);
+ }
reset_digest:
EVP_DigestInit_ex(&sctx->mdctx, sctx->md, NULL);