libzpc 1.5
IBM Z Protected-key Crypto library
Loading...
Searching...
No Matches
aes_xts_key.h
Go to the documentation of this file.
1/*
2 * Copyright IBM Corp. 2025
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_XTS_KEY_H
9# define ZPC_AES_XTS_KEY_H
10# ifdef __cplusplus
11/* *INDENT-OFF* */
12extern "C" {
13/* *INDENT-ON* */
14# endif
15
23
24# include <stddef.h>
25
26/*
27 * These constants match with kernel's pkey.h, enum pkey_key_type.
28 */
29# define ZPC_AES_XTS_KEY_TYPE_PVSECRET 9
30
31typedef enum {
32 ZPC_XTS_SECRET_TYPE_NOT_SET = -2,
33 ZPC_XTS_SECRET_TYPE_INVALID = -1,
34 ZPC_XTS_SECRET_AES_XTS_128 = 0x07, /* architected key types, also below */
35 ZPC_XTS_SECRET_AES_XTS_256 = 0x08,
36} zpc_xtssecret_type_t;
37
38struct zpc_aes_xts_key;
39
45__attribute__((visibility("default")))
46int zpc_aes_xts_key_alloc(struct zpc_aes_xts_key **key);
53__attribute__((visibility("default")))
54int zpc_aes_xts_key_set_size(struct zpc_aes_xts_key *key, int size);
61__attribute__((visibility("default")))
62int zpc_aes_xts_key_set_type(struct zpc_aes_xts_key *key, int type);
70__attribute__((visibility("default")))
71int zpc_aes_xts_key_import(struct zpc_aes_xts_key *key, const unsigned char *seckey,
72 size_t seckeylen);
83__attribute__((visibility("default")))
84int zpc_aes_xts_key_import_clear(struct zpc_aes_xts_key *key,
85 const unsigned char *clrkey);
93__attribute__((visibility("default")))
94int zpc_aes_xts_key_export(struct zpc_aes_xts_key *key, unsigned char *seckey,
95 size_t *seckeylen);
103__attribute__((visibility("default")))
104int zpc_aes_xts_key_generate(struct zpc_aes_xts_key *key);
110__attribute__((visibility("default")))
111void zpc_aes_xts_key_free(struct zpc_aes_xts_key **key);
112
113# ifdef __cplusplus
114/* *INDENT-OFF* */
115}
116/* *INDENT-ON* */
117# endif
118#endif
void zpc_aes_xts_key_free(struct zpc_aes_xts_key **key)
int zpc_aes_xts_key_export(struct zpc_aes_xts_key *key, unsigned char *seckey, size_t *seckeylen)
int zpc_aes_xts_key_generate(struct zpc_aes_xts_key *key)
int zpc_aes_xts_key_set_type(struct zpc_aes_xts_key *key, int type)
int zpc_aes_xts_key_alloc(struct zpc_aes_xts_key **key)
int zpc_aes_xts_key_import(struct zpc_aes_xts_key *key, const unsigned char *seckey, size_t seckeylen)
int zpc_aes_xts_key_import_clear(struct zpc_aes_xts_key *key, const unsigned char *clrkey)
int zpc_aes_xts_key_set_size(struct zpc_aes_xts_key *key, int size)