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

Lines Matching refs:to

1 /* Demo of how to construct your own engine and using it.  The basis of this
32 * Functions to handle the engine
52 unsigned char *to, RSA *rsa, int padding);
54 unsigned char *to, RSA *rsa, int padding);
56 unsigned char *to, RSA *rsa, int padding);
58 unsigned char *to, RSA *rsa, int padding);
215 * Functions to handle the engine
274 /* Initiator which is only present to make sure this engine looks available */
280 /* Finisher which is only present to make sure this engine looks available */
310 /* unsigned char *to: [max] */
311 static int RSAref_bn2bin(BIGNUM *from, unsigned char *to, int max)
322 memset(to,0,(unsigned int)max);
323 if (!BN_bn2bin(from,&(to[max-i])))
330 static BIGNUM *RSAref_bin2bn(unsigned char *from, BIGNUM *to, int max)
338 ret=BN_bin2bn(&(from[i]),max-i,to);
342 static int RSAref_Public_ref2eay(RSArefPublicKey *from, RSA *to)
344 to->n=RSAref_bin2bn(from->m,NULL,RSAref_MAX_LEN);
345 to->e=RSAref_bin2bn(from->e,NULL,RSAref_MAX_LEN);
346 if ((to->n == NULL) || (to->e == NULL)) return(0);
351 static int RSAref_Public_eay2ref(RSA *from, R_RSA_PUBLIC_KEY *to)
353 to->bits=BN_num_bits(from->n);
354 if (!RSAref_bn2bin(from->n,to->modulus,MAX_RSA_MODULUS_LEN)) return(0);
355 if (!RSAref_bn2bin(from->e,to->exponent,MAX_RSA_MODULUS_LEN)) return(0);
360 static int RSAref_Private_ref2eay(RSArefPrivateKey *from, RSA *to)
362 if ((to->n=RSAref_bin2bn(from->m,NULL,RSAref_MAX_LEN)) == NULL)
364 if ((to->e=RSAref_bin2bn(from->e,NULL,RSAref_MAX_LEN)) == NULL)
366 if ((to->d=RSAref_bin2bn(from->d,NULL,RSAref_MAX_LEN)) == NULL)
368 if ((to->p=RSAref_bin2bn(from->prime[0],NULL,RSAref_MAX_PLEN)) == NULL)
370 if ((to->q=RSAref_bin2bn(from->prime[1],NULL,RSAref_MAX_PLEN)) == NULL)
372 if ((to->dmp1=RSAref_bin2bn(from->pexp[0],NULL,RSAref_MAX_PLEN))
375 if ((to->dmq1=RSAref_bin2bn(from->pexp[1],NULL,RSAref_MAX_PLEN))
378 if ((to->iqmp=RSAref_bin2bn(from->coef,NULL,RSAref_MAX_PLEN)) == NULL)
384 static int RSAref_Private_eay2ref(RSA *from, R_RSA_PRIVATE_KEY *to)
386 to->bits=BN_num_bits(from->n);
387 if (!RSAref_bn2bin(from->n,to->modulus,MAX_RSA_MODULUS_LEN)) return(0);
388 if (!RSAref_bn2bin(from->e,to->publicExponent,MAX_RSA_MODULUS_LEN)) return(0);
389 if (!RSAref_bn2bin(from->d,to->exponent,MAX_RSA_MODULUS_LEN)) return(0);
390 if (!RSAref_bn2bin(from->p,to->prime[0],MAX_RSA_PRIME_LEN)) return(0);
391 if (!RSAref_bn2bin(from->q,to->prime[1],MAX_RSA_PRIME_LEN)) return(0);
392 if (!RSAref_bn2bin(from->dmp1,to->primeExponent[0],MAX_RSA_PRIME_LEN)) return(0);
393 if (!RSAref_bn2bin(from->dmq1,to->primeExponent[1],MAX_RSA_PRIME_LEN)) return(0);
394 if (!RSAref_bn2bin(from->iqmp,to->coefficient,MAX_RSA_PRIME_LEN)) return(0);
398 static int rsaref_private_decrypt(int len, const unsigned char *from, unsigned char *to,
406 if ((i=RSAPrivateDecrypt(to,(unsigned int *)&outlen,(unsigned char *)from,len,&RSAkey)) != 0)
416 static int rsaref_private_encrypt(int len, const unsigned char *from, unsigned char *to,
429 if ((i=RSAPrivateEncrypt(to,(unsigned int *)&outlen,(unsigned char *)from,len,&RSAkey)) != 0)
439 static int rsaref_public_decrypt(int len, const unsigned char *from, unsigned char *to,
447 if ((i=RSAPublicDecrypt(to,(unsigned int *)&outlen,(unsigned char *)from,len,&RSAkey)) != 0)
457 static int rsaref_public_encrypt(int len, const unsigned char *from, unsigned char *to,
484 if ((i=RSAPublicEncrypt(to,(unsigned int *)&outlen,(unsigned char *)from,len,&RSAkey,&rnd)) != 0)