文件
JGZYES 6da27731b5 实现 TLS 1.2 握手与版本回退,修复 GCM 记录层 RFC 偏差
- tls_handshake12.c: 完整 TLS 1.2 client/server 状态机(ECDHE-RSA/ECDSA/RSA AES-GCM + CHACHA20-POLY1305),支持 1.3 收到 1.2 ServerHello/ClientHello 后回退
- tls_record.c: 修正 TLS 1.2 AEAD-GCM 两处 RFC 偏差: AAD length 字段应为明文长度 ctlen(RFC 5246 6.2.3.3)原为 ct+16; GCMNonce = fixed_iv(4) || explicit_nonce(8)(RFC 5288 3)原顺序相反
- tls_handshake13.c: CV/Finished transcript 处理、1.3 套件记录版本修正、链式证书构造
- x509.c: AttributeTypeAndValue 补 SEQUENCE; validity 2050 年前用 UTCTime
- apps/pazessl: s_client/s_server 增加 -tls1_2
- 新增 build.ps1、build/run_tls_test.ps1、build/run_openssl_interop.ps1

验证: 自测 4/4(1.2/1.3 双向 + 回退); OpenSSL 互操作 4/4(s_client/s_server 双向 1.2/1.3)
2026-08-13 17:30:31 +08:00

46 行
1.5 KiB
C

/* ssh_config.h —— ~/.pssh/config.conf 解析(ssh_config 子集)
*
* 支持指令:
* Host <pattern...> 段开始(支持 * 通配,可多模式空格分隔)
* HostName <host> 实际主机名
* Port <n> 端口
* User <name> 用户名
* IdentityFile <path> 私钥路径(支持 ~)
* ProxyJump [user@]host[:port] 代理跳转
* StrictHostKeyChecking no|accept-new|yes
*/
#ifndef PAZE_SSH_CONFIG_H
#define PAZE_SSH_CONFIG_H
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
char host[128]; /* Host 模式串 */
char hostname[256]; /* HostName */
char user[128]; /* User */
int port; /* Port,0=未设置 */
char identity_file[512];
char proxyjump[512];
int hostkey_mode; /* -1=未设置, 0=ask, 1=accept-new, 2=no */
} pssh_config_entry_t;
/* 解析配置文件;*out 为 malloc 数组,调用方 free。返回条目数,失败返回 -1。 */
int pssh_config_load(const char *path, pssh_config_entry_t **out, int *count);
/* 匹配主机别名,按 ssh_config 语义(第一个匹配段生效,后续不覆盖已设值)。
* out 需由调用方初始化(全零)后传入。返回匹配的段数,0=无。 */
int pssh_config_match(const pssh_config_entry_t *entries, int count,
const char *alias, pssh_config_entry_t *out);
/* 展开 ~ 为用户主目录 */
void pssh_config_expand_home(const char *in, char *out, size_t n);
#ifdef __cplusplus
}
#endif
#endif /* PAZE_SSH_CONFIG_H */