unsigned int keylen)
{
struct gcm_key *ctx = crypto_aead_ctx(tfm);
- struct crypto_aes_ctx aes_ctx;
+ struct aes_enckey aes_key;
be128 h, k;
int ret;
- ret = aes_expandkey(&aes_ctx, inkey, keylen);
+ ret = aes_prepareenckey(&aes_key, inkey, keylen);
if (ret)
return -EINVAL;
- aes_encrypt(&aes_ctx, (u8 *)&k, (u8[AES_BLOCK_SIZE]){});
+ aes_encrypt(&aes_key, (u8 *)&k, (u8[AES_BLOCK_SIZE]){});
- memcpy(ctx->rk, aes_ctx.key_enc, sizeof(ctx->rk));
+ /*
+ * Note: this assumes that the arm implementation of the AES library
+ * stores the standard round keys in k.rndkeys.
+ */
+ memcpy(ctx->rk, aes_key.k.rndkeys, sizeof(ctx->rk));
ctx->rounds = 6 + keylen / 4;
- memzero_explicit(&aes_ctx, sizeof(aes_ctx));
+ memzero_explicit(&aes_key, sizeof(aes_key));
ghash_reflect(ctx->h[0], &k);