Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
photon-beetle-hkdf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Southern Storm Software, Pty Ltd.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef LWCRYPTO_PHOTON_BEETLE_HKDF_H
24 #define LWCRYPTO_PHOTON_BEETLE_HKDF_H
25 
26 #include <stddef.h>
27 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
43 #define PHOTON_BEETLE_HKDF_OUTPUT_SIZE 32
44 
49 typedef struct
50 {
52  unsigned char prk[PHOTON_BEETLE_HKDF_OUTPUT_SIZE];
53 
55  unsigned char out[PHOTON_BEETLE_HKDF_OUTPUT_SIZE];
56 
58  unsigned char counter;
59 
61  unsigned char posn;
62 
64 
83  (unsigned char *out, size_t outlen,
84  const unsigned char *key, size_t keylen,
85  const unsigned char *salt, size_t saltlen,
86  const unsigned char *info, size_t infolen);
87 
101  const unsigned char *key, size_t keylen,
102  const unsigned char *salt, size_t saltlen);
103 
118  const unsigned char *info, size_t infolen,
119  unsigned char *out, size_t outlen);
120 
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
132 #endif
#define PHOTON_BEETLE_HKDF_OUTPUT_SIZE
Default output block size for PHOTON-Beetle-HKDF. Key material is generated in blocks of this size...
Definition: photon-beetle-hkdf.h:43
void photon_beetle_hkdf_free(photon_beetle_hkdf_state_t *state)
Frees all sensitive material in a PHOTON-Beetle-HKDF state.
int photon_beetle_hkdf(unsigned char *out, size_t outlen, const unsigned char *key, size_t keylen, const unsigned char *salt, size_t saltlen, const unsigned char *info, size_t infolen)
Derives key material using PHOTON-Beetle-HKDF.
void photon_beetle_hkdf_extract(photon_beetle_hkdf_state_t *state, const unsigned char *key, size_t keylen, const unsigned char *salt, size_t saltlen)
Extracts entropy from a key and salt for PHOTON-Beetle-HKDF.
unsigned char counter
Definition: photon-beetle-hkdf.h:58
int photon_beetle_hkdf_expand(photon_beetle_hkdf_state_t *state, const unsigned char *info, size_t infolen, unsigned char *out, size_t outlen)
Expands key material using a PHOTON-Beetle-HKDF state.
State for incremental generation of key material from PHOTON-Beetle-HKDF.
Definition: photon-beetle-hkdf.h:49
unsigned char posn
Definition: photon-beetle-hkdf.h:61