KDF additons to names and numbers
authorPauli <paul.dale@oracle.com>
Wed, 21 Aug 2019 08:52:32 +0000 (18:52 +1000)
committerPauli <paul.dale@oracle.com>
Fri, 6 Sep 2019 09:27:57 +0000 (19:27 +1000)
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9662)

include/openssl/core_names.h
include/openssl/core_numbers.h

index 2fe06dc27246a8ecb0066c4d8b1099efdec17579..1d8857295cce19afd5b88da01b0877a1c0c7cae4 100644 (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"
index e39410893e777241c7e081efc858f5e278177cac..4fd91b465c379da8e52e524586dd033f18adf72b 100644 (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
  *