-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20698 from netd-tud/sha3_implementation
sys/psa_crypto: sha3 support
- Loading branch information
Showing
18 changed files
with
532 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (C) 2024 TU Dresden | ||
* | ||
* This file is subject to the terms and conditions of the GNU Lesser | ||
* General Public License v2.1. See the file LICENSE in the top level | ||
* directory for more details. | ||
*/ | ||
|
||
/** | ||
* @ingroup sys_psa_crypto | ||
* @{ | ||
* | ||
* @brief Glue code translating between PSA Crypto and the RIOT SHA3 Hash module | ||
* | ||
* @author Lennard Melling <lennard.melling@msx.tu-dresden.de> | ||
* | ||
* @} | ||
*/ | ||
#include "psa/crypto.h" | ||
#include "hashes/psa/riot_hashes.h" | ||
|
||
psa_status_t psa_hashes_sha3_256_update(psa_hashes_sha3_ctx_t *ctx, | ||
const uint8_t *input, | ||
size_t input_length) | ||
{ | ||
sha3_update((keccak_state_t *)ctx, input, input_length); | ||
return PSA_SUCCESS; | ||
} | ||
|
||
psa_status_t psa_hashes_sha3_256_setup(psa_hashes_sha3_ctx_t *ctx) | ||
{ | ||
sha3_256_init((keccak_state_t *)ctx); | ||
return PSA_SUCCESS; | ||
} | ||
|
||
psa_status_t psa_hashes_sha3_256_finish(psa_hashes_sha3_ctx_t *ctx, | ||
uint8_t *hash) | ||
{ | ||
sha3_256_final((keccak_state_t *)ctx, hash); | ||
return PSA_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (C) 2024 TU Dresden | ||
* | ||
* This file is subject to the terms and conditions of the GNU Lesser | ||
* General Public License v2.1. See the file LICENSE in the top level | ||
* directory for more details. | ||
*/ | ||
|
||
/** | ||
* @ingroup sys_psa_crypto | ||
* @{ | ||
* | ||
* @brief Glue code translating between PSA Crypto and the RIOT SHA3 Hash module | ||
* | ||
* @author Lennard Melling <lennard.melling@msx.tu-dresden.de> | ||
* | ||
* @} | ||
*/ | ||
#include "psa/crypto.h" | ||
#include "hashes/psa/riot_hashes.h" | ||
|
||
psa_status_t psa_hashes_sha3_384_update(psa_hashes_sha3_ctx_t *ctx, | ||
const uint8_t *input, | ||
size_t input_length) | ||
{ | ||
sha3_update((keccak_state_t *)ctx, input, input_length); | ||
return PSA_SUCCESS; | ||
} | ||
|
||
psa_status_t psa_hashes_sha3_384_setup(psa_hashes_sha3_ctx_t *ctx) | ||
{ | ||
sha3_384_init((keccak_state_t *)ctx); | ||
return PSA_SUCCESS; | ||
} | ||
|
||
psa_status_t psa_hashes_sha3_384_finish(psa_hashes_sha3_ctx_t *ctx, | ||
uint8_t *hash) | ||
{ | ||
sha3_384_final((keccak_state_t *)ctx, hash); | ||
return PSA_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (C) 2024 TU Dresden | ||
* | ||
* This file is subject to the terms and conditions of the GNU Lesser | ||
* General Public License v2.1. See the file LICENSE in the top level | ||
* directory for more details. | ||
*/ | ||
|
||
/** | ||
* @ingroup sys_psa_crypto | ||
* @{ | ||
* | ||
* @brief Glue code translating between PSA Crypto and the RIOT SHA3 Hash module | ||
* | ||
* @author Lennard Melling <lennard.melling@msx.tu-dresden.de> | ||
* | ||
* @} | ||
*/ | ||
#include "psa/crypto.h" | ||
#include "hashes/psa/riot_hashes.h" | ||
|
||
psa_status_t psa_hashes_sha3_512_update(psa_hashes_sha3_ctx_t *ctx, | ||
const uint8_t *input, | ||
size_t input_length) | ||
{ | ||
sha3_update((keccak_state_t *)ctx, input, input_length); | ||
return PSA_SUCCESS; | ||
} | ||
|
||
psa_status_t psa_hashes_sha3_512_setup(psa_hashes_sha3_ctx_t *ctx) | ||
{ | ||
sha3_512_init((keccak_state_t *)ctx); | ||
return PSA_SUCCESS; | ||
} | ||
|
||
psa_status_t psa_hashes_sha3_512_finish(psa_hashes_sha3_ctx_t *ctx, | ||
uint8_t *hash) | ||
{ | ||
sha3_512_final((keccak_state_t *)ctx, hash); | ||
return PSA_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.