From 081ee457120c4e0df7f174968f3682e73dbf4054 Mon Sep 17 00:00:00 2001 From: Karel Miko Date: Mon, 6 Mar 2017 10:43:39 +0100 Subject: [PATCH 1/4] move declaration at block beginning --- src/modes/xts/xts_test.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modes/xts/xts_test.c b/src/modes/xts/xts_test.c index e274eb02..0b887adc 100644 --- a/src/modes/xts/xts_test.c +++ b/src/modes/xts/xts_test.c @@ -17,6 +17,7 @@ static int _xts_test_accel_xts_encrypt(const unsigned char *pt, unsigned char *c { int ret; symmetric_xts xts; + void *orig; /* AES can be under rijndael or aes... try to find it */ if ((xts.cipher = find_cipher("aes")) == -1) { @@ -24,7 +25,7 @@ static int _xts_test_accel_xts_encrypt(const unsigned char *pt, unsigned char *c return CRYPT_NOP; } } - void *orig = cipher_descriptor[xts.cipher].accel_xts_encrypt; + orig = cipher_descriptor[xts.cipher].accel_xts_encrypt; cipher_descriptor[xts.cipher].accel_xts_encrypt = NULL; XMEMCPY(&xts.key1, skey1, sizeof(symmetric_key)); @@ -41,6 +42,7 @@ static int _xts_test_accel_xts_decrypt(const unsigned char *ct, unsigned char *p { int ret; symmetric_xts xts; + void *orig; /* AES can be under rijndael or aes... try to find it */ if ((xts.cipher = find_cipher("aes")) == -1) { @@ -48,7 +50,7 @@ static int _xts_test_accel_xts_decrypt(const unsigned char *ct, unsigned char *p return CRYPT_NOP; } } - void *orig = cipher_descriptor[xts.cipher].accel_xts_decrypt; + orig = cipher_descriptor[xts.cipher].accel_xts_decrypt; cipher_descriptor[xts.cipher].accel_xts_decrypt = NULL; XMEMCPY(&xts.key1, skey1, sizeof(symmetric_key)); From fb749199db3ecc2edf10e25ce15f9ff83255bdd6 Mon Sep 17 00:00:00 2001 From: Karel Miko Date: Mon, 6 Mar 2017 19:51:46 +0100 Subject: [PATCH 2/4] moving declaration to block beginning --- src/misc/crypt/crypt_constants.c | 4 ++-- src/misc/crypt/crypt_sizes.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/misc/crypt/crypt_constants.c b/src/misc/crypt/crypt_constants.c index 03755b06..68e9aae2 100755 --- a/src/misc/crypt/crypt_constants.c +++ b/src/misc/crypt/crypt_constants.c @@ -182,7 +182,7 @@ int crypt_get_constant(const char* namein, int *valueout) { int crypt_list_all_constants(char *names_list, unsigned int *names_list_size) { int i; unsigned int total_len = 0; - char number[32]; + char number[32], *ptr; int number_len; int count = sizeof(_crypt_constants) / sizeof(_crypt_constants[0]); @@ -205,7 +205,7 @@ int crypt_list_all_constants(char *names_list, unsigned int *names_list_size) { return -1; } /* build the names list */ - char *ptr = names_list; + ptr = names_list; for (i=0; i Date: Mon, 6 Mar 2017 19:53:04 +0100 Subject: [PATCH 3/4] msvc 2008 does not like { } initialization --- src/encauth/ocb3/ocb3_test.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/encauth/ocb3/ocb3_test.c b/src/encauth/ocb3/ocb3_test.c index d59d005d..011ded74 100644 --- a/src/encauth/ocb3/ocb3_test.c +++ b/src/encauth/ocb3/ocb3_test.c @@ -38,9 +38,9 @@ int ocb3_test(void) { /* index:0 */ 0, /* PLAINTEXT length */ 0, /* AAD length */ - { }, /* PLAINTEXT */ - { }, /* AAD */ - { }, /* CIPHERTEXT */ + { 0 }, /* PLAINTEXT */ + { 0 }, /* AAD */ + { 0 }, /* CIPHERTEXT */ { 0x19,0x7b,0x9c,0x3c,0x44,0x1d,0x3c,0x83,0xea,0xfb,0x2b,0xef,0x63,0x3b,0x91,0x82 }, /* TAG */ }, { /* index:1 */ @@ -54,16 +54,16 @@ int ocb3_test(void) { /* index:2 */ 0, /* PLAINTEXT length */ 8, /* AAD length */ - { }, /* PLAINTEXT */ + { 0 }, /* PLAINTEXT */ { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07 }, /* AAD */ - { }, /* CIPHERTEXT */ + { 0 }, /* CIPHERTEXT */ { 0x98,0xb9,0x15,0x52,0xc8,0xc0,0x09,0x18,0x50,0x44,0xe3,0x0a,0x6e,0xb2,0xfe,0x21 }, /* TAG */ }, { /* index:3 */ 8, /* PLAINTEXT length */ 0, /* AAD length */ { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07 }, /* PLAINTEXT */ - { }, /* AAD */ + { 0 }, /* AAD */ { 0x92,0xb6,0x57,0x13,0x0a,0x74,0xb8,0x5a }, /* CIPHERTEXT */ { 0x97,0x1e,0xff,0xca,0xe1,0x9a,0xd4,0x71,0x6f,0x88,0xe8,0x7b,0x87,0x1f,0xbe,0xed }, /* TAG */ }, @@ -78,16 +78,16 @@ int ocb3_test(void) { /* index:5 */ 0, /* PLAINTEXT length */ 16, /* AAD length */ - { }, /* PLAINTEXT */ + { 0 }, /* PLAINTEXT */ { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f }, /* AAD */ - { }, /* CIPHERTEXT */ + { 0 }, /* CIPHERTEXT */ { 0x7d,0xdb,0x8e,0x6c,0xea,0x68,0x14,0x86,0x62,0x12,0x50,0x96,0x19,0xb1,0x9c,0xc6 }, /* TAG */ }, { /* index:6 */ 16, /* PLAINTEXT length */ 0, /* AAD length */ { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f }, /* PLAINTEXT */ - { }, /* AAD */ + { 0 }, /* AAD */ { 0xbe,0xa5,0xe8,0x79,0x8d,0xbe,0x71,0x10,0x03,0x1c,0x14,0x4d,0xa0,0xb2,0x61,0x22 }, /* CIPHERTEXT */ { 0x13,0xcc,0x8b,0x74,0x78,0x07,0x12,0x1a,0x4c,0xbb,0x3e,0x4b,0xd6,0xb4,0x56,0xaf }, /* TAG */ }, @@ -102,16 +102,16 @@ int ocb3_test(void) { /* index:8 */ 0, /* PLAINTEXT length */ 24, /* AAD length */ - { }, /* PLAINTEXT */ + { 0 }, /* PLAINTEXT */ { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17 }, /* AAD */ - { }, /* CIPHERTEXT */ + { 0 }, /* CIPHERTEXT */ { 0x28,0x20,0x26,0xda,0x30,0x68,0xbc,0x9f,0xa1,0x18,0x68,0x1d,0x55,0x9f,0x10,0xf6 }, /* TAG */ }, { /* index:9 */ 24, /* PLAINTEXT length */ 0, /* AAD length */ { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17 }, /* PLAINTEXT */ - { }, /* AAD */ + { 0 }, /* AAD */ { 0xbe,0xa5,0xe8,0x79,0x8d,0xbe,0x71,0x10,0x03,0x1c,0x14,0x4d,0xa0,0xb2,0x61,0x22,0xfc,0xfc,0xee,0x7a,0x2a,0x8d,0x4d,0x48 }, /* CIPHERTEXT */ { 0x6e,0xf2,0xf5,0x25,0x87,0xfd,0xa0,0xed,0x97,0xdc,0x7e,0xed,0xe2,0x41,0xdf,0x68 }, /* TAG */ }, @@ -126,16 +126,16 @@ int ocb3_test(void) { /* index:11 */ 0, /* PLAINTEXT length */ 32, /* AAD length */ - { }, /* PLAINTEXT */ + { 0 }, /* PLAINTEXT */ { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f }, /* AAD */ - { }, /* CIPHERTEXT */ + { 0 }, /* CIPHERTEXT */ { 0xe1,0xe0,0x72,0x63,0x3b,0xad,0xe5,0x1a,0x60,0xe8,0x59,0x51,0xd9,0xc4,0x2a,0x1b }, /* TAG */ }, { /* index:12 */ 32, /* PLAINTEXT length */ 0, /* AAD length */ { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f }, /* PLAINTEXT */ - { }, /* AAD */ + { 0 }, /* AAD */ { 0xbe,0xa5,0xe8,0x79,0x8d,0xbe,0x71,0x10,0x03,0x1c,0x14,0x4d,0xa0,0xb2,0x61,0x22,0xce,0xaa,0xb9,0xb0,0x5d,0xf7,0x71,0xa6,0x57,0x14,0x9d,0x53,0x77,0x34,0x63,0xcb }, /* CIPHERTEXT */ { 0x4a,0x3b,0xae,0x82,0x44,0x65,0xcf,0xda,0xf8,0xc4,0x1f,0xc5,0x0c,0x7d,0xf9,0xd9 }, /* TAG */ }, @@ -150,16 +150,16 @@ int ocb3_test(void) { /* index:14 */ 0, /* PLAINTEXT length */ 40, /* AAD length */ - { }, /* PLAINTEXT */ + { 0 }, /* PLAINTEXT */ { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27 }, /* AAD */ - { }, /* CIPHERTEXT */ + { 0 }, /* CIPHERTEXT */ { 0x7a,0xeb,0x7a,0x69,0xa1,0x68,0x7d,0xd0,0x82,0xca,0x27,0xb0,0xd9,0xa3,0x70,0x96 }, /* TAG */ }, { /* index:15 */ 40, /* PLAINTEXT length */ 0, /* AAD length */ { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27 }, /* PLAINTEXT */ - { }, /* AAD */ + { 0 }, /* AAD */ { 0xbe,0xa5,0xe8,0x79,0x8d,0xbe,0x71,0x10,0x03,0x1c,0x14,0x4d,0xa0,0xb2,0x61,0x22,0xce,0xaa,0xb9,0xb0,0x5d,0xf7,0x71,0xa6,0x57,0x14,0x9d,0x53,0x77,0x34,0x63,0xcb,0x68,0xc6,0x57,0x78,0xb0,0x58,0xa6,0x35 }, /* CIPHERTEXT */ { 0x06,0x0c,0x84,0x67,0xf4,0xab,0xab,0x5e,0x8b,0x3c,0x20,0x67,0xa2,0xe1,0x15,0xdc }, /* TAG */ }, From ac3f55fd92170848e1556023ec0423f9cf0ec013 Mon Sep 17 00:00:00 2001 From: Karel Miko Date: Mon, 6 Mar 2017 19:54:43 +0100 Subject: [PATCH 4/4] there is no snprintf before Visual C++ 2015 --- src/headers/tomcrypt_macros.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/headers/tomcrypt_macros.h b/src/headers/tomcrypt_macros.h index 39cf1182..52ca9402 100644 --- a/src/headers/tomcrypt_macros.h +++ b/src/headers/tomcrypt_macros.h @@ -430,6 +430,11 @@ static inline ulong64 ROR64(ulong64 word, int i) #define byte(x, n) (((x) >> (8 * (n))) & 255) #endif +/* there is no snprintf before Visual C++ 2015 */ +#if defined(_MSC_VER) && _MSC_VER < 1900 +#define snprintf _snprintf +#endif + /* $Source$ */ /* $Revision$ */ /* $Date$ */