Lines Matching refs:reqp
64 dca_request_t *reqp = ctx->cc_provider_private; in dca_rsastart() local
88 if (dca_length(out) < reqp->dr_ctx.modlen) { in dca_rsastart()
91 dca_length(out), reqp->dr_ctx.modlen); in dca_rsastart()
92 out->cd_length = reqp->dr_ctx.modlen; in dca_rsastart()
97 if (out != in && out->cd_length > reqp->dr_ctx.modlen) in dca_rsastart()
98 out->cd_length = reqp->dr_ctx.modlen; in dca_rsastart()
101 if (len > reqp->dr_ctx.modlen) { in dca_rsastart()
111 if (len < reqp->dr_ctx.modlen && (mode == DCA_RSA_DEC || in dca_rsastart()
122 if (out->cd_length < reqp->dr_ctx.modlen && (mode == DCA_RSA_DEC || in dca_rsastart()
124 reqp->dr_ctx.ctx_cm_type == RSA_X_509_MECH_INFO_TYPE) { in dca_rsastart()
125 out->cd_length = reqp->dr_ctx.modlen; in dca_rsastart()
144 if (dca_numcmp(daddr, len, (char *)reqp->dr_ctx.mod, in dca_rsastart()
145 reqp->dr_ctx.modlen) > 0) { in dca_rsastart()
153 reqp->dr_byte_stat = -1; in dca_rsastart()
154 reqp->dr_in = in; in dca_rsastart()
155 reqp->dr_out = out; in dca_rsastart()
156 reqp->dr_kcf_req = req; in dca_rsastart()
158 reqp->dr_callback = dca_rsaverifydone; in dca_rsastart()
160 reqp->dr_callback = dca_rsadone; in dca_rsastart()
162 dca_reverse(daddr, reqp->dr_ibuf_kaddr, len, reqp->dr_pkt_length); in dca_rsastart()
169 if (reqp->dr_ctx.ctx_cm_type == RSA_PKCS_MECH_INFO_TYPE) { in dca_rsastart()
170 if ((rv = dca_pkcs1_padding(dca, reqp->dr_ibuf_kaddr, in dca_rsastart()
171 len, reqp->dr_ctx.modlen, reqp->dr_ctx.pqfix)) != in dca_rsastart()
174 } else if (reqp->dr_ctx.ctx_cm_type == in dca_rsastart()
176 if ((rv = dca_x509_padding(reqp->dr_ibuf_kaddr, in dca_rsastart()
177 len, reqp->dr_pkt_length)) != CRYPTO_QUEUED) in dca_rsastart()
181 reqp->dr_ctx.mode = mode; in dca_rsastart()
188 reqp->dr_in_paddr = reqp->dr_ibuf_head.dc_buffer_paddr; in dca_rsastart()
189 reqp->dr_in_next = 0; in dca_rsastart()
190 reqp->dr_in_len = reqp->dr_pkt_length; in dca_rsastart()
191 reqp->dr_out_paddr = reqp->dr_obuf_head.dc_buffer_paddr; in dca_rsastart()
192 reqp->dr_out_next = 0; in dca_rsastart()
193 reqp->dr_out_len = reqp->dr_pkt_length; in dca_rsastart()
196 rv = dca_start(dca, reqp, MCR2, 1); in dca_rsastart()
207 dca_rsadone(dca_request_t *reqp, int errno) in dca_rsadone() argument
210 int outsz = reqp->dr_out->cd_length; in dca_rsadone()
213 (void) ddi_dma_sync(reqp->dr_obuf_dmah, 0, reqp->dr_out_len, in dca_rsadone()
215 if (dca_check_dma_handle(reqp->dr_dca, reqp->dr_obuf_dmah, in dca_rsadone()
217 reqp->destroy = TRUE; in dca_rsadone()
222 if (reqp->dr_ctx.mode == DCA_RSA_DEC || in dca_rsadone()
223 reqp->dr_ctx.mode == DCA_RSA_VRFY || in dca_rsadone()
224 reqp->dr_ctx.mode == DCA_RSA_VRFYR) { in dca_rsadone()
229 if (reqp->dr_ctx.ctx_cm_type == in dca_rsadone()
232 reqp->dr_obuf_kaddr, &outsz, in dca_rsadone()
233 reqp->dr_ctx.modlen, reqp->dr_ctx.mode); in dca_rsadone()
240 if (dca_bufdaddr(reqp->dr_out) == NULL) { in dca_rsadone()
244 reqp->dr_out->cd_length = outsz; in dca_rsadone()
248 reqp->dr_out->cd_length = outsz; in dca_rsadone()
249 } else if (reqp->dr_ctx.ctx_cm_type == in dca_rsadone()
252 reqp->dr_obuf_kaddr, outsz, in dca_rsadone()
253 reqp->dr_pkt_length, reqp->dr_ctx.mode)) != in dca_rsadone()
259 if ((daddr = dca_bufdaddr(reqp->dr_out)) == NULL) { in dca_rsadone()
260 DBG(reqp->dr_dca, DINTR, in dca_rsadone()
271 dca_reverse(reqp->dr_obuf_kaddr, daddr, outsz, outsz); in dca_rsadone()
274 ASSERT(reqp->dr_kcf_req != NULL); in dca_rsadone()
277 crypto_op_notification(reqp->dr_kcf_req, errno); in dca_rsadone()
278 DBG(reqp->dr_dca, DINTR, in dca_rsadone()
287 if (reqp->dr_ctx.atomic) { in dca_rsadone()
289 ctx.cc_provider_private = reqp; in dca_rsadone()
295 dca_rsaverifydone(dca_request_t *reqp, int errno) in dca_rsaverifydone() argument
299 int outsz = reqp->dr_out->cd_length; in dca_rsaverifydone()
306 (void) ddi_dma_sync(reqp->dr_obuf_dmah, 0, outsz, in dca_rsaverifydone()
308 if (dca_check_dma_handle(reqp->dr_dca, reqp->dr_obuf_dmah, in dca_rsaverifydone()
310 reqp->destroy = TRUE; in dca_rsaverifydone()
315 if (reqp->dr_ctx.mode == DCA_RSA_DEC || in dca_rsaverifydone()
316 reqp->dr_ctx.mode == DCA_RSA_VRFY || in dca_rsaverifydone()
317 reqp->dr_ctx.mode == DCA_RSA_VRFYR) { in dca_rsaverifydone()
322 if (reqp->dr_ctx.ctx_cm_type == in dca_rsaverifydone()
325 reqp->dr_obuf_kaddr, &outsz, in dca_rsaverifydone()
326 reqp->dr_ctx.modlen, reqp->dr_ctx.mode); in dca_rsaverifydone()
333 if (dca_bufdaddr(reqp->dr_out) == NULL) { in dca_rsaverifydone()
337 reqp->dr_out->cd_length = outsz; in dca_rsaverifydone()
341 reqp->dr_out->cd_length = outsz; in dca_rsaverifydone()
342 } else if (reqp->dr_ctx.ctx_cm_type == in dca_rsaverifydone()
345 reqp->dr_obuf_kaddr, outsz, in dca_rsaverifydone()
346 reqp->dr_pkt_length, reqp->dr_ctx.mode)) != in dca_rsaverifydone()
352 dca_reverse(reqp->dr_obuf_kaddr, scratch, outsz, outsz); in dca_rsaverifydone()
354 if ((daddr = dca_bufdaddr(reqp->dr_out)) == NULL) { in dca_rsaverifydone()
358 if (dca_numcmp(daddr, reqp->dr_out->cd_length, scratch, in dca_rsaverifydone()
365 ASSERT(reqp->dr_kcf_req != NULL); in dca_rsaverifydone()
368 crypto_op_notification(reqp->dr_kcf_req, errno); in dca_rsaverifydone()
369 DBG(reqp->dr_dca, DINTR, in dca_rsaverifydone()
378 if (reqp->dr_ctx.atomic) { in dca_rsaverifydone()
380 ctx.cc_provider_private = reqp; in dca_rsaverifydone()
415 dca_request_t *reqp = NULL; in dca_rsainit() local
420 if ((reqp = dca_getreq(dca, MCR2, 1)) == NULL) { in dca_rsainit()
427 reqp->dr_ctx.ctx_cm_type = mechanism->cm_type; in dca_rsainit()
428 ctx->cc_provider_private = reqp; in dca_rsainit()
459 &attrdata, &(reqp->dr_ctx.modlen))) != CRYPTO_SUCCESS) { in dca_rsainit()
463 if ((reqp->dr_ctx.modlen == 0) || in dca_rsainit()
464 (reqp->dr_ctx.modlen > RSA_MAX_KEY_LEN)) { in dca_rsainit()
469 if ((reqp->dr_ctx.mod = kmem_alloc(reqp->dr_ctx.modlen, kmflag)) == in dca_rsainit()
474 bcopy(attrdata, reqp->dr_ctx.mod, reqp->dr_ctx.modlen); in dca_rsainit()
511 modbits = dca_bitlen(reqp->dr_ctx.mod, reqp->dr_ctx.modlen); in dca_rsainit()
532 reqp->dr_job_stat = DS_RSAPRIVATE; in dca_rsainit()
533 reqp->dr_pkt_length = 2 * pqfix; in dca_rsainit()
535 reqp->dr_job_stat = DS_RSAPUBLIC; in dca_rsainit()
536 reqp->dr_pkt_length = modfix; in dca_rsainit()
548 PUTCTX16(reqp, CTX_CMD, CMD_RSAPRIVATE); in dca_rsainit()
549 PUTCTX16(reqp, CTX_LENGTH, ctxlen); in dca_rsainit()
551 PUTCTX16(reqp, CTX_RSAQLEN, qbits); in dca_rsainit()
552 PUTCTX16(reqp, CTX_RSAPLEN, pbits); in dca_rsainit()
554 kaddr = reqp->dr_ctx_kaddr + CTX_RSABIGNUMS; in dca_rsainit()
574 PUTCTX16(reqp, CTX_CMD, CMD_RSAPUBLIC); in dca_rsainit()
575 PUTCTX16(reqp, CTX_LENGTH, (uint16_t)ctxlen); in dca_rsainit()
577 PUTCTX16(reqp, CTX_RSAEXPLEN, expbits); in dca_rsainit()
578 PUTCTX16(reqp, CTX_RSAMODLEN, modbits); in dca_rsainit()
580 kaddr = reqp->dr_ctx_kaddr + CTX_RSABIGNUMS; in dca_rsainit()
583 dca_reverse(reqp->dr_ctx.mod, kaddr, reqp->dr_ctx.modlen, in dca_rsainit()
591 reqp->dr_ctx.pqfix = pqfix; in dca_rsainit()
604 dca_request_t *reqp = ctx->cc_provider_private; in dca_rsactxfree() local
606 if (reqp == NULL) in dca_rsactxfree()
609 if (reqp->dr_ctx.mod) in dca_rsactxfree()
610 kmem_free(reqp->dr_ctx.mod, reqp->dr_ctx.modlen); in dca_rsactxfree()
612 reqp->dr_ctx.mode = 0; in dca_rsactxfree()
613 reqp->dr_ctx.ctx_cm_type = 0; in dca_rsactxfree()
614 reqp->dr_ctx.mod = NULL; in dca_rsactxfree()
615 reqp->dr_ctx.modlen = 0; in dca_rsactxfree()
616 reqp->dr_ctx.pqfix = 0; in dca_rsactxfree()
617 reqp->dr_ctx.atomic = 0; in dca_rsactxfree()
619 if (reqp->destroy) in dca_rsactxfree()
620 dca_destroyreq(reqp); in dca_rsactxfree()
622 dca_freereq(reqp); in dca_rsactxfree()