libcoap
4.3.5
Toggle main menu visibility
Loading...
Searching...
No Matches
oscore_crypto.h
Go to the documentation of this file.
1
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
3
/*
4
* Copyright (c) 2018, SICS, RISE AB
5
* All rights reserved.
6
*
7
* Redistribution and use in source and binary forms, with or without
8
* modification, are permitted provided that the following conditions
9
* are met:
10
* 1. Redistributions of source code must retain the above copyright
11
* notice, this list of conditions and the following disclaimer.
12
* 2. Redistributions in binary form must reproduce the above copyright
13
* notice, this list of conditions and the following disclaimer in the
14
* documentation and/or other materials provided with the distribution.
15
* 3. Neither the name of the Institute nor the names of its contributors
16
* may be used to endorse or promote products derived from this software
17
* without specific prior written permission.
18
*
19
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
20
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
23
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29
* SUCH DAMAGE.
30
*
31
*/
32
47
48
#ifndef _OSCORE_CRYPTO_H
49
#define _OSCORE_CRYPTO_H
50
51
#include <
coap3/coap_internal.h
>
52
58
59
#define HKDF_INFO_MAXLEN 25
60
#define HKDF_OUTPUT_MAXLEN 25
61
#define AES_CCM_TAG 8
62
63
/* Plaintext Maxlen and Tag Maxlen is quite generous. */
64
#define AEAD_PLAINTEXT_MAXLEN COAP_MAX_CHUNK_SIZE
65
#define AEAD_TAG_MAXLEN COAP_MAX_CHUNK_SIZE
66
77
int
oscore_hmac_hash
(
cose_hmac_alg_t
hmac_alg,
78
coap_bin_const_t
*key,
79
coap_bin_const_t
*data,
80
coap_bin_const_t
**hmac);
81
94
int
oscore_hkdf_extract
(
cose_hkdf_alg_t
hkdf_alg,
95
coap_bin_const_t
*salt,
96
coap_bin_const_t
*ikm,
97
coap_bin_const_t
**hkdf_extract);
98
112
int
oscore_hkdf_expand
(
cose_hkdf_alg_t
hkdf_alg,
113
coap_bin_const_t
*prk,
114
uint8_t *info,
115
size_t
info_len,
116
uint8_t *okm,
117
size_t
okm_len);
118
133
int
oscore_hkdf
(
cose_hkdf_alg_t
hkdf_alg,
134
coap_bin_const_t
*salt,
135
coap_bin_const_t
*ikm,
136
uint8_t *info,
137
size_t
info_len,
138
uint8_t *okm,
139
size_t
okm_len);
140
142
143
#endif
/* _OSCORE_CRYPTO_H */
coap_internal.h
Pulls together all the internal only header files.
cose_hkdf_alg_t
cose_hkdf_alg_t
Definition
oscore_cose.h:165
cose_hmac_alg_t
cose_hmac_alg_t
Definition
oscore_cose.h:157
oscore_hkdf_expand
int oscore_hkdf_expand(cose_hkdf_alg_t hkdf_alg, coap_bin_const_t *prk, uint8_t *info, size_t info_len, uint8_t *okm, size_t okm_len)
Derive the key using HKDF-Expand() function.
Definition
oscore_crypto.c:101
oscore_hkdf
int oscore_hkdf(cose_hkdf_alg_t hkdf_alg, coap_bin_const_t *salt, coap_bin_const_t *ikm, uint8_t *info, size_t info_len, uint8_t *okm, size_t okm_len)
Derive the key using HKDF() function.
Definition
oscore_crypto.c:158
oscore_hmac_hash
int oscore_hmac_hash(cose_hmac_alg_t hmac_alg, coap_bin_const_t *key, coap_bin_const_t *data, coap_bin_const_t **hmac)
Derive the hmac hash using HMAC-HASH() function.
Definition
oscore_crypto.c:57
oscore_hkdf_extract
int oscore_hkdf_extract(cose_hkdf_alg_t hkdf_alg, coap_bin_const_t *salt, coap_bin_const_t *ikm, coap_bin_const_t **hkdf_extract)
Derive the pseudorandom key using HKDF-Extract() function.
Definition
oscore_crypto.c:73
coap_bin_const_t
CoAP binary data definition with const data.
Definition
coap_str.h:64
include
oscore
oscore_crypto.h
Generated on
for libcoap by
1.17.0