libzpc 1.5
IBM Z Protected-key Crypto library
Loading...
Searching...
No Matches
aes_gcm.h
Go to the documentation of this file.
1/*
2 * Copyright IBM Corp. 2021
3 *
4 * libzpc is free software; you can redistribute it and/or modify
5 * it under the terms of the MIT license. See LICENSE for details.
6 */
7
8#ifndef ZPC_AES_GCM_H
9# define ZPC_AES_GCM_H
10# ifdef __cplusplus
11/* *INDENT-OFF* */
12extern "C" {
13/* *INDENT-ON* */
14# endif
15
24
25# include <zpc/aes_key.h>
26# include <stddef.h>
27
28struct zpc_aes_gcm;
29
35__attribute__((visibility("default")))
36int zpc_aes_gcm_alloc(struct zpc_aes_gcm **ctx);
43__attribute__((visibility("default")))
44int zpc_aes_gcm_set_key(struct zpc_aes_gcm *ctx, struct zpc_aes_key *key);
54__attribute__((visibility("default")))
55int zpc_aes_gcm_create_iv(struct zpc_aes_gcm *ctx, unsigned char *iv,
56 size_t ivlen);
65__attribute__((visibility("default")))
66int zpc_aes_gcm_set_iv(struct zpc_aes_gcm *ctx, const unsigned char *iv,
67 size_t ivlen);
80__attribute__((visibility("default")))
81int zpc_aes_gcm_encrypt(struct zpc_aes_gcm *ctx, unsigned char *ct,
82 unsigned char *mac, size_t maclen, const unsigned char *aad, size_t aadlen,
83 const unsigned char *pt, size_t ptlen);
96__attribute__((visibility("default")))
97int zpc_aes_gcm_decrypt(struct zpc_aes_gcm *ctx, unsigned char *pt,
98 const unsigned char *mac, size_t maclen, const unsigned char *aad,
99 size_t aadlen, const unsigned char *ct, size_t ctlen);
104__attribute__((visibility("default")))
105void zpc_aes_gcm_free(struct zpc_aes_gcm **ctx);
106
107# ifdef __cplusplus
108/* *INDENT-OFF* */
109}
110/* *INDENT-ON* */
111# endif
112#endif
int zpc_aes_gcm_encrypt(struct zpc_aes_gcm *ctx, unsigned char *ct, unsigned char *mac, size_t maclen, const unsigned char *aad, size_t aadlen, const unsigned char *pt, size_t ptlen)
int zpc_aes_gcm_set_iv(struct zpc_aes_gcm *ctx, const unsigned char *iv, size_t ivlen)
void zpc_aes_gcm_free(struct zpc_aes_gcm **ctx)
int zpc_aes_gcm_set_key(struct zpc_aes_gcm *ctx, struct zpc_aes_key *key)
int zpc_aes_gcm_alloc(struct zpc_aes_gcm **ctx)
int zpc_aes_gcm_decrypt(struct zpc_aes_gcm *ctx, unsigned char *pt, const unsigned char *mac, size_t maclen, const unsigned char *aad, size_t aadlen, const unsigned char *ct, size_t ctlen)
int zpc_aes_gcm_create_iv(struct zpc_aes_gcm *ctx, unsigned char *iv, size_t ivlen)
AES key API.