• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/ap/gpl/openssl/crypto/rsa/

Lines Matching refs:rsa

1 /* crypto/rsa/rsa_gen.c */
63 #include <openssl/rsa.h>
70 RSA *rsa=NULL;
88 rsa=RSA_new();
89 if (rsa == NULL) goto err;
92 rsa->e=BN_new();
93 if (rsa->e == NULL) goto err;
101 BN_set_bit(rsa->e,i);
104 if (!BN_set_word(rsa->e,e_value)) goto err;
110 rsa->p=BN_generate_prime(NULL,bitsp,0,NULL,NULL,callback,cb_arg);
111 if (rsa->p == NULL) goto err;
112 if (!BN_sub(r2,rsa->p,BN_value_one())) goto err;
113 if (!BN_gcd(r1,r2,rsa->e,ctx)) goto err;
116 BN_free(rsa->p);
121 rsa->q=BN_generate_prime(NULL,bitsq,0,NULL,NULL,callback,cb_arg);
122 if (rsa->q == NULL) goto err;
123 if (!BN_sub(r2,rsa->q,BN_value_one())) goto err;
124 if (!BN_gcd(r1,r2,rsa->e,ctx)) goto err;
125 if (BN_is_one(r1) && (BN_cmp(rsa->p,rsa->q) != 0))
128 BN_free(rsa->q);
131 if (BN_cmp(rsa->p,rsa->q) < 0)
133 tmp=rsa->p;
134 rsa->p=rsa->q;
135 rsa->q=tmp;
139 rsa->n=BN_new();
140 if (rsa->n == NULL) goto err;
141 if (!BN_mul(rsa->n,rsa->p,rsa->q,ctx)) goto err;
144 if (!BN_sub(r1,rsa->p,BN_value_one())) goto err; /* p-1 */
145 if (!BN_sub(r2,rsa->q,BN_value_one())) goto err; /* q-1 */
151 if (!BN_gcd(r3,r0,rsa->e,ctx)) goto err;
156 if (!BN_add_word(rsa->e,2L)) goto err;
163 rsa->d=BN_mod_inverse(NULL,rsa->e,r0,ctx2); /* d */
164 if (rsa->d == NULL) goto err;
167 rsa->dmp1=BN_new();
168 if (rsa->dmp1 == NULL) goto err;
169 if (!BN_mod(rsa->dmp1,rsa->d,r1,ctx)) goto err;
172 rsa->dmq1=BN_new();
173 if (rsa->dmq1 == NULL) goto err;
174 if (!BN_mod(rsa->dmq1,rsa->d,r2,ctx)) goto err;
177 rsa->iqmp=BN_mod_inverse(NULL,rsa->q,rsa->p,ctx2);
178 if (rsa->iqmp == NULL) goto err;
193 if (rsa != NULL) RSA_free(rsa);
197 return(rsa);