2018-06-22 05:16:18 +08:00
|
|
|
/*
|
|
|
|
* Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
|
|
|
|
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <openssl/evp.h>
|
|
|
|
#include <openssl/err.h>
|
2019-08-30 20:32:55 +08:00
|
|
|
#include <openssl/buffer.h>
|
2018-06-22 05:16:18 +08:00
|
|
|
#include <openssl/kdf.h>
|
2019-08-21 06:06:29 +08:00
|
|
|
#include <openssl/core.h>
|
|
|
|
#include <openssl/core_names.h>
|
|
|
|
#include <openssl/params.h>
|
2019-02-28 17:31:20 +08:00
|
|
|
#include "internal/numbers.h"
|
2018-06-22 05:16:18 +08:00
|
|
|
#include "internal/evp_int.h"
|
|
|
|
|
2019-08-21 06:06:29 +08:00
|
|
|
#define MAX_PARAM 20
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
EVP_KDF_CTX *kctx;
|
2019-08-30 20:32:55 +08:00
|
|
|
/*
|
|
|
|
* EVP_PKEY implementations collect bits of certain data
|
|
|
|
*/
|
|
|
|
BUF_MEM *collected_seed;
|
|
|
|
BUF_MEM *collected_info;
|
2019-08-21 06:06:29 +08:00
|
|
|
} EVP_PKEY_KDF_CTX;
|
|
|
|
|
2019-08-30 20:32:55 +08:00
|
|
|
static void pkey_kdf_free_collected(EVP_PKEY_KDF_CTX *pkctx)
|
2019-08-21 06:06:29 +08:00
|
|
|
{
|
2019-08-30 20:32:55 +08:00
|
|
|
BUF_MEM_free(pkctx->collected_seed);
|
|
|
|
pkctx->collected_seed = NULL;
|
|
|
|
BUF_MEM_free(pkctx->collected_info);
|
|
|
|
pkctx->collected_info = NULL;
|
2019-08-21 06:06:29 +08:00
|
|
|
}
|
|
|
|
|
2018-06-22 05:16:18 +08:00
|
|
|
static int pkey_kdf_init(EVP_PKEY_CTX *ctx)
|
|
|
|
{
|
2019-08-21 06:06:29 +08:00
|
|
|
EVP_PKEY_KDF_CTX *pkctx;
|
2018-06-22 05:16:18 +08:00
|
|
|
EVP_KDF_CTX *kctx;
|
2019-08-21 06:06:29 +08:00
|
|
|
const char *kdf_name = OBJ_nid2sn(ctx->pmeth->pkey_id);
|
|
|
|
EVP_KDF *kdf;
|
2018-06-22 05:16:18 +08:00
|
|
|
|
2019-08-21 06:06:29 +08:00
|
|
|
pkctx = OPENSSL_zalloc(sizeof(*pkctx));
|
|
|
|
if (pkctx == NULL)
|
2018-06-22 05:16:18 +08:00
|
|
|
return 0;
|
|
|
|
|
2019-08-21 06:06:29 +08:00
|
|
|
kdf = EVP_KDF_fetch(NULL, kdf_name, NULL);
|
|
|
|
kctx = EVP_KDF_CTX_new(kdf);
|
|
|
|
EVP_KDF_free(kdf);
|
|
|
|
if (kctx == NULL) {
|
|
|
|
OPENSSL_free(pkctx);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
pkctx->kctx = kctx;
|
|
|
|
ctx->data = pkctx;
|
2018-06-22 05:16:18 +08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void pkey_kdf_cleanup(EVP_PKEY_CTX *ctx)
|
|
|
|
{
|
2019-08-21 06:06:29 +08:00
|
|
|
EVP_PKEY_KDF_CTX *pkctx = ctx->data;
|
2018-06-22 05:16:18 +08:00
|
|
|
|
2019-08-21 06:06:29 +08:00
|
|
|
EVP_KDF_CTX_free(pkctx->kctx);
|
2019-08-30 20:32:55 +08:00
|
|
|
pkey_kdf_free_collected(pkctx);
|
2019-08-21 06:06:29 +08:00
|
|
|
OPENSSL_free(pkctx);
|
2018-06-22 05:16:18 +08:00
|
|
|
}
|
|
|
|
|
2019-08-30 22:34:27 +08:00
|
|
|
static int collect(BUF_MEM **collector, void *data, size_t datalen)
|
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
if (*collector == NULL)
|
|
|
|
*collector = BUF_MEM_new();
|
|
|
|
if (*collector == NULL) {
|
|
|
|
ERR_raise(ERR_LIB_EVP, ERR_R_MALLOC_FAILURE);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-09-11 22:03:39 +08:00
|
|
|
if (data != NULL && datalen > 0) {
|
|
|
|
i = (*collector)->length; /* BUF_MEM_grow() changes it! */
|
|
|
|
|
|
|
|
if (!BUF_MEM_grow(*collector, i + datalen))
|
|
|
|
return 0;
|
2019-08-30 22:54:47 +08:00
|
|
|
memcpy((*collector)->data + i, data, datalen);
|
2019-09-11 22:03:39 +08:00
|
|
|
}
|
2019-08-30 22:34:27 +08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2018-06-22 05:16:18 +08:00
|
|
|
static int pkey_kdf_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
|
|
|
|
{
|
2019-08-21 06:06:29 +08:00
|
|
|
EVP_PKEY_KDF_CTX *pkctx = ctx->data;
|
2019-08-30 20:32:55 +08:00
|
|
|
EVP_KDF_CTX *kctx = pkctx->kctx;
|
2019-08-21 06:06:29 +08:00
|
|
|
enum { T_OCTET_STRING, T_UINT64, T_DIGEST, T_INT } cmd;
|
|
|
|
const char *name, *mdname;
|
2019-08-30 20:32:55 +08:00
|
|
|
BUF_MEM **collector = NULL;
|
|
|
|
OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
|
2018-06-22 05:16:18 +08:00
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case EVP_PKEY_CTRL_PASS:
|
2019-08-21 06:06:29 +08:00
|
|
|
cmd = T_OCTET_STRING;
|
|
|
|
name = OSSL_KDF_PARAM_PASSWORD;
|
2018-06-22 05:16:18 +08:00
|
|
|
break;
|
|
|
|
case EVP_PKEY_CTRL_HKDF_SALT:
|
|
|
|
case EVP_PKEY_CTRL_SCRYPT_SALT:
|
2019-08-21 06:06:29 +08:00
|
|
|
cmd = T_OCTET_STRING;
|
|
|
|
name = OSSL_KDF_PARAM_SALT;
|
2018-06-22 05:16:18 +08:00
|
|
|
break;
|
|
|
|
case EVP_PKEY_CTRL_TLS_MD:
|
|
|
|
case EVP_PKEY_CTRL_HKDF_MD:
|
2019-08-21 06:06:29 +08:00
|
|
|
cmd = T_DIGEST;
|
|
|
|
name = OSSL_KDF_PARAM_DIGEST;
|
2018-06-22 05:16:18 +08:00
|
|
|
break;
|
|
|
|
case EVP_PKEY_CTRL_TLS_SECRET:
|
2019-08-21 06:06:29 +08:00
|
|
|
cmd = T_OCTET_STRING;
|
|
|
|
name = OSSL_KDF_PARAM_SECRET;
|
2019-08-30 20:32:55 +08:00
|
|
|
/*
|
|
|
|
* Perform the semantics described in
|
|
|
|
* EVP_PKEY_CTX_add1_tls1_prf_seed(3)
|
|
|
|
*/
|
2019-09-03 12:28:47 +08:00
|
|
|
if (ctx->pmeth->pkey_id == NID_tls1_prf) {
|
2019-08-30 20:32:55 +08:00
|
|
|
BUF_MEM_free(pkctx->collected_seed);
|
2019-09-03 12:28:47 +08:00
|
|
|
pkctx->collected_seed = NULL;
|
|
|
|
}
|
2018-06-22 05:16:18 +08:00
|
|
|
break;
|
|
|
|
case EVP_PKEY_CTRL_TLS_SEED:
|
2019-08-21 06:06:29 +08:00
|
|
|
cmd = T_OCTET_STRING;
|
|
|
|
name = OSSL_KDF_PARAM_SEED;
|
2019-08-30 20:32:55 +08:00
|
|
|
collector = &pkctx->collected_seed;
|
2018-06-22 05:16:18 +08:00
|
|
|
break;
|
|
|
|
case EVP_PKEY_CTRL_HKDF_KEY:
|
2019-08-21 06:06:29 +08:00
|
|
|
cmd = T_OCTET_STRING;
|
|
|
|
name = OSSL_KDF_PARAM_KEY;
|
2018-06-22 05:16:18 +08:00
|
|
|
break;
|
|
|
|
case EVP_PKEY_CTRL_HKDF_INFO:
|
2019-08-21 06:06:29 +08:00
|
|
|
cmd = T_OCTET_STRING;
|
|
|
|
name = OSSL_KDF_PARAM_INFO;
|
2019-08-30 20:32:55 +08:00
|
|
|
collector = &pkctx->collected_info;
|
2018-06-22 05:16:18 +08:00
|
|
|
break;
|
|
|
|
case EVP_PKEY_CTRL_HKDF_MODE:
|
2019-08-21 06:06:29 +08:00
|
|
|
cmd = T_INT;
|
|
|
|
name = OSSL_KDF_PARAM_MODE;
|
2018-06-22 05:16:18 +08:00
|
|
|
break;
|
|
|
|
case EVP_PKEY_CTRL_SCRYPT_N:
|
2019-08-21 06:06:29 +08:00
|
|
|
cmd = T_UINT64;
|
|
|
|
name = OSSL_KDF_PARAM_SCRYPT_N;
|
2018-06-22 05:16:18 +08:00
|
|
|
break;
|
|
|
|
case EVP_PKEY_CTRL_SCRYPT_R:
|
2019-08-21 06:06:29 +08:00
|
|
|
cmd = T_UINT64; /* Range checking occurs on the provider side */
|
|
|
|
name = OSSL_KDF_PARAM_SCRYPT_R;
|
2018-06-22 05:16:18 +08:00
|
|
|
break;
|
|
|
|
case EVP_PKEY_CTRL_SCRYPT_P:
|
2019-08-21 06:06:29 +08:00
|
|
|
cmd = T_UINT64; /* Range checking occurs on the provider side */
|
|
|
|
name = OSSL_KDF_PARAM_SCRYPT_P;
|
2018-06-22 05:16:18 +08:00
|
|
|
break;
|
|
|
|
case EVP_PKEY_CTRL_SCRYPT_MAXMEM_BYTES:
|
2019-08-21 06:06:29 +08:00
|
|
|
cmd = T_UINT64;
|
|
|
|
name = OSSL_KDF_PARAM_SCRYPT_MAXMEM;
|
2018-06-22 05:16:18 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return -2;
|
|
|
|
}
|
|
|
|
|
2019-08-30 20:32:55 +08:00
|
|
|
if (collector != NULL) {
|
|
|
|
switch (cmd) {
|
|
|
|
case T_OCTET_STRING:
|
2019-08-30 22:34:27 +08:00
|
|
|
return collect(collector, p2, p1);
|
2019-08-30 20:32:55 +08:00
|
|
|
default:
|
|
|
|
OPENSSL_assert("You shouldn't be here");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2018-06-22 05:16:18 +08:00
|
|
|
switch (cmd) {
|
2019-08-21 06:06:29 +08:00
|
|
|
case T_OCTET_STRING:
|
2019-08-30 20:32:55 +08:00
|
|
|
params[0] =
|
|
|
|
OSSL_PARAM_construct_octet_string(name, (unsigned char *)p2,
|
|
|
|
(size_t)p1);
|
2019-08-21 06:06:29 +08:00
|
|
|
break;
|
2018-06-22 05:16:18 +08:00
|
|
|
|
2019-08-21 06:06:29 +08:00
|
|
|
case T_DIGEST:
|
|
|
|
mdname = EVP_MD_name((const EVP_MD *)p2);
|
2019-08-30 20:32:55 +08:00
|
|
|
params[0] = OSSL_PARAM_construct_utf8_string(name, (char *)mdname,
|
|
|
|
strlen(mdname) + 1);
|
2019-08-21 06:06:29 +08:00
|
|
|
break;
|
2018-06-22 05:16:18 +08:00
|
|
|
|
2019-08-21 06:06:29 +08:00
|
|
|
/*
|
|
|
|
* These are special because the helper macros pass a pointer to the
|
|
|
|
* stack, so a local copy is required.
|
|
|
|
*/
|
|
|
|
case T_INT:
|
2019-08-30 20:32:55 +08:00
|
|
|
params[0] = OSSL_PARAM_construct_int(name, &p1);
|
2019-08-21 06:06:29 +08:00
|
|
|
break;
|
2018-06-22 05:16:18 +08:00
|
|
|
|
2019-08-21 06:06:29 +08:00
|
|
|
case T_UINT64:
|
2019-08-30 20:32:55 +08:00
|
|
|
params[0] = OSSL_PARAM_construct_uint64(name, (uint64_t *)p2);
|
2019-08-21 06:06:29 +08:00
|
|
|
break;
|
2018-06-22 05:16:18 +08:00
|
|
|
}
|
2019-08-30 20:32:55 +08:00
|
|
|
|
|
|
|
return EVP_KDF_CTX_set_params(kctx, params);
|
2018-06-22 05:16:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int pkey_kdf_ctrl_str(EVP_PKEY_CTX *ctx, const char *type,
|
|
|
|
const char *value)
|
|
|
|
{
|
2019-08-21 06:06:29 +08:00
|
|
|
EVP_PKEY_KDF_CTX *pkctx = ctx->data;
|
|
|
|
EVP_KDF_CTX *kctx = pkctx->kctx;
|
|
|
|
const EVP_KDF *kdf = EVP_KDF_CTX_kdf(kctx);
|
2019-08-30 22:34:27 +08:00
|
|
|
BUF_MEM **collector = NULL;
|
2019-08-21 06:06:29 +08:00
|
|
|
const OSSL_PARAM *defs = EVP_KDF_CTX_settable_params(kdf);
|
2019-08-30 20:32:55 +08:00
|
|
|
OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
|
|
|
|
int ok = 0;
|
2018-06-22 05:16:18 +08:00
|
|
|
|
2019-08-21 06:06:29 +08:00
|
|
|
/* Deal with ctrl name aliasing */
|
2018-06-22 05:16:18 +08:00
|
|
|
if (strcmp(type, "md") == 0)
|
2019-08-21 06:06:29 +08:00
|
|
|
type = OSSL_KDF_PARAM_DIGEST;
|
|
|
|
/* scrypt uses 'N', params uses 'n' */
|
|
|
|
if (strcmp(type, "N") == 0)
|
|
|
|
type = OSSL_KDF_PARAM_SCRYPT_N;
|
|
|
|
|
2019-08-30 20:32:55 +08:00
|
|
|
if (!OSSL_PARAM_allocate_from_text(¶ms[0], defs, type,
|
|
|
|
value, strlen(value)))
|
2019-08-21 06:06:29 +08:00
|
|
|
return 0;
|
2019-08-30 22:34:27 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* We do the same special casing of seed and info here as in
|
|
|
|
* pkey_kdf_ctrl()
|
|
|
|
*/
|
|
|
|
if (strcmp(params[0].key, OSSL_KDF_PARAM_SEED) == 0)
|
|
|
|
collector = &pkctx->collected_seed;
|
|
|
|
else if (strcmp(params[0].key, OSSL_KDF_PARAM_INFO) == 0)
|
|
|
|
collector = &pkctx->collected_info;
|
|
|
|
|
|
|
|
if (collector != NULL)
|
|
|
|
ok = collect(collector, params[0].data, params[0].data_size);
|
|
|
|
else
|
|
|
|
ok = EVP_KDF_CTX_set_params(kctx, params);
|
2019-08-30 20:32:55 +08:00
|
|
|
OPENSSL_free(params[0].data);
|
|
|
|
return ok;
|
2018-06-22 05:16:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int pkey_kdf_derive_init(EVP_PKEY_CTX *ctx)
|
|
|
|
{
|
2019-08-21 06:06:29 +08:00
|
|
|
EVP_PKEY_KDF_CTX *pkctx = ctx->data;
|
2018-06-22 05:16:18 +08:00
|
|
|
|
2019-08-30 20:32:55 +08:00
|
|
|
pkey_kdf_free_collected(pkctx);
|
|
|
|
if (pkctx->kctx != NULL)
|
|
|
|
EVP_KDF_reset(pkctx->kctx);
|
2018-06-22 05:16:18 +08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For fixed-output algorithms the keylen parameter is an "out" parameter
|
|
|
|
* otherwise it is an "in" parameter.
|
|
|
|
*/
|
|
|
|
static int pkey_kdf_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
|
|
|
|
size_t *keylen)
|
|
|
|
{
|
2019-08-21 06:06:29 +08:00
|
|
|
EVP_PKEY_KDF_CTX *pkctx = ctx->data;
|
|
|
|
EVP_KDF_CTX *kctx = pkctx->kctx;
|
2018-06-22 05:16:18 +08:00
|
|
|
size_t outlen = EVP_KDF_size(kctx);
|
2019-08-21 06:06:29 +08:00
|
|
|
int r;
|
2018-06-22 05:16:18 +08:00
|
|
|
|
2019-08-30 20:32:55 +08:00
|
|
|
if (pkctx->collected_seed != NULL) {
|
|
|
|
OSSL_PARAM params[] = { OSSL_PARAM_END, OSSL_PARAM_END };
|
|
|
|
|
|
|
|
params[0] =
|
|
|
|
OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SEED,
|
|
|
|
pkctx->collected_seed->data,
|
|
|
|
pkctx->collected_seed->length);
|
|
|
|
|
|
|
|
r = EVP_KDF_CTX_set_params(kctx, params);
|
|
|
|
pkey_kdf_free_collected(pkctx);
|
|
|
|
if (!r)
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (pkctx->collected_info != NULL) {
|
|
|
|
OSSL_PARAM params[] = { OSSL_PARAM_END, OSSL_PARAM_END };
|
|
|
|
|
|
|
|
params[0] =
|
|
|
|
OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,
|
|
|
|
pkctx->collected_info->data,
|
|
|
|
pkctx->collected_info->length);
|
|
|
|
|
|
|
|
r = EVP_KDF_CTX_set_params(kctx, params);
|
|
|
|
pkey_kdf_free_collected(pkctx);
|
2019-08-21 06:06:29 +08:00
|
|
|
if (!r)
|
|
|
|
return 0;
|
|
|
|
}
|
2018-06-22 05:16:18 +08:00
|
|
|
if (outlen == 0 || outlen == SIZE_MAX) {
|
|
|
|
/* Variable-output algorithm */
|
|
|
|
if (key == NULL)
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
/* Fixed-output algorithm */
|
|
|
|
*keylen = outlen;
|
|
|
|
if (key == NULL)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return EVP_KDF_derive(kctx, key, *keylen);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef OPENSSL_NO_SCRYPT
|
2019-09-19 21:31:27 +08:00
|
|
|
static const EVP_PKEY_METHOD scrypt_pkey_meth = {
|
2018-06-22 05:16:18 +08:00
|
|
|
EVP_PKEY_SCRYPT,
|
|
|
|
0,
|
|
|
|
pkey_kdf_init,
|
|
|
|
0,
|
|
|
|
pkey_kdf_cleanup,
|
|
|
|
|
|
|
|
0, 0,
|
|
|
|
0, 0,
|
|
|
|
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
|
|
|
|
0, 0,
|
|
|
|
|
|
|
|
0, 0, 0, 0,
|
|
|
|
|
|
|
|
0, 0,
|
|
|
|
|
|
|
|
0, 0,
|
|
|
|
|
|
|
|
pkey_kdf_derive_init,
|
|
|
|
pkey_kdf_derive,
|
|
|
|
pkey_kdf_ctrl,
|
|
|
|
pkey_kdf_ctrl_str
|
|
|
|
};
|
2019-09-19 21:31:27 +08:00
|
|
|
|
|
|
|
const EVP_PKEY_METHOD *scrypt_pkey_method(void)
|
|
|
|
{
|
|
|
|
return &scrypt_pkey_meth;
|
|
|
|
}
|
2018-06-22 05:16:18 +08:00
|
|
|
#endif
|
|
|
|
|
2019-09-19 21:31:27 +08:00
|
|
|
static const EVP_PKEY_METHOD tls1_prf_pkey_meth = {
|
2018-06-22 05:16:18 +08:00
|
|
|
EVP_PKEY_TLS1_PRF,
|
|
|
|
0,
|
|
|
|
pkey_kdf_init,
|
|
|
|
0,
|
|
|
|
pkey_kdf_cleanup,
|
|
|
|
|
|
|
|
0, 0,
|
|
|
|
0, 0,
|
|
|
|
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
|
|
|
|
0, 0,
|
|
|
|
|
|
|
|
0, 0, 0, 0,
|
|
|
|
|
|
|
|
0, 0,
|
|
|
|
|
|
|
|
0, 0,
|
|
|
|
|
|
|
|
pkey_kdf_derive_init,
|
|
|
|
pkey_kdf_derive,
|
|
|
|
pkey_kdf_ctrl,
|
|
|
|
pkey_kdf_ctrl_str
|
|
|
|
};
|
|
|
|
|
2019-09-19 21:31:27 +08:00
|
|
|
const EVP_PKEY_METHOD *tls1_prf_pkey_method(void)
|
|
|
|
{
|
|
|
|
return &tls1_prf_pkey_meth;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const EVP_PKEY_METHOD hkdf_pkey_meth = {
|
2018-06-22 05:16:18 +08:00
|
|
|
EVP_PKEY_HKDF,
|
|
|
|
0,
|
|
|
|
pkey_kdf_init,
|
|
|
|
0,
|
|
|
|
pkey_kdf_cleanup,
|
|
|
|
|
|
|
|
0, 0,
|
|
|
|
0, 0,
|
|
|
|
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
|
|
|
|
0, 0,
|
|
|
|
|
|
|
|
0, 0, 0, 0,
|
|
|
|
|
|
|
|
0, 0,
|
|
|
|
|
|
|
|
0, 0,
|
|
|
|
|
|
|
|
pkey_kdf_derive_init,
|
|
|
|
pkey_kdf_derive,
|
|
|
|
pkey_kdf_ctrl,
|
|
|
|
pkey_kdf_ctrl_str
|
|
|
|
};
|
|
|
|
|
2019-09-19 21:31:27 +08:00
|
|
|
const EVP_PKEY_METHOD *hkdf_pkey_method(void)
|
|
|
|
{
|
|
|
|
return &hkdf_pkey_meth;
|
|
|
|
}
|