# ex:ts=8 sw=4:
-# $OpenBSD: Delete.pm,v 1.120 2013/09/24 21:00:57 espie Exp $
+# $OpenBSD: Delete.pm,v 1.121 2013/12/25 14:38:15 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
}
if ($plist->is_signed) {
if (!$state->{quick}) {
- require OpenBSD::x509;
- if (!OpenBSD::x509::check_signature($plist, $state)) {
+ if (!$plist->check_signature($state)) {
$state->fatal("package #1 was corrupted: signature check failed", $pkgname);
}
}
# ex:ts=8 sw=4:
-# $OpenBSD: PackingList.pm,v 1.121 2012/12/28 15:09:09 espie Exp $
+# $OpenBSD: PackingList.pm,v 1.122 2013/12/25 14:38:15 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
$self->tofile(OpenBSD::PackageInfo::installed_contents($self->pkgname));
}
+sub check_signature
+{
+ my ($plist, $state) = @_;
+ my $sig = $plist->get('digital-signature');
+ if ($sig->{key} eq 'x509') {
+ require OpenBSD::x509;
+ return OpenBSD::x509::check_signature($plist, $state);
+ } else {
+ $state->log("Error: unknown signature style $sig->{key}");
+ return 0;
+ }
+}
sub forget
{
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgAdd.pm,v 1.39 2013/12/25 14:20:48 espie Exp $
+# $OpenBSD: PkgAdd.pm,v 1.40 2013/12/25 14:38:15 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
$state->errsay("NOT CHECKING DIGITAL SIGNATURE FOR #1",
$plist->pkgname);
} else {
- require OpenBSD::x509;
-
- if (!OpenBSD::x509::check_signature($plist,
- $state)) {
+ if (!$plist->check_signature($state)) {
$state->fatal("#1 is corrupted",
- $set->print);
+ $plist->pkgname);
}
$state->{check_digest} = 1;
$state->{packages_with_sig}++;
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgCheck.pm,v 1.41 2013/09/11 15:36:18 espie Exp $
+# $OpenBSD: PkgCheck.pm,v 1.42 2013/12/25 14:38:15 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
my $plist = OpenBSD::PackingList->from_installation($name);
$state->log->set_context($name);
if ($plist->is_signed && !$state->defines('nosig')) {
- require OpenBSD::x509;
-
- if (!OpenBSD::x509::check_signature($plist, $state)) {
+ if (!$plist->check_signature($state)) {
$state->fatal("#1 is corrupted", $name);
}
}
# ex:ts=8 sw=4:
-# $OpenBSD: x509.pm,v 1.11 2010/12/24 09:04:14 espie Exp $
+# $OpenBSD: x509.pm,v 1.12 2013/12/25 14:38:15 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
{
my ($plist, $state) = @_;
my $sig = $plist->get('digital-signature');
- if ($sig->{key} ne 'x509') {
- $state->log("Error: unknown signature style");
- return 0;
- }
my ($fh, $fname) = mkstemp("/tmp/pkgcontent.XXXXXXXXX");
my ($fh2, $fname2) = mkstemp("/tmp/pkgsig.XXXXXXXXX");
$plist->write_no_sig($fh);