KDF additons to names and numbers

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9662)
This commit is contained in:
Pauli 2019-08-21 18:52:32 +10:00
parent bf5739a026
commit 2f7557016c
2 changed files with 55 additions and 0 deletions

View File

@ -92,6 +92,31 @@ extern "C" {
#define OSSL_MAC_NAME_KMAC128 "KMAC128"
#define OSSL_MAC_NAME_KMAC256 "KMAC256"
/* KDF / PRF parameters */
#define OSSL_KDF_PARAM_SECRET "secret" /* octet string */
#define OSSL_KDF_PARAM_KEY "key" /* octet string */
#define OSSL_KDF_PARAM_SALT "salt" /* octet string */
#define OSSL_KDF_PARAM_PASSWORD "pass" /* octet string */
#define OSSL_KDF_PARAM_DIGEST "digest" /* utf8 string */
#define OSSL_KDF_PARAM_MAC "mac" /* utf8 string */
#define OSSL_KDF_PARAM_MAC_SIZE "maclen" /* size_t */
#define OSSL_KDF_PARAM_PROPERTIES "properties" /* utf8 string */
#define OSSL_KDF_PARAM_ITER "iter" /* unsigned int */
#define OSSL_KDF_PARAM_MODE "mode" /* utf8 string or int */
#define OSSL_KDF_PARAM_PKCS5 "pkcs5" /* int */
#define OSSL_KDF_PARAM_UKM "ukm" /* octet string */
#define OSSL_KDF_PARAM_CEK_ALG "cekalg" /* utf8 string */
#define OSSL_KDF_PARAM_SCRYPT_N "n" /* uint64_t */
#define OSSL_KDF_PARAM_SCRYPT_R "r" /* uint32_t */
#define OSSL_KDF_PARAM_SCRYPT_P "p" /* uint32_t */
#define OSSL_KDF_PARAM_SCRYPT_MAXMEM "maxmem_bytes" /* uint64_t */
#define OSSL_KDF_PARAM_INFO "info" /* octet string */
#define OSSL_KDF_PARAM_SEED "seed" /* octet string */
#define OSSL_KDF_PARAM_SSHKDF_XCGHASH "xcghash" /* octet string */
#define OSSL_KDF_PARAM_SSHKDF_SESSION_ID "session_id" /* octet string */
#define OSSL_KDF_PARAM_SSHKDF_TYPE "type" /* int */
#define OSSL_KDF_PARAM_SIZE "size" /* size_t */
/* PKEY parameters */
/* Diffie-Hellman Parameters */
#define OSSL_PKEY_PARAM_DH_P "dh-p"

View File

@ -281,6 +281,36 @@ OSSL_CORE_MAKE_FUNC(int, OP_mac_get_ctx_params,
OSSL_CORE_MAKE_FUNC(int, OP_mac_set_ctx_params,
(void *mctx, const OSSL_PARAM params[]))
/* KDFs and PRFs */
# define OSSL_OP_KDF 4
# define OSSL_FUNC_KDF_NEWCTX 1
# define OSSL_FUNC_KDF_DUPCTX 2
# define OSSL_FUNC_KDF_FREECTX 3
# define OSSL_FUNC_KDF_RESET 4
# define OSSL_FUNC_KDF_DERIVE 5
# define OSSL_FUNC_KDF_GETTABLE_PARAMS 6
# define OSSL_FUNC_KDF_GETTABLE_CTX_PARAMS 7
# define OSSL_FUNC_KDF_SETTABLE_CTX_PARAMS 8
# define OSSL_FUNC_KDF_GET_PARAMS 9
# define OSSL_FUNC_KDF_GET_CTX_PARAMS 10
# define OSSL_FUNC_KDF_SET_CTX_PARAMS 11
OSSL_CORE_MAKE_FUNC(void *, OP_kdf_newctx, (void *provctx))
OSSL_CORE_MAKE_FUNC(void *, OP_kdf_dupctx, (void *src))
OSSL_CORE_MAKE_FUNC(void, OP_kdf_freectx, (void *kctx))
OSSL_CORE_MAKE_FUNC(void, OP_kdf_reset, (void *kctx))
OSSL_CORE_MAKE_FUNC(int, OP_kdf_derive, (void *kctx, unsigned char *key,
size_t keylen))
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_kdf_gettable_params, (void))
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_kdf_gettable_ctx_params, (void))
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_kdf_settable_ctx_params, (void))
OSSL_CORE_MAKE_FUNC(int, OP_kdf_get_params, (OSSL_PARAM params[]))
OSSL_CORE_MAKE_FUNC(int, OP_kdf_get_ctx_params,
(void *kctx, OSSL_PARAM params[]))
OSSL_CORE_MAKE_FUNC(int, OP_kdf_set_ctx_params,
(void *kctx, const OSSL_PARAM params[]))
/*-
* Key management
*