Files
s390-tools/zkey/cca.h
Ingo Franzki 95c7258ea7 zkey: Separate and rework CCA host library loading
As preparation for future changes, rework the loading of the
CCA host library so that the exported symbols are not passed
individually to the functions that use it. Pass a structure
that contains all entry points of all loaded CCA functions
instead. This will make it easier to add further CCA functions
at a later time.

Also add a version query for the CCA host library since some
future functions might be dependent on the library version.

While at it, separate the CCA related functions and definitions,
and move them into a separate source file (cca.h/cca.h).

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-09-18 12:55:17 +02:00

55 lines
1.2 KiB
C

/*
* zkey - Generate, re-encipher, and validate secure keys
*
* This header file defines the interface to the CCA host library.
*
* Copyright IBM Corp. 2019
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
*/
#ifndef CCA_H
#define CCA_H
#include "lib/zt_common.h"
#define METHOD_OLD_TO_CURRENT "RTCMK "
#define METHOD_CURRENT_TO_NEW "RTNMK "
typedef void (*t_CSNBKTC)(long *return_code,
long *reason_code,
long *exit_data_length,
unsigned char *exit_data,
long *rule_array_count,
unsigned char *rule_array,
unsigned char *key_identifier);
typedef void (*t_CSUACFV)(long *return_code,
long *reason_code,
long *exit_data_length,
unsigned char *exit_data,
long *version_data_length,
unsigned char *version_data);
struct cca_version {
unsigned int ver;
unsigned int rel;
unsigned int mod;
};
struct cca_lib {
void *lib_csulcca;
t_CSNBKTC dll_CSNBKTC;
t_CSUACFV dll_CSUACFV;
struct cca_version version;
};
int load_cca_library(struct cca_lib *cca, bool verbose);
int key_token_change(struct cca_lib *cca,
u8 *secure_key, unsigned int secure_key_size,
char *method, bool verbose);
#endif