| 1 |
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 |
// SPDX-License-Identifier: Apache-2.0 OR ISC |
| 3 |
|
| 4 |
#ifndef OPENSSL_HEADER_KDF_INTERNAL_H |
| 5 |
#define OPENSSL_HEADER_KDF_INTERNAL_H |
| 6 |
|
| 7 |
#include <openssl/digest.h> |
| 8 |
#include <openssl/hmac.h> |
| 9 |
|
| 10 |
#define SSKDF_MAX_INPUT_LEN (1 << 30) |
| 11 |
#define SSKDF_COUNTER_SIZE 4 |
| 12 |
|
| 13 |
#define KBKDF_COUNTER_SIZE 4 |
| 14 |
|
| 15 |
typedef struct { |
| 16 |
void *data; |
| 17 |
} sskdf_variant_ctx; |
| 18 |
|
| 19 |
typedef struct { |
| 20 |
const EVP_MD *digest; |
| 21 |
EVP_MD_CTX *md_ctx; |
| 22 |
} sskdf_variant_digest_ctx; |
| 23 |
|
| 24 |
typedef struct { |
| 25 |
HMAC_CTX *hmac_ctx; |
| 26 |
} sskdf_variant_hmac_ctx; |
| 27 |
|
| 28 |
typedef struct { |
| 29 |
size_t (*h_output_bytes)(sskdf_variant_ctx *ctx); |
| 30 |
int (*compute)(sskdf_variant_ctx *ctx, uint8_t *out, size_t out_len, |
| 31 |
const uint8_t counter[SSKDF_COUNTER_SIZE], |
| 32 |
const uint8_t *secret, size_t secret_len, const uint8_t *info, |
| 33 |
size_t info_len); |
| 34 |
} sskdf_variant; |
| 35 |
|
| 36 |
const sskdf_variant *sskdf_variant_digest(void); |
| 37 |
|
| 38 |
const sskdf_variant *sskdf_variant_hmac(void); |
| 39 |
|
| 40 |
#endif // OPENSSL_HEADER_KDF_INTERNAL_H |