Skip to content

Commit

Permalink
Merge pull request #53 from dongbeiouba/doc/notice
Browse files Browse the repository at this point in the history
Add notice;Optimize ascon
  • Loading branch information
InfoHunter authored Jan 12, 2024
2 parents ca2ae8c + 283dd68 commit 21cbad7
Show file tree
Hide file tree
Showing 13 changed files with 617 additions and 246 deletions.
39 changes: 39 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
This product includes the OSCORE related code from libcoap
(https://libcoap.net). The original author(s) and the original license of the
OSCORE code are as follows:

Martin Gunnarsson <[email protected]>
adapted to libcoap and major rewrite
Peter van der Stok <[email protected]>
on request of Fairhair alliance
adapted for libcoap integration
Jon Shallow <[email protected]>

Copyright (c) 2018, SICS, RISE AB
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the Institute nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.

========================================================================
8 changes: 4 additions & 4 deletions include/internal/ascon.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
# define ASCON_PHASE_FINAL 4

# pragma pack(1)
typedef struct {
typedef struct tsm_ascon_state_st {
uint64_t x[5];
} ascon_state_t;
} TSM_ASCON_STATE;

typedef struct tsm_ascon_aead_ctx_st {
ascon_state_t s;
TSM_ASCON_STATE s;
uint64_t K[2];
uint64_t N[2];
uint8_t mode;
Expand All @@ -41,7 +41,7 @@ typedef struct tsm_ascon_aead_ctx_st {
} TSM_ASCON_AEAD_CTX;

typedef struct tsm_ascon_hash_ctx_st {
ascon_state_t s;
TSM_ASCON_STATE s;
uint8_t alg;
uint8_t buf_len;
unsigned char buf[8]; /* saved partial block */
Expand Down
48 changes: 43 additions & 5 deletions include/internal/oscore_crypto.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,48 @@
/*
* Copyright 2023 The Tongsuo Project Authors. All Rights Reserved.
* Copyright (c) 2018, SICS, RISE AB
* 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://github.com/Tongsuo-Project/tongsuo-mini/blob/main/LICENSE
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/

/**
* @file oscore_crypto.h
* @brief An implementation of the Hash Based Key Derivation Function (RFC) and
* wrappers for AES-CCM*.
*
* \author
* Martin Gunnarsson <[email protected]>
*
* adapted to libcoap
* Peter van der Stok <[email protected]>
* on request of Fairhair alliance
* adapted for libcoap integration
* Jon Shallow <[email protected]>
* adapted for Tongsuo-mini integration
* K1 <[email protected]>
*/

#if !defined(TSM_INTERNAL_OSCORE_CRYPTO_H)
Expand Down
46 changes: 41 additions & 5 deletions include/tongsuo/oscore.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,46 @@
/*
* Copyright 2023 The Tongsuo Project Authors. All Rights Reserved.
* Copyright (c) 2018, SICS, RISE AB
* 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://github.com/Tongsuo-Project/tongsuo-mini/blob/main/LICENSE
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/

/**
* @file oscore.h
* @brief An implementation of the Object Security for Constrained RESTful
* Environments (RFC 8613).
*
* \author Martin Gunnarsson <[email protected]>
* major rewrite for libcoap
* Peter van der Stok <[email protected]>
* on request of Fairhair alliance
* adapted for libcoap integration
* Jon Shallow <[email protected]>
* adapted for Tongsuo-mini integration
* K1 <[email protected]>
*/

#if !defined(TSM_OSCORE_H)
Expand Down
46 changes: 41 additions & 5 deletions include/tongsuo/oscore_cbor.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,46 @@
/*
* Copyright 2023 The Tongsuo Project Authors. All Rights Reserved.
* Copyright (c) 2018, SICS, RISE AB
* 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://github.com/Tongsuo-Project/tongsuo-mini/blob/main/LICENSE
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/

/**
* @file oscore_cbor.h
* @brief An implementation of the Concise Binary Object Representation (RFC).
*
* \author
* Martin Gunnarsson <[email protected]>
* extended for libcoap by:
* Peter van der Stok <[email protected]>
* on request of Fairhair alliance
* adapted for libcoap integration
* Jon Shallow <[email protected]>
* adapted for Tongsuo-mini integration
* K1 <[email protected]>
*/

#if !defined(TSM_OSCORE_CBOR_H)
Expand Down
47 changes: 42 additions & 5 deletions include/tongsuo/oscore_context.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,47 @@
/*
* Copyright 2023 The Tongsuo Project Authors. All Rights Reserved.
* Copyright (c) 2018, SICS, RISE AB
* 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://github.com/Tongsuo-Project/tongsuo-mini/blob/main/LICENSE
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/

/**
* @file oscore_context.h
* @brief An implementation of the Object Security for Constrained RESTful
* Enviornments (RFC 8613).
*
* \author
* Martin Gunnarsson <[email protected]>
* adapted to libcoap; added group communication
* Peter van der Stok <[email protected]>
* on request of Fairhair alliance
* adapted for libcoap integration
* Jon Shallow <[email protected]>
* adapted for Tongsuo-mini integration
* K1 <[email protected]>
*/

#if !defined(TSM_OSCORE_CONTEXT_H)
Expand Down
46 changes: 41 additions & 5 deletions include/tongsuo/oscore_cose.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,46 @@
/*
* Copyright 2023 The Tongsuo Project Authors. All Rights Reserved.
* Copyright (c) 2018, SICS, RISE AB
* 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://github.com/Tongsuo-Project/tongsuo-mini/blob/main/LICENSE
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/

/**
* @file oscore_cose.h
* @brief An implementation of the CBOR Object Signing and Encryption (RFC).
*
* \author
* Martin Gunnarsson <[email protected]>
* adapted with sign1 function for libcoap
* Peter van der Stok <[email protected]>
* on request of Fairhair alliance
* adapted for libcoap integration
* Jon Shallow <[email protected]>
* adapted for Tongsuo-mini integration
* K1 <[email protected]>
*/

#if !defined(TSM_OSCORE_COSE_H)
Expand Down
Loading

0 comments on commit 21cbad7

Please sign in to comment.