X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fwgtpkg-digsig.c;h=098a240dc960195e083885bd00e9b7ee3d85bc48;hb=2a319cf90daa6e3b01e8139923f7073e1c9bcf28;hp=ed9d089323c7bbd9109f24dd2e5b439396841979;hpb=189415eece11c543e1ccb95dff32695ddc383565;p=src%2Fapp-framework-main.git diff --git a/src/wgtpkg-digsig.c b/src/wgtpkg-digsig.c index ed9d089..098a240 100644 --- a/src/wgtpkg-digsig.c +++ b/src/wgtpkg-digsig.c @@ -1,5 +1,5 @@ /* - Copyright 2015 IoT.bzh + Copyright (C) 2015-2019 IoT.bzh author: José Bollo @@ -336,18 +336,22 @@ int verify_digsig(struct filedesc *fdesc) } /* check all the signature files */ -int check_all_signatures() +int check_all_signatures(int allow_none) { int rc, irc; unsigned int i, n; struct filedesc *fdesc; n = signature_count(); + if (n == 0 && !allow_none) { + ERROR("no signature found"); + return -1; + } rc = 0; for (i = n ; i-- > 0 ; ) { fdesc = signature_of_index(i); irc = verify_digsig(fdesc); - if (!irc) + if (irc < 0) rc = irc; } @@ -357,11 +361,12 @@ int check_all_signatures() /* create a signature of 'index' (0 for author, other values for distributors) using the private 'key' (filename) and the certificates 'certs' (filenames) as trusted chain */ -int create_digsig(int index, const char *key, const char **certs) +int create_digsig(unsigned int index, const char *key, const char **certs) { struct filedesc *fdesc; xmlDocPtr doc; - int rc, len, fd; + int rc, fd; + long len; xmlSaveCtxtPtr ctx; rc = -1;