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 
9 #pragma once
10 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #include "kernel_defines.h"
27 #include "psa/crypto.h"
28 #include "psa/crypto_contexts.h"
29 
30 #if IS_USED(MODULE_PSA_HASH_MD5) || defined(DOXYGEN)
38 psa_status_t psa_hashes_md5_setup(psa_hashes_md5_ctx_t *ctx);
39 
44 psa_status_t psa_hashes_md5_update(psa_hashes_md5_ctx_t *ctx,
45  const uint8_t *input,
46  size_t input_length);
47 
52 psa_status_t psa_hashes_md5_finish(psa_hashes_md5_ctx_t *ctx,
53  uint8_t *hash,
54  size_t hash_size,
55  size_t *hash_length);
56 #endif /* MODULE_PSA_HASH_MD5 */
57 
58 #if IS_USED(MODULE_PSA_HASH_SHA_1) || defined(DOXYGEN)
64 
70  const uint8_t *input,
71  size_t input_length);
72 
78  uint8_t *hash,
79  size_t hash_size,
80  size_t *hash_length);
81 #endif /* MODULE_PSA_HASH_SHA_1 */
82 
83 #if IS_USED(MODULE_PSA_HASH_SHA_224) || defined(DOXYGEN)
89 
95  const uint8_t *input,
96  size_t input_length);
97 
103  uint8_t *hash,
104  size_t hash_size,
105  size_t *hash_length);
106 #endif /* MODULE_PSA_HASH_SHA_224 */
107 
108 #if IS_USED(MODULE_PSA_HASH_SHA_256) || defined(DOXYGEN)
114 
120  const uint8_t *input,
121  size_t input_length);
122 
128  uint8_t *hash,
129  size_t hash_size,
130  size_t *hash_length);
131 #endif /* MODULE_PSA_HASH_SHA_256 */
132 
133 #if IS_USED(MODULE_PSA_HASH_SHA_384) || defined(DOXYGEN)
138 psa_status_t psa_hashes_sha384_setup(psa_hashes_sha384_ctx_t *ctx);
139 
144 psa_status_t psa_hashes_sha384_update(psa_hashes_sha384_ctx_t *ctx,
145  const uint8_t *input,
146  size_t input_length);
147 
152 psa_status_t psa_hashes_sha384_finish(psa_hashes_sha384_ctx_t *ctx,
153  uint8_t *hash,
154  size_t hash_size,
155  size_t *hash_length);
156 #endif /* MODULE_PSA_HASH_SHA_384 */
157 
158 #if IS_USED(MODULE_PSA_HASH_SHA_512) || defined(DOXYGEN)
164 
170  const uint8_t *input,
171  size_t input_length);
172 
178  uint8_t *hash,
179  size_t hash_size,
180  size_t *hash_length);
181 #endif /* MODULE_PSA_HASH_SHA_512 */
182 
183 #if IS_USED(MODULE_PSA_HASH_SHA_512_224) || defined(DOXYGEN)
188 psa_status_t psa_hashes_sha512_224_setup(psa_hashes_sha512_224_ctx_t *ctx);
189 
194 psa_status_t psa_hashes_sha512_224_update(psa_hashes_sha512_224_ctx_t *ctx,
195  const uint8_t *input,
196  size_t input_length);
197 
202 psa_status_t psa_hashes_sha512_224_finish(psa_hashes_sha512_224_ctx_t *ctx,
203  uint8_t *hash,
204  size_t hash_size,
205  size_t *hash_length);
206 #endif /* MODULE_PSA_HASH_SHA_512_224 */
207 
208 #if IS_USED(MODULE_PSA_HASH_SHA_512_256) || defined(DOXYGEN)
213 psa_status_t psa_hashes_sha512_256_setup(psa_hashes_sha512_256_ctx_t *ctx);
214 
219 psa_status_t psa_hashes_sha512_256_update(psa_hashes_sha512_256_ctx_t *ctx,
220  const uint8_t *input,
221  size_t input_length);
222 
227 psa_status_t psa_hashes_sha512_256_finish(psa_hashes_sha512_256_ctx_t *ctx,
228  uint8_t *hash,
229  size_t hash_size,
230  size_t *hash_length);
231 #endif /* MODULE_PSA_HASH_SHA_512_256 */
232 
233 #if IS_USED(MODULE_PSA_HASH_SHA3_256) || defined(DOXYGEN)
238 psa_status_t psa_hashes_sha3_256_update(psa_hashes_sha3_ctx_t *ctx,
239  const uint8_t *input,
240  size_t input_length);
241 
246 psa_status_t psa_hashes_sha3_256_setup(psa_hashes_sha3_ctx_t *ctx);
247 
252 psa_status_t psa_hashes_sha3_256_finish(psa_hashes_sha3_ctx_t *ctx,
253  uint8_t *hash);
254 #endif /* MODULE_PSA_HASH_SHA3_256 */
255 
256 #if IS_USED(MODULE_PSA_HASH_SHA3_384) || defined(DOXYGEN)
261 psa_status_t psa_hashes_sha3_384_update(psa_hashes_sha3_ctx_t *ctx,
262  const uint8_t *input,
263  size_t input_length);
264 
269 psa_status_t psa_hashes_sha3_384_setup(psa_hashes_sha3_ctx_t *ctx);
270 
275 psa_status_t psa_hashes_sha3_384_finish(psa_hashes_sha3_ctx_t *ctx,
276  uint8_t *hash);
277 #endif /* MODULE_PSA_HASH_SHA3_384 */
278 
279 #if IS_USED(MODULE_PSA_HASH_SHA3_512) || defined(DOXYGEN)
284 psa_status_t psa_hashes_sha3_512_update(psa_hashes_sha3_ctx_t *ctx,
285  const uint8_t *input,
286  size_t input_length);
287 
292 psa_status_t psa_hashes_sha3_512_setup(psa_hashes_sha3_ctx_t *ctx);
293 
298 psa_status_t psa_hashes_sha3_512_finish(psa_hashes_sha3_ctx_t *ctx,
299  uint8_t *hash);
300 #endif /* MODULE_PSA_HASH_SHA3_512 */
301 
302 #ifdef __cplusplus
303 }
304 #endif
305 
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:40
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.