TLS 1.3 PSK 会话恢复: NewSessionTicket 签发/解析、ticket+binder 校验、selected_identity 回选、恢复握手免证书(pazessl -sess_in/-sess_out 端到端验证); 构建脚本输出 bin/ 并支持独立命令与 psftp; 修复 SFTP 二进制传输与 copy_id -P; 补充 tests/ 调试与 verify_tls
48 行
1.5 KiB
C
48 行
1.5 KiB
C
/* dbg_point2.c —— 深入定位 add/dbl 一致性
|
|
* 核心问题:G+G(add) != 2G(dbl), 且两者都声称 on curve */
|
|
#include "paze/p256.h"
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
static void dump(const char *tag, const paze_p256_point_t *P) {
|
|
uint8_t b[65];
|
|
if (paze_p256_to_affine(P, b, sizeof(b)) != PAZE_OK) { printf("%s: to_affine FAIL\n", tag); return; }
|
|
paze_p256_point_t chk;
|
|
int oc = paze_p256_from_affine(&chk, b, sizeof(b)) == PAZE_OK;
|
|
printf("%s oncurve=%d x=", tag, oc);
|
|
for (size_t i = 1; i <= 32; i++) printf("%02x", b[i]);
|
|
printf("\n%s y=", tag);
|
|
for (size_t i = 33; i < 65; i++) printf("%02x", b[i]);
|
|
printf("\n");
|
|
}
|
|
|
|
int main(void) {
|
|
paze_p256_point_t G;
|
|
paze_p256_load_generator(&G);
|
|
|
|
paze_p256_point_t D; /* dbl */
|
|
uint8_t two[32] = {0}; two[31] = 2;
|
|
paze_p256_scalar_mult(&D, two, &G);
|
|
|
|
paze_p256_point_t A; /* add G+G */
|
|
paze_p256_add(&A, &G, &G);
|
|
|
|
dump("2G(dbl)", &D);
|
|
dump("G+G(add)", &A);
|
|
|
|
/* add 处理 Jacobian 输入: 2G + G == 3G (dbl) */
|
|
paze_p256_point_t A3, D3;
|
|
paze_p256_add(&A3, &D, &G); /* 2G + G */
|
|
uint8_t three[32] = {0}; three[31] = 3;
|
|
paze_p256_scalar_mult(&D3, three, &G); /* 3G */
|
|
dump("3G(scalar)", &D3);
|
|
dump("2G+G(add)", &A3);
|
|
|
|
/* 检查 D 的 Z 分量(应该 != 1) */
|
|
printf("D.Z limbs: %d [%08x %08x %08x ...]\n", D.Z.n,
|
|
D.Z.n > 0 ? D.Z.d[0] : 0,
|
|
D.Z.n > 1 ? D.Z.d[1] : 0,
|
|
D.Z.n > 2 ? D.Z.d[2] : 0);
|
|
return 0;
|
|
}
|