Lines Matching refs:rsa

187             if (rsa_make_key((int)dwKeyLen, 65537, &pKeyContext->rsa) != CRYPT_OK) {  in new_key_impl()
203 rsa_free(&pKeyContext->rsa); in free_key_impl()
273 pDestKeyContext->rsa.type = pSrcKeyContext->rsa.type; in duplicate_key_impl()
274 mp_init_copy(&pDestKeyContext->rsa.e, &pSrcKeyContext->rsa.e); in duplicate_key_impl()
275 mp_init_copy(&pDestKeyContext->rsa.d, &pSrcKeyContext->rsa.d); in duplicate_key_impl()
276 mp_init_copy(&pDestKeyContext->rsa.N, &pSrcKeyContext->rsa.N); in duplicate_key_impl()
277 mp_init_copy(&pDestKeyContext->rsa.p, &pSrcKeyContext->rsa.p); in duplicate_key_impl()
278 mp_init_copy(&pDestKeyContext->rsa.q, &pSrcKeyContext->rsa.q); in duplicate_key_impl()
279 mp_init_copy(&pDestKeyContext->rsa.qP, &pSrcKeyContext->rsa.qP); in duplicate_key_impl()
280 mp_init_copy(&pDestKeyContext->rsa.dP, &pSrcKeyContext->rsa.dP); in duplicate_key_impl()
281 mp_init_copy(&pDestKeyContext->rsa.dQ, &pSrcKeyContext->rsa.dQ); in duplicate_key_impl()
349 outlen = inlen = (mp_count_bits(&pKeyContext->rsa.N)+7)/8; in encrypt_block_impl()
351 … if (rsa_exptmod(in, inlen, out, &outlen, dwKeySpec, &pKeyContext->rsa) != CRYPT_OK) { in encrypt_block_impl()
364 … if (rsa_exptmod(in_reversed, inlen, out, &outlen, dwKeySpec, &pKeyContext->rsa) != CRYPT_OK) { in encrypt_block_impl()
403 mp_to_unsigned_bin(&pKeyContext->rsa.N, pbDest); in export_public_key_impl()
404 reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.N)); in export_public_key_impl()
405 if (mp_unsigned_bin_size(&pKeyContext->rsa.N) < dwKeyLen) in export_public_key_impl()
406 memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.N), 0, in export_public_key_impl()
407 dwKeyLen - mp_unsigned_bin_size(&pKeyContext->rsa.N)); in export_public_key_impl()
408 *pdwPubExp = (DWORD)mp_get_int(&pKeyContext->rsa.e); in export_public_key_impl()
417 if (mp_init_multi(&pKeyContext->rsa.e, &pKeyContext->rsa.d, &pKeyContext->rsa.N, in import_public_key_impl()
418 &pKeyContext->rsa.dQ,&pKeyContext->rsa.dP,&pKeyContext->rsa.qP, in import_public_key_impl()
419 &pKeyContext->rsa.p, &pKeyContext->rsa.q, NULL) != MP_OKAY) in import_public_key_impl()
429 pKeyContext->rsa.type = PK_PUBLIC; in import_public_key_impl()
431 mp_read_unsigned_bin(&pKeyContext->rsa.N, pbTemp, dwKeyLen); in import_public_key_impl()
433 mp_set_int(&pKeyContext->rsa.e, dwPubExp); in import_public_key_impl()
441 mp_to_unsigned_bin(&pKeyContext->rsa.N, pbDest); in export_private_key_impl()
442 reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.N)); in export_private_key_impl()
443 if (mp_unsigned_bin_size(&pKeyContext->rsa.N) < dwKeyLen) in export_private_key_impl()
444 memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.N), 0, in export_private_key_impl()
445 dwKeyLen - mp_unsigned_bin_size(&pKeyContext->rsa.N)); in export_private_key_impl()
447 mp_to_unsigned_bin(&pKeyContext->rsa.p, pbDest); in export_private_key_impl()
448 reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.p)); in export_private_key_impl()
449 if (mp_unsigned_bin_size(&pKeyContext->rsa.p) < (dwKeyLen+1)>>1) in export_private_key_impl()
450 memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.p), 0, in export_private_key_impl()
451 ((dwKeyLen+1)>>1) - mp_unsigned_bin_size(&pKeyContext->rsa.p)); in export_private_key_impl()
453 mp_to_unsigned_bin(&pKeyContext->rsa.q, pbDest); in export_private_key_impl()
454 reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.q)); in export_private_key_impl()
455 if (mp_unsigned_bin_size(&pKeyContext->rsa.q) < (dwKeyLen+1)>>1) in export_private_key_impl()
456 memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.q), 0, in export_private_key_impl()
457 ((dwKeyLen+1)>>1) - mp_unsigned_bin_size(&pKeyContext->rsa.q)); in export_private_key_impl()
459 mp_to_unsigned_bin(&pKeyContext->rsa.dP, pbDest); in export_private_key_impl()
460 reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.dP)); in export_private_key_impl()
461 if (mp_unsigned_bin_size(&pKeyContext->rsa.dP) < (dwKeyLen+1)>>1) in export_private_key_impl()
462 memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.dP), 0, in export_private_key_impl()
463 ((dwKeyLen+1)>>1) - mp_unsigned_bin_size(&pKeyContext->rsa.dP)); in export_private_key_impl()
465 mp_to_unsigned_bin(&pKeyContext->rsa.dQ, pbDest); in export_private_key_impl()
466 reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.dQ)); in export_private_key_impl()
467 if (mp_unsigned_bin_size(&pKeyContext->rsa.dQ) < (dwKeyLen+1)>>1) in export_private_key_impl()
468 memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.dQ), 0, in export_private_key_impl()
469 ((dwKeyLen+1)>>1) - mp_unsigned_bin_size(&pKeyContext->rsa.dQ)); in export_private_key_impl()
471 mp_to_unsigned_bin(&pKeyContext->rsa.qP, pbDest); in export_private_key_impl()
472 reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.qP)); in export_private_key_impl()
473 if (mp_unsigned_bin_size(&pKeyContext->rsa.qP) < (dwKeyLen+1)>>1) in export_private_key_impl()
474 memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.qP), 0, in export_private_key_impl()
475 ((dwKeyLen+1)>>1) - mp_unsigned_bin_size(&pKeyContext->rsa.qP)); in export_private_key_impl()
477 mp_to_unsigned_bin(&pKeyContext->rsa.d, pbDest); in export_private_key_impl()
478 reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.d)); in export_private_key_impl()
479 if (mp_unsigned_bin_size(&pKeyContext->rsa.d) < dwKeyLen) in export_private_key_impl()
480 memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.d), 0, in export_private_key_impl()
481 dwKeyLen - mp_unsigned_bin_size(&pKeyContext->rsa.d)); in export_private_key_impl()
482 *pdwPubExp = (DWORD)mp_get_int(&pKeyContext->rsa.e); in export_private_key_impl()
492 if (mp_init_multi(&pKeyContext->rsa.e, &pKeyContext->rsa.d, &pKeyContext->rsa.N, in import_private_key_impl()
493 &pKeyContext->rsa.dQ,&pKeyContext->rsa.dP,&pKeyContext->rsa.qP, in import_private_key_impl()
494 &pKeyContext->rsa.p, &pKeyContext->rsa.q, NULL) != MP_OKAY) in import_private_key_impl()
505 pKeyContext->rsa.type = PK_PRIVATE; in import_private_key_impl()
507 mp_read_unsigned_bin(&pKeyContext->rsa.N, pbBigNum, dwKeyLen); in import_private_key_impl()
510 mp_read_unsigned_bin(&pKeyContext->rsa.p, pbBigNum, (dwKeyLen+1)>>1); in import_private_key_impl()
513 mp_read_unsigned_bin(&pKeyContext->rsa.q, pbBigNum, (dwKeyLen+1)>>1); in import_private_key_impl()
516 mp_read_unsigned_bin(&pKeyContext->rsa.dP, pbBigNum, (dwKeyLen+1)>>1); in import_private_key_impl()
519 mp_read_unsigned_bin(&pKeyContext->rsa.dQ, pbBigNum, (dwKeyLen+1)>>1); in import_private_key_impl()
522 mp_read_unsigned_bin(&pKeyContext->rsa.qP, pbBigNum, (dwKeyLen+1)>>1); in import_private_key_impl()
529 mp_read_unsigned_bin(&pKeyContext->rsa.d, pbBigNum, dwKeyLen); in import_private_key_impl()
530 mp_set_int(&pKeyContext->rsa.e, dwPubExp); in import_private_key_impl()