Software APIs
dif_kmac.h
Go to the documentation of this file.
1// Copyright lowRISC contributors (OpenTitan project).
2// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3// SPDX-License-Identifier: Apache-2.0
4
5#ifndef OPENTITAN_SW_DEVICE_LIB_DIF_DIF_KMAC_H_
6#define OPENTITAN_SW_DEVICE_LIB_DIF_DIF_KMAC_H_
7
8/**
9 * @file
10 * @brief <a href="/book/hw/ip/kmac/">KMAC</a> Device Interface Functions
11 */
12
13#include <stdint.h>
14
18
19#include "sw/device/lib/dif/autogen/dif_kmac_autogen.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif // __cplusplus
24
25/**
26 * This API implements an interface for the KMAC hardware.
27 *
28 * The KMAC hardware implements the following cryptographic hash and message
29 * authentication code (MAC) functions:
30 *
31 * - SHA-3 [1]
32 * - SHAKE [1]
33 * - cSHAKE [2]
34 * - KMAC [2]
35 *
36 * The following sequence of operations is required to initialize the KMAC
37 * hardware:
38 *
39 * - `dif_kmac_init()`
40 * - `dif_kmac_configure()`
41 * - `dif_kmac_configure_entropy()`
42 *
43 * If configuration changes are required then `dif_kmac_configure` can be called
44 * again so long as there are no operations in progress.
45 *
46 * The following sequence of operations is required to execute an operation:
47 *
48 * - `dif_kmac_{sha3,shake,cshake,kmac}_start()`
49 * - `dif_kmac_absorb()`
50 * - `dif_kmac_squeeze()`
51 * - `dif_kmac_end()`
52 *
53 * This is a streaming API and the `dif_kmac_absorb` and `dif_kmac_squeeze`
54 * functions may be called multiple times during a single operation. Once
55 * `dif_kmac_squeeze` has been called however no further `dif_kmac_absorb` calls
56 * may be made. See NIST FIPS 202 [1] for more information about the sponge
57 * construction and the 'absorbing' and 'squeezing' states.
58 *
59 * Please see the following documentation for more information about the KMAC
60 * hardware:
61 * https://opentitan.org/book/hw/ip/kmac/
62 *
63 * References:
64 * [1] - NIST FIPS 202
65 * SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions
66 * http://dx.doi.org/10.6028/NIST.FIPS.202
67 * [2] - NIST Special Publication 800-185
68 * SHA-3 Derived Functions: cSHAKE, KMAC, TupleHash and ParallelHash
69 * https://doi.org/10.6028/NIST.SP.800-185
70 */
71
72/**
73 * Maximum lengths supported by the KMAC unit.
74 */
75enum {
76
77 /**
78 * The maximum length in bytes of a customization string (S) before it has
79 * been encoded.
80 */
82
83 /**
84 * The maximum number of bytes required to encode the length of the
85 * customization string.
86 *
87 * Assumes maximum customization string length of 32 bytes (256 bits).
88 */
90
91 /**
92 * The maximum length in bytes of a function name (N) before it has been
93 * encoded.
94 */
96
97 /**
98 * The maximum number of bytes required to encode the length of the function
99 * name.
100 *
101 * Assumes maximum function name length of 4 bytes (32 bits).
102 */
104
105 /**
106 * The maximum output length (L) that can be set when starting a KMAC
107 * operation.
108 *
109 * The length is in 32-bit words and is designed to be low enough that the
110 * length in bits can still be represented by an unsigned 32-bit integer.
111 */
112 kDifKmacMaxOutputLenWords = (UINT32_MAX - 32) / 32,
113
114 /**
115 * The maximum key length supported by the KMAC operation.
116 *
117 * The length is in 32-bit words.
118 */
120
121 /**
122 * The length of the software entropy seed.
123 *
124 * The length is in 32-bit words.
125 */
127 /**
128 * The offset of the second share within the output state register.
129 */
131 /**
132 * The size of the Keccak state in words (i.e. 1600 bits).
133 */
134 kDifKmacStateWords = 1600 / 8 / sizeof(uint32_t),
135};
136
137/**
138 * Supported entropy modes.
139 *
140 * Entropy may be provided by the entropy distribution network (EDN) or using a
141 * seed provided by software.
142 */
144 kDifKmacEntropyModeEdn = 0,
145 kDifKmacEntropyModeSoftware,
147
148/**
149 * Entropy configuration for KMAC.
150 *
151 * This struct describes entropy configuration of the hardware.
152 */
154 /**
155 * Entropy mode specifying the source of entropy (EDN or software).
156 */
158
159 /**
160 * Ignore entropy reseed requests received via CMD register.
161 */
163
164 /**
165 * The number of KMAC invocations that triggers an automatic reseed request
166 * from EDN.
167 */
169
170 /**
171 * Software entropy seed. Only used when the source of entropy is software.
172 */
174
176
177/**
178 * Runtime configuration for KMAC.
179 *
180 * This struct describes runtime information for configuration of the hardware.
181 */
182typedef struct dif_kmac_config {
183 /**
184 * Entropy fast process mode when enabled prevents the KMAC unit consuming
185 * entropy unless it is processing a secret key. This process should not be
186 * used when resistance against side-channel attacks is required, because
187 * it may lead to leakage of the secret key in the power trace.
188 */
190
191 /**
192 * Convert the message to big-endian byte order.
193 * Note: this option currently had no effect since the message is sent a byte
194 * at a time but will in the future.
195 */
197
198 /**
199 * Convert the output state (digest) to big-endian byte order on a word
200 * granularity.
201 */
203
204 /**
205 * Place kmac inside key sideload mode
206 */
208
209 /**
210 * Message Masking with PRNG.
211 * If true, KMAC applies PRNG to the input messages to the Keccak module when
212 * KMAC mode is on.
213 */
215
217
218/**
219 * A KMAC operation state context.
220 */
222 /**
223 * Whether the 'squeezing' phase has been started.
224 */
226
227 /**
228 * Flag indicating whether the output length (d) should be right encoded in
229 * software and appended to the end of the message. The output length is
230 * required to be appended to the message as part of a KMAC operation.
231 */
233
234 /**
235 * Offset into the output state.
236 */
237 size_t offset;
238
239 /**
240 * The rate (r) in 32-bit words.
241 */
242 size_t r;
243
244 /**
245 * The output length (d) in 32-bit words.
246 *
247 * If the output length is not fixed then this field will be set to 0.
248 *
249 * Note: if the output length is fixed length will be modified to ensure that
250 * `d - offset` always accurately reflects the number of words remaining.
251 */
252 size_t d;
254
255/**
256 * A saved KMAC context.
257 *
258 * Holds the internal state of a paused hashing operation so that it can be
259 * resumed later on. The secret key is not part of it, as it has been absorbed
260 * into the Keccak state when the operation was started.
261 *
262 * The context is therefore equivalent to the secret key. The Keccak function is
263 * public and invertible, so anyone holding the context can compute the key from
264 * it. It must be protected like the key itself.
265 */
266typedef struct dif_kmac_context {
267 /**
268 * The first share of the Keccak state.
269 */
271
272 /**
273 * The second share of the Keccak state. Reads as zero if masking is disabled
274 * in hardware.
275 */
277
278 /**
279 * The operation state that belongs to the saved Keccak state.
280 */
283
284/**
285 * Supported SHA-3 modes of operation.
286 */
287typedef enum dif_kmac_mode_sha3 {
288 /** SHA-3 with 224 bit strength. */
290 /** SHA-3 with 256 bit strength. */
292 /** SHA-3 with 384 bit strength. */
294 /** SHA-3 with 512 bit strength. */
297
298/**
299 * Supported SHAKE modes of operation.
300 */
302 /** SHAKE with 128 bit strength. */
304 /** SHAKE with 256 bit strength. */
307
308/**
309 * Supported cSHAKE modes of operation.
310 */
312 /** cSHAKE with 128 bit strength. */
314 /** cSHAKE with 256 bit strength. */
317
318/**
319 * Supported KMAC modes of operation.
320 */
321typedef enum dif_kmac_mode_kmac {
322 /** KMAC with 128 bit strength. */
324 /** KMAC with 256 bit strength. */
327
328/**
329 * Key length.
330 *
331 * The key length is specified in bits.
332 */
334 /** Software provided 128 bit key. */
336 /** Software provided 192 bit key. */
338 /** Software provided 256 bit key. */
340 /** Software provided 384 bit key. */
342 /** Software provided 512 bit key. */
345
346/**
347 * A key for KMAC operations.
348 *
349 * The key is provided in two parts, `share0` and `share1`. These are
350 * combined using a bitwise XOR operation in the KMAC unit to produce the real
351 * key.
352 *
353 * The key shares are encoded in little endian byte order. This is fixed and
354 * cannot be changed (unlike the byte order used for the message and state).
355 *
356 * Unused words in the key shares must be set to 0.
357 */
358typedef struct dif_kmac_key {
359 uint32_t share0[kDifKmacMaxKeyLenWords];
360 uint32_t share1[kDifKmacMaxKeyLenWords];
363
364/**
365 * An encoded bit string used for customization string (S).
366 *
367 * Use `dif_kmac_customization_string_init` to initialize.
368 */
370 /** Encoded S: left_encode(len(S)) || S */
373 /** Length of data in buffer in bytes. */
374 uint32_t length;
376
377/**
378 * An encoded bit string used for function name (N).
379 *
380 * Use `dif_kmac_function_name_init` to initialize.
381 */
383 /** Encoded N: left_encode(len(N)) || N */
385 /** Length of data in buffer in bytes. */
386 uint32_t length;
388
389/**
390 * Error reported by KMAC unit.
391 *
392 * Codes taken from hw/ip/kmac/rtl/kmac_pkg.sv:err_code_e
393 */
394typedef enum dif_kmac_error {
395 /**
396 * No error has occurred.
397 */
399
400 /**
401 * The Key Manager has raised an error because the secret key is not valid.
402 */
404
405 /**
406 * An attempt was made to write data into the message FIFO but the KMAC unit
407 * was not in the correct state to receive the data.
408 */
410
411 /**
412 * SW issued a command while a HW application interface was using KMAC.
413 */
415
416 /**
417 * The entropy wait timer has expired.
418 */
420
421 /**
422 * Incorrect entropy mode when entropy is ready.
423 */
425
426 kDifErrorUnexpectedModeStrength = 6,
427
428 kDifErrorIncorrectFunctionName = 7,
429
430 kDifErrorSoftwareCommandSequence = 8,
431
432 kDifErrorSoftwareHashingWithoutEntropyReady = 9,
433
434 kDifErrorStopNotBlockAligned = 0xA,
435
436 kDifErrorSaveRestoreSideload = 0xB,
437
438 kDifErrorFatalError = 0xC1,
439
440 kDifErrorPackerIntegrity = 0xC2,
441
442 kDifErrorMsgFifoIntegrity = 0xC3,
444
445/**
446 * The state of the message FIFO used to buffer absorbed data.
447 *
448 * The hardware defined these status in different bit fields, however they work
449 * better in the same field. i.e the fifo can't be empty and full at the same
450 * time. That said, the values chosen for this enum allow the conversion from
451 * the register bits to this enum without branches.
452 */
454 /** The message FIFO is not empty or full. */
456 /** The message FIFO is empty. */
458 /** The message FIFO is full. Further writes will block. */
461
463 /**
464 * SHA3 hashing engine is in idle state.
465 */
467
468 /**
469 * SHA3 is receiving message stream and processing it.
470 */
472
473 /**
474 * SHA3 completes sponge absorbing stage. In this stage, SW can manually run
475 * the hashing engine.
476 */
478
479 /**
480 * SHA3 stopped the sponge absorbing stage to save a context. In this stage,
481 * SW can read the state to save the context.
482 */
484} dif_kmac_sha3_state_t;
485
486/**
487 * The kmac error faults.
488 *
489 * The hardware defined these status in different bit fields, however they work
490 * better in the same field. Then the values chosen for this enum allow the
491 * conversion from the register bits to this enum without branches.
492 */
494 /**
495 * Neither errors nor fault has occurred.
496 */
498 /**
499 * A fatal fault has occurred and the KMAC unit needs to be reset (1),
500 * Examples for such faults include i) TL-UL bus integrity fault ii)
501 * storage errors in the shadow registers iii) errors in the message,
502 * round, or key counter iv) any internal FSM entering an invalid state v)
503 * an error in the redundant lfsr.
504 */
506 /**
507 * An update error has occurred in the shadowed Control Register. KMAC
508 * operation needs to be restarted by re-writing the Control Register.
509 */
512
513typedef struct dif_kmac_status {
514 /**
515 * Sha3 state.
516 */
517 dif_kmac_sha3_state_t sha3_state;
518
519 /**
520 * Message FIFO entry count.
521 */
522 uint32_t fifo_depth;
523
524 /**
525 * Kmac fifo state.
526 */
528
529 /**
530 * Kmac faults and errors state.
531 */
533} dif_kmac_status_t;
534
535/**
536 * Configures KMAC with runtime information.
537 *
538 * @param kmac A KMAC handle.
539 * @param config Runtime configuration parameters.
540 * @return The result of the operation.
541 */
544
545/**
546 * Configures KMAC entropy interface with non-boot-entropy-mode configuration.
547 *
548 * @param kmac A KMAC handle.
549 * @param config Entropy configuration parameters.
550 * @return The result of the operation.
551 */
555
556/**
557 * Encode a customization string (S).
558 *
559 * The length of the string must not exceed `kDifKmacMaxCustomizationStringLen`.
560 *
561 * Note that this function will encode `len` bytes from `data` regardless of
562 * whether `data` is null-terminated or not.
563 *
564 * See NIST Special Publication 800-185 [2] for more information about the
565 * customization string (S) parameter.
566 *
567 * @param data String to encode.
568 * @param len Length of string to encode.
569 * @param[out] out Encoded customization string.
570 * @return The result of the operation.
571 */
574 const char *data, size_t len, dif_kmac_customization_string_t *out);
575
576/**
577 * Encode a function name (N).
578 *
579 * The length of the string must not exceed `kDifKmacMaxFunctionNameLen`.
580 *
581 * Note that this function will encode `len` bytes from `data` regardless of
582 * whether `data` is null-terminated or not.
583 *
584 * See NIST Special Publication 800-185 [2] for more information about the
585 * function name (N) parameter.
586 *
587 * @param data String to encode.
588 * @param len Length of string to encode.
589 * @param[out] out Encoded function name.
590 * @return The result of the operation.
591 */
593dif_result_t dif_kmac_function_name_init(const char *data, size_t len,
595
596/**
597 * Start a SHA-3 operation.
598 *
599 * SHA-3 operations have a fixed output length.
600 *
601 * See NIST FIPS 202 [1] for more information about SHA-3.
602 *
603 * @param kmac A KMAC handle.
604 * @param operation_state A KMAC operation state context.
605 * @param mode The SHA-3 mode of operation.
606 * @return The result of the operation.
607 */
610 const dif_kmac_t *kmac, dif_kmac_operation_state_t *operation_state,
612
613/**
614 * Start a SHAKE operation.
615 *
616 * SHAKE operations have a variable (XOF) output length.
617 *
618 * See NIST FIPS 202 [1] for more information about SHAKE.
619 *
620 * @param kmac A KMAC handle.
621 * @param operation_state A KMAC operation state context.
622 * @param mode The mode of operation.
623 * @return The result of the operation.
624 */
627 const dif_kmac_t *kmac, dif_kmac_operation_state_t *operation_state,
629
630/**
631 * Start a cSHAKE operation.
632 *
633 * cSHAKE operations have a variable (XOF) output length.
634 *
635 * See NIST Special Publication 800-185 [2] for more information about cSHAKE.
636 *
637 * @param kmac A KMAC handle.
638 * @param operation_state A KMAC operation state context.
639 * @param mode The mode of operation.
640 * @param n Function name (optional).
641 * @param s Customization string (optional).
642 * @return The result of the operation.
643 */
646 const dif_kmac_t *kmac, dif_kmac_operation_state_t *operation_state,
649
650/**
651 * Start a KMAC operation.
652 *
653 * To use KMAC in eXtendable-Output Function (XOF) mode set the output length
654 * (`l`) to 0. The output length must not be greater than
655 * `kDifKmacMaxOutputLenWords`.
656 *
657 * The key provided must have at least as many bits as the security strength
658 * of the `mode`.
659 *
660 * See NIST Special Publication 800-185 [2] for more information about KMAC.
661 *
662 * @param kmac A KMAC handle.
663 * @param operation_state A KMAC operation state context.
664 * @param mode The mode of operation.
665 * @param l Output length (number of 32-bit words that will be 'squeezed').
666 * @param k Pointer to secret key.
667 * @param s Customization string (optional).
668 * @return The result of the operation.
669 */
672 const dif_kmac_t *kmac, dif_kmac_operation_state_t *operation_state,
673 dif_kmac_mode_kmac_t mode, size_t l, const dif_kmac_key_t *k,
675
676/**
677 * Absorb bytes from the message provided.
678 *
679 * If `processed` is non-NULL, then this function will write the remaining
680 * space in the FIFO and update `processed` with the number of bytes written.
681 * The caller should adjust the `msg` pointer and `len` parameters and call
682 * again as needed until all input has been written.
683 *
684 * If `processed` is NULL, then this function will block until the entire
685 * message has been processed or an error occurs.
686 *
687 * If big-endian mode is enabled for messages (`message_big_endian`) only the
688 * part of the message aligned to 32-bit word boundaries will be byte swapped.
689 * Unaligned leading and trailing bytes will be written into the message as-is.
690 *
691 * @param kmac A KMAC handle.
692 * @param operation_state A KMAC operation state context.
693 * @param msg Pointer to data to absorb.
694 * @param len Number of bytes of data to absorb.
695 * @param[out] processed Number of bytes processed (optional).
696 * @preturn The result of the operation.
697 */
700 dif_kmac_operation_state_t *operation_state,
701 const void *msg, size_t len, size_t *processed);
702
703/**
704 * Squeeze bytes into the output buffer provided.
705 *
706 * Requesting a squeeze operation will prevent any further absorption operations
707 * from taking place.
708 *
709 * If `kDifKmacIncomplete` is returned then the hardware is currently
710 * recomputing the state and the output was only partially written. The output
711 * pointer and length should be updated according to the number of bytes
712 * processed and the squeeze operation continued at a later time.
713 *
714 * If `processed` is not provided then this function will block until `len`
715 * bytes have been written to `out` or an error occurs.
716 *
717 * Normally, the capacity part of Keccak state is and should not be read
718 * as part of a regular cryptographic operation. However, this function
719 * can also read the capacity for testing purposes.
720 * When `capacity` is a non-NULL pointer, at the end of the operation, the
721 * capacity part of the Keccak state is also read and written into this buffer.
722 * The capacity is read for each output round, meaning that if the requested
723 * digest is larger than a single Keccak round can provide (i.e. the rate), then
724 * the additional rounds also update this buffer. Hence it should be large
725 * enough to accommodate `ceil(digest_len/rate_len) * capacity_len`.
726 * `capacity` can be set to NULL to skip reading the capacity.
727 *
728 * @param kmac A KMAC handle.
729 * @param operation_state A KMAC operation state context.
730 * @param[out] out Pointer to output buffer.
731 * @param[out] len Number of 32-bit words to write to output buffer.
732 * @param[out] processed Number of 32-bit words written to output buffer
733 * (optional).
734 * @param[out] capacity Optional buffer to read capacity along with the digest.
735 * @preturn The result of the operation.
736 */
739 dif_kmac_operation_state_t *operation_state,
740 uint32_t *out, size_t len, size_t *processed,
741 uint32_t *capacity);
742
743/**
744 * Ends a squeeze operation and resets the hardware so it is ready for a new
745 * operation.
746 *
747 * @param kmac A KMAC handle.
748 * @param operation_state A KMAC operation state context.
749 * @return The result of the operation.
750 */
753 dif_kmac_operation_state_t *operation_state);
754
755/**
756 * Saves the context of an absorbing operation.
757 *
758 * The message absorbed since the operation was started or restored must be a
759 * multiple of the Keccak rate. This is not checked. Otherwise the hardware
760 * reports `kDifErrorStopNotBlockAligned`, the saved context is invalid and the
761 * operation has to be started again.
762 *
763 * If an error is returned, the hardware may be left in the stopped state. The
764 * caller must then release it with `dif_kmac_context_release()`.
765 *
766 * Not available if a sideloaded key is used.
767 *
768 * @param kmac A KMAC handle.
769 * @param operation_state A KMAC operation state context.
770 * @param[out] context The saved context.
771 * @return The result of the operation.
772 */
775 dif_kmac_operation_state_t *operation_state,
776 dif_kmac_context_t *context);
777
778/**
779 * Restores a previously saved context and resumes the absorbing operation.
780 *
781 * The KMAC HWIP must hold the same configuration in `CFG_SHADOWED` as when the
782 * context was saved, i.e. the same mode, strength, KMAC enable and endianness.
783 * This is not checked, and a mismatch silently produces a wrong digest. In KMAC
784 * mode with masking enabled, the entropy must be configured as for starting an
785 * operation.
786 *
787 * Claims the block before writing the context, so that no application interface
788 * can take it over while the context is being restored. Returns `kDifError` if
789 * the block was granted to an application interface instead, in which case
790 * nothing has been written.
791 *
792 * Application interfaces are stalled while the block is claimed. If an error is
793 * returned after the block has been claimed, the caller must release it with
794 * `dif_kmac_context_release()`.
795 *
796 * Not available if a sideloaded key is used.
797 *
798 * @param kmac A KMAC handle.
799 * @param context The context to restore.
800 * @param[out] operation_state A KMAC operation state context.
801 * @return The result of the operation.
802 */
805 const dif_kmac_t *kmac, const dif_kmac_context_t *context,
806 dif_kmac_operation_state_t *operation_state);
807
808/**
809 * Releases the KMAC HWIP after a failed context save or restore.
810 *
811 * Issues the done command, which clears the Keccak state and returns the
812 * hardware to the idle state when it has been stopped by
813 * `dif_kmac_context_save()` or claimed by `dif_kmac_context_restore()`.
814 *
815 * @param kmac A KMAC handle.
816 * @return The result of the operation.
817 */
820
821/**
822 * Read the kmac error register to get the error code indicated the interrupt
823 * state.
824 *
825 * This function should be called in case of any of the `start` functions
826 * returns `kDifError`.
827 *
828 * @param kmac A KMAC handle.
829 * @param[out] error The current error code.
830 * @param[out] info Optional additional error information.
831 * @return The result of the operation.
832 */
835 uint32_t *info);
836
837/**
838 * Clear the current error code and reset the state machine to the idle state
839 * ready to accept new operations.
840 *
841 * The state of any in-progress operation will be lost and the operation will
842 * need to be restarted.
843 *
844 * @param kmac A KMAC handle.
845 * @param operation_state A KMAC operation state context.
846 * @return The result of the operation.
847 */
850 dif_kmac_operation_state_t *operation_state);
851
852/**
853 * Let the KMAC HW know that SW has processed the errors the HW has flagged.
854 *
855 * @param kmac A KMAC handle
856 * @return The result of the operation.
857 */
860
861/**
862 * Report whether the hardware currently indicates an error.
863 *
864 * @param kmac A KMAC handle.
865 * @param[out] error Whether hardware currently indicates an error.
866 * @returns The result of the operation.
867 */
869dif_result_t dif_kmac_has_error_occurred(const dif_kmac_t *kmac, bool *error);
870
871/**
872 * Clear the `kmac_err` IRQ.
873 *
874 * @param kmac A KMAC handle.
875 * @return The result of the operation.
876 */
879
880/**
881 * Fetch the current status of the message FIFO used to buffer absorbed data.
882 *
883 * @param kmac A KMAC handle.
884 * @param[out] kmac_status The kmac status struct.
885 * @return The result of the operation.
886 */
889 dif_kmac_status_t *kmac_status);
890
891/**
892 * Returns the current value of the refresh hash counter.
893 *
894 * @param kmac A KMAC handle.
895 * @param hash_ctr The hash counter value that is returned.
896 * @return The result of the operation.
897 */
900 uint32_t *hash_ctr);
901
902/**
903 * Reports whether or not the KMAC configuration register is locked.
904 *
905 * If writes to the KMAC configuration register are disabled (locked) then it is
906 * not possible to change any configuration parameters or start a new operation.
907 * The configuration register is locked when an operation has been started and
908 * is unlocked again when it completes.
909 *
910 * @param kmac A KMAC handle.
911 * @param[out] is_locked Out-param reporting the lock state.
912 * @return The result of the operation.
913 */
915dif_result_t dif_kmac_config_is_locked(const dif_kmac_t *kmac, bool *is_locked);
916
917/**
918 * Reports whether or not the KMAC entropy configuration register is locked.
919 *
920 * If writes to the KMAC entropy configuration register are disabled (locked)
921 * then it is not possible to change any entropy configuration parameters. The
922 * entropy configuration register is locked when an operation (including a PRNG
923 * reseed operation) has been started and is unlocked again when it completes.
924 * In addition, it can be locked until the next reset via the entropy
925 * configuration lock register.
926 *
927 * @param kmac A KMAC handle.
928 * @param[out] is_locked Out-param reporting the lock state.
929 * @return The result of the operation.
930 */
933 bool *is_locked);
934
935/**
936 * Poll until a given flag in the status register is set.
937 *
938 * @param kmac A KMAC handle.
939 * @param flag the
940 * @return The result of the operation.
941 */
943dif_result_t dif_kmac_poll_status(const dif_kmac_t *kmac, uint32_t flag);
944
945#ifdef __cplusplus
946} // extern "C"
947#endif // __cplusplus
948
949#endif // OPENTITAN_SW_DEVICE_LIB_DIF_DIF_KMAC_H_