return pkcextractkey before processing key exponent/modulus if an error was encountered
authorJameson Rollins <jrollins@finestructure.net>
Thu, 30 Dec 2010 17:35:08 +0000 (12:35 -0500)
committerJameson Rollins <jrollins@finestructure.net>
Thu, 30 Dec 2010 17:41:57 +0000 (12:41 -0500)
This should prevent some unnecessary processing on errors.

Crypt/Monkeysphere/MSVA.pm

index 38162e0832afaae8bf972cec2c9b3ae2572731bd..c9a4cd66171cca83f962159393bfc41c7a226072 100755 (executable)
       $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}));
     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;
   }