mirror of https://github.com/ARMmbed/mbed-os.git
Update Nanostack binaries to 5.0.6
parent
cbce88d422
commit
bf8d8211fa
|
|
@ -0,0 +1,107 @@
|
|||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Export FEATURE_NANOSTACK libraries into mbed OS
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# To remove all repositories call: ./clone_client.sh clean
|
||||
# To replace all with clone repositores: ./clone_client.sh clone
|
||||
# To export from cloned repositories: ./clone_client.sh export
|
||||
#
|
||||
# For developers:
|
||||
# Use "clone" functionality to get master repositories to work with.
|
||||
#
|
||||
# For maintainers: Creating a release
|
||||
# Use "clone" to get master repositories.
|
||||
# For every directory checkout the release branch.
|
||||
# Now use "export" function to flatten the git repositories into bare directories
|
||||
# Now you can "git add" each directory and do "git commit"
|
||||
#
|
||||
# Note "clone" does implicit "clean" so you lose all changes done into directories.
|
||||
|
||||
|
||||
# REPOSITORIES and DIRECTORIES are array of repositories where to clone
|
||||
# and directories where to clone
|
||||
# these arrays MUST be in sync
|
||||
# * Same number of elements
|
||||
# * Same order. Each line should have maching pair in same index at other array
|
||||
REPOSITORIES=(
|
||||
git@github.com:ARMmbed/sal-stack-nanostack.git
|
||||
git@github.com:ARMmbed/coap-service.git
|
||||
)
|
||||
|
||||
DIRECTORIES=(
|
||||
sal-stack-nanostack
|
||||
coap-service
|
||||
)
|
||||
|
||||
# Exit immediately on fail, thread unset variables as error
|
||||
set -eu
|
||||
|
||||
# Count number of repositories
|
||||
N=0
|
||||
for repo in ${REPOSITORIES[*]}; do
|
||||
let N=N+1
|
||||
done
|
||||
let N=N-1 # Substract one, because indexes start from 0
|
||||
|
||||
print_usage() {
|
||||
echo -e "Usage: $0 [clean | clone | export ]"
|
||||
echo -e "\tclean : Remove all repositories"
|
||||
echo -e "\tclone : Replace repositories with Git cone"
|
||||
echo -e "\texport : Export cloned Git repositories"
|
||||
}
|
||||
|
||||
clean() {
|
||||
for dir in ${DIRECTORIES[*]}; do
|
||||
rm -rf $dir
|
||||
done
|
||||
clean_nanostack_binaries
|
||||
}
|
||||
|
||||
clone() {
|
||||
for i in $(seq 0 $N); do
|
||||
git clone ${REPOSITORIES[$i]} ${DIRECTORIES[$i]}
|
||||
done
|
||||
}
|
||||
|
||||
export_repos() {
|
||||
for i in $(seq 0 $N); do
|
||||
echo "Exporting ${DIRECTORIES[$i]}"
|
||||
cd ${DIRECTORIES[$i]}
|
||||
git archive HEAD -o ../${DIRECTORIES[$i]}.tar.gz
|
||||
cd ..
|
||||
rm -rf ${DIRECTORIES[$i]}
|
||||
mkdir ${DIRECTORIES[$i]}
|
||||
tar xzf ${DIRECTORIES[$i]}.tar.gz -C ${DIRECTORIES[$i]}
|
||||
rm ${DIRECTORIES[$i]}.tar.gz
|
||||
done
|
||||
}
|
||||
|
||||
copy_nanostack_binaries() {
|
||||
mkdir -p ../nanostack-binaries
|
||||
mv sal-stack-nanostack/FEATURE_* ../nanostack-binaries/
|
||||
}
|
||||
|
||||
clean_nanostack_binaries() {
|
||||
rm -rf ../nanostack-binaries
|
||||
}
|
||||
|
||||
case "${1-}" in
|
||||
clean)
|
||||
clean
|
||||
;;
|
||||
clone)
|
||||
clean
|
||||
clone
|
||||
;;
|
||||
export)
|
||||
export_repos
|
||||
copy_nanostack_binaries
|
||||
;;
|
||||
*)
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
# Change Log
|
||||
|
||||
## [v4.0.3](https://github.com/ARMmbed/coap-service/releases/tag/v4.0.3) (15-Sep-2016)
|
||||
[Full Changelog](https://github.com/ARMmbed/coap-service/compare/mbed-os-5.0-rc1...v4.0.3)
|
||||
|
||||
** New feature **
|
||||
|
||||
- Updated coap-service to use new structure from mbed-client-c
|
||||
- Set link layer security when opening socket.
|
||||
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
commit 0fcd1d4254ca30c2d96ef51a5df513912b5fb133 (HEAD, tag: v4.0.3, origin/master, origin/HEAD, master)
|
||||
Author: Antti Kauppila <antti.kauppila@arm.com>
|
||||
Date: Thu Sep 15 15:21:03 2016 +0300
|
||||
|
||||
version v4.0.3
|
||||
|
||||
commit 4769b274ece0989cc43de614171bd20cca0b0a27
|
||||
Author: Antti Kauppila <antti.kauppila@arm.com>
|
||||
Date: Thu Sep 15 15:18:55 2016 +0300
|
||||
|
||||
version v4.0.2
|
||||
|
||||
commit 078bd0db248955c7f09bc53fa1de3e1a2f2eac4e
|
||||
Merge: 70447c3 bc636c0
|
||||
Author: Antti Kauppila <antti.kauppila@arm.com>
|
||||
Date: Thu Sep 15 15:17:41 2016 +0300
|
||||
|
||||
Merge pull request #32 from ARMmbed/coap-option-tidy
|
||||
|
||||
Coap option tidy
|
||||
|
||||
commit bc636c0621f0a895e62b6dc23ecd7a261f18ed7e (origin/coap-option-tidy)
|
||||
Author: Antti Kauppila <antti.kauppila@arm.com>
|
||||
Date: Thu Sep 15 10:42:29 2016 +0300
|
||||
|
||||
mbed-client-c version updated
|
||||
|
||||
commit 73d5163e4ef07ee10b494290761cf977ae6a6f28
|
||||
Author: Antti Kauppila <antti.kauppila@arm.com>
|
||||
Date: Thu Sep 8 18:13:26 2016 +0300
|
||||
|
||||
New CoAP changes updated to this library
|
||||
|
||||
Unittests updated also
|
||||
|
||||
commit 70447c3e35426be19fb1885aaa85e645f2ee144d
|
||||
Author: Tero Heinonen <tero.heinonen@arm.com>
|
||||
Date: Wed Aug 17 14:30:36 2016 +0300
|
||||
|
||||
Set link layer security when opening socket. (#30)
|
||||
|
|
@ -321,10 +321,11 @@ int coap_security_handler_connect(coap_security_t *sec, bool is_server, SecureSo
|
|||
return -1;
|
||||
}
|
||||
|
||||
//TODO: Only needed for server type?
|
||||
#ifdef MBEDTLS_SSL_SRV_C
|
||||
mbedtls_ssl_conf_dtls_cookies(&sec->_conf, simple_cookie_write,
|
||||
simple_cookie_check,
|
||||
&sec->_cookie);
|
||||
#endif
|
||||
|
||||
sec->_is_started = true;
|
||||
|
||||
|
|
@ -416,10 +417,11 @@ int coap_security_handler_connect_non_blocking(coap_security_t *sec, bool is_ser
|
|||
return -1;
|
||||
}
|
||||
|
||||
//Only needed for server type?
|
||||
#ifdef MBEDTLS_SSL_SRV_C
|
||||
mbedtls_ssl_conf_dtls_cookies(&sec->_conf, simple_cookie_write,
|
||||
simple_cookie_check,
|
||||
&sec->_cookie);
|
||||
#endif
|
||||
|
||||
mbedtls_ssl_conf_min_version(&sec->_conf, MBEDTLS_SSL_MAJOR_VERSION_3, MBEDTLS_SSL_MAJOR_VERSION_3);
|
||||
mbedtls_ssl_conf_max_version(&sec->_conf, MBEDTLS_SSL_MAJOR_VERSION_3, MBEDTLS_SSL_MAJOR_VERSION_3);
|
||||
|
|
|
|||
0
features/net/FEATURE_NANOSTACK/coap-service/test/coap-service/unittest/run_tests
Normal file → Executable file
0
features/net/FEATURE_NANOSTACK/coap-service/test/coap-service/unittest/run_tests
Normal file → Executable file
|
|
@ -1,6 +0,0 @@
|
|||
Dependencies for sal-stack-nanostack library are:
|
||||
* mbed-client-c > 0.1.6
|
||||
* nanostack-libservice > 3.0.0
|
||||
* sal-stack-nanostack-eventloop > 0.0.8
|
||||
* nanostack-randlib > 0.0.4
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
#error "No binary build of IPV6/6LoWPAN/Thread stack available for this platform currently."
|
||||
|
|
@ -1 +0,0 @@
|
|||
#error "No binary build of IPV6/6LoWPAN/Thread stack available for this platform currently."
|
||||
|
|
@ -1 +0,0 @@
|
|||
#error "No binary build of IPV6/6LoWPAN/Thread stack available for this platform currently."
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1 +0,0 @@
|
|||
#error "No binary build of IPV6/6LoWPAN/Thread stack available for this platform currently."
|
||||
|
|
@ -1 +0,0 @@
|
|||
#error "No binary build of IPV6/6LoWPAN/Thread stack available for this platform currently."
|
||||
|
|
@ -1 +0,0 @@
|
|||
#error "No binary build of IPV6/6LoWPAN/Thread stack available for this platform currently."
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1 +0,0 @@
|
|||
#error "No binary build of IPV6/6LoWPAN/Thread stack available for this platform currently."
|
||||
|
|
@ -1 +0,0 @@
|
|||
#error "No binary build of IPV6/6LoWPAN/Thread stack available for this platform currently."
|
||||
|
|
@ -1 +0,0 @@
|
|||
#error "No binary build of IPV6/6LoWPAN/Thread stack available for this platform currently."
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -59,6 +59,12 @@
|
|||
#define TX_OPT_MULTICAST_HOP_LIMIT_64 0x02 /**< Use multicast hop limit of 64. */
|
||||
///@}
|
||||
|
||||
typedef enum dhcp_instance_type
|
||||
{
|
||||
DHCP_INSTANCE_CLIENT,
|
||||
DHCP_INSTANCE_SERVER
|
||||
} dhcp_instance_type_e;
|
||||
|
||||
/**
|
||||
* \brief DHCP Service receive callback.
|
||||
*
|
||||
|
|
@ -96,14 +102,18 @@ typedef int (dhcp_service_receive_resp_cb)(uint16_t instance_id, void *ptr, uint
|
|||
|
||||
|
||||
/**
|
||||
* \brief Initialize the server instance.
|
||||
* \brief Initialize a new DHCP service instance.
|
||||
*
|
||||
* Creates and shares the socket for other DHCP services.
|
||||
*
|
||||
* \param interface_id Interface for the new DHCP instance.
|
||||
* \param instance_type The type of the new DHCP instance.
|
||||
* \param A callback function to receive DHCP messages.
|
||||
*
|
||||
* \return Instance ID that is used to identify the service.
|
||||
*/
|
||||
|
||||
uint16_t dhcp_service_init(int8_t interface_id, dhcp_service_receive_req_cb *receive_req_cb);
|
||||
uint16_t dhcp_service_init(int8_t interface_id, dhcp_instance_type_e instance_type, dhcp_service_receive_req_cb *receive_req_cb);
|
||||
|
||||
/**
|
||||
* \brief Deletes a server instance.
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ extern "C" {
|
|||
|
||||
#include "ns_types.h"
|
||||
|
||||
|
||||
#define thread_test_router_upgrade(iface) thread_test_router_id_request_send(iface, 2) // THREAD_COAP_STATUS_TLV_TOO_FEW_ROUTERS
|
||||
/**
|
||||
* \brief Add a static neighbour
|
||||
*
|
||||
|
|
@ -174,15 +174,7 @@ int thread_test_set_context_id_reuse_timeout(
|
|||
* \return <0 Remove fail
|
||||
*/
|
||||
int thread_test_remove_router_by_id(int8_t interface_id, uint8_t routerId);
|
||||
/**
|
||||
* \brief Start router upgrade process.
|
||||
*
|
||||
* \param interface_id Network Interface
|
||||
*
|
||||
* \return 0, upgrade started
|
||||
* \return <0 fail
|
||||
*/
|
||||
int thread_test_router_upgrade(int8_t interface_id);
|
||||
|
||||
/**
|
||||
* \brief Start router downgrade process.
|
||||
*
|
||||
|
|
@ -367,7 +359,7 @@ int8_t thread_test_neighbour_info_get(int8_t interface_id, uint8_t index, uint16
|
|||
typedef int (response_cb)(int8_t interface_id, uint8_t *response_ptr, uint16_t response_len);
|
||||
|
||||
/**
|
||||
* \brief Send diagnostic command
|
||||
* \brief Send diagnostic command DEPRECATED
|
||||
*
|
||||
* \param interface_id Network Interface
|
||||
* \param address_ptr Address to which the command is sent
|
||||
|
|
@ -380,6 +372,24 @@ typedef int (response_cb)(int8_t interface_id, uint8_t *response_ptr, uint16_t r
|
|||
*/
|
||||
int thread_test_diagnostic_command_send(int8_t interface_id, uint8_t *address_ptr,const char *uri_ptr, uint8_t request_length, uint8_t *request_ptr, response_cb *resp_cb);
|
||||
|
||||
typedef int (coap_response_cb)(int8_t interface_id, uint8_t message_code, uint8_t message_type, uint8_t *response_ptr, uint16_t response_len);
|
||||
|
||||
/**
|
||||
* \brief Send diagnostic request
|
||||
*
|
||||
* \param interface_id Network Interface
|
||||
* \param address_ptr Address to which the command is sent
|
||||
* \param msg_type Uri for the command
|
||||
* \param msg_code Uri for the command
|
||||
* \param uri_ptr Uri for the command
|
||||
* \param request_length The length of the request
|
||||
* \param request_ptr Pointer to the beginning of the request contents
|
||||
* \param resp_cb Pointer to callback function that is called after the reply for the command is obtained
|
||||
*
|
||||
* \return 0, Command send OK
|
||||
* \return <0 Command send Fail
|
||||
*/
|
||||
int thread_test_coap_request_send(int8_t interface_id, uint8_t *address_ptr, uint16_t port, uint8_t msg_type, uint8_t msg_code, uint16_t content_format, const char *uri_ptr, uint8_t *request_ptr, uint8_t request_length, coap_response_cb *resp_cb);
|
||||
|
||||
/**
|
||||
* \brief Set initial SLAAC iid.
|
||||
|
|
@ -391,6 +401,26 @@ int thread_test_diagnostic_command_send(int8_t interface_id, uint8_t *address_pt
|
|||
*/
|
||||
int8_t thread_test_initial_slaac_iid_set(int8_t interface_id, uint8_t *iid);
|
||||
|
||||
/**
|
||||
* \brief Send router ID request.
|
||||
*
|
||||
* \param interface_id Network Interface
|
||||
* \param status Value of router ID request status TLV
|
||||
* \return 0, Command OK
|
||||
* \return <0 Command Fail
|
||||
*/
|
||||
int8_t thread_test_router_id_request_send(int8_t interface_id, uint8_t status);
|
||||
|
||||
/**
|
||||
* \brief Set joiner port to joiner router device.
|
||||
* If port == 0, then default port is used.
|
||||
*
|
||||
* \param iid Joiner port.
|
||||
* \return 0, Command OK
|
||||
* \return <0 Command Fail
|
||||
*/
|
||||
int8_t thread_test_joiner_router_joiner_port_set(uint16_t port);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -0,0 +1,202 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2016 ARM Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-PBL
|
||||
*
|
||||
* Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.mbed.com/licenses/PBL-1.0
|
||||
*
|
||||
* See the License for the specific language governing permissions and limitations under the License.
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* \file ns_sha256.h
|
||||
*
|
||||
* \brief SHA-256 cryptographic hash function
|
||||
*
|
||||
* This file is derived from sha256.h in mbed TLS 2.3.0.
|
||||
*
|
||||
* This file provides an API very similar to mbed TLS, either implemented
|
||||
* locally, or by calling mbed TLS, depending on NS_USE_EXTERNAL_MBED_TLS.
|
||||
*
|
||||
* Differences from mbed TLS:
|
||||
*
|
||||
* a) ns_ prefix instead of mbedtls_;
|
||||
* b) Pointers are void * instead of unsigned char * to avoid type clashes;
|
||||
* c) SHA-224 not supported;
|
||||
* d) Ability to output truncated hashes.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef NS_SHA256_H_
|
||||
#define NS_SHA256_H_
|
||||
|
||||
#ifdef NS_USE_EXTERNAL_MBED_TLS
|
||||
|
||||
#include <string.h>
|
||||
#include "mbedtls/sha256.h"
|
||||
|
||||
typedef mbedtls_sha256_context ns_sha256_context;
|
||||
|
||||
static inline void ns_sha256_init(ns_sha256_context *ctx)
|
||||
{
|
||||
mbedtls_sha256_init(ctx);
|
||||
}
|
||||
|
||||
static inline void ns_sha256_free(ns_sha256_context *ctx)
|
||||
{
|
||||
mbedtls_sha256_free(ctx);
|
||||
}
|
||||
|
||||
static inline void ns_sha256_clone(ns_sha256_context *dst,
|
||||
const ns_sha256_context *src)
|
||||
{
|
||||
mbedtls_sha256_clone(dst, src);
|
||||
}
|
||||
|
||||
static inline void ns_sha256_starts(ns_sha256_context *ctx)
|
||||
{
|
||||
mbedtls_sha256_starts(ctx, 0);
|
||||
}
|
||||
|
||||
static inline void ns_sha256_update(ns_sha256_context *ctx, const void *input,
|
||||
size_t ilen)
|
||||
{
|
||||
mbedtls_sha256_update(ctx, input, ilen);
|
||||
}
|
||||
|
||||
static inline void ns_sha256_finish(ns_sha256_context *ctx, void *output)
|
||||
{
|
||||
mbedtls_sha256_finish(ctx, output);
|
||||
}
|
||||
|
||||
static inline void ns_sha256(const void *input, size_t ilen, void *output)
|
||||
{
|
||||
mbedtls_sha256(input, ilen, output, 0);
|
||||
}
|
||||
|
||||
/* Extensions to standard mbed TLS - output the first bits of a hash only */
|
||||
/* Number of bits must be a multiple of 32, and <=256 */
|
||||
static inline void ns_sha256_finish_nbits(ns_sha256_context *ctx, void *output, unsigned obits)
|
||||
{
|
||||
if (obits == 256) {
|
||||
mbedtls_sha256_finish(ctx, output);
|
||||
} else {
|
||||
uint8_t sha256[32];
|
||||
mbedtls_sha256_finish(ctx, sha256);
|
||||
memcpy(output, sha256, obits / 8);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void ns_sha256_nbits(const void *input, size_t ilen, void *output, unsigned obits)
|
||||
{
|
||||
if (obits == 256) {
|
||||
mbedtls_sha256(input, ilen, output, 0);
|
||||
} else {
|
||||
uint8_t sha256[32];
|
||||
mbedtls_sha256(input, ilen, sha256, 0);
|
||||
memcpy(output, sha256, obits / 8);
|
||||
}
|
||||
}
|
||||
|
||||
#else /* NS_USE_EXTERNAL_MBED_TLS */
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* \brief SHA-256 context structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t total[2]; /*!< number of bytes processed */
|
||||
uint32_t state[8]; /*!< intermediate digest state */
|
||||
unsigned char buffer[64]; /*!< data block being processed */
|
||||
}
|
||||
ns_sha256_context;
|
||||
|
||||
/**
|
||||
* \brief Initialize SHA-256 context
|
||||
*
|
||||
* \param ctx SHA-256 context to be initialized
|
||||
*/
|
||||
void ns_sha256_init( ns_sha256_context *ctx );
|
||||
|
||||
/**
|
||||
* \brief Clear SHA-256 context
|
||||
*
|
||||
* \param ctx SHA-256 context to be cleared
|
||||
*/
|
||||
void ns_sha256_free( ns_sha256_context *ctx );
|
||||
|
||||
/**
|
||||
* \brief Clone (the state of) a SHA-256 context
|
||||
*
|
||||
* \param dst The destination context
|
||||
* \param src The context to be cloned
|
||||
*/
|
||||
void ns_sha256_clone( ns_sha256_context *dst,
|
||||
const ns_sha256_context *src );
|
||||
|
||||
/**
|
||||
* \brief SHA-256 context setup
|
||||
*
|
||||
* \param ctx context to be initialized
|
||||
*/
|
||||
void ns_sha256_starts( ns_sha256_context *ctx );
|
||||
|
||||
/**
|
||||
* \brief SHA-256 process buffer
|
||||
*
|
||||
* \param ctx SHA-256 context
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
*/
|
||||
void ns_sha256_update( ns_sha256_context *ctx, const void *input,
|
||||
size_t ilen );
|
||||
|
||||
/**
|
||||
* \brief SHA-256 final digest
|
||||
*
|
||||
* \param ctx SHA-256 context
|
||||
* \param output SHA-256 checksum result
|
||||
*/
|
||||
void ns_sha256_finish( ns_sha256_context *ctx, void *output );
|
||||
|
||||
/**
|
||||
* \brief SHA-256 final digest
|
||||
*
|
||||
* \param ctx SHA-256 context
|
||||
* \param output SHA-256 checksum result
|
||||
* \param obits Number of bits of to output - must be multiple of 32
|
||||
*/
|
||||
void ns_sha256_finish_nbits( ns_sha256_context *ctx,
|
||||
void *output, unsigned obits );
|
||||
|
||||
/**
|
||||
* \brief Output = SHA-256( input buffer )
|
||||
*
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
* \param output SHA-256 checksum result
|
||||
*/
|
||||
void ns_sha256( const void *input, size_t ilen,
|
||||
void *output );
|
||||
|
||||
/**
|
||||
* \brief Output = SHA-256( input buffer )
|
||||
*
|
||||
* \param input buffer holding the data
|
||||
* \param ilen length of the input data
|
||||
* \param output SHA-256 checksum result
|
||||
* \param obits Number of bits of to output - must be multiple of 32
|
||||
*/
|
||||
void ns_sha256_nbits( const void *input, size_t ilen,
|
||||
void *output, unsigned obits );
|
||||
|
||||
#endif /* NS_USE_EXTERNAL_MBED_TLS */
|
||||
|
||||
|
||||
#endif /* NS_SHA256_H_ */
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2014-2015 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2014-2016 ARM Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-PBL
|
||||
*
|
||||
|
|
@ -15,35 +15,17 @@
|
|||
* \file shalib.h
|
||||
* \brief SHA256 Library API.
|
||||
*
|
||||
* \section sha256-api SHA256 Library API:
|
||||
* There are two ways to calculate SHA256:
|
||||
* 1. Calc by given 1 data and length pointer
|
||||
* - SHALIB_SHA256_HASH(), A function to calculate SHA256 for given data.
|
||||
* 2. Calc by different data pointer sequence given separately
|
||||
* - SHALIB_init_sha256(), Init SHA registers
|
||||
* - SHALIB_push_data_sha256(), Give data sectors(s) one by one
|
||||
* - **** Give data
|
||||
* - SHALIB_push_data_sha256(), Give last data sequence
|
||||
* - SHALIB_finish_sha256(), Finish SHA256 by given data to given buffer
|
||||
*
|
||||
* \section sha256res-api SHA256 register resume and save library API:
|
||||
* SHA256 Operation dataflow can come in many different timeslots or packets and between them, the application needs
|
||||
* to calculated more SHA256 then SAVE and Resume operation SHA registers is usefully.
|
||||
* -sha_resume_regs(), Load SHA registers from old HASH sessions
|
||||
* -sha_save_regs(), Save SHA registers from current HASH sessions
|
||||
*
|
||||
* \section hmac256-inctuction HMAC256 process sequence:
|
||||
* 1. SHALIB_init_HMAC(), Init HMAC IN process by given security signature material
|
||||
* 2. SHALIB_push_data_sha256(), Give data sectors(s) one by one
|
||||
* 2. SHALIB_push_data_HMAC(), Give data sectors(s) one by one
|
||||
* 3. SHALIB_finish_HMAC(), Finish HMAC and save SHA256 hash to given buffer
|
||||
*
|
||||
* \section prf256-inctuction PRF256 process sequence:
|
||||
* 1. shalib_prf_param_get(), Init PRF and get configure structure
|
||||
* 2. Set the following parameters to configure structure:
|
||||
* - HMAC security signature pointer and length
|
||||
* - Label text and length
|
||||
* - Label text
|
||||
* - Seed data and length
|
||||
* - PRF result pointer
|
||||
* 3. shalib_prf_calc(), Calc PRF256 HASH
|
||||
*
|
||||
*/
|
||||
|
|
@ -58,9 +40,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Do Not change. */
|
||||
#define SHALIB_RING_BUFFER_SIZE 64
|
||||
|
||||
/*!
|
||||
* \struct prf_sec_param_t
|
||||
* \brief PRF 256 stucture
|
||||
|
|
@ -69,72 +48,13 @@ extern "C" {
|
|||
typedef struct {
|
||||
const uint8_t *secret; /**< HMAC security signature pointer. */
|
||||
uint8_t sec_len; /**< HMAC security signature length. */
|
||||
uint8_t label[25]; /**< Label text. */
|
||||
uint8_t lablen; /**< Label text length. */
|
||||
const uint8_t *seed; /**< Seed data. */
|
||||
uint8_t seedlen; /**< Seed data length. */
|
||||
uint8_t *buffer; /**< Buffer for saving 256-BIT hash. */
|
||||
const char *label; /**< PRF label text. */
|
||||
const uint8_t *seed; /**< PRF Seed data. */
|
||||
uint8_t seedlen; /**< PRF Seed data length. */
|
||||
} prf_sec_param_t;
|
||||
|
||||
/*!
|
||||
* \struct sha256_temp_t
|
||||
* \brief SHA temporary buffer database for saving current hash operation or resume saved.
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t m_Data[SHALIB_RING_BUFFER_SIZE]; /**< 64-bytes ring buffer for SHA256 operation. */
|
||||
uint8_t m_Read; /**< Read pointer to ring buffer. */
|
||||
uint8_t m_Write; /**< Write pointer to ring buffer. */
|
||||
uint32_t SHALIB_pushed_bytes; /**< Hash total byte coun. t*/
|
||||
uint8_t SHALIB_buffered_bytes; /**< Ring buffer data in. */
|
||||
uint32_t areg_temps[8]; /**< Shalib operation 8 HREG. */
|
||||
} sha256_temp_t;
|
||||
|
||||
// Cumulative static version using a static ring buffer object
|
||||
//=============================================================================
|
||||
/**
|
||||
* \brief Init SHA registers.
|
||||
*/
|
||||
void SHALIB_init_sha256(void); // Call this first...
|
||||
/**
|
||||
* \brief Push data SHALIB.
|
||||
*
|
||||
* \param data A pointer to data.
|
||||
* \param len Length of data.
|
||||
*/
|
||||
void SHALIB_push_data_sha256(const uint8_t *data, uint16_t len); // ... add data ...
|
||||
/**
|
||||
* \brief Finish SHA-256 operation and get result to given buffer by given length.
|
||||
*
|
||||
* The first `len` words of the SHA-256 are output to buffer.
|
||||
*
|
||||
* \param buffer A pointer to result buffer.
|
||||
* \param len Length of 32-bit register to save to buffer (8= 256 bit and 4= 128-bit).
|
||||
*/
|
||||
void SHALIB_finish_sha256(uint8_t *buffer, uint8_t len); // ... get the sha256 digest.
|
||||
/**
|
||||
* \brief Calc SHA-256 by 1 function call.
|
||||
*
|
||||
* \param data_ptr A pointer to data.
|
||||
* \param data_len Length of data.
|
||||
* \param buffer A pointer to 256-bit buffer!!
|
||||
*/
|
||||
void SHALIB_SHA256_HASH(const uint8_t *data_ptr, uint16_t data_len, uint8_t *buffer); // ... get the sha256 digest.
|
||||
|
||||
/* Shalib registers resume and save API */
|
||||
/**
|
||||
* \brief Resume old SHA-256 registers.
|
||||
*
|
||||
* \param ptr A pointer to saved session.
|
||||
*/
|
||||
void sha_resume_regs(const sha256_temp_t *ptr);
|
||||
/**
|
||||
* \brief Save SHA-256 registers.
|
||||
*
|
||||
* \param ptr A pointer to buffer.
|
||||
*/
|
||||
void sha_save_regs(sha256_temp_t *ptr);
|
||||
|
||||
// Use these for cumulativec HMAC
|
||||
// Use these for cumulative HMAC
|
||||
/**
|
||||
* \brief Init HMAC256 operation by given security material.
|
||||
*
|
||||
|
|
@ -142,14 +62,20 @@ void sha_save_regs(sha256_temp_t *ptr);
|
|||
* \param sec_len Length of security material.
|
||||
*/
|
||||
void SHALIB_init_HMAC(const uint8_t *secret, uint8_t sec_len); // Call this first...
|
||||
// ... add data ... by SHALIB_push_data_sha256()
|
||||
/**
|
||||
* \brief Push data for HMAC
|
||||
*
|
||||
* \param data A pointer to data.
|
||||
* \param len Length of data.
|
||||
*/
|
||||
void SHALIB_push_data_HMAC(const void *data, uint16_t len); // ... add data ...
|
||||
/**
|
||||
* \brief Finish HMAC256 operation and save result in given buffer.
|
||||
*
|
||||
* \param buffer A pointer to result buffer.
|
||||
* \param len Length of 32-bit register to save to buffer (8= 256 bit and 4= 128-bit).
|
||||
* \param nwords Length of 32-bit register to save to buffer (8= 256 bit and 4= 128-bit).
|
||||
*/
|
||||
void SHALIB_finish_HMAC(uint8_t *buffer, uint8_t len); // ... get the HMAC digest.
|
||||
void SHALIB_finish_HMAC(void *buffer, uint8_t nwords); // ... get the HMAC digest.
|
||||
|
||||
|
||||
/** PRF API */
|
||||
|
|
@ -159,7 +85,6 @@ void SHALIB_finish_HMAC(uint8_t *buffer, uint8_t len); // ... get the HMAC diges
|
|||
* -Security material and length
|
||||
* -Label text and length
|
||||
* -Seed data and length
|
||||
* -Buffer for 256 Result
|
||||
*
|
||||
* \return A pointer to PRF configure structure.
|
||||
|
||||
|
|
@ -168,9 +93,8 @@ prf_sec_param_t *shalib_prf_param_get(void); // GET PRF structure
|
|||
/* SET secret, label, seed & buffer to 256 PRF */
|
||||
/**
|
||||
* \brief Finish PRF256 operation and save result in given buffer.
|
||||
*
|
||||
*/
|
||||
void shalib_prf_calc(void);// GET 256 PRF
|
||||
void shalib_prf_calc(void *output, uint_fast16_t nwords);// GET 256 PRF
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2014-2015 ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2014-2016 ARM Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-PBL
|
||||
*
|
||||
|
|
@ -27,10 +27,8 @@
|
|||
|
||||
#include "ns_types.h"
|
||||
|
||||
|
||||
/**
|
||||
* Structure specifying the prefix service.
|
||||
*
|
||||
* \brief Border router network data structure.
|
||||
*/
|
||||
typedef struct thread_border_router_info_t {
|
||||
unsigned Prf: 2; /**!< Prefix preference, 01 = High, 00 = Default, 11 = Low, 10 = Reserved. */
|
||||
|
|
@ -44,10 +42,6 @@ typedef struct thread_border_router_info_t {
|
|||
bool stableData: 1; /**!< This data is stable and expected to be available at least 48h. */
|
||||
} thread_border_router_info_t;
|
||||
|
||||
/* Define flags for backwards compatibility. Remove once applications have been updated */
|
||||
#define P_slaac_preferred P_preferred
|
||||
#define P_slaac_valid P_slaac
|
||||
|
||||
/**
|
||||
* \brief Create local service that is provided to the Thread network.
|
||||
* If a prefix exists it is updated. For example, when removing SLAAC (Stateless Address Autoconfiguration) you should modify the prefix
|
||||
|
|
@ -158,4 +152,32 @@ int thread_border_router_publish(int8_t interface_id);
|
|||
*/
|
||||
int thread_border_router_delete_all(int8_t interface_id);
|
||||
|
||||
/**
|
||||
* \brief Set Recursive DNS server (RDNSS) option that is encoded according to RFC6106.
|
||||
* Setting a new RDNSS will overwrite previous RDNSS option. Set RNDDS will be used
|
||||
* until it is cleared.
|
||||
*
|
||||
* \param interface_id Network interface ID.
|
||||
* \param recursive_dns_server_option Recursive DNS server option encoded according to rfc6106, can be NULL to clear existing RDNSS.
|
||||
* \param recursive_dns_server_option_len Length of the recursive_dns_server_option in bytes.
|
||||
*
|
||||
* \return 0, Option saved OK.
|
||||
* \return <0 when error occurs during option processing.
|
||||
*/
|
||||
int thread_border_router_recursive_dns_server_option_set(int8_t interface_id, uint8_t *recursive_dns_server_option, uint16_t recursive_dns_server_option_len);
|
||||
|
||||
/**
|
||||
* \brief Set DNS server search list (DNSSL) option that is encoded according to RFC6106.
|
||||
* Setting a new DNSSL will overwrite previous DNSSL option. Set DNSSL will be used
|
||||
* until it is cleared.
|
||||
*
|
||||
* \param interface_id Network interface ID.
|
||||
* \param dns_search_list_option DNS search list option encoded according to rfc6106, can be NULL to clear existing DNSSL.
|
||||
* \param search_list_option_len Length of the dns_search_list_option in bytes.
|
||||
*
|
||||
* \return 0, Option saved OK.
|
||||
* \return <0 when error occurs during option processing.
|
||||
*/
|
||||
int thread_border_router_dns_search_list_option_set(int8_t interface_id, uint8_t *dns_search_list_option, uint16_t search_list_option_len);
|
||||
|
||||
#endif /* THREAD_DHCPV6_SERVER_H_ */
|
||||
|
|
|
|||
|
|
@ -40,8 +40,7 @@
|
|||
#define DIAGCOP_TLV_SUPPLY_VOLTAGE 15 /**< Can not reset*/
|
||||
#define DIAGCOP_TLV_CHILD_TABLE 16 /**< Can not reset*/
|
||||
#define DIAGCOP_TLV_CHANNEL_PAGES 17 /**< Can not reset*/
|
||||
|
||||
#define DIAGCOP_TLV_GET 13
|
||||
#define DIAGCOP_TLV_TYPE_LIST 18
|
||||
|
||||
/**
|
||||
* \brief Write array TLV.
|
||||
|
|
|
|||
|
|
@ -121,6 +121,38 @@ int thread_management_node_init(
|
|||
device_configuration_s *device_configuration,
|
||||
link_configuration_s *static_configuration);
|
||||
|
||||
/**
|
||||
* Thread device type.
|
||||
*
|
||||
* REED - Router enabled End device. Device can become router or end device depending on network conditions.
|
||||
* FED - Full End Device. Device creates links and makes address queries but does not become router.
|
||||
* MED - Minimal End Device. Device communicates through parent. With radio on
|
||||
* SED - Sleepy End Device. Device communicates through parent. Uses data poll to sleep.
|
||||
*/
|
||||
typedef enum {
|
||||
THREAD_DEVICE_REED = 1,
|
||||
THREAD_DEVICE_FED,
|
||||
THREAD_DEVICE_MED,
|
||||
THREAD_DEVICE_SED,
|
||||
} thread_device_type_e;
|
||||
|
||||
/**
|
||||
* Change thread device type.
|
||||
*
|
||||
* This function modifies the thread device mode. Default values are given in
|
||||
* function arm_nwk_interface_configure_6lowpan_bootstrap_set().
|
||||
*
|
||||
* If this function is called when interface is up re-attach is made.
|
||||
*
|
||||
* \param interface_id Network interface ID.
|
||||
* \param device_type Device type of current bootstrap.
|
||||
*
|
||||
* \return 0, Set OK.
|
||||
* \return <0 Set fail.
|
||||
*/
|
||||
|
||||
int thread_management_device_type_set(int8_t interface_id, thread_device_type_e device_type);
|
||||
|
||||
/**
|
||||
* Get Thread network settings.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -52,6 +52,11 @@
|
|||
#define MESHCOP_TLV_STATE 16
|
||||
#define MESHCOP_TLV_JOINER_UDP_PORT 18
|
||||
|
||||
/**
|
||||
* Network management TLV specific bit defines
|
||||
*/
|
||||
#define MESHCOP_TLV_ACTIVE_TIME_STAMP_U_BIT 0x01
|
||||
|
||||
/**
|
||||
* Relay message TLV
|
||||
*/
|
||||
|
|
@ -158,6 +163,18 @@ uint8_t *thread_meshcop_tlv_data_write_uint32(uint8_t *ptr, const uint8_t type,
|
|||
*/
|
||||
uint8_t *thread_meshcop_tlv_data_write_uint64(uint8_t *ptr, const uint8_t type, const uint64_t data);
|
||||
|
||||
/**
|
||||
* Check if TLV exists in the message.
|
||||
*
|
||||
* \param ptr Message buffer.
|
||||
* \param length Length of the message buffer to validate message.
|
||||
* \param type Type of TLV searched.
|
||||
*
|
||||
* \return true if TLV is found.
|
||||
* \return false if TLV does not exist.
|
||||
*/
|
||||
bool thread_meshcop_tlv_exist(const uint8_t *ptr, const uint16_t length, const uint8_t type);
|
||||
|
||||
/**
|
||||
* Find TLV from message.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright (c) 2016 ARM Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-PBL
|
||||
*
|
||||
* Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.mbed.com/licenses/PBL-1.0
|
||||
*
|
||||
* See the License for the specific language governing permissions and limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file thread_net_config_api.h
|
||||
* \brief Public API to handle the Thread network services and configuration.
|
||||
*/
|
||||
|
||||
#ifndef _THREAD_NET_CONFIG_API_H_
|
||||
#define _THREAD_NET_CONFIG_API_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ns_types.h"
|
||||
|
||||
/*
|
||||
* \brief function callback type for nd_data_request.
|
||||
*
|
||||
* \param inteface_id Network interface ID where request was made.
|
||||
* \param status 0 when response is received from destination, -1 otherwise.
|
||||
* \param data_ptr ND_data options encoded according to RFC6106. Is NULL if destination was unreachable or didn't have the requested data.
|
||||
* \param data_len Length of data in bytes.
|
||||
*/
|
||||
typedef void thread_net_config_nd_data_req_cb(int8_t interface_id, int8_t status, uint8_t *data_ptr, uint16_t data_len);
|
||||
|
||||
/**
|
||||
* \brief Request ND options (as in RFC6106) from given destination.
|
||||
* Response data will be provided in callback function.
|
||||
*
|
||||
* \param interface_id network interface ID.
|
||||
* \param destination IPv6 address where request is sent.
|
||||
* \param options requested option type identifiers according to RFC6106.
|
||||
* \param options_len number of options requested.
|
||||
* \param callback Function that will be called once information is available.
|
||||
*
|
||||
* \return 0 on success. A callback will be called with/without response data.
|
||||
* \return <0 in error cases. Callback will not be called.
|
||||
*/
|
||||
int thread_net_config_nd_data_request(int8_t interface_id, const uint8_t destination[16], const uint8_t *options, uint8_t options_len, thread_net_config_nd_data_req_cb *callback);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _THREAD_NET_CONFIG_API_H_ */
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue