Use BN_rand_range().
[openssl.git] / crypto / rsa / rsa_lib.c
index d09dbd4a33c921be3441847be70e85bdc57c468e..d3a602f0a5be91bb9944b03c03e6b77760850f9d 100644 (file)
@@ -325,7 +325,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,