From b56eddde1a625feff02ebfb92dff88c96f11d376 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Wed, 27 Sep 2017 01:59:22 +0200 Subject: Dpkg::Control::HashCore: Expect stanza delimiters more often than Armor Headers Usually we will just have Armor Headers at the beginning and end of the data, so it's more common to find stanza delimiter lines. Optimize for that. --- scripts/Dpkg/Control/HashCore.pm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'scripts/Dpkg/Control') diff --git a/scripts/Dpkg/Control/HashCore.pm b/scripts/Dpkg/Control/HashCore.pm index 91b279d43..a3ea4bc96 100644 --- a/scripts/Dpkg/Control/HashCore.pm +++ b/scripts/Dpkg/Control/HashCore.pm @@ -227,16 +227,6 @@ sub parse { $line = substr $line, 1; } $self->{$cf} .= "\n$line"; - } elsif (m/^-----BEGIN PGP SIGNED MESSAGE-----[\r\t ]*$/) { - $expect_pgp_sig = 1; - if ($$self->{allow_pgp} and not $parabody) { - # Skip OpenPGP headers - while (<$fh>) { - last if m/^\s*$/; - } - } else { - $self->parse_error($desc, g_('OpenPGP signature not allowed here')); - } } elsif (m/^\s*$/ || ($expect_pgp_sig && m/^-----BEGIN PGP SIGNATURE-----[\r\t ]*$/)) { if ($expect_pgp_sig) { @@ -264,6 +254,16 @@ sub parse { $$self->{is_pgp_signed} = 1; } last; # Finished parsing one block + } elsif (m/^-----BEGIN PGP SIGNED MESSAGE-----[\r\t ]*$/) { + $expect_pgp_sig = 1; + if ($$self->{allow_pgp} and not $parabody) { + # Skip OpenPGP headers + while (<$fh>) { + last if m/^\s*$/; + } + } else { + $self->parse_error($desc, g_('OpenPGP signature not allowed here')); + } } else { $self->parse_error($desc, g_('line with unknown format (not field-colon-value)')); -- cgit v1.2.3