From 4af4d3342e93da92301f6df02a1037b325646c65 Mon Sep 17 00:00:00 2001 From: zcy Date: Tue, 9 Sep 2025 19:56:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E6=94=B9=E4=B8=80=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Src/com/cscn/Method.java | 9 +-------- Src/com/cscn/XwSecurity.java | 1 - Src/com/cscn/Zuc256Tables.java | 4 +--- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/Src/com/cscn/Method.java b/Src/com/cscn/Method.java index 40a6bc5..532260c 100644 --- a/Src/com/cscn/Method.java +++ b/Src/com/cscn/Method.java @@ -10,9 +10,6 @@ import javacard.framework.Util; /** */ public class Method { - // ======= 已按你提供的数据填充 ======= - - // todo 写固定值在代码里了 // 加密密钥0: 32字节 private static final byte[] ZUC256_ENC_KEY_0 = { @@ -76,7 +73,7 @@ public class Method { // 输入数据缓冲区最大值 static final short MAX_DATA_BLOCK_SIZE = 128; - // 运行时缓冲:放RAM,避免写EEPROM + // 运行时缓冲 byte[] ctx_buf; short ctx_buflen; @@ -1541,7 +1538,6 @@ public class Method { // System.arraycopy(out, 4, newOut, 0, out.length - 4); // } // out = newOut; - // 这里C实现就是直接指针+4的。JavaSE实现搞这个new干嘛。。 outPos += 4; } } @@ -1616,8 +1612,6 @@ public class Method { } } - - // 清理上下文 // Arrays.fill(this.buf, (byte) 0); for(short i=0; i<4; i++) { @@ -1633,7 +1627,6 @@ public class Method { LFSR_hi[i] = 0; } - // this.state.R1 = 0; // this.state.R2 = 0; // R1、R2 清零 diff --git a/Src/com/cscn/XwSecurity.java b/Src/com/cscn/XwSecurity.java index f10e549..90f39b7 100644 --- a/Src/com/cscn/XwSecurity.java +++ b/Src/com/cscn/XwSecurity.java @@ -11,7 +11,6 @@ import javacard.framework.ISOException; * */ public class XwSecurity extends Applet { - //todo test // public static final byte INS_PROCESS_DATA_TEST = (byte)0xE3; diff --git a/Src/com/cscn/Zuc256Tables.java b/Src/com/cscn/Zuc256Tables.java index cbc6539..14e4ae0 100644 --- a/Src/com/cscn/Zuc256Tables.java +++ b/Src/com/cscn/Zuc256Tables.java @@ -2,12 +2,10 @@ package com.cscn; /** * 常量表:S0/S1 与 ZUC256_D。 - * 注意:JavaCard 目标环境建议将表定义为 static final 数组,按 int/short 存放。 - * 适配说明:已将 32bit int 数组改为 16bit short 数组,符合JavaCard 16bit能力要求 + * */ public final class Zuc256Tables { - // 私有构造函数:防止类被实例化 private Zuc256Tables() {} // S盒:S0, S1