stm32 cubeide 添加 cryptographic .a .lib 加密库 使用 RSA非对称加密解密

STM32加密库移植实战:从硬件加速到工程集成的完整指南 在嵌入式系统开发中,数据加密是保障通信安全与设备认证的核心技术,其原理基于密码学算法对数据进行变换与保护。从基础的对称加密(如AES)到非对称加密(如RSA),再到哈希算法(如SHA256),这些技术为物联网设备、工业控制等场景提供了防篡改、防窃听的关键价值。面对资源受限的MCU环境,直接使用硬件加速的官方加密库能显著提升性能与可靠性。本文以STM32 Cryptographic Library为例,深入解析如何将经过芯片原厂优化的加密库集成到实际工程中,涵盖从硬件外设配置、内存管理到与通信协议栈对接的全流 阅读详情
AI摘要

本文详细介绍如何将STM32F4的RSA加密解密库移植到特定工程项目中,包括库文件的添加、配置及代码示例。通过具体步骤说明,帮助读者快速掌握移植过程。

移植过程

在这里插入图片描述

  1. 从st官网下载cryptolib,解压文件,进入目录 .\STM32CubeExpansion_Crypto_V3.1.0\Fw_Crypto\STM32F4\Middlewares\ST
    注:本文针对F4芯片,其他芯片请参照路径自行更改
  2. 将目录下的文件夹 STM32_Cryptographic拷贝到需要移植的工程目录下
  3. 右键项目名称,refresh, 文件已添加进工程内
  4. 右键项目名称,Properties->C/C++ General->Paths and Symbols, 将新添加库.h文件的路径添加进工程。在这里插入图片描述
  5. 点击 Library Paths->add->输入库文件路径 在这里插入图片描述
  6. 点击 Library Paths->Add->输入库文件名称, 重点!!!:去掉库文件名开头的lib和末尾的.a在这里插入图片描述
  7. 非常重要!否则一直编译不通过 进入 C/C++ Build->Setting->Tool Settings->MCU Setting->Floating-point ABI 选择 -mfloat-abi=softfp在这里插入图片描述
  8. 以 RSA非对称加密解密为例,打开之前解压的文件目录 .\STM32CubeExpansion_Crypto_V3.1.0\Fw_Crypto\STM32F4\Projects\STM32F401RE-Nucleo\RSA\Enc_Dec\Src 打开main.c,拷贝所有内容。
  9. 在项目中适当位置,新建rsa.c/rsa.h文件,将main.c中内容,拷贝到rsa.c文件中,并对内容进行修改

rsa.c:

/* Includes ------------------------------------------------------------------*/
#include "rsa.h"

/** @addtogroup STM32_Crypto_Examples
 * @{
 */

/* Private typedef -----------------------------------------------------------*/
typedef enum
{
	FAILED = 0, PASSED = !FAILED
} TestStatus;
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/

uint8_t preallocated_buffer[4096]; /* buffer required for internal allocation of memory */

/******************************************************************************/
/************************** RSA 2048 Test Vector  ****************************/
/******************************************************************************/
const uint8_t Message[] =
{ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33,
		0x34, 0x35, 0x36, 0x00};

const uint8_t Modulus[] =
{ 0xB5, 0x05, 0xFC, 0xA2, 0x
STM32硬件加密库移植指南:从环境配置到性能优化实战 在嵌入式系统开发中,数据安全是保障设备可靠通信与存储的核心需求。加密技术通过特定算法对数据进行编码转换,确保其机密性、完整性与真实性。其原理涉及对称加密(如AES)、非对称加密及哈希算法等,利用数学计算实现安全防护。对于资源受限的MCU,纯软件加密往往面临性能与功耗的挑战,而硬件加密加速器则能显著提升效率。STM32 Cryptographic Library作为官方解决方案,深度整合了芯片的AES、HASH、RNG等硬件模块,为开发者提供了统一易用的API接口。在物联网关、智能设备等应用场景中,该库能有效 阅读详情

相关推荐

STM32 X-CUBE-CRYPTOLIB V4.0.1 STM32加密库

该加密库适用于stm32全系列,加密库是4.0.1版本,其中的加密函数包括AES、ARC4、C25519、CHACHA20、ECC、ED25519、HASH、RAND、POLY1305、DES、SM2、SM3、SM4等等。

stm32-cryp-lib 以及说明文档 加密库函数 RSA AES

本附件为stm32官方给的加密库,包括一些历程以及详细的使用说明文档,加密方式包括DES、TDES、AES、ARC4、HASH、RSA.

STM32加密库包,支持常见加密算法

STM32加密库包,支持常见加密算法

STM32CubeExpansion_Crypto_V4.0.0.zip

STM32加解密库 V4.0.0版本 2021-07 最新

STM32 Cryptographic Library.rar

STM32 芯片加密库函数 + STM32 Cryptographic Library(加密库)用户使用手册以及例程

STM32加密库_stm32加密库_STM32加密_

STM32加密库文档说明及使用,包括AES-128

自动化测试-自愈技术

随着人工智能的发展,作为一名软件测试工程师,相信大家都会思考如何把这一前沿技术引入到我们的自动化测试当中,想一万遍不如做一遍。,传递当前页面状态,获取之前成功的定位器路径,比较它们,并生成修复的定位器列表。如果修复成功,我们可以使用 Healenium Idea 插件更新我们的自动化测试代码:插件使用修复定位器寻找修复和更新测试代码。的旧定位器去定位按钮的时候,脚本就会报错,提示 “NoSuchElement”的错误异常。现在,我们假设开发人员变更了应用程序的UI界面,改变了这个按钮的id属性,从。

qq_58223744的博客 2663

5G物理层基础知识

1、关于RB和RE (1) RB(Resource Block,资源块)频率上连续12个子载波,时域上一个slot(时隙,14个ofdm符号) (2) RE(Resource Element,资源单元)频率上一个子载波,及时域上一个ofdm符号 注意:协议规定,5G每个时隙(非扩展CP)的符号数为14个(扩展CP情况下每个时隙有12个符号),而LTE(非扩展CP)每个时隙的符号数为7个。 简单说:一个12X14的方格,大的整个叫一个RB,每一个小块叫一个RE。另外,一个RE可存放一个调制符号(mo.

qq_39074243的博客 2万+

告别Mac自带终端:iTerm2 + Oh My Zsh 保姆级配置指南(含国内镜像源)

本文提供了一份详细的Mac终端优化指南,涵盖iTerm2、Oh My Zsh和Homebrew的配置流程,特别针对国内用户提供镜像源解决方案。通过安装现代化工具链和优化配置,帮助开发者打造高效、美观的终端工作环境,提升日常开发效率。

weixin_42638178的博客 405

保姆级教程:用Workbench DesignModeler和TurboGrid搞定叶轮机械IGS文件网格划分(附.js脚本生成技巧)

本文提供了一份详细的叶轮机械网格划分教程,涵盖从IGS文件导入到TurboGrid网格生成的全过程。通过Workbench DesignModeler和TurboGrid的实战操作,帮助工程师高效处理叶轮机械仿真中的几何分割、轮廓线创建和网格质量检查等关键步骤,特别适合CFD初学者和需要快速上手的专业人士。

weixin_32667955的博客 346

别再纠结了!实测罗技Flow、对拷线、微软Mouse without Borders,我的最终选择是...

本文通过实测对比罗技Flow、对拷线和微软Mouse without Borders等多设备控制方案,详细分析了各自的优缺点及适用场景。作者最终选择了对拷线与罗技键鼠的组合方案,为专业用户提供了稳定可靠的多设备协同办公解决方案,特别适合需要频繁传输大文件和跨设备操作的用户。

weixin_33696106的博客 410

使用STM32制作智能窗帘控制

以上就是一个简单的基于STM32的智能窗帘控制代码案例。通过感知光线强度和控制步进电机的旋转,我们可以实现智能窗帘的自动开启和关闭。通过定时器的中断来控制步进电机的旋转,从而实现窗帘的开启和关闭动作。最后,我们需要实现主函数和中断函数。在主函数中,我们需要初始化硬件资源,然后进入一个无限循环来不断检测光敏电阻的值,并根据其值来控制窗帘的开启和关闭。接下来,我们需要编写功能函数,用于控制窗帘的开启和关闭。然后,我们需要配置STM32开发环境,并创建一个新的工程。接下来,我们初始化相关的硬件资源。

2401_85258012的博客 278

Langchain cannot connect with Azure SQL Database

Langchain 无法连接到 Azure SQL 数据库

suiusoar 635

华为OD机试双机位C卷-几何平均值最大子数组(Py/Java/C/C++/Js/Go)

华为OD机试(机考)2026双机位C卷 【几何平均值最大子数组】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解,以及在线OJ模拟做题。华为OD机试真题【几何平均值最大子数组】。

qq_45776114的博客 1371

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

上一篇: stm32 cubemx 添加 rt-thread 操作系统 context_gcc.S 编译报错
下一篇: stm32f407+rtthread 使用 ec20 ppp拨号
郑州-刘明鑫
博客等级 码龄9年 58粉丝 17原创
评论 4
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址