RSA_check_key() may return -1 if it fails
authorMartin Willi <martin@revosec.ch>
Tue, 9 Apr 2013 09:37:15 +0000 (11:37 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Wed, 10 Apr 2013 16:10:30 +0000 (18:10 +0200)
src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c

index fb86a6b..036f53d 100644 (file)
@@ -428,7 +428,7 @@ openssl_rsa_private_key_t *openssl_rsa_private_key_load(key_type_t type,
        if (blob.ptr)
        {
                this->rsa = d2i_RSAPrivateKey(NULL, (const u_char**)&blob.ptr, blob.len);
-               if (this->rsa && RSA_check_key(this->rsa))
+               if (this->rsa && RSA_check_key(this->rsa) == 1)
                {
                        return &this->public;
                }
@@ -450,7 +450,7 @@ openssl_rsa_private_key_t *openssl_rsa_private_key_load(key_type_t type,
                        this->rsa->dmq1 = BN_bin2bn((const u_char*)exp2.ptr, exp2.len, NULL);
                }
                this->rsa->iqmp = BN_bin2bn((const u_char*)coeff.ptr, coeff.len, NULL);
-               if (RSA_check_key(this->rsa))
+               if (RSA_check_key(this->rsa) == 1)
                {
                        return &this->public;
                }