Procházet zdrojové kódy

avoid C++ style comments

Karel Miko před 8 roky
rodič
revize
54a26525dc

+ 3 - 3
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)

+ 3 - 3
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);

+ 1 - 0
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) {

+ 2 - 2
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) */

+ 5 - 5
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,

+ 2 - 2
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);

+ 10 - 10
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),

+ 1 - 1
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"
            }
         }