Lines Matching refs:ctx
15 static void aesgcm_encrypt_block(const struct crypto_aes_ctx *ctx, void *dst, in aesgcm_encrypt_block() argument
29 aes_encrypt(ctx, dst, src); in aesgcm_encrypt_block()
45 int aesgcm_expandkey(struct aesgcm_ctx *ctx, const u8 *key, in aesgcm_expandkey() argument
52 aes_expandkey(&ctx->aes_ctx, key, keysize); in aesgcm_expandkey()
56 ctx->authsize = authsize; in aesgcm_expandkey()
57 aesgcm_encrypt_block(&ctx->aes_ctx, &ctx->ghash_key, kin); in aesgcm_expandkey()
88 static void aesgcm_mac(const struct aesgcm_ctx *ctx, const u8 *src, int src_len, in aesgcm_mac() argument
95 aesgcm_ghash(&ghash, &ctx->ghash_key, assoc, assoc_len); in aesgcm_mac()
96 aesgcm_ghash(&ghash, &ctx->ghash_key, src, src_len); in aesgcm_mac()
97 aesgcm_ghash(&ghash, &ctx->ghash_key, &tail, sizeof(tail)); in aesgcm_mac()
100 aesgcm_encrypt_block(&ctx->aes_ctx, buf, ctr); in aesgcm_mac()
101 crypto_xor_cpy(authtag, buf, (u8 *)&ghash, ctx->authsize); in aesgcm_mac()
107 static void aesgcm_crypt(const struct aesgcm_ctx *ctx, u8 *dst, const u8 *src, in aesgcm_crypt() argument
122 aesgcm_encrypt_block(&ctx->aes_ctx, buf, ctr); in aesgcm_crypt()
147 void aesgcm_encrypt(const struct aesgcm_ctx *ctx, u8 *dst, const u8 *src, in aesgcm_encrypt() argument
155 aesgcm_crypt(ctx, dst, src, crypt_len, ctr); in aesgcm_encrypt()
156 aesgcm_mac(ctx, dst, crypt_len, assoc, assoc_len, ctr, authtag); in aesgcm_encrypt()
177 bool __must_check aesgcm_decrypt(const struct aesgcm_ctx *ctx, u8 *dst, in aesgcm_decrypt() argument
187 aesgcm_mac(ctx, src, crypt_len, assoc, assoc_len, ctr, tagbuf); in aesgcm_decrypt()
188 if (crypto_memneq(authtag, tagbuf, ctx->authsize)) { in aesgcm_decrypt()
192 aesgcm_crypt(ctx, dst, src, crypt_len, ctr); in aesgcm_decrypt()
698 struct aesgcm_ctx ctx; in libaesgcm_init() local
701 if (aesgcm_expandkey(&ctx, aesgcm_tv[i].key, aesgcm_tv[i].klen, in libaesgcm_init()
707 if (!aesgcm_decrypt(&ctx, buf, aesgcm_tv[i].ctext, plen, in libaesgcm_init()
716 aesgcm_encrypt(&ctx, buf, buf, plen, aesgcm_tv[i].assoc, in libaesgcm_init()
724 if (!aesgcm_decrypt(&ctx, buf, buf, plen, aesgcm_tv[i].assoc, in libaesgcm_init()