-int RSA_size(r)
-RSA *r;
- {
- return(BN_num_bytes(r->n));
- }
-
-int RSA_public_encrypt(flen, from, to, rsa, padding)
-int flen;
-unsigned char *from;
-unsigned char *to;
-RSA *rsa;
-int padding;
- {
- return(rsa->meth->rsa_pub_enc(flen, from, to, rsa, padding));
- }
-
-int RSA_private_encrypt(flen, from, to, rsa, padding)
-int flen;
-unsigned char *from;
-unsigned char *to;
-RSA *rsa;
-int padding;
- {
- return(rsa->meth->rsa_priv_enc(flen, from, to, rsa, padding));
- }
-
-int RSA_private_decrypt(flen, from, to, rsa, padding)
-int flen;
-unsigned char *from;
-unsigned char *to;
-RSA *rsa;
-int padding;
- {
- return(rsa->meth->rsa_priv_dec(flen, from, to, rsa, padding));
- }
-
-int RSA_public_decrypt(flen, from, to, rsa, padding)
-int flen;
-unsigned char *from;
-unsigned char *to;
-RSA *rsa;
-int padding;
- {
- return(rsa->meth->rsa_pub_dec(flen, from, to, rsa, padding));
- }
-
-int RSA_flags(r)
-RSA *r;
- {
- return((r == NULL)?0:r->meth->flags);
- }
-
-void RSA_blinding_off(rsa)
-RSA *rsa;
- {
- if (rsa->blinding != NULL)
- {
- BN_BLINDING_free(rsa->blinding);
- rsa->blinding=NULL;
- }
- rsa->flags&= ~RSA_FLAG_BLINDING;
- }
-
-int RSA_blinding_on(rsa,p_ctx)
-RSA *rsa;
-BN_CTX *p_ctx;
- {
- BIGNUM *A,*Ai;
- BN_CTX *ctx;
- int ret=0;
-
- if (p_ctx == NULL)
- {
- if ((ctx=BN_CTX_new()) == NULL) goto err;
- }
- else
- ctx=p_ctx;
-
- if (rsa->blinding != NULL)
- BN_BLINDING_free(rsa->blinding);
-
- A= &(ctx->bn[0]);
- ctx->tos++;
- if (!BN_rand(A,BN_num_bits(rsa->n)-1,1,0)) goto err;
- if ((Ai=BN_mod_inverse(NULL,A,rsa->n,ctx)) == NULL) goto err;
-
- if (!rsa->meth->bn_mod_exp(A,A,rsa->e,rsa->n,ctx,
- (char *)rsa->method_mod_n)) goto err;
- rsa->blinding=BN_BLINDING_new(A,Ai,rsa->n);
- ctx->tos--;
- rsa->flags|=RSA_FLAG_BLINDING;
- BN_free(Ai);
- ret=1;
-err:
- if (ctx != p_ctx) BN_CTX_free(ctx);
- return(ret);
- }
-
-int RSA_memory_lock(r)
-RSA *r;