From: Jameson Rollins Date: Thu, 30 Dec 2010 17:35:08 +0000 (-0500) Subject: return pkcextractkey before processing key exponent/modulus if an error was encountered X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b1defd42b9fbd7552478cf30a1ea4e7dea477cf6;p=monkeysphere-validation-agent.git return pkcextractkey before processing key exponent/modulus if an error was encountered This should prevent some unnecessary processing on errors. --- 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; }