Lines Matching refs:ctx
89 static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
91 static int cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
93 static int cryptodev_cleanup(EVP_CIPHER_CTX *ctx);
105 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
107 RSA *rsa, BN_CTX *ctx);
108 static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx);
110 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
113 BN_CTX *ctx, BN_MONT_CTX *mont);
119 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
380 cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
384 struct dev_crypto_state *state = ctx->cipher_data;
393 if ((inl % ctx->cipher->block_size) != 0)
405 cryp.op = ctx->encrypt ? COP_ENCRYPT : COP_DECRYPT;
407 if (ctx->cipher->iv_len) {
408 cryp.iv = (caddr_t) ctx->iv;
409 if (!ctx->encrypt) {
410 iiv = in + inl - ctx->cipher->iv_len;
411 memcpy(save_iv, iiv, ctx->cipher->iv_len);
423 if (ctx->cipher->iv_len) {
424 if (ctx->encrypt)
425 iiv = out + inl - ctx->cipher->iv_len;
428 memcpy(ctx->iv, iiv, ctx->cipher->iv_len);
434 cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
437 struct dev_crypto_state *state = ctx->cipher_data;
441 if ((cipher = cipher_nid_to_cryptodev(ctx->cipher->nid)) == NID_undef)
444 if (ctx->cipher->iv_len > cryptodev_max_iv(cipher))
447 if (!cryptodev_key_length_valid(cipher, ctx->key_len))
456 sess->keylen = ctx->key_len;
472 cryptodev_cleanup(EVP_CIPHER_CTX *ctx)
475 struct dev_crypto_state *state = ctx->cipher_data;
482 * may have called us with a bogus ctx, or we could
733 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
742 ret = BN_mod_exp(r, a, p, m, ctx);
760 ret = meth->bn_mod_exp(r, a, p, m, ctx, in_mont);
768 cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
772 r = cryptodev_bn_mod_exp(r0, I, rsa->d, rsa->n, ctx, NULL);
777 cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
806 ret = (*meth->rsa_mod_exp)(r0, I, rsa, ctx);
831 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
833 return (cryptodev_bn_mod_exp(r, a, p, m, ctx, m_ctx));
839 BN_CTX *ctx, BN_MONT_CTX *mont)
850 if (!dsa->meth->bn_mod_exp(dsa,t1,dsa->g,u1,dsa->p,ctx,mont))
854 if (!dsa->meth->bn_mod_exp(dsa,&t2,dsa->pub_key,u2,dsa->p,ctx,mont))
857 if (!BN_mod_mul(u1,t1,&t2,dsa->p,ctx))
970 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
973 return (cryptodev_bn_mod_exp(r, a, p, m, ctx, m_ctx));