mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
The libseckey is a secure key library to perform secure key operations with OpenSSL. It provides a framework to create OpenSSL PKEYs with a secure key attached. Such a PKEY contains the public key parts in clear, but the private key as secure key blob. Only the private key operations are actually performed with the secure key, public key operations are performed in software by OpenSSL. It supports CCA and EP11 secure keys for RSA and ECC crypto operations. Because many PKEY method related functions are deprecated since OpenSSL 3.0, two versions of the OpenSSL secure key support are needed. One (using a PKEY method override) for OpenSSL 1.1.1, and another one (using an own OpenSSL provider) for OpenSSL 3.0 and later. The desired implementation is selected automatically at compile time, using OpenSSL version defines. The interface of both implementations is the same, so a user does not need to care which one is used. Reviewed-by: Juergen Christ <jchrist@linux.ibm.com> Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
49 lines
1.4 KiB
C
49 lines
1.4 KiB
C
/*
|
|
* libseckey - Secure key library
|
|
*
|
|
* Copyright IBM Corp. 2021
|
|
*
|
|
* 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 SK_CCA_H
|
|
#define SK_CCA_H
|
|
|
|
#include <stddef.h>
|
|
#include <stdbool.h>
|
|
|
|
#include <openssl/evp.h>
|
|
|
|
#include "libseckey/sk_openssl.h"
|
|
|
|
#define CCA_MAX_PKA_KEY_TOKEN_SIZE 3500
|
|
|
|
int SK_CCA_generate_ec_key_pair(const struct sk_ext_cca_lib *cca_lib,
|
|
int curve_nid, unsigned char *key_token,
|
|
size_t *key_token_length, bool debug);
|
|
|
|
int SK_CCA_generate_rsa_key_pair(const struct sk_ext_cca_lib *cca_lib,
|
|
size_t modulus_bits, unsigned int pub_exp,
|
|
unsigned char *key_token,
|
|
size_t *key_token_length, bool debug);
|
|
|
|
int SK_CCA_get_key_type(const unsigned char *key_token, size_t key_token_length,
|
|
int *pkey_type);
|
|
|
|
int SK_CCA_get_secure_key_as_pkey(const struct sk_ext_cca_lib *cca_lib,
|
|
const unsigned char *key_token,
|
|
size_t key_token_length,
|
|
bool rsa_pss, EVP_PKEY **pkey, bool debug);
|
|
|
|
int SK_CCA_get_public_from_secure_key(const unsigned char *key_token,
|
|
size_t key_token_length,
|
|
sk_pub_key_func_t pub_key_cb,
|
|
void *private,
|
|
bool debug);
|
|
|
|
int SK_CCA_reencipher_key(const struct sk_ext_cca_lib *cca_lib,
|
|
unsigned char *key_token, size_t key_token_length,
|
|
bool to_new, bool debug);
|
|
|
|
#endif
|