From b1defd42b9fbd7552478cf30a1ea4e7dea477cf6 Mon Sep 17 00:00:00 2001 From: Jameson Rollins Date: Thu, 30 Dec 2010 12:35:08 -0500 Subject: [PATCH] return pkcextractkey before processing key exponent/modulus if an error was encountered This should prevent some unnecessary processing on errors. --- Crypt/Monkeysphere/MSVA.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Crypt/Monkeysphere/MSVA.pm b/Crypt/Monkeysphere/MSVA.pm index 38162e0..c9a4cd6 100755 --- a/Crypt/Monkeysphere/MSVA.pm +++ b/Crypt/Monkeysphere/MSVA.pm @@ -493,6 +493,10 @@ $key->{error} = sprintf("Don't know this public key carrier type: %s", $data->{pkc}->{type}); } + if (exists $key->{error}) { + return $key; + } + # make sure that the returned integers are Math::BigInts: $key->{exponent} = Math::BigInt::->new($key->{exponent}) unless (ref($key->{exponent})); $key->{modulus} = Math::BigInt::->new($key->{modulus}) unless (ref($key->{modulus})); @@ -504,6 +508,7 @@ if ($key->{modulus}->copy()->blog(2) < 1000) { $key->{error} = sprintf('Public key size is less than 1000 bits (was: %d bits)', $key->{modulus}->copy()->blog(2)); } + return $key; } -- 2.26.2