文件
JGZYES 3e8a5442fa 实现 TLS 1.3 PSK 会话恢复,构建输出移至 bin/ 并新增 standalone/psftp 命令
TLS 1.3 PSK 会话恢复: NewSessionTicket 签发/解析、ticket+binder 校验、selected_identity 回选、恢复握手免证书(pazessl -sess_in/-sess_out 端到端验证); 构建脚本输出 bin/ 并支持独立命令与 psftp; 修复 SFTP 二进制传输与 copy_id -P; 补充 tests/ 调试与 verify_tls
2026-08-13 19:30:07 +08:00

28 行
1.1 KiB
C

/* dbg_x25519.c —— X25519 RFC 7748 迭代向量验证 */
#include "paze/curve25519.h"
#include <stdio.h>
#include <string.h>
int main(void) {
/* RFC 7748 §5.2 迭代向量: 1 的标量倍 = 0x2f e5 7d a3 ... */
uint8_t k[32] = {1}, u[32] = {9}, out[32];
if (paze_x25519(out, k, u) != PAZE_OK) { printf("x25519 fail\n"); return 1; }
static const uint8_t e1[32] = {
0x2f,0xe5,0x7d,0xa3,0xc4,0x67,0x9c,0x1a,0x7d,0xeb,0x48,0x2a,0x0e,0xbd,0x59,0x6a,
0x66,0x41,0xe6,0x1c,0xc4,0xd6,0x75,0x5f,0x35,0x6e,0xbe,0x6a,0xf2,0x2b,0x8d,0x7c
};
printf("X25519(1,9): %s\n", memcmp(out, e1, 32) == 0 ? "PASS" : "FAIL");
/* 1000 次迭代 */
uint8_t kk[32] = {9};
for (int i = 0; i < 1000; i++) {
paze_x25519(kk, kk, u);
}
static const uint8_t e2[32] = {
0x68,0x4c,0xf5,0x9b,0xa8,0x33,0x09,0x55,0x28,0x00,0xef,0x56,0x6f,0x2f,0x4d,0x3c,
0x1c,0x38,0x87,0xc4,0x93,0x60,0xe3,0x87,0x5f,0x2e,0xb9,0x4a,0xe9,0x5a,0xc4,0x4f
};
printf("X25519 1000-iter: %s\n", memcmp(kk, e2, 32) == 0 ? "PASS" : "FAIL");
return 0;
}