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 
20 #ifndef PSA_HASHES_H
21 #define PSA_HASHES_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include "kernel_defines.h"
28 #include "psa/crypto.h"
29 #include "psa/crypto_contexts.h"
30 
31 #if IS_USED(MODULE_PSA_HASH_MD5) || defined(DOXYGEN)
39 psa_status_t psa_hashes_md5_setup(psa_hashes_md5_ctx_t *ctx);
40 
45 psa_status_t psa_hashes_md5_update(psa_hashes_md5_ctx_t *ctx,
46  const uint8_t *input,
47  size_t input_length);
48 
53 psa_status_t psa_hashes_md5_finish(psa_hashes_md5_ctx_t *ctx,
54  uint8_t *hash,
55  size_t hash_size,
56  size_t *hash_length);
57 #endif /* MODULE_PSA_HASH_MD5 */
58 
59 #if IS_USED(MODULE_PSA_HASH_SHA_1) || defined(DOXYGEN)
65 
71  const uint8_t *input,
72  size_t input_length);
73 
79  uint8_t *hash,
80  size_t hash_size,
81  size_t *hash_length);
82 #endif /* MODULE_PSA_HASH_SHA_1 */
83 
84 #if IS_USED(MODULE_PSA_HASH_SHA_224) || defined(DOXYGEN)
90 
96  const uint8_t *input,
97  size_t input_length);
98 
104  uint8_t *hash,
105  size_t hash_size,
106  size_t *hash_length);
107 #endif /* MODULE_PSA_HASH_SHA_224 */
108 
109 #if IS_USED(MODULE_PSA_HASH_SHA_256) || defined(DOXYGEN)
115 
121  const uint8_t *input,
122  size_t input_length);
123 
129  uint8_t *hash,
130  size_t hash_size,
131  size_t *hash_length);
132 #endif /* MODULE_PSA_HASH_SHA_256 */
133 
134 #if IS_USED(MODULE_PSA_HASH_SHA_384) || defined(DOXYGEN)
139 psa_status_t psa_hashes_sha384_setup(psa_hashes_sha384_ctx_t *ctx);
140 
145 psa_status_t psa_hashes_sha384_update(psa_hashes_sha384_ctx_t *ctx,
146  const uint8_t *input,
147  size_t input_length);
148 
153 psa_status_t psa_hashes_sha384_finish(psa_hashes_sha384_ctx_t *ctx,
154  uint8_t *hash,
155  size_t hash_size,
156  size_t *hash_length);
157 #endif /* MODULE_PSA_HASH_SHA_384 */
158 
159 #if IS_USED(MODULE_PSA_HASH_SHA_512) || defined(DOXYGEN)
165 
171  const uint8_t *input,
172  size_t input_length);
173 
179  uint8_t *hash,
180  size_t hash_size,
181  size_t *hash_length);
182 #endif /* MODULE_PSA_HASH_SHA_512 */
183 
184 #if IS_USED(MODULE_PSA_HASH_SHA_512_224) || defined(DOXYGEN)
189 psa_status_t psa_hashes_sha512_224_setup(psa_hashes_sha512_224_ctx_t *ctx);
190 
195 psa_status_t psa_hashes_sha512_224_update(psa_hashes_sha512_224_ctx_t *ctx,
196  const uint8_t *input,
197  size_t input_length);
198 
203 psa_status_t psa_hashes_sha512_224_finish(psa_hashes_sha512_224_ctx_t *ctx,
204  uint8_t *hash,
205  size_t hash_size,
206  size_t *hash_length);
207 #endif /* MODULE_PSA_HASH_SHA_512_224 */
208 
209 #if IS_USED(MODULE_PSA_HASH_SHA_512_256) || defined(DOXYGEN)
214 psa_status_t psa_hashes_sha512_256_setup(psa_hashes_sha512_256_ctx_t *ctx);
215 
220 psa_status_t psa_hashes_sha512_256_update(psa_hashes_sha512_256_ctx_t *ctx,
221  const uint8_t *input,
222  size_t input_length);
223 
228 psa_status_t psa_hashes_sha512_256_finish(psa_hashes_sha512_256_ctx_t *ctx,
229  uint8_t *hash,
230  size_t hash_size,
231  size_t *hash_length);
232 #endif /* MODULE_PSA_HASH_SHA_512_256 */
233 
234 #if IS_USED(MODULE_PSA_HASH_SHA3_256) || defined(DOXYGEN)
239 psa_status_t psa_hashes_sha3_256_update(psa_hashes_sha3_ctx_t *ctx,
240  const uint8_t *input,
241  size_t input_length);
242 
247 psa_status_t psa_hashes_sha3_256_setup(psa_hashes_sha3_ctx_t *ctx);
248 
253 psa_status_t psa_hashes_sha3_256_finish(psa_hashes_sha3_ctx_t *ctx,
254  uint8_t *hash);
255 #endif /* MODULE_PSA_HASH_SHA3_256 */
256 
257 #if IS_USED(MODULE_PSA_HASH_SHA3_384) || defined(DOXYGEN)
262 psa_status_t psa_hashes_sha3_384_update(psa_hashes_sha3_ctx_t *ctx,
263  const uint8_t *input,
264  size_t input_length);
265 
270 psa_status_t psa_hashes_sha3_384_setup(psa_hashes_sha3_ctx_t *ctx);
271 
276 psa_status_t psa_hashes_sha3_384_finish(psa_hashes_sha3_ctx_t *ctx,
277  uint8_t *hash);
278 #endif /* MODULE_PSA_HASH_SHA3_384 */
279 
280 #if IS_USED(MODULE_PSA_HASH_SHA3_512) || defined(DOXYGEN)
285 psa_status_t psa_hashes_sha3_512_update(psa_hashes_sha3_ctx_t *ctx,
286  const uint8_t *input,
287  size_t input_length);
288 
293 psa_status_t psa_hashes_sha3_512_setup(psa_hashes_sha3_ctx_t *ctx);
294 
299 psa_status_t psa_hashes_sha3_512_finish(psa_hashes_sha3_ctx_t *ctx,
300  uint8_t *hash);
301 #endif /* MODULE_PSA_HASH_SHA3_512 */
302 
303 #ifdef __cplusplus
304 }
305 #endif
306 
307 #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.