惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
J
Java Code Geeks
C
Check Point Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Google DeepMind News
Google DeepMind News
阮一峰的网络日志
阮一峰的网络日志
Engineering at Meta
Engineering at Meta
Blog — PlanetScale
Blog — PlanetScale
D
Docker
H
Hackread – Cybersecurity News, Data Breaches, AI and More
月光博客
月光博客
I
InfoQ
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
A
About on SuperTechFans
L
LangChain Blog
腾讯CDC
Y
Y Combinator Blog
MongoDB | Blog
MongoDB | Blog
Vercel News
Vercel News
MyScale Blog
MyScale Blog
博客园 - Franky
IT之家
IT之家
博客园_首页

博客园 - panrui

Git和Sourcetree 模拟电子器件的恒流特性 python环境下的加密库import Crypto失败解决 TI的C2000系列处理器的Flash使用指导手册 TI的TMS320的MCU的16位地址的特点 使用开源音频软件去分析声音的频率成分 SVPWM波形分区 python的使用 什么是xml c语言中const关键字的使用 Cross compilation 程序流监控 飞思卡尔的工具freemaster和powerpc调试器的配合使用 汽车电子sent协议的使用 Autosar 入门 INCA 如何让标定的map显示成立体的图形的形式 ASPICE的实践 安装ubuntu后的U盘(tf卡)恢复到之前的状态 ssh的使用 bash脚本的判断语句之一 推测执行 Speculative execution 什么是cache Assembler Instructions with C Expression Operands
csec的key更新
panrui · 2022-09-13 · via 博客园 - panrui

在对csec的使用中(其他遵循hsm key update协议的芯片也适用),kdf的运算过程中遇到的数据都是128bit。不需要考虑padding的问题。
目前并没有找到对padding的一致性的处理方式。

对于Miyaguchi-Preneel compression的具体计算过程,Wikipedia中存在相应的算法解释。

https://en.wikipedia.org/wiki/One-way_compression_function

AES的CBC模式:

    mbedtls_aes_context aes;
    mbedtls_aes_init( &aes );
    ret = mbedtls_aes_setkey_enc( &aes, k1, 128u );
    ret = mbedtls_aes_crypt_cbc( &aes, MBEDTLS_AES_ENCRYPT, ATOMIC_BUFSIZE*2, IV_zero, data_connected, pM2); /*  */
    mbedtls_aes_free( &aes );

AES的ECB模式:

    mbedtls_aes_context aes;
    mbedtls_aes_init( &aes );
    ret = mbedtls_aes_setkey_enc( &aes, tempIV, 128u );
    ret = mbedtls_aes_crypt_ecb( &aes, MBEDTLS_AES_ENCRYPT, key, tempENC_Text);
    mbedtls_aes_free( &aes );

CMAC算法:

    const mbedtls_cipher_info_t *cipher_info;

    cipher_info = mbedtls_cipher_info_from_type( MBEDTLS_CIPHER_AES_128_ECB );
    ret = mbedtls_cipher_cmac( cipher_info, k2, 128u, data_connected, M1_SIZE + M2_SIZE, pM3);

注意,CMAC的计算模式也是CBC模式,由于CBC模式的初始化向量必然要用到,相关的NIST公开规范中规定初始化向量为全零值。

/* The Fid can be considered as always 6bits. no matter the SFE is 0x00 or 0x01.
* Align the Fid to the leftest postion.
*
* */