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:
@@ -20,12 +20,22 @@
|
||||
#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/sha1.h>
|
||||
|
||||
#include <linux/compiler.h>
|
||||
|
||||
#ifdef USE_HOSTCC
|
||||
#undef __weak
|
||||
#define __weak
|
||||
#undef __maybe_unused
|
||||
#define __maybe_unused
|
||||
#endif
|
||||
|
||||
const uint8_t sha1_der_prefix[SHA1_DER_LEN] = {
|
||||
0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e,
|
||||
0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14
|
||||
@@ -56,6 +66,23 @@ const uint8_t sha1_der_prefix[SHA1_DER_LEN] = {
|
||||
*/
|
||||
void sha1_starts (sha1_context * ctx)
|
||||
{
|
||||
#if !defined(USE_HOSTCC)
|
||||
#if !CONFIG_IS_ENABLED(ARMV8_CE_SHA1) && CONFIG_IS_ENABLED(DM_CRYPTO)
|
||||
sha_context cctx;
|
||||
u32 algo = CRYPTO_SHA1;
|
||||
|
||||
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;
|
||||
|
||||
@@ -66,7 +93,7 @@ void sha1_starts (sha1_context * ctx)
|
||||
ctx->state[4] = 0xC3D2E1F0;
|
||||
}
|
||||
|
||||
static void sha1_process(sha1_context *ctx, const unsigned char data[64])
|
||||
static void __maybe_unused sha1_process_one(sha1_context *ctx, const unsigned char data[64])
|
||||
{
|
||||
unsigned long temp, W[16], A, B, C, D, E;
|
||||
|
||||
@@ -220,6 +247,18 @@ static void sha1_process(sha1_context *ctx, const unsigned char data[64])
|
||||
ctx->state[4] += E;
|
||||
}
|
||||
|
||||
__weak void sha1_process(sha1_context *ctx, const unsigned char *data,
|
||||
unsigned int blocks)
|
||||
{
|
||||
if (!blocks)
|
||||
return;
|
||||
|
||||
while (blocks--) {
|
||||
sha1_process_one(ctx, data);
|
||||
data += 64;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-1 process buffer
|
||||
*/
|
||||
@@ -231,7 +270,14 @@ void sha1_update(sha1_context *ctx, const unsigned char *input,
|
||||
|
||||
if (ilen <= 0)
|
||||
return;
|
||||
|
||||
#if !defined(USE_HOSTCC)
|
||||
#if !CONFIG_IS_ENABLED(ARMV8_CE_SHA1) && CONFIG_IS_ENABLED(DM_CRYPTO)
|
||||
if (ctx->cdev) {
|
||||
crypto_sha_update(ctx->cdev, (void *)input, ilen);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
left = ctx->total[0] & 0x3F;
|
||||
fill = 64 - left;
|
||||
|
||||
@@ -243,17 +289,15 @@ void sha1_update(sha1_context *ctx, const unsigned char *input,
|
||||
|
||||
if (left && ilen >= fill) {
|
||||
memcpy ((void *) (ctx->buffer + left), (void *) input, fill);
|
||||
sha1_process (ctx, ctx->buffer);
|
||||
sha1_process(ctx, ctx->buffer, 1);
|
||||
input += fill;
|
||||
ilen -= fill;
|
||||
left = 0;
|
||||
}
|
||||
|
||||
while (ilen >= 64) {
|
||||
sha1_process (ctx, input);
|
||||
input += 64;
|
||||
ilen -= 64;
|
||||
}
|
||||
sha1_process(ctx, input, ilen / 64);
|
||||
input += ilen / 64 * 64;
|
||||
ilen = ilen % 64;
|
||||
|
||||
if (ilen > 0) {
|
||||
memcpy ((void *) (ctx->buffer + left), (void *) input, ilen);
|
||||
@@ -276,6 +320,18 @@ void sha1_finish (sha1_context * ctx, unsigned char output[20])
|
||||
unsigned long high, low;
|
||||
unsigned char msglen[8];
|
||||
|
||||
#if !defined(USE_HOSTCC)
|
||||
#if !CONFIG_IS_ENABLED(ARMV8_CE_SHA1) && CONFIG_IS_ENABLED(DM_CRYPTO)
|
||||
sha_context cctx;
|
||||
|
||||
if (ctx->cdev) {
|
||||
cctx.algo = CRYPTO_SHA1;
|
||||
cctx.length = ctx->length;
|
||||
crypto_sha_final(ctx->cdev, &cctx, output);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
high = (ctx->total[0] >> 29)
|
||||
| (ctx->total[1] << 3);
|
||||
low = (ctx->total[0] << 3);
|
||||
@@ -304,6 +360,11 @@ void sha1_csum(const unsigned char *input, unsigned int ilen,
|
||||
{
|
||||
sha1_context ctx;
|
||||
|
||||
#if !defined(USE_HOSTCC)
|
||||
#if !CONFIG_IS_ENABLED(ARMV8_CE_SHA1) && CONFIG_IS_ENABLED(DM_CRYPTO)
|
||||
ctx.length = ilen;
|
||||
#endif
|
||||
#endif
|
||||
sha1_starts (&ctx);
|
||||
sha1_update (&ctx, input, ilen);
|
||||
sha1_finish (&ctx, output);
|
||||
@@ -321,7 +382,11 @@ void sha1_csum_wd(const unsigned char *input, unsigned int ilen,
|
||||
const unsigned char *end, *curr;
|
||||
int chunk;
|
||||
#endif
|
||||
|
||||
#if !defined(USE_HOSTCC)
|
||||
#if !CONFIG_IS_ENABLED(ARMV8_CE_SHA1) && CONFIG_IS_ENABLED(DM_CRYPTO)
|
||||
ctx.length = ilen;
|
||||
#endif
|
||||
#endif
|
||||
sha1_starts (&ctx);
|
||||
|
||||
#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
|
||||
@@ -366,11 +431,21 @@ void sha1_hmac(const unsigned char *key, int keylen,
|
||||
k_opad[i] ^= key[i];
|
||||
}
|
||||
|
||||
#if !defined(USE_HOSTCC)
|
||||
#if !CONFIG_IS_ENABLED(ARMV8_CE_SHA1) && CONFIG_IS_ENABLED(DM_CRYPTO)
|
||||
ctx.length = 64 + ilen;
|
||||
#endif
|
||||
#endif
|
||||
sha1_starts (&ctx);
|
||||
sha1_update (&ctx, k_ipad, 64);
|
||||
sha1_update (&ctx, input, ilen);
|
||||
sha1_finish (&ctx, tmpbuf);
|
||||
|
||||
#if !defined(USE_HOSTCC)
|
||||
#if !CONFIG_IS_ENABLED(ARMV8_CE_SHA1) && CONFIG_IS_ENABLED(DM_CRYPTO)
|
||||
ctx.length = 64 + 20;
|
||||
#endif
|
||||
#endif
|
||||
sha1_starts (&ctx);
|
||||
sha1_update (&ctx, k_opad, 64);
|
||||
sha1_update (&ctx, tmpbuf, 20);
|
||||
|
||||
Reference in New Issue
Block a user