1 /*
2  * Copyright (c) 2023, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef __RSE_SECURE_WORD_COPY_H__
9 #define __RSE_SECURE_WORD_COPY_H__
10 
11 #include <stdint.h>
12 #include <stddef.h>
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 /**
19  * \brief                        Copy a series of words in a randomised order.
20  *                               Intended to be used as a DPA countermeasure
21  *                               when copying key materal.
22  *
23  * \Note                         This function may take a variable amount of
24  *                               time to execute.
25  *
26  * \param[out] dst               Destination buffer to copy into
27  * \param[in]  src               Source buffer to copy from.
28  * \param[in]  word_count        The amount of words to copy.
29  */
30 void dpa_hardened_word_copy(volatile uint32_t *dst,
31                             volatile const uint32_t *src, size_t word_count);
32 
33 #ifdef __cplusplus
34 }
35 #endif
36 
37 #endif /* __RSE_SECURE_WORD_COPY_H__ */
38