mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
016a0a56fc
Some operations require the CCA host library to be used, such as re-enciphering a secure key. The CCA host library uses a different approach to select the APQN it operates with. To ensure that the desired APQN is used for an operation, a utility function is added to select a specific APQN for usage with the CCA host library. The CCA host library allows to set environment variables to override the default CCA APQN selection. The environment variables are inspected during CCA host library initialization only. To select a specific domain for CCA, the CSU_DEFAULT_DOMAIN environment variable is set, and then the CCA host library is un-loaded and re-loaded again. Furthermore, the 'Cryptographic Resource Allocate' verb of the CCA host library is used together with the 'Cryptographic Facility Query function' verb to iterate over the crypto cards known by the CCA host library, and to identify the desired crypto card based on its serial number. That way, a specific APQN can be selected for use with subsequent CCA verbs. 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>
87 lines
2.1 KiB
C
87 lines
2.1 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);
|
|
|
|
typedef void (*t_CSUACFQ)(long *return_code,
|
|
long *reason_code,
|
|
long *exit_data_length,
|
|
unsigned char *exit_data,
|
|
long *rule_array_count,
|
|
unsigned char *rule_array,
|
|
long *verb_data_length,
|
|
unsigned char *verb_data);
|
|
|
|
typedef void (*t_CSUACRA)(long *return_code,
|
|
long *reason_code,
|
|
long *exit_data_length,
|
|
unsigned char *exit_data,
|
|
long *rule_array_count,
|
|
unsigned char *rule_array,
|
|
long *ressource_name_length,
|
|
unsigned char *ressource_name);
|
|
|
|
typedef void (*t_CSUACRD)(long *return_code,
|
|
long *reason_code,
|
|
long *exit_data_length,
|
|
unsigned char *exit_data,
|
|
long *rule_array_count,
|
|
unsigned char *rule_array,
|
|
long *ressource_name_length,
|
|
unsigned char *ressource_name);
|
|
|
|
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;
|
|
t_CSUACFQ dll_CSUACFQ;
|
|
t_CSUACRA dll_CSUACRA;
|
|
t_CSUACRD dll_CSUACRD;
|
|
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);
|
|
|
|
int select_cca_adapter(struct cca_lib *cca, int card, int domain, bool verbose);
|
|
|
|
#endif
|