Lines Matching refs:rsa

45 rsa_pkey_wrap(struct lws_genrsa_ctx *ctx, RSA *rsa)
57 if (EVP_PKEY_assign_RSA(pkey, rsa) != 1) {
109 ctx->rsa = RSA_new();
110 if (!ctx->rsa) {
116 if (RSA_set0_key(ctx->rsa, ctx->bn[LWS_GENCRYPTO_RSA_KEYEL_N],
122 RSA_set0_factors(ctx->rsa, ctx->bn[LWS_GENCRYPTO_RSA_KEYEL_P],
125 ctx->rsa->e = ctx->bn[LWS_GENCRYPTO_RSA_KEYEL_E];
126 ctx->rsa->n = ctx->bn[LWS_GENCRYPTO_RSA_KEYEL_N];
127 ctx->rsa->d = ctx->bn[LWS_GENCRYPTO_RSA_KEYEL_D];
128 ctx->rsa->p = ctx->bn[LWS_GENCRYPTO_RSA_KEYEL_P];
129 ctx->rsa->q = ctx->bn[LWS_GENCRYPTO_RSA_KEYEL_Q];
132 if (!rsa_pkey_wrap(ctx, ctx->rsa))
142 if (ctx->rsa) {
143 RSA_free(ctx->rsa);
144 ctx->rsa = NULL;
162 ctx->rsa = RSA_new();
163 if (!ctx->rsa) {
176 n = RSA_generate_key_ex(ctx->rsa, bits, bn, NULL);
185 RSA_get0_key(ctx->rsa, &mpi[LWS_GENCRYPTO_RSA_KEYEL_N],
187 RSA_get0_factors(ctx->rsa, &mpi[LWS_GENCRYPTO_RSA_KEYEL_P],
191 BIGNUM *mpi[5] = { ctx->rsa->e, ctx->rsa->n, ctx->rsa->d,
192 ctx->rsa->p, ctx->rsa->q, };
205 if (!rsa_pkey_wrap(ctx, ctx->rsa))
213 RSA_free(ctx->rsa);
214 ctx->rsa = NULL;
220 * in_len must be less than RSA_size(rsa) - 11 for the PKCS #1 v1.5
228 int n = RSA_public_encrypt((int)in_len, in, out, ctx->rsa,
243 int n = RSA_private_encrypt((int)in_len, in, out, ctx->rsa,
258 int n = RSA_public_decrypt((int)in_len, in, out, ctx->rsa,
272 int n = RSA_private_decrypt((int)in_len, in, out, ctx->rsa,
298 (unsigned int)sig_len, ctx->rsa);
306 n = RSA_verify_pss_mgf1(ctx->rsa, in, h, md, NULL, -1,
309 n = RSA_verify_PKCS1_PSS(ctx->rsa, in, md, (uint8_t *)sig,
343 if (RSA_sign(n, in, (unsigned int)h, sig, &used, ctx->rsa) != 1) {
412 ctx->rsa = NULL;