Merge patch series "Clean-up patch set for MbedTLS integration"

Raymond Mao <raymond.mao@linaro.org> says:

This patch set is picked from the previously posted serie:
"[RFC] Integrate MbedTLS v3.6 LTS with U-Boot"

They are not directly related to MbedTLS integration, but the
prerequisite for a few clean-up, refactoring and minor fixes.

For V2, the linker script patch is dropped and added one patch
to move the snprintf to stdio.h
This commit is contained in:
Tom Rini 2024-05-22 08:55:35 -06:00
commit 377e91c162
21 changed files with 43 additions and 48 deletions

View file

@ -7,7 +7,7 @@
#include <clock_legacy.h>
#include <init.h>
#include <malloc.h>
#include <vsprintf.h>
#include <stdio.h>
#include <asm/arcregs.h>
#include <asm/cache.h>
#include <asm/global_data.h>

View file

@ -6,6 +6,7 @@
*/
#include <config.h>
#include <stdio.h>
#include <vsprintf.h>
#include <env.h>
#include <net.h>

View file

@ -6,7 +6,7 @@
*/
#include <env.h>
#include <vsprintf.h>
#include <stdio.h>
#include "fdt_ops.h"
void ti_set_fdt_env(const char *board_name, struct ti_fdt_map *fdt_map)

View file

@ -37,10 +37,6 @@ DECLARE_GLOBAL_DATA_PTR;
#include <image.h>
#include <bootstage.h>
#include <u-boot/crc.h>
#include <u-boot/md5.h>
#include <u-boot/sha1.h>
#include <u-boot/sha256.h>
#include <u-boot/sha512.h>
/*****************************************************************************/
/* New uImage format routines */

View file

@ -25,8 +25,6 @@
#endif
#include <asm/global_data.h>
#include <u-boot/md5.h>
#include <u-boot/sha1.h>
#include <linux/errno.h>
#include <asm/io.h>

View file

@ -19,6 +19,7 @@
#include <command.h>
#include <env.h>
#include <part.h>
#include <stdio.h>
#include <vsprintf.h>
enum cmd_part_info {

View file

@ -8,7 +8,7 @@
#include <command.h>
#include <env.h>
#include <log.h>
#include <vsprintf.h>
#include <stdio.h>
/* Some sane limit "just in case" */
#define MAX_BTN_CMDS 32

View file

@ -9,7 +9,7 @@
#include <cpu.h>
#include <dm.h>
#include <log.h>
#include <vsprintf.h>
#include <stdio.h>
#include <linux/bitops.h>
#include "mpc83xx_cpu.h"

View file

@ -50,17 +50,17 @@ static void hash_finish_crc32(void *ctx, void *obuf)
/* MD5 */
static void hash_init_md5(void *ctx)
{
MD5Init((struct MD5Context *)ctx);
MD5Init((MD5Context *)ctx);
}
static void hash_update_md5(void *ctx, const void *ibuf, uint32_t ilen)
{
MD5Update((struct MD5Context *)ctx, ibuf, ilen);
MD5Update((MD5Context *)ctx, ibuf, ilen);
}
static void hash_finish_md5(void *ctx, void *obuf)
{
MD5Final(obuf, (struct MD5Context *)ctx);
MD5Final(obuf, (MD5Context *)ctx);
}
/* SHA1 */
@ -158,7 +158,7 @@ static struct sw_hash_impl sw_hash_impl[HASH_ALGO_NUM] = {
.init = hash_init_md5,
.update = hash_update_md5,
.finish = hash_finish_md5,
.ctx_alloc_sz = sizeof(struct MD5Context),
.ctx_alloc_sz = sizeof(MD5Context),
},
[HASH_ALGO_SHA1] = {

View file

@ -46,6 +46,23 @@ static inline int vprintf(const char *fmt, va_list args)
}
#endif
/**
* Format a string and place it in a buffer
*
* @buf: The buffer to place the result into
* @size: The size of the buffer, including the trailing null space
* @fmt: The format string to use
* @...: Arguments for the format string
* Return: the number of characters which would be
* generated for the given input, excluding the trailing null,
* as per ISO C99. If the return is greater than or equal to
* @size, the resulting string is truncated.
*
* See the vsprintf() documentation for format string extensions over C99.
*/
int snprintf(char *buf, size_t size, const char *fmt, ...)
__attribute__ ((format (__printf__, 3, 4)));
/*
* FILE based functions (can only be used AFTER relocation!)
*/

View file

@ -10,18 +10,18 @@
#define MD5_SUM_LEN 16
struct MD5Context {
typedef struct MD5Context {
__u32 buf[4];
__u32 bits[2];
union {
unsigned char in[64];
__u32 in32[16];
};
};
} MD5Context;
void MD5Init(struct MD5Context *ctx);
void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len);
void MD5Final(unsigned char digest[16], struct MD5Context *ctx);
void MD5Init(MD5Context *ctx);
void MD5Update(MD5Context *ctx, unsigned char const *buf, unsigned int len);
void MD5Final(unsigned char digest[16], MD5Context *ctx);
/*
* Calculate and store in 'output' the MD5 digest of 'len' bytes at

View file

@ -218,23 +218,6 @@ char *simple_itoa(ulong val);
*/
char *simple_xtoa(ulong num);
/**
* Format a string and place it in a buffer
*
* @buf: The buffer to place the result into
* @size: The size of the buffer, including the trailing null space
* @fmt: The format string to use
* @...: Arguments for the format string
* Return: the number of characters which would be
* generated for the given input, excluding the trailing null,
* as per ISO C99. If the return is greater than or equal to
* @size, the resulting string is truncated.
*
* See the vsprintf() documentation for format string extensions over C99.
*/
int snprintf(char *buf, size_t size, const char *fmt, ...)
__attribute__ ((format (__printf__, 3, 4)));
/**
* Format a string and place it in a buffer
*

View file

@ -12,6 +12,7 @@
#include <linux/ctype.h>
#include <linux/kernel.h>
#include <asm/io.h>
#include <stdio.h>
#include <vsprintf.h>
char *display_options_get_banner_priv(bool newlines, const char *build_tag,

View file

@ -17,7 +17,6 @@
#include <linux/oid_registry.h>
#include <u-boot/hash-checksum.h>
#include <u-boot/rsa.h>
#include <u-boot/sha256.h>
const efi_guid_t efi_guid_sha256 = EFI_CERT_SHA256_GUID;
const efi_guid_t efi_guid_cert_rsa2048 = EFI_CERT_RSA2048_GUID;

View file

@ -19,9 +19,6 @@
#include <tpm-v2.h>
#include <tpm_api.h>
#include <u-boot/hash-checksum.h>
#include <u-boot/sha1.h>
#include <u-boot/sha256.h>
#include <u-boot/sha512.h>
#include <linux/unaligned/be_byteshift.h>
#include <linux/unaligned/le_byteshift.h>
#include <linux/unaligned/generic.h>

View file

@ -11,7 +11,7 @@
#include <malloc.h>
#include <mtd.h>
#include <uuid.h>
#include <vsprintf.h>
#include <stdio.h>
#include <dm/ofnode.h>

View file

@ -10,7 +10,7 @@
#include <hexdump.h>
#include <mapmem.h>
#include <vsprintf.h>
#include <stdio.h>
#include <linux/ctype.h>
#include <linux/compat.h>
#include <linux/log2.h>

View file

@ -55,7 +55,7 @@ byteReverse(unsigned char *buf, unsigned longs)
* initialization constants.
*/
void
MD5Init(struct MD5Context *ctx)
MD5Init(MD5Context *ctx)
{
ctx->buf[0] = 0x67452301;
ctx->buf[1] = 0xefcdab89;
@ -71,7 +71,7 @@ MD5Init(struct MD5Context *ctx)
* of bytes.
*/
void
MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
MD5Update(MD5Context *ctx, unsigned char const *buf, unsigned int len)
{
register __u32 t;
@ -120,7 +120,7 @@ MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
* 1 0* (64-bit count of bits processed, MSB-first)
*/
void
MD5Final(unsigned char digest[16], struct MD5Context *ctx)
MD5Final(unsigned char digest[16], MD5Context *ctx)
{
unsigned int count;
unsigned char *p;
@ -269,7 +269,7 @@ MD5Transform(__u32 buf[4], __u32 const in[16])
void
md5 (unsigned char *input, int len, unsigned char output[16])
{
struct MD5Context context;
MD5Context context;
MD5Init(&context);
MD5Update(&context, input, len);
@ -286,7 +286,7 @@ void
md5_wd(const unsigned char *input, unsigned int len, unsigned char output[16],
unsigned int chunk_sz)
{
struct MD5Context context;
MD5Context context;
#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
const unsigned char *end, *curr;
int chunk;

View file

@ -19,6 +19,7 @@
#include <hexdump.h>
#include <stdarg.h>
#include <uuid.h>
#include <stdio.h>
#include <vsprintf.h>
#include <linux/ctype.h>
#include <linux/err.h>

View file

@ -18,7 +18,7 @@
#include <scmi_agent.h>
#include <scmi_agent-uclass.h>
#include <scmi_protocols.h>
#include <vsprintf.h>
#include <stdio.h>
#include <asm/scmi_test.h>
#include <dm/device-internal.h>
#include <dm/test.h>

View file

@ -9,6 +9,7 @@
#include <log.h>
#include <mapmem.h>
#include <version_string.h>
#include <stdio.h>
#include <vsprintf.h>
#include <test/suites.h>
#include <test/test.h>