Lines Matching refs:rsa
272 return BN_num_bits(k->rsa->n); in sshkey_size()
462 RSA *rsa; in sshkey_new() local
472 k->rsa = NULL; in sshkey_new()
481 if ((rsa = RSA_new()) == NULL || in sshkey_new()
482 (rsa->n = BN_new()) == NULL || in sshkey_new()
483 (rsa->e = BN_new()) == NULL) { in sshkey_new()
484 if (rsa != NULL) in sshkey_new()
485 RSA_free(rsa); in sshkey_new()
489 k->rsa = rsa; in sshkey_new()
541 if (bn_maybe_alloc_failed(k->rsa->d) || in sshkey_add_private()
542 bn_maybe_alloc_failed(k->rsa->iqmp) || in sshkey_add_private()
543 bn_maybe_alloc_failed(k->rsa->q) || in sshkey_add_private()
544 bn_maybe_alloc_failed(k->rsa->p) || in sshkey_add_private()
545 bn_maybe_alloc_failed(k->rsa->dmq1) || in sshkey_add_private()
546 bn_maybe_alloc_failed(k->rsa->dmp1)) in sshkey_add_private()
596 if (k->rsa != NULL) in sshkey_free()
597 RSA_free(k->rsa); in sshkey_free()
598 k->rsa = NULL; in sshkey_free()
674 return a->rsa != NULL && b->rsa != NULL && in sshkey_equal_public()
675 BN_cmp(a->rsa->e, b->rsa->e) == 0 && in sshkey_equal_public()
676 BN_cmp(a->rsa->n, b->rsa->n) == 0; in sshkey_equal_public()
780 if (key->rsa == NULL) in to_blob_buf()
783 (ret = sshbuf_put_bignum2(b, key->rsa->e)) != 0 || in to_blob_buf()
784 (ret = sshbuf_put_bignum2(b, key->rsa->n)) != 0) in to_blob_buf()
891 int nlen = BN_num_bytes(k->rsa->n); in sshkey_fingerprint_raw()
892 int elen = BN_num_bytes(k->rsa->e); in sshkey_fingerprint_raw()
900 BN_bn2bin(k->rsa->n, blob); in sshkey_fingerprint_raw()
901 BN_bn2bin(k->rsa->e, blob + nlen); in sshkey_fingerprint_raw()
1254 if ((r = read_decimal_bignum(&ep, ret->rsa->e)) < 0) in sshkey_read()
1256 if ((r = read_decimal_bignum(&ep, ret->rsa->n)) < 0) in sshkey_read()
1260 if (BN_num_bits(ret->rsa->n) != (int)bits) in sshkey_read()
1334 if (ret->rsa != NULL) in sshkey_read()
1335 RSA_free(ret->rsa); in sshkey_read()
1336 ret->rsa = k->rsa; in sshkey_read()
1337 k->rsa = NULL; in sshkey_read()
1339 RSA_print_fp(stderr, ret->rsa, 8); in sshkey_read()
1422 if (key->rsa == NULL || key->rsa->e == NULL || in sshkey_format_rsa1()
1423 key->rsa->n == NULL) { in sshkey_format_rsa1()
1427 if ((dec_e = BN_bn2dec(key->rsa->e)) == NULL || in sshkey_format_rsa1()
1428 (dec_n = BN_bn2dec(key->rsa->n)) == NULL) { in sshkey_format_rsa1()
1433 if ((bits = BN_num_bits(key->rsa->n)) <= 0) { in sshkey_format_rsa1()
1685 ret = rsa_generate_private_key(bits, &k->rsa); in sshkey_generate()
1801 if ((BN_copy(n->rsa->n, k->rsa->n) == NULL) || in sshkey_from_private()
1802 (BN_copy(n->rsa->e, k->rsa->e) == NULL)) { in sshkey_from_private()
2001 if (sshbuf_get_bignum2(b, key->rsa->e) != 0 || in sshkey_from_blob_internal()
2002 sshbuf_get_bignum2(b, key->rsa->n) != 0) { in sshkey_from_blob_internal()
2007 RSA_print_fp(stderr, key->rsa, 8); in sshkey_from_blob_internal()
2256 pk->rsa = NULL; in sshkey_demote()
2268 if ((pk->rsa = RSA_new()) == NULL || in sshkey_demote()
2269 (pk->rsa->e = BN_dup(k->rsa->e)) == NULL || in sshkey_demote()
2270 (pk->rsa->n = BN_dup(k->rsa->n)) == NULL) { in sshkey_demote()
2425 if ((ret = sshbuf_put_bignum2(cert, k->rsa->e)) != 0 || in sshkey_certify()
2426 (ret = sshbuf_put_bignum2(cert, k->rsa->n)) != 0) in sshkey_certify()
2551 if ((r = sshbuf_put_bignum2(b, key->rsa->n)) != 0 || in sshkey_private_serialize()
2552 (r = sshbuf_put_bignum2(b, key->rsa->e)) != 0 || in sshkey_private_serialize()
2553 (r = sshbuf_put_bignum2(b, key->rsa->d)) != 0 || in sshkey_private_serialize()
2554 (r = sshbuf_put_bignum2(b, key->rsa->iqmp)) != 0 || in sshkey_private_serialize()
2555 (r = sshbuf_put_bignum2(b, key->rsa->p)) != 0 || in sshkey_private_serialize()
2556 (r = sshbuf_put_bignum2(b, key->rsa->q)) != 0) in sshkey_private_serialize()
2565 (r = sshbuf_put_bignum2(b, key->rsa->d)) != 0 || in sshkey_private_serialize()
2566 (r = sshbuf_put_bignum2(b, key->rsa->iqmp)) != 0 || in sshkey_private_serialize()
2567 (r = sshbuf_put_bignum2(b, key->rsa->p)) != 0 || in sshkey_private_serialize()
2568 (r = sshbuf_put_bignum2(b, key->rsa->q)) != 0) in sshkey_private_serialize()
2732 if ((r = sshbuf_get_bignum2(buf, k->rsa->n)) != 0 || in sshkey_private_deserialize()
2733 (r = sshbuf_get_bignum2(buf, k->rsa->e)) != 0 || in sshkey_private_deserialize()
2734 (r = sshbuf_get_bignum2(buf, k->rsa->d)) != 0 || in sshkey_private_deserialize()
2735 (r = sshbuf_get_bignum2(buf, k->rsa->iqmp)) != 0 || in sshkey_private_deserialize()
2736 (r = sshbuf_get_bignum2(buf, k->rsa->p)) != 0 || in sshkey_private_deserialize()
2737 (r = sshbuf_get_bignum2(buf, k->rsa->q)) != 0 || in sshkey_private_deserialize()
2738 (r = rsa_generate_additional_parameters(k->rsa)) != 0) in sshkey_private_deserialize()
2744 (r = sshbuf_get_bignum2(buf, k->rsa->d) != 0) || in sshkey_private_deserialize()
2745 (r = sshbuf_get_bignum2(buf, k->rsa->iqmp) != 0) || in sshkey_private_deserialize()
2746 (r = sshbuf_get_bignum2(buf, k->rsa->p) != 0) || in sshkey_private_deserialize()
2747 (r = sshbuf_get_bignum2(buf, k->rsa->q) != 0) || in sshkey_private_deserialize()
2748 (r = rsa_generate_additional_parameters(k->rsa)) != 0) in sshkey_private_deserialize()
2792 if (RSA_blinding_on(k->rsa, NULL) != 1) { in sshkey_private_deserialize()
3405 if ((r = sshbuf_put_bignum1(buffer, key->rsa->d)) != 0 || in sshkey_private_rsa1_to_blob()
3406 (r = sshbuf_put_bignum1(buffer, key->rsa->iqmp)) != 0 || in sshkey_private_rsa1_to_blob()
3407 (r = sshbuf_put_bignum1(buffer, key->rsa->q)) != 0 || in sshkey_private_rsa1_to_blob()
3408 (r = sshbuf_put_bignum1(buffer, key->rsa->p)) != 0) in sshkey_private_rsa1_to_blob()
3433 if ((r = sshbuf_put_u32(encrypted, BN_num_bits(key->rsa->n))) != 0 || in sshkey_private_rsa1_to_blob()
3434 (r = sshbuf_put_bignum1(encrypted, key->rsa->n) != 0) || in sshkey_private_rsa1_to_blob()
3435 (r = sshbuf_put_bignum1(encrypted, key->rsa->e) != 0) || in sshkey_private_rsa1_to_blob()
3500 success = PEM_write_bio_RSAPrivateKey(bio, key->rsa, in sshkey_private_pem_to_blob()
3596 (r = sshbuf_get_bignum1(copy, pub->rsa->n)) != 0 || in sshkey_parse_public_rsa1_fileblob()
3597 (r = sshbuf_get_bignum1(copy, pub->rsa->e)) != 0) in sshkey_parse_public_rsa1_fileblob()
3669 (r = sshbuf_get_bignum1(copy, prv->rsa->n)) != 0 || in sshkey_parse_private_rsa1()
3670 (r = sshbuf_get_bignum1(copy, prv->rsa->e)) != 0 || in sshkey_parse_private_rsa1()
3705 if ((r = sshbuf_get_bignum1(decrypted, prv->rsa->d)) != 0 || in sshkey_parse_private_rsa1()
3706 (r = sshbuf_get_bignum1(decrypted, prv->rsa->iqmp)) != 0 || in sshkey_parse_private_rsa1()
3707 (r = sshbuf_get_bignum1(decrypted, prv->rsa->q)) != 0 || in sshkey_parse_private_rsa1()
3708 (r = sshbuf_get_bignum1(decrypted, prv->rsa->p)) != 0) in sshkey_parse_private_rsa1()
3712 if ((r = rsa_generate_additional_parameters(prv->rsa)) != 0) in sshkey_parse_private_rsa1()
3716 if (RSA_blinding_on(prv->rsa, NULL) != 1) { in sshkey_parse_private_rsa1()
3772 prv->rsa = EVP_PKEY_get1_RSA(pk); in sshkey_parse_private_pem_fileblob()
3775 RSA_print_fp(stderr, prv->rsa, 8); in sshkey_parse_private_pem_fileblob()
3777 if (RSA_blinding_on(prv->rsa, NULL) != 1) { in sshkey_parse_private_pem_fileblob()