+aes_rval
+aes_encrypt_gcm(const unsigned char *in_blk, unsigned int num_bytes,
+ unsigned char *out_blk, ccgcm_ctx *ctx)
+{
+ const struct ccmode_gcm *gcm = g_crypto_funcs->ccaes_gcm_encrypt;
+ if (!gcm) {
+ return aes_error;
+ }
+
+ return ccgcm_update(gcm, ctx, num_bytes, in_blk, out_blk); //Actually gcm encrypt.
+}
+
+aes_rval
+aes_encrypt_finalize_gcm(unsigned char *tag, unsigned int tag_bytes, ccgcm_ctx *ctx)
+{
+ const struct ccmode_gcm *gcm = g_crypto_funcs->ccaes_gcm_encrypt;
+ if (!gcm) {
+ return aes_error;
+ }
+
+ int rc = ccgcm_finalize(gcm, ctx, tag_bytes, tag);
+ if (rc) {
+ return rc;
+ }
+
+ return ccgcm_reset(gcm, ctx);
+}
+
+aes_rval
+aes_decrypt_key_gcm(const unsigned char *key, int key_len, ccgcm_ctx *ctx)