From 7c3a0ed9bc22441575b5cdeeec1e8946269c2a32 Mon Sep 17 00:00:00 2001 From: qzh Date: Wed, 3 Sep 2025 03:08:18 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20inc/zuc256.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/zuc256.h | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/inc/zuc256.h b/inc/zuc256.h index 1ff94ac..0438ef9 100644 --- a/inc/zuc256.h +++ b/inc/zuc256.h @@ -1,3 +1,32 @@ +/* + * Copyright (C) 2025. Institute of Information Engineering, CAS + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @file: zuc256.h + * @brief: zuc256模块对外接口声明 + * @author: QZH + * @version: 1.0.0 + * @date: 2025-09-01 + * + * @attention: 接口使用注意事项 + */ #ifndef __ZUC256_H #define __ZUC256_H @@ -28,11 +57,11 @@ typedef struct { ZUC_UINT31 LFSR[16]; // ZUC256 线性反馈移位寄存器 uint32_t R1; // 非线性函数寄存器R1 uint32_t R2; // 非线性函数寄存器R2 - uint8_t buf[4]; // 数据缓存(处理不足4字节的待认证数据) - size_t buflen; // 缓存中有效数据长度(0~3) - uint32_t T[4]; // MAC 累加器(支持最大128位MAC,4个32位字) - uint32_t K0[4]; // MAC 初始密钥字(与T长度匹配) - int macbits; // MAC 输出位数(32/64/128,按32位对齐) + uint8_t buf[4]; // 数据缓存(处理不足4字节的待认证数据) + size_t buflen; // 缓存中有效数据长度(0~3) + uint32_t T[4]; // MAC 累加器(支持最大128位MAC,4个32位字) + uint32_t K0[4]; // MAC 初始密钥字(与T长度匹配) + int macbits; // MAC 输出位数(32/64/128,按32位对齐) } ZUC256_MAC_CTX; // 初始化ZUC256状态