psa_hashes.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 HAW Hamburg
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
21 #ifndef PSA_HASHES_H
22 #define PSA_HASHES_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #include "kernel_defines.h"
29 #include "psa/crypto.h"
30 #include "psa/crypto_contexts.h"
31 
32 #if IS_USED(MODULE_PSA_HASH_MD5) || defined(DOXYGEN)
40 psa_status_t psa_hashes_md5_setup(psa_hashes_md5_ctx_t *ctx);
41 
51 psa_status_t psa_hashes_md5_update(psa_hashes_md5_ctx_t *ctx,
52  const uint8_t *input,
53  size_t input_length);
54 
65 psa_status_t psa_hashes_md5_finish(psa_hashes_md5_ctx_t *ctx,
66  uint8_t *hash,
67  size_t hash_size,
68  size_t *hash_length);
69 #endif /* MODULE_PSA_HASH_MD5 */
70 
71 #if IS_USED(MODULE_PSA_HASH_SHA_1) || defined(DOXYGEN)
80 
91  const uint8_t *input,
92  size_t input_length);
93 
105  uint8_t *hash,
106  size_t hash_size,
107  size_t *hash_length);
108 #endif /* MODULE_PSA_HASH_SHA_1 */
109 
110 #if IS_USED(MODULE_PSA_HASH_SHA_224) || defined(DOXYGEN)
119 
130  const uint8_t *input,
131  size_t input_length);
132 
144  uint8_t *hash,
145  size_t hash_size,
146  size_t *hash_length);
147 #endif /* MODULE_PSA_HASH_SHA_224 */
148 
149 #if IS_USED(MODULE_PSA_HASH_SHA_256) || defined(DOXYGEN)
158 
169  const uint8_t *input,
170  size_t input_length);
171 
183  uint8_t *hash,
184  size_t hash_size,
185  size_t *hash_length);
186 #endif /* MODULE_PSA_HASH_SHA_256 */
187 
188 #if IS_USED(MODULE_PSA_HASH_SHA_384) || defined(DOXYGEN)
196 psa_status_t psa_hashes_sha384_setup(psa_hashes_sha384_ctx_t *ctx);
197 
207 psa_status_t psa_hashes_sha384_update(psa_hashes_sha384_ctx_t *ctx,
208  const uint8_t *input,
209  size_t input_length);
210 
221 psa_status_t psa_hashes_sha384_finish(psa_hashes_sha384_ctx_t *ctx,
222  uint8_t *hash,
223  size_t hash_size,
224  size_t *hash_length);
225 #endif /* MODULE_PSA_HASH_SHA_384 */
226 
227 #if IS_USED(MODULE_PSA_HASH_SHA_512) || defined(DOXYGEN)
236 
247  const uint8_t *input,
248  size_t input_length);
249 
261  uint8_t *hash,
262  size_t hash_size,
263  size_t *hash_length);
264 #endif /* MODULE_PSA_HASH_SHA_512 */
265 
266 #if IS_USED(MODULE_PSA_HASH_SHA_512_224) || defined(DOXYGEN)
274 psa_status_t psa_hashes_sha512_224_setup(psa_hashes_sha512_224_ctx_t *ctx);
275 
285 psa_status_t psa_hashes_sha512_224_update(psa_hashes_sha512_224_ctx_t *ctx,
286  const uint8_t *input,
287  size_t input_length);
288 
299 psa_status_t psa_hashes_sha512_224_finish(psa_hashes_sha512_224_ctx_t *ctx,
300  uint8_t *hash,
301  size_t hash_size,
302  size_t *hash_length);
303 #endif /* MODULE_PSA_HASH_SHA_512_224 */
304 
305 #if IS_USED(MODULE_PSA_HASH_SHA_512_256) || defined(DOXYGEN)
313 psa_status_t psa_hashes_sha512_256_setup(psa_hashes_sha512_256_ctx_t *ctx);
314 
324 psa_status_t psa_hashes_sha512_256_update(psa_hashes_sha512_256_ctx_t *ctx,
325  const uint8_t *input,
326  size_t input_length);
327 
338 psa_status_t psa_hashes_sha512_256_finish(psa_hashes_sha512_256_ctx_t *ctx,
339  uint8_t *hash,
340  size_t hash_size,
341  size_t *hash_length);
342 #endif /* MODULE_PSA_HASH_SHA_512_256 */
343 
344 #if IS_USED(MODULE_PSA_HASH_SHA3_256) || defined(DOXYGEN)
354 psa_status_t psa_hashes_sha3_256_update(psa_hashes_sha3_ctx_t *ctx,
355  const uint8_t *input,
356  size_t input_length);
357 
365 psa_status_t psa_hashes_sha3_256_setup(psa_hashes_sha3_ctx_t *ctx);
366 
375 psa_status_t psa_hashes_sha3_256_finish(psa_hashes_sha3_ctx_t *ctx,
376  uint8_t *hash);
377 #endif /* MODULE_PSA_HASH_SHA3_256 */
378 
379 #if IS_USED(MODULE_PSA_HASH_SHA3_384) || defined(DOXYGEN)
389 psa_status_t psa_hashes_sha3_384_update(psa_hashes_sha3_ctx_t *ctx,
390  const uint8_t *input,
391  size_t input_length);
392 
400 psa_status_t psa_hashes_sha3_384_setup(psa_hashes_sha3_ctx_t *ctx);
401 
410 psa_status_t psa_hashes_sha3_384_finish(psa_hashes_sha3_ctx_t *ctx,
411  uint8_t *hash);
412 #endif /* MODULE_PSA_HASH_SHA3_384 */
413 
414 #if IS_USED(MODULE_PSA_HASH_SHA3_512) || defined(DOXYGEN)
424 psa_status_t psa_hashes_sha3_512_update(psa_hashes_sha3_ctx_t *ctx,
425  const uint8_t *input,
426  size_t input_length);
427 
435 psa_status_t psa_hashes_sha3_512_setup(psa_hashes_sha3_ctx_t *ctx);
436 
445 psa_status_t psa_hashes_sha3_512_finish(psa_hashes_sha3_ctx_t *ctx,
446  uint8_t *hash);
447 #endif /* MODULE_PSA_HASH_SHA3_512 */
448 
449 #ifdef __cplusplus
450 }
451 #endif
452 
453 #endif /* PSA_HASHES_H */
Function declarations for PSA Crypto.
Context definitions for PSA Crypto.
psa_status_t psa_hashes_sha384_finish(psa_hashes_sha384_ctx_t *ctx, uint8_t *hash, size_t hash_size, size_t *hash_length)
Low level wrapper function to call a driver for an SHA384 hash finish See psa_hash_finish()
psa_status_t psa_hashes_sha224_setup(psa_hashes_sha224_ctx_t *ctx)
Low level wrapper function to call a driver for an SHA224 hash setup See psa_hash_setup()
psa_status_t psa_hashes_sha1_update(psa_hashes_sha1_ctx_t *ctx, const uint8_t *input, size_t input_length)
Low level wrapper function to call a driver for an SHA1 hash update See psa_hash_update()
psa_status_t psa_hashes_sha3_512_setup(psa_hashes_sha3_ctx_t *ctx)
Low level wrapper function to call a driver for a SHA3-512 hash setup See psa_hash_setup()
psa_status_t psa_hashes_sha3_256_update(psa_hashes_sha3_ctx_t *ctx, const uint8_t *input, size_t input_length)
Low level wrapper function to call a driver for a general SHA3 hash update See psa_hash_update()
psa_status_t psa_hashes_sha512_finish(psa_hashes_sha512_ctx_t *ctx, uint8_t *hash, size_t hash_size, size_t *hash_length)
Low level wrapper function to call a driver for an SHA512 hash finish See psa_hash_finish()
psa_status_t psa_hashes_sha256_update(psa_hashes_sha256_ctx_t *ctx, const uint8_t *input, size_t input_length)
Low level wrapper function to call a driver for an SHA256 hash update See psa_hash_update()
psa_status_t psa_hashes_sha1_finish(psa_hashes_sha1_ctx_t *ctx, uint8_t *hash, size_t hash_size, size_t *hash_length)
Low level wrapper function to call a driver for an SHA1 hash finish See psa_hash_finish()
psa_status_t psa_hashes_sha256_finish(psa_hashes_sha256_ctx_t *ctx, uint8_t *hash, size_t hash_size, size_t *hash_length)
Low level wrapper function to call a driver for an SHA256 hash finish See psa_hash_finish()
psa_status_t psa_hashes_sha512_setup(psa_hashes_sha512_ctx_t *ctx)
Low level wrapper function to call a driver for an SHA512 hash setup See psa_hash_setup()
psa_status_t psa_hashes_md5_setup(psa_hashes_md5_ctx_t *ctx)
Low level wrapper function to call a driver for an MD5 hash setup See psa_hash_setup()
psa_status_t psa_hashes_sha256_setup(psa_hashes_sha256_ctx_t *ctx)
Low level wrapper function to call a driver for an SHA256 hash setup See psa_hash_setup()
psa_status_t psa_hashes_sha512_224_update(psa_hashes_sha512_224_ctx_t *ctx, const uint8_t *input, size_t input_length)
Low level wrapper function to call a driver for an SHA512/224 hash update See psa_hash_update()
psa_status_t psa_hashes_sha384_update(psa_hashes_sha384_ctx_t *ctx, const uint8_t *input, size_t input_length)
Low level wrapper function to call a driver for an SHA384 hash update See psa_hash_update()
psa_status_t psa_hashes_sha512_update(psa_hashes_sha512_ctx_t *ctx, const uint8_t *input, size_t input_length)
Low level wrapper function to call a driver for an SHA512 hash update See psa_hash_update()
psa_status_t psa_hashes_sha3_384_setup(psa_hashes_sha3_ctx_t *ctx)
Low level wrapper function to call a driver for a SHA3-384 hash setup See psa_hash_setup()
psa_status_t psa_hashes_sha3_512_update(psa_hashes_sha3_ctx_t *ctx, const uint8_t *input, size_t input_length)
Low level wrapper function to call a driver for a general SHA3 hash update See psa_hash_update()
psa_status_t psa_hashes_sha3_256_finish(psa_hashes_sha3_ctx_t *ctx, uint8_t *hash)
Low level wrapper function to call a driver for a SHA3-256 hash finish See psa_hash_finish()
psa_status_t psa_hashes_sha512_224_setup(psa_hashes_sha512_224_ctx_t *ctx)
Low level wrapper function to call a driver for an SHA512/224 hash setup See psa_hash_setup()
psa_status_t psa_hashes_sha3_512_finish(psa_hashes_sha3_ctx_t *ctx, uint8_t *hash)
Low level wrapper function to call a driver for a SHA3-512 hash finish See psa_hash_finish()
psa_status_t psa_hashes_sha384_setup(psa_hashes_sha384_ctx_t *ctx)
Low level wrapper function to call a driver for an SHA384 hash setup See psa_hash_setup()
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)
Low level wrapper function to call a driver for an SHA512/256 hash finish See psa_hash_finish()
psa_status_t psa_hashes_sha3_384_finish(psa_hashes_sha3_ctx_t *ctx, uint8_t *hash)
Low level wrapper function to call a driver for a SHA3-384 hash finish See psa_hash_finish()
psa_status_t psa_hashes_sha224_finish(psa_hashes_sha224_ctx_t *ctx, uint8_t *hash, size_t hash_size, size_t *hash_length)
Low level wrapper function to call a driver for an SHA224 hash finish See psa_hash_finish()
psa_status_t psa_hashes_sha3_384_update(psa_hashes_sha3_ctx_t *ctx, const uint8_t *input, size_t input_length)
Low level wrapper function to call a driver for a general SHA3 hash update See psa_hash_update()
psa_status_t psa_hashes_sha512_256_setup(psa_hashes_sha512_256_ctx_t *ctx)
Low level wrapper function to call a driver for an SHA512/256 hash setup See psa_hash_setup()
psa_status_t psa_hashes_sha224_update(psa_hashes_sha224_ctx_t *ctx, const uint8_t *input, size_t input_length)
Low level wrapper function to call a driver for an SHA224 hash update See psa_hash_update()
psa_status_t psa_hashes_sha3_256_setup(psa_hashes_sha3_ctx_t *ctx)
Low level wrapper function to call a driver for a SHA3-256 hash setup See psa_hash_setup()
psa_status_t psa_hashes_md5_update(psa_hashes_md5_ctx_t *ctx, const uint8_t *input, size_t input_length)
Low level wrapper function to call a driver for an MD5 hash update See psa_hash_update()
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)
Low level wrapper function to call a driver for an SHA512/224 hash finish See psa_hash_finish()
psa_status_t psa_hashes_md5_finish(psa_hashes_md5_ctx_t *ctx, uint8_t *hash, size_t hash_size, size_t *hash_length)
Low level wrapper function to call a driver for an MD5 hash finish See psa_hash_finish()
psa_status_t psa_hashes_sha512_256_update(psa_hashes_sha512_256_ctx_t *ctx, const uint8_t *input, size_t input_length)
Low level wrapper function to call a driver for an SHA512/256 hash update See psa_hash_update()
psa_status_t psa_hashes_sha1_setup(psa_hashes_sha1_ctx_t *ctx)
Low level wrapper function to call a driver for an SHA1 hash setup See psa_hash_setup()
Common macros and compiler attributes/pragmas configuration.
int32_t psa_status_t
Status code type used for all PSA Certified APIs.
Definition: error.h:41
CRYS_HASHUserContext_t psa_hashes_sha224_ctx_t
Map driver specific SHA224 context to PSA context.
CRYS_HASHUserContext_t psa_hashes_sha256_ctx_t
Map driver specific SHA256 context to PSA context.
CRYS_HASHUserContext_t psa_hashes_sha512_ctx_t
Map driver specific SHA512 context to PSA context.
CRYS_HASHUserContext_t psa_hashes_sha1_ctx_t
Map driver specific SHA1 context to PSA context.