mirror of https://github.com/thesofproject/sof.git
misc_utils: Move byte_swap function to new misc_utils.c file
This function will be used in different places in the code, so I moved it to a separate file. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
This commit is contained in:
parent
9ce1cc8988
commit
93c5e8b51f
|
@ -22,6 +22,7 @@ add_executable(rimage
|
|||
src/rimage.c
|
||||
src/toml_utils.c
|
||||
src/adsp_config.c
|
||||
src/misc_utils.c
|
||||
src/file_utils.c
|
||||
tomlc99/toml.c
|
||||
)
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* Copyright(c) 2023 Intel Corporation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* Reverses the order of bytes in the array
|
||||
* @param ptr pointer to a array
|
||||
* @param size of the array
|
||||
*/
|
||||
void bytes_swap(uint8_t *ptr, uint32_t size);
|
|
@ -0,0 +1,18 @@
|
|||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
/*
|
||||
* Copyright(c) 2018-2023 Intel Corporation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <rimage/misc_utils.h>
|
||||
|
||||
void bytes_swap(uint8_t *ptr, uint32_t size)
|
||||
{
|
||||
uint8_t tmp;
|
||||
uint32_t index;
|
||||
|
||||
for (index = 0; index < (size / 2); index++) {
|
||||
tmp = ptr[index];
|
||||
ptr[index] = ptr[size - 1 - index];
|
||||
ptr[size - 1 - index] = tmp;
|
||||
}
|
||||
}
|
|
@ -23,6 +23,7 @@
|
|||
#include <rimage/rimage.h>
|
||||
#include <rimage/css.h>
|
||||
#include <rimage/manifest.h>
|
||||
#include <rimage/misc_utils.h>
|
||||
|
||||
#define DEBUG_PKCS 0
|
||||
|
||||
|
@ -33,18 +34,6 @@ enum manver {
|
|||
VACE15 = 3
|
||||
};
|
||||
|
||||
static void bytes_swap(uint8_t *ptr, uint32_t size)
|
||||
{
|
||||
uint8_t tmp;
|
||||
uint32_t index;
|
||||
|
||||
for (index = 0; index < (size / 2); index++) {
|
||||
tmp = ptr[index];
|
||||
ptr[index] = ptr[size - 1 - index];
|
||||
ptr[size - 1 - index] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
static int rimage_read_key(EVP_PKEY **privkey, struct image *image)
|
||||
{
|
||||
char path[256];
|
||||
|
|
Loading…
Reference in New Issue