In RSA, DSA, DH, and RAND - if the "***_new()" function fails because the
[oweals/openssl.git] / crypto / rsa / rsa_lib.c
index d09dbd4a33c921be3441847be70e85bdc57c468e..3a4760c8d4e31ae4a54d441e8f246d3552184ba2 100644 (file)
@@ -166,6 +166,7 @@ RSA *RSA_new_method(ENGINE *engine)
                {
                if((ret->engine=ENGINE_get_default_RSA()) == NULL)
                        {
+                       RSAerr(RSA_F_RSA_NEW_METHOD,ERR_LIB_ENGINE);
                        OPENSSL_free(ret);
                        return NULL;
                        }
@@ -325,7 +326,7 @@ int RSA_blinding_on(RSA *rsa, BN_CTX *p_ctx)
 
        BN_CTX_start(ctx);
        A = BN_CTX_get(ctx);
-       if (!BN_rand(A,BN_num_bits(rsa->n)-1,1,0)) goto err;
+       if (!BN_rand_range(A,rsa->n)) goto err;
        if ((Ai=BN_mod_inverse(NULL,A,rsa->n,ctx)) == NULL) goto err;
 
        if (!ENGINE_get_RSA(rsa->engine)->bn_mod_exp(A,A,