...
 
Commits (43)
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifdef USE_HOSTCC
#include "../scripts/dtc/libfdt/libfdt_env.h"
#else
/*
* This position of the include guard is intentional.
* Using the same guard name as that of scripts/dtc/libfdt/libfdt_env.h
* prevents it from being included.
*/
#ifndef LIBFDT_ENV_H
#define LIBFDT_ENV_H
#include <linux/string.h>
#include <asm/byteorder.h>
typedef __be16 fdt16_t;
typedef __be32 fdt32_t;
typedef __be64 fdt64_t;
#define fdt32_to_cpu(x) be32_to_cpu(x)
#define cpu_to_fdt32(x) cpu_to_be32(x)
#define fdt64_to_cpu(x) be64_to_cpu(x)
#define cpu_to_fdt64(x) cpu_to_be64(x)
/* U-Boot: for strtoul in fdt_overlay.c */
#include <vsprintf.h>
#define strtoul(cp, endp, base) simple_strtoul(cp, endp, base)
#endif /* LIBFDT_ENV_H */
#endif
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* (C) Copyright 2009
* Marvell Semiconductor <www.marvell.com>
* Written-by: Prafulla Wadaskar <prafulla@marvell.com>
*/
#ifndef _UBOOT_CRC_H
#define _UBOOT_CRC_H
/* lib/crc8.c */
unsigned int crc8(unsigned int crc_start, const unsigned char *vptr, int len);
/* lib/crc16.c - 16 bit CRC with polynomial x^16+x^12+x^5+1 (CRC-CCITT) */
uint16_t crc16_ccitt(uint16_t crc_start, const unsigned char *s, int len);
/**
* crc16_ccitt_wd_buf - Perform CRC16-CCIT on an input buffer and return the
* 16-bit result (network byte-order) in an output buffer
*
* @in: input buffer
* @len: input buffer length
* @out: output buffer (at least 2 bytes)
* @chunk_sz: ignored
*/
void crc16_ccitt_wd_buf(const uint8_t *in, uint len,
uint8_t *out, uint chunk_sz);
/* lib/crc32.c */
uint32_t crc32 (uint32_t, const unsigned char *, uint);
uint32_t crc32_wd (uint32_t, const unsigned char *, uint, uint);
uint32_t crc32_no_comp (uint32_t, const unsigned char *, uint);
/**
* crc32_wd_buf - Perform CRC32 on a buffer and return result in buffer
*
* @input: Input buffer
* @ilen: Input buffer length
* @output: Place to put checksum result (4 bytes)
* @chunk_sz: Trigger watchdog after processing this many bytes
*/
void crc32_wd_buf(const unsigned char *input, uint ilen,
unsigned char *output, uint chunk_sz);
/* lib/crc32c.c */
void crc32c_init(uint32_t *, uint32_t);
uint32_t crc32c_cal(uint32_t, const char *, int, uint32_t *);
#endif /* _UBOOT_CRC_H */
/*
* This file was transplanted with slight modifications from Linux sources
* (fs/cifs/md5.h) into U-Boot by Bartlomiej Sieka <tur@semihalf.com>.
*/
#ifndef _MD5_H
#define _MD5_H
#include "compiler.h"
struct MD5Context {
__u32 buf[4];
__u32 bits[2];
union {
unsigned char in[64];
__u32 in32[16];
};
};
/*
* Calculate and store in 'output' the MD5 digest of 'len' bytes at
* 'input'. 'output' must have enough space to hold 16 bytes.
*/
void md5 (unsigned char *input, int len, unsigned char output[16]);
/*
* Calculate and store in 'output' the MD5 digest of 'len' bytes at 'input'.
* 'output' must have enough space to hold 16 bytes. If 'chunk' Trigger the
* watchdog every 'chunk_sz' bytes of input processed.
*/
void md5_wd (unsigned char *input, int len, unsigned char output[16],
unsigned int chunk_sz);
#endif /* _MD5_H */
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (c) 2013, Andreas Oetken.
*/
#ifndef _RSA_CHECKSUM_H
#define _RSA_CHECKSUM_H
#include <errno.h>
#include <image.h>
#include <u-boot/sha1.h>
#include <u-boot/sha256.h>
/**
* hash_calculate() - Calculate hash over the data
*
* @name: Name of algorithm to be used for hash calculation
* @region: Array having info of regions over which hash needs to be calculated
* @region_count: Number of regions in the region array
* @checksum: Buffer contanining the output hash
*
* @return 0 if OK, < 0 if error
*/
int hash_calculate(const char *name,
const struct image_region region[], int region_count,
uint8_t *checksum);
#endif
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright 2014 Freescale Semiconductor, Inc.
*/
#ifndef _RSA_MOD_EXP_H
#define _RSA_MOD_EXP_H
#include <errno.h>
#include <image.h>
/**
* struct key_prop - holder for a public key properties
*
* The struct has pointers to modulus (Typically called N),
* The inverse, R^2, exponent. These can be typecasted and
* used as byte arrays or converted to the required format
* as per requirement of RSA implementation.
*/
struct key_prop {
const void *rr; /* R^2 can be treated as byte array */
const void *modulus; /* modulus as byte array */
const void *public_exponent; /* public exponent as byte array */
uint32_t n0inv; /* -1 / modulus[0] mod 2^32 */
int num_bits; /* Key length in bits */
uint32_t exp_len; /* Exponent length in number of uint8_t */
};
/**
* rsa_mod_exp_sw() - Perform RSA Modular Exponentiation in sw
*
* Operation: out[] = sig ^ exponent % modulus
*
* @sig: RSA PKCS1.5 signature
* @sig_len: Length of signature in number of bytes
* @node: Node with RSA key elements like modulus, exponent, R^2, n0inv
* @out: Result in form of byte array of len equal to sig_len
*/
int rsa_mod_exp_sw(const uint8_t *sig, uint32_t sig_len,
struct key_prop *node, uint8_t *out);
int rsa_mod_exp(struct udevice *dev, const uint8_t *sig, uint32_t sig_len,
struct key_prop *node, uint8_t *out);
#if defined(CONFIG_CMD_ZYNQ_RSA)
int zynq_pow_mod(u32 *keyptr, u32 *inout);
#endif
/**
* struct struct mod_exp_ops - Driver model for RSA Modular Exponentiation
* operations
*
* The uclass interface is implemented by all crypto devices which use
* driver model.
*/
struct mod_exp_ops {
/**
* Perform Modular Exponentiation
*
* Operation: out[] = sig ^ exponent % modulus
*
* @dev: RSA Device
* @sig: RSA PKCS1.5 signature
* @sig_len: Length of signature in number of bytes
* @node: Node with RSA key elements like modulus, exponent,
* R^2, n0inv
* @out: Result in form of byte array of len equal to sig_len
*
* This function computes exponentiation over the signature.
* Returns: 0 if exponentiation is successful, or a negative value
* if it wasn't.
*/
int (*mod_exp)(struct udevice *dev, const uint8_t *sig,
uint32_t sig_len, struct key_prop *node,
uint8_t *outp);
};
#endif
This diff is collapsed.
This diff is collapsed.
#ifndef _SHA256_H
#define _SHA256_H
#define SHA256_SUM_LEN 32
#define SHA256_DER_LEN 19
extern const uint8_t sha256_der_prefix[];
/* Reset watchdog each time we process this many bytes */
#define CHUNKSZ_SHA256 (64 * 1024)
typedef struct {
uint32_t total[2];
uint32_t state[8];
uint8_t buffer[64];
} sha256_context;
void sha256_starts(sha256_context * ctx);
void sha256_update(sha256_context *ctx, const uint8_t *input, uint32_t length);
void sha256_finish(sha256_context * ctx, uint8_t digest[SHA256_SUM_LEN]);
void sha256_csum_wd(const unsigned char *input, unsigned int ilen,
unsigned char *output, unsigned int chunk_sz);
#endif /* _SHA256_H */
/*
* Linker script helper macros
*
* Copyright (c) 2009 Analog Devices Inc.
*
* Licensed under the GPL-2 or later.
*/
#ifndef __U_BOOT_LDS__
#define __U_BOOT_LDS__
/* See if the linker version is at least the specified version */
#define LD_AT_LEAST(major, minor) \
((major > LD_MAJOR) || (major == LD_MAJOR && minor <= LD_MINOR))
/*
* Linker versions prior to 2.16 don't understand the builtin
* functions SORT_BY_ALIGNMENT() and SORT_BY_NAME(), so disable these
*/
#if !LD_AT_LEAST(2, 16)
# define SORT_BY_ALIGNMENT(x) x
# define SORT_BY_NAME(x) x
#endif
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#include <linux/libfdt_env.h>
#include "../../scripts/dtc/libfdt/fdt.c"
#include <linux/libfdt_env.h>
#include "../../scripts/dtc/libfdt/fdt_addresses.c"
#include <linux/libfdt_env.h>
#include "../../scripts/dtc/libfdt/fdt_empty_tree.c"
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#include "../../scripts/dtc/libfdt/libfdt_internal.h"
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.