-
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.
sys/psa_crypto: support for SHA-{384,512-{224,256}}
- Loading branch information
1 parent
3ba49d5
commit e077fec
Showing
15 changed files
with
490 additions
and
8 deletions.
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,47 @@ | ||
/* | ||
* Copyright (C) 2023 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 Hash module | ||
* | ||
* @author Mikolai Gütschow <[email protected]> | ||
* | ||
* @} | ||
*/ | ||
|
||
#include "psa/crypto.h" | ||
#include "hashes/psa/riot_hashes.h" | ||
|
||
psa_status_t psa_hashes_sha384_setup(psa_hashes_sha384_ctx_t *ctx) | ||
{ | ||
sha384_init((sha384_context_t *)ctx); | ||
return PSA_SUCCESS; | ||
} | ||
|
||
psa_status_t psa_hashes_sha384_update(psa_hashes_sha384_ctx_t *ctx, | ||
const uint8_t *input, | ||
size_t input_length) | ||
{ | ||
sha384_update((sha384_context_t *)ctx, input, input_length); | ||
return PSA_SUCCESS; | ||
} | ||
|
||
psa_status_t psa_hashes_sha384_finish(psa_hashes_sha384_ctx_t *ctx, | ||
uint8_t *hash, | ||
size_t hash_size, | ||
size_t *hash_length) | ||
{ | ||
sha384_final((sha384_context_t *)ctx, hash); | ||
|
||
(void)hash_size; | ||
(void)hash_length; | ||
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,47 @@ | ||
/* | ||
* Copyright (C) 2023 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 Hash module | ||
* | ||
* @author Mikolai Gütschow <[email protected]> | ||
* | ||
* @} | ||
*/ | ||
|
||
#include "psa/crypto.h" | ||
#include "hashes/psa/riot_hashes.h" | ||
|
||
psa_status_t psa_hashes_sha512_224_setup(psa_hashes_sha512_224_ctx_t *ctx) | ||
{ | ||
sha512_224_init((sha512_224_context_t *)ctx); | ||
return PSA_SUCCESS; | ||
} | ||
|
||
psa_status_t psa_hashes_sha512_224_update(psa_hashes_sha512_224_ctx_t *ctx, | ||
const uint8_t *input, | ||
size_t input_length) | ||
{ | ||
sha512_224_update((sha512_224_context_t *)ctx, input, input_length); | ||
return PSA_SUCCESS; | ||
} | ||
|
||
psa_status_t psa_hashes_sha512_224_finish(psa_hashes_sha512_224_ctx_t *ctx, | ||
uint8_t *hash, | ||
size_t hash_size, | ||
size_t *hash_length) | ||
{ | ||
sha512_224_final((sha512_224_context_t *)ctx, hash); | ||
|
||
(void)hash_size; | ||
(void)hash_length; | ||
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,47 @@ | ||
/* | ||
* Copyright (C) 2023 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 Hash module | ||
* | ||
* @author Mikolai Gütschow <[email protected]> | ||
* | ||
* @} | ||
*/ | ||
|
||
#include "psa/crypto.h" | ||
#include "hashes/psa/riot_hashes.h" | ||
|
||
psa_status_t psa_hashes_sha512_256_setup(psa_hashes_sha512_256_ctx_t *ctx) | ||
{ | ||
sha512_256_init((sha512_256_context_t *)ctx); | ||
return PSA_SUCCESS; | ||
} | ||
|
||
psa_status_t psa_hashes_sha512_256_update(psa_hashes_sha512_256_ctx_t *ctx, | ||
const uint8_t *input, | ||
size_t input_length) | ||
{ | ||
sha512_256_update((sha512_256_context_t *)ctx, input, input_length); | ||
return PSA_SUCCESS; | ||
} | ||
|
||
psa_status_t psa_hashes_sha512_256_finish(psa_hashes_sha512_256_ctx_t *ctx, | ||
uint8_t *hash, | ||
size_t hash_size, | ||
size_t *hash_length) | ||
{ | ||
sha512_256_final((sha512_256_context_t *)ctx, hash); | ||
|
||
(void)hash_size; | ||
(void)hash_length; | ||
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
Oops, something went wrong.