mirror of
https://github.com/LuckfoxTECH/luckfox-pico.git
synced 2026-01-19 17:59:18 +01:00
project:build.sh: Added fastboot support; custom modifications to U-Boot and kernel implemented using patches.
project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp: Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem. sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately. sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades. sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for fastboot. Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
This commit is contained in:
@@ -9,12 +9,20 @@
|
||||
#ifndef USE_HOSTCC
|
||||
#include <common.h>
|
||||
#include <linux/string.h>
|
||||
#include <crypto.h>
|
||||
#else
|
||||
#include <string.h>
|
||||
#endif /* USE_HOSTCC */
|
||||
#include <watchdog.h>
|
||||
#include <u-boot/sha256.h>
|
||||
|
||||
#include <linux/compiler.h>
|
||||
|
||||
#ifdef USE_HOSTCC
|
||||
#undef __weak
|
||||
#define __weak
|
||||
#endif
|
||||
|
||||
const uint8_t sha256_der_prefix[SHA256_DER_LEN] = {
|
||||
0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86,
|
||||
0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05,
|
||||
@@ -43,6 +51,23 @@ const uint8_t sha256_der_prefix[SHA256_DER_LEN] = {
|
||||
|
||||
void sha256_starts(sha256_context * ctx)
|
||||
{
|
||||
#if !defined(USE_HOSTCC)
|
||||
#if !CONFIG_IS_ENABLED(ARMV8_CE_SHA256) && CONFIG_IS_ENABLED(DM_CRYPTO)
|
||||
sha_context cctx;
|
||||
u32 algo = CRYPTO_SHA256;
|
||||
|
||||
ctx->cdev = NULL;
|
||||
if (ctx->length) {
|
||||
ctx->cdev = crypto_get_device(algo);
|
||||
if (ctx->cdev) {
|
||||
cctx.algo = algo;
|
||||
cctx.length = ctx->length;
|
||||
crypto_sha_init(ctx->cdev, &cctx);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
ctx->total[0] = 0;
|
||||
ctx->total[1] = 0;
|
||||
|
||||
@@ -56,7 +81,7 @@ void sha256_starts(sha256_context * ctx)
|
||||
ctx->state[7] = 0x5BE0CD19;
|
||||
}
|
||||
|
||||
static void sha256_process(sha256_context *ctx, const uint8_t data[64])
|
||||
static void sha256_process_one(sha256_context *ctx, const uint8_t data[64])
|
||||
{
|
||||
uint32_t temp1, temp2;
|
||||
uint32_t W[64];
|
||||
@@ -187,6 +212,18 @@ static void sha256_process(sha256_context *ctx, const uint8_t data[64])
|
||||
ctx->state[7] += H;
|
||||
}
|
||||
|
||||
__weak void sha256_process(sha256_context *ctx, const unsigned char *data,
|
||||
unsigned int blocks)
|
||||
{
|
||||
if (!blocks)
|
||||
return;
|
||||
|
||||
while (blocks--) {
|
||||
sha256_process_one(ctx, data);
|
||||
data += 64;
|
||||
}
|
||||
}
|
||||
|
||||
void sha256_update(sha256_context *ctx, const uint8_t *input, uint32_t length)
|
||||
{
|
||||
uint32_t left, fill;
|
||||
@@ -194,6 +231,14 @@ void sha256_update(sha256_context *ctx, const uint8_t *input, uint32_t length)
|
||||
if (!length)
|
||||
return;
|
||||
|
||||
#if !defined(USE_HOSTCC)
|
||||
#if !CONFIG_IS_ENABLED(ARMV8_CE_SHA256) && CONFIG_IS_ENABLED(DM_CRYPTO)
|
||||
if (ctx->cdev) {
|
||||
crypto_sha_update(ctx->cdev, (void *)input, length);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
left = ctx->total[0] & 0x3F;
|
||||
fill = 64 - left;
|
||||
|
||||
@@ -205,17 +250,15 @@ void sha256_update(sha256_context *ctx, const uint8_t *input, uint32_t length)
|
||||
|
||||
if (left && length >= fill) {
|
||||
memcpy((void *) (ctx->buffer + left), (void *) input, fill);
|
||||
sha256_process(ctx, ctx->buffer);
|
||||
sha256_process(ctx, ctx->buffer, 1);
|
||||
length -= fill;
|
||||
input += fill;
|
||||
left = 0;
|
||||
}
|
||||
|
||||
while (length >= 64) {
|
||||
sha256_process(ctx, input);
|
||||
length -= 64;
|
||||
input += 64;
|
||||
}
|
||||
sha256_process(ctx, input, length / 64);
|
||||
input += length / 64 * 64;
|
||||
length = length % 64;
|
||||
|
||||
if (length)
|
||||
memcpy((void *) (ctx->buffer + left), (void *) input, length);
|
||||
@@ -234,6 +277,18 @@ void sha256_finish(sha256_context * ctx, uint8_t digest[32])
|
||||
uint32_t high, low;
|
||||
uint8_t msglen[8];
|
||||
|
||||
#if !defined(USE_HOSTCC)
|
||||
#if !CONFIG_IS_ENABLED(ARMV8_CE_SHA256) && CONFIG_IS_ENABLED(DM_CRYPTO)
|
||||
sha_context cctx;
|
||||
|
||||
if (ctx->cdev) {
|
||||
cctx.algo = CRYPTO_SHA256;
|
||||
cctx.length = ctx->length;
|
||||
crypto_sha_final(ctx->cdev, &cctx, digest);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
high = ((ctx->total[0] >> 29)
|
||||
| (ctx->total[1] << 3));
|
||||
low = (ctx->total[0] << 3);
|
||||
@@ -265,6 +320,11 @@ void sha256_csum(const unsigned char *input, unsigned int ilen,
|
||||
{
|
||||
sha256_context ctx;
|
||||
|
||||
#if !defined(USE_HOSTCC)
|
||||
#if !CONFIG_IS_ENABLED(ARMV8_CE_SHA256) && CONFIG_IS_ENABLED(DM_CRYPTO)
|
||||
ctx.length = ilen;
|
||||
#endif
|
||||
#endif
|
||||
sha256_starts(&ctx);
|
||||
sha256_update(&ctx, input, ilen);
|
||||
sha256_finish(&ctx, output);
|
||||
@@ -284,6 +344,11 @@ void sha256_csum_wd(const unsigned char *input, unsigned int ilen,
|
||||
int chunk;
|
||||
#endif
|
||||
|
||||
#if !defined(USE_HOSTCC)
|
||||
#if !CONFIG_IS_ENABLED(ARMV8_CE_SHA256) && CONFIG_IS_ENABLED(DM_CRYPTO)
|
||||
ctx.length = ilen;
|
||||
#endif
|
||||
#endif
|
||||
sha256_starts(&ctx);
|
||||
|
||||
#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
|
||||
|
||||
Reference in New Issue
Block a user