Beispiel #1
0
static void pcrypt_aead_giv_serial(struct padata_priv *padata)
{
	struct pcrypt_request *preq = pcrypt_padata_request(padata);
	struct aead_givcrypt_request *req = pcrypt_request_ctx(preq);

	aead_request_complete(req->areq.base.data, padata->info);
}
Beispiel #2
0
static void echainiv_encrypt_complete(struct crypto_async_request *base,
                                      int err)
{
    struct aead_request *req = base->data;

    echainiv_encrypt_complete2(req, err);
    aead_request_complete(req, err);
}
Beispiel #3
0
static void gcm_enc_hash_done(struct aead_request *req, int err)
{
    struct crypto_gcm_req_priv_ctx *pctx = crypto_gcm_reqctx(req);

    if (!err)
        gcm_enc_copy_hash(req, pctx);

    aead_request_complete(req, err);
}
Beispiel #4
0
static void crypto_gcm_decrypt_done(struct crypto_async_request *areq, int err)
{
	struct aead_request *req = areq->data;

	if (!err)
		err = crypto_gcm_verify(req);

	aead_request_complete(req, err);
}
Beispiel #5
0
static void gcm_decrypt_done(struct crypto_async_request *areq, int err)
{
    struct aead_request *req = areq->data;
    struct crypto_gcm_req_priv_ctx *pctx = crypto_gcm_reqctx(req);

    if (!err)
        err = crypto_gcm_verify(req, pctx);

    aead_request_complete(req, err);
}
Beispiel #6
0
static void crypto_ccm_encrypt_done(struct crypto_async_request *areq, int err)
{
	struct aead_request *req = areq->data;
	struct crypto_aead *aead = crypto_aead_reqtfm(req);
	struct crypto_ccm_req_priv_ctx *pctx = crypto_ccm_reqctx(req);
	u8 *odata = pctx->odata;

	if (!err)
		scatterwalk_map_and_copy(odata, req->dst, req->cryptlen,
					 crypto_aead_authsize(aead), 1);
	aead_request_complete(req, err);
}
Beispiel #7
0
static void crypto_rfc4543_done(struct crypto_async_request *areq, int err)
{
    struct aead_request *req = areq->data;
    struct crypto_aead *aead = crypto_aead_reqtfm(req);
    struct crypto_rfc4543_req_ctx *rctx = crypto_rfc4543_reqctx(req);

    if (!err) {
        scatterwalk_map_and_copy(rctx->auth_tag, req->dst,
                                 req->cryptlen,
                                 crypto_aead_authsize(aead), 1);
    }

    aead_request_complete(req, err);
}
Beispiel #8
0
static void crypto_ccm_decrypt_done(struct crypto_async_request *areq,
				   int err)
{
	struct aead_request *req = areq->data;
	struct crypto_ccm_req_priv_ctx *pctx = crypto_ccm_reqctx(req);
	struct crypto_aead *aead = crypto_aead_reqtfm(req);
	unsigned int authsize = crypto_aead_authsize(aead);
	unsigned int cryptlen = req->cryptlen - authsize;

	if (!err) {
		err = crypto_ccm_auth(req, req->dst, cryptlen);
		if (!err && crypto_memneq(pctx->auth_tag, pctx->odata, authsize))
			err = -EBADMSG;
	}
	aead_request_complete(req, err);
}
Beispiel #9
0
static void gcm_encrypt_done(struct crypto_async_request *areq, int err)
{
    struct aead_request *req = areq->data;
    struct crypto_gcm_req_priv_ctx *pctx = crypto_gcm_reqctx(req);

    if (!err) {
        err = gcm_hash(req, pctx);
        if (err == -EINPROGRESS || err == -EBUSY)
            return;
        else if (!err) {
            crypto_xor(pctx->auth_tag, pctx->iauth_tag, 16);
            gcm_enc_copy_hash(req, pctx);
        }
    }

    aead_request_complete(req, err);
}
Beispiel #10
0
static void gcm_dec_hash_done(struct aead_request *req, int err)
{
    struct crypto_gcm_req_priv_ctx *pctx = crypto_gcm_reqctx(req);
    struct ablkcipher_request *abreq = &pctx->u.abreq;
    struct crypto_gcm_ghash_ctx *gctx = &pctx->ghash_ctx;

    if (!err) {
        ablkcipher_request_set_callback(abreq, aead_request_flags(req),
                                        gcm_decrypt_done, req);
        crypto_gcm_init_crypt(abreq, req, gctx->cryptlen);
        err = crypto_ablkcipher_decrypt(abreq);
        if (err == -EINPROGRESS || err == -EBUSY)
            return;
        else if (!err)
            err = crypto_gcm_verify(req, pctx);
    }

    aead_request_complete(req, err);
}