From 54a26525dca650ba5a7ecce6fc60a67952d86bf2 Mon Sep 17 00:00:00 2001 From: Karel Miko Date: Wed, 15 Mar 2017 13:06:23 +0100 Subject: [PATCH] avoid C++ style comments --- demos/constants.c | 6 +++--- demos/sizes.c | 6 +++--- helper.pl | 1 + src/encauth/ccm/ccm_memory_ex.c | 4 ++-- src/mac/hmac/hmac_test.c | 10 +++++----- src/math/gmp_desc.c | 4 ++-- src/misc/crypt/crypt_sizes.c | 20 ++++++++++---------- testprof/der_tests.c | 2 +- 8 files changed, 27 insertions(+), 26 deletions(-) diff --git a/demos/constants.c b/demos/constants.c index b1d6112..ffa223e 100644 --- a/demos/constants.c +++ b/demos/constants.c @@ -21,7 +21,7 @@ int main(void) { - // given a specific constant name, get and print its value + /* given a specific constant name, get and print its value */ char name[] = "CTR_COUNTER_BIG_ENDIAN"; int value; @@ -29,7 +29,7 @@ int main(void) { exit(EXIT_FAILURE); printf("\n %s is %d \n\n", name, value); - // get and print the length of the names (and values) list + /* get and print the length of the names (and values) list */ char *names_list; unsigned int names_list_len; @@ -37,7 +37,7 @@ int main(void) { exit(EXIT_FAILURE); printf(" need to allocate %u bytes \n\n", names_list_len); - // get and print the names (and values) list + /* get and print the names (and values) list */ if ((names_list = malloc(names_list_len)) == NULL) exit(EXIT_FAILURE); if (crypt_list_all_constants(names_list, &names_list_len) != 0) diff --git a/demos/sizes.c b/demos/sizes.c index cacf5c6..b544372 100644 --- a/demos/sizes.c +++ b/demos/sizes.c @@ -20,21 +20,21 @@ int main(void) { - // given a specific size name, get and print its size + /* given a specific size name, get and print its size */ char name[] = "ecc_key"; unsigned int size; if(crypt_get_size(name, &size) != 0) exit(EXIT_FAILURE); printf("\n size of '%s' is %u \n\n", name, size); - // get and print the length of the names (and sizes) list + /* get and print the length of the names (and sizes) list */ char *sizes_list; unsigned int sizes_list_len; if(crypt_list_all_sizes(NULL, &sizes_list_len) != 0) exit(EXIT_FAILURE); printf(" need to allocate %u bytes \n\n", sizes_list_len); - // get and print the names (and sizes) list + /* get and print the names (and sizes) list */ sizes_list = malloc(sizes_list_len); if(crypt_list_all_sizes(sizes_list, &sizes_list_len) != 0) exit(EXIT_FAILURE); diff --git a/helper.pl b/helper.pl index 18b12ff..3b0406d 100755 --- a/helper.pl +++ b/helper.pl @@ -41,6 +41,7 @@ sub check_source { push @{$troubles->{trailing_space}}, $lineno if $l =~ / $/; push @{$troubles->{tab}}, $lineno if $l =~ /\t/ && basename($file) !~ /^makefile/i; push @{$troubles->{non_ascii_char}}, $lineno if $l =~ /[^[:ascii:]]/; + push @{$troubles->{cpp_comment}}, $lineno if $file =~ /\.(c|h)$/ && ($l =~ /\s\/\// || $l =~ /\/\/\s/); $lineno++; } for my $k (sort keys %$troubles) { diff --git a/src/encauth/ccm/ccm_memory_ex.c b/src/encauth/ccm/ccm_memory_ex.c index 4b09ddc..0fbdd09 100644 --- a/src/encauth/ccm/ccm_memory_ex.c +++ b/src/encauth/ccm/ccm_memory_ex.c @@ -172,7 +172,7 @@ if (B_0 == NULL) { } } else { - // B_0 != NULL + /* B_0 != NULL */ XMEMCPY(PAD, B_0, 16); } @@ -329,7 +329,7 @@ if (CTR == NULL) { } } - // grab the CTR + /* grab the CTR */ XMEMCPY(ctrcopy, ctr, 16); /* setup CTR for the TAG (zero the count) */ diff --git a/src/mac/hmac/hmac_test.c b/src/mac/hmac/hmac_test.c index 051ab46..0c311c6 100644 --- a/src/mac/hmac/hmac_test.c +++ b/src/mac/hmac/hmac_test.c @@ -61,26 +61,26 @@ int hmac_test(void) int i; static const unsigned char hmac_test_case_keys[][136] = { - { // 1 + { /* 1 */ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b }, #ifdef LTC_TEST_EXT - { // 2 + { /* 2 */ 0x4a, 0x65, 0x66, 0x65 }, - { // 4 + { /* 4 */ 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 }, - { // 5 + { /* 5 */ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c }, - { // 3, 6, 7 + { /* 3, 6, 7 */ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, diff --git a/src/math/gmp_desc.c b/src/math/gmp_desc.c index 16c1d90..0a23e99 100644 --- a/src/math/gmp_desc.c +++ b/src/math/gmp_desc.c @@ -167,7 +167,7 @@ static int read_radix(void *a, const char *b, int radix) } if (i == 64) { XFREE (tmp); - // printf ("c = '%c'\n", c); + /* printf ("c = '%c'\n", c); */ return CRYPT_ERROR; } *q++ = '0' + (i / 8); @@ -175,7 +175,7 @@ static int read_radix(void *a, const char *b, int radix) } *q = 0; ret = mpz_set_str(a, tmp, 8); - // printf ("ret = %d for '%s'\n", ret, tmp); + /* printf ("ret = %d for '%s'\n", ret, tmp); */ XFREE (tmp); } else { ret = mpz_set_str(a, b, radix); diff --git a/src/misc/crypt/crypt_sizes.c b/src/misc/crypt/crypt_sizes.c index 69304dc..32b04ba 100755 --- a/src/misc/crypt/crypt_sizes.c +++ b/src/misc/crypt/crypt_sizes.c @@ -29,7 +29,7 @@ typedef struct { #define _SZ_STRINGIFY_T(s) { #s, sizeof(s) } static const crypt_size _crypt_sizes[] = { - // hash state sizes + /* hash state sizes */ _SZ_STRINGIFY_S(ltc_hash_descriptor), _SZ_STRINGIFY_T(hash_state), #ifdef LTC_SHA256 @@ -72,7 +72,7 @@ static const crypt_size _crypt_sizes[] = { _SZ_STRINGIFY_S(chc_state), #endif - // block cipher key sizes + /* block cipher key sizes */ _SZ_STRINGIFY_S(ltc_cipher_descriptor), _SZ_STRINGIFY_T(symmetric_key), #ifdef LTC_ANUBIS @@ -134,7 +134,7 @@ static const crypt_size _crypt_sizes[] = { _SZ_STRINGIFY_S(twofish_key), #endif - // mode sizes + /* mode sizes */ #ifdef LTC_CBC_MODE _SZ_STRINGIFY_T(symmetric_CBC), #endif @@ -157,7 +157,7 @@ static const crypt_size _crypt_sizes[] = { _SZ_STRINGIFY_T(symmetric_OFB), #endif - // MAC sizes -- no states for ccm, lrw + /* MAC sizes -- no states for ccm, lrw */ #ifdef LTC_F9_MODE _SZ_STRINGIFY_T(f9_state), #endif @@ -189,13 +189,13 @@ static const crypt_size _crypt_sizes[] = { _SZ_STRINGIFY_T(eax_state), #endif #ifdef LTC_CCM_MODE -// not defined +/* not defined */ #endif #ifdef LRW_MODE -// not defined +/* not defined */ #endif - // asymmetric keys + /* asymmetric keys */ #ifdef LTC_MRSA _SZ_STRINGIFY_T(rsa_key), #endif @@ -214,7 +214,7 @@ static const crypt_size _crypt_sizes[] = { _SZ_STRINGIFY_T(katja_key), #endif - // prng state sizes + /* prng state sizes */ _SZ_STRINGIFY_S(ltc_prng_descriptor), _SZ_STRINGIFY_T(prng_state), #ifdef LTC_FORTUNA @@ -229,8 +229,8 @@ static const crypt_size _crypt_sizes[] = { #ifdef LTC_YARROW _SZ_STRINGIFY_S(yarrow_prng), #endif - // sprng has no state as it uses other potentially available sources - // like /dev/random. See Developers Guide for more info. + /* sprng has no state as it uses other potentially available sources */ + /* like /dev/random. See Developers Guide for more info. */ #ifdef LTC_ADLER32 _SZ_STRINGIFY_T(adler32_state), diff --git a/testprof/der_tests.c b/testprof/der_tests.c index b79a5ae..7ce6273 100644 --- a/testprof/der_tests.c +++ b/testprof/der_tests.c @@ -620,7 +620,7 @@ static void der_set_test(void) OID { 1, 2, 840, 113549 } NULL SET OF { - PRINTABLE "333" // WILL GET SORTED + PRINTABLE "333" -- WILL GET SORTED PRINTABLE "222" } }