mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Fix AES build on real Visual Studio.
Apparently a nasty trick I did in one of the selector vtable macros was not acceptable to VS, which thinks that "string" ? NULL : NULL is not a constant expression - it can't tell that the string literal has a non-null value _or_ that it doesn't matter whether the value is null or not. Redone the vtable name construction in a way that depends only on the actual preprocessor, not on the followup C expression semantics.
This commit is contained in:
parent
c8b66101ee
commit
fbb979aa98
@ -39,7 +39,7 @@ static ssh_cipher *aes_select(const ssh_cipheralg *alg)
|
||||
#define IF_NEON(...)
|
||||
#endif
|
||||
|
||||
#define AES_SELECTOR_VTABLE(mode_c, mode_protocol, mode_display, bits, ...) \
|
||||
#define AES_SELECTOR_VTABLE(mode_c, namemaker, mode_display, bits, ...) \
|
||||
static const ssh_cipheralg * \
|
||||
ssh_aes ## bits ## _ ## mode_c ## _impls[] = { \
|
||||
IF_NI(&ssh_aes ## bits ## _ ## mode_c ## _ni,) \
|
||||
@ -49,7 +49,7 @@ static ssh_cipher *aes_select(const ssh_cipheralg *alg)
|
||||
}; \
|
||||
const ssh_cipheralg ssh_aes ## bits ## _ ## mode_c = { \
|
||||
.new = aes_select, \
|
||||
.ssh2_id = "aes" #bits "-" mode_protocol, \
|
||||
.ssh2_id = namemaker(bits), \
|
||||
.blksize = 16, \
|
||||
.real_keybits = bits, \
|
||||
.padded_keybytes = bits/8, \
|
||||
@ -59,22 +59,27 @@ static ssh_cipher *aes_select(const ssh_cipheralg *alg)
|
||||
__VA_ARGS__ \
|
||||
}
|
||||
|
||||
AES_SELECTOR_VTABLE(cbc, "cbc", "CBC", 128);
|
||||
AES_SELECTOR_VTABLE(cbc, "cbc", "CBC", 192);
|
||||
AES_SELECTOR_VTABLE(cbc, "cbc", "CBC", 256);
|
||||
AES_SELECTOR_VTABLE(sdctr, "ctr", "SDCTR", 128);
|
||||
AES_SELECTOR_VTABLE(sdctr, "ctr", "SDCTR", 192);
|
||||
AES_SELECTOR_VTABLE(sdctr, "ctr", "SDCTR", 256);
|
||||
AES_SELECTOR_VTABLE(gcm, "gcm@openssh.com", "GCM", 128,
|
||||
#define cbc_namemaker(bits) "aes" #bits "-cbc"
|
||||
#define ctr_namemaker(bits) "aes" #bits "-ctr"
|
||||
#define gcm_namemaker(bits) "aes" #bits "-gcm@openssh.com"
|
||||
|
||||
AES_SELECTOR_VTABLE(cbc, cbc_namemaker, "CBC", 128);
|
||||
AES_SELECTOR_VTABLE(cbc, cbc_namemaker, "CBC", 192);
|
||||
AES_SELECTOR_VTABLE(cbc, cbc_namemaker, "CBC", 256);
|
||||
AES_SELECTOR_VTABLE(sdctr, ctr_namemaker, "SDCTR", 128);
|
||||
AES_SELECTOR_VTABLE(sdctr, ctr_namemaker, "SDCTR", 192);
|
||||
AES_SELECTOR_VTABLE(sdctr, ctr_namemaker, "SDCTR", 256);
|
||||
AES_SELECTOR_VTABLE(gcm, gcm_namemaker, "GCM", 128,
|
||||
.required_mac = &ssh2_aesgcm_mac);
|
||||
AES_SELECTOR_VTABLE(gcm, "gcm@openssh.com", "GCM", 256,
|
||||
AES_SELECTOR_VTABLE(gcm, gcm_namemaker, "GCM", 256,
|
||||
.required_mac = &ssh2_aesgcm_mac);
|
||||
|
||||
/* 192-bit AES-GCM is included only so that testcrypt can run standard
|
||||
* test vectors against it. OpenSSH doesn't define a protocol id for
|
||||
* it. Hence the silly macro trick here to set its ssh2_id to 0, and
|
||||
* more importantly, leaving it out of aesgcm_list[] below. */
|
||||
AES_SELECTOR_VTABLE(gcm, ?NULL:NULL, "GCM", 192,
|
||||
* it. Hence the use of null_namemaker here to set its ssh2_id to NULL,
|
||||
* and more importantly, leaving it out of aesgcm_list[] below. */
|
||||
#define null_namemaker(bits) NULL
|
||||
AES_SELECTOR_VTABLE(gcm, null_namemaker, "GCM", 192,
|
||||
.required_mac = &ssh2_aesgcm_mac);
|
||||
|
||||
static const ssh_cipheralg ssh_rijndael_lysator = {
|
||||
|
Loading…
Reference in New Issue
Block a user