Lines Matching refs:rsa_ctx
47 RSA_CTX *rsa_ctx; in RSA_priv_key_new() local
50 rsa_ctx = *ctx; in RSA_priv_key_new()
51 bi_ctx = rsa_ctx->bi_ctx; in RSA_priv_key_new()
52 rsa_ctx->d = bi_import(bi_ctx, priv_exp, priv_len); in RSA_priv_key_new()
53 bi_permanent(rsa_ctx->d); in RSA_priv_key_new()
56 rsa_ctx->p = bi_import(bi_ctx, p, p_len); in RSA_priv_key_new()
57 rsa_ctx->q = bi_import(bi_ctx, q, q_len); in RSA_priv_key_new()
58 rsa_ctx->dP = bi_import(bi_ctx, dP, dP_len); in RSA_priv_key_new()
59 rsa_ctx->dQ = bi_import(bi_ctx, dQ, dQ_len); in RSA_priv_key_new()
60 rsa_ctx->qInv = bi_import(bi_ctx, qInv, qInv_len); in RSA_priv_key_new()
61 bi_permanent(rsa_ctx->dP); in RSA_priv_key_new()
62 bi_permanent(rsa_ctx->dQ); in RSA_priv_key_new()
63 bi_permanent(rsa_ctx->qInv); in RSA_priv_key_new()
64 bi_set_mod(bi_ctx, rsa_ctx->p, BIGINT_P_OFFSET); in RSA_priv_key_new()
65 bi_set_mod(bi_ctx, rsa_ctx->q, BIGINT_Q_OFFSET); in RSA_priv_key_new()
73 RSA_CTX *rsa_ctx; in RSA_pub_key_new() local
76 rsa_ctx = *ctx; in RSA_pub_key_new()
77 rsa_ctx->bi_ctx = bi_ctx; in RSA_pub_key_new()
78 rsa_ctx->num_octets = (mod_len & 0xFFF0); in RSA_pub_key_new()
79 rsa_ctx->m = bi_import(bi_ctx, modulus, mod_len); in RSA_pub_key_new()
80 bi_set_mod(bi_ctx, rsa_ctx->m, BIGINT_M_OFFSET); in RSA_pub_key_new()
81 rsa_ctx->e = bi_import(bi_ctx, pub_exp, pub_len); in RSA_pub_key_new()
82 bi_permanent(rsa_ctx->e); in RSA_pub_key_new()
88 void RSA_free(RSA_CTX *rsa_ctx) in RSA_free() argument
91 if (rsa_ctx == NULL) /* deal with ptrs that are null */ in RSA_free()
94 bi_ctx = rsa_ctx->bi_ctx; in RSA_free()
96 bi_depermanent(rsa_ctx->e); in RSA_free()
97 bi_free(bi_ctx, rsa_ctx->e); in RSA_free()
98 bi_free_mod(rsa_ctx->bi_ctx, BIGINT_M_OFFSET); in RSA_free()
100 if (rsa_ctx->d) in RSA_free()
102 bi_depermanent(rsa_ctx->d); in RSA_free()
103 bi_free(bi_ctx, rsa_ctx->d); in RSA_free()
105 bi_depermanent(rsa_ctx->dP); in RSA_free()
106 bi_depermanent(rsa_ctx->dQ); in RSA_free()
107 bi_depermanent(rsa_ctx->qInv); in RSA_free()
108 bi_free(bi_ctx, rsa_ctx->dP); in RSA_free()
109 bi_free(bi_ctx, rsa_ctx->dQ); in RSA_free()
110 bi_free(bi_ctx, rsa_ctx->qInv); in RSA_free()
111 bi_free_mod(rsa_ctx->bi_ctx, BIGINT_P_OFFSET); in RSA_free()
112 bi_free_mod(rsa_ctx->bi_ctx, BIGINT_Q_OFFSET); in RSA_free()
117 free(rsa_ctx); in RSA_free()
228 void RSA_print(const RSA_CTX *rsa_ctx) in RSA_print() argument
230 if (rsa_ctx == NULL) in RSA_print()
234 printf("Size:\t%d\n", rsa_ctx->num_octets); in RSA_print()
235 bi_print("Modulus", rsa_ctx->m); in RSA_print()
236 bi_print("Public Key", rsa_ctx->e); in RSA_print()
237 bi_print("Private Key", rsa_ctx->d); in RSA_print()