avoid C++ style comments
This commit is contained in:
parent
db32cc3a81
commit
54a26525dc
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
|
|
||||||
int main(void) {
|
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";
|
char name[] = "CTR_COUNTER_BIG_ENDIAN";
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ int main(void) {
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
printf("\n %s is %d \n\n", name, value);
|
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;
|
char *names_list;
|
||||||
unsigned int names_list_len;
|
unsigned int names_list_len;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ int main(void) {
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
printf(" need to allocate %u bytes \n\n", names_list_len);
|
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)
|
if ((names_list = malloc(names_list_len)) == NULL)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
if (crypt_list_all_constants(names_list, &names_list_len) != 0)
|
if (crypt_list_all_constants(names_list, &names_list_len) != 0)
|
||||||
|
@ -20,21 +20,21 @@
|
|||||||
|
|
||||||
int main(void) {
|
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";
|
char name[] = "ecc_key";
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
if(crypt_get_size(name, &size) != 0)
|
if(crypt_get_size(name, &size) != 0)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
printf("\n size of '%s' is %u \n\n", name, size);
|
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;
|
char *sizes_list;
|
||||||
unsigned int sizes_list_len;
|
unsigned int sizes_list_len;
|
||||||
if(crypt_list_all_sizes(NULL, &sizes_list_len) != 0)
|
if(crypt_list_all_sizes(NULL, &sizes_list_len) != 0)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
printf(" need to allocate %u bytes \n\n", sizes_list_len);
|
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);
|
sizes_list = malloc(sizes_list_len);
|
||||||
if(crypt_list_all_sizes(sizes_list, &sizes_list_len) != 0)
|
if(crypt_list_all_sizes(sizes_list, &sizes_list_len) != 0)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@ -41,6 +41,7 @@ sub check_source {
|
|||||||
push @{$troubles->{trailing_space}}, $lineno if $l =~ / $/;
|
push @{$troubles->{trailing_space}}, $lineno if $l =~ / $/;
|
||||||
push @{$troubles->{tab}}, $lineno if $l =~ /\t/ && basename($file) !~ /^makefile/i;
|
push @{$troubles->{tab}}, $lineno if $l =~ /\t/ && basename($file) !~ /^makefile/i;
|
||||||
push @{$troubles->{non_ascii_char}}, $lineno if $l =~ /[^[:ascii:]]/;
|
push @{$troubles->{non_ascii_char}}, $lineno if $l =~ /[^[:ascii:]]/;
|
||||||
|
push @{$troubles->{cpp_comment}}, $lineno if $file =~ /\.(c|h)$/ && ($l =~ /\s\/\// || $l =~ /\/\/\s/);
|
||||||
$lineno++;
|
$lineno++;
|
||||||
}
|
}
|
||||||
for my $k (sort keys %$troubles) {
|
for my $k (sort keys %$troubles) {
|
||||||
|
@ -172,7 +172,7 @@ if (B_0 == NULL) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// B_0 != NULL
|
/* B_0 != NULL */
|
||||||
XMEMCPY(PAD, B_0, 16);
|
XMEMCPY(PAD, B_0, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ if (CTR == NULL) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// grab the CTR
|
/* grab the CTR */
|
||||||
XMEMCPY(ctrcopy, ctr, 16);
|
XMEMCPY(ctrcopy, ctr, 16);
|
||||||
|
|
||||||
/* setup CTR for the TAG (zero the count) */
|
/* setup CTR for the TAG (zero the count) */
|
||||||
|
@ -61,26 +61,26 @@ int hmac_test(void)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
static const unsigned char hmac_test_case_keys[][136] = {
|
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, 0x0b, 0x0b, 0x0b, 0x0b,
|
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
|
||||||
0x0b, 0x0b, 0x0b, 0x0b
|
0x0b, 0x0b, 0x0b, 0x0b
|
||||||
},
|
},
|
||||||
#ifdef LTC_TEST_EXT
|
#ifdef LTC_TEST_EXT
|
||||||
{ // 2
|
{ /* 2 */
|
||||||
0x4a, 0x65, 0x66, 0x65
|
0x4a, 0x65, 0x66, 0x65
|
||||||
},
|
},
|
||||||
{ // 4
|
{ /* 4 */
|
||||||
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
|
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
|
||||||
0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14,
|
0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14,
|
||||||
0x15, 0x16, 0x17, 0x18, 0x19
|
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, 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,
|
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||||
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
|
||||||
|
@ -167,7 +167,7 @@ static int read_radix(void *a, const char *b, int radix)
|
|||||||
}
|
}
|
||||||
if (i == 64) {
|
if (i == 64) {
|
||||||
XFREE (tmp);
|
XFREE (tmp);
|
||||||
// printf ("c = '%c'\n", c);
|
/* printf ("c = '%c'\n", c); */
|
||||||
return CRYPT_ERROR;
|
return CRYPT_ERROR;
|
||||||
}
|
}
|
||||||
*q++ = '0' + (i / 8);
|
*q++ = '0' + (i / 8);
|
||||||
@ -175,7 +175,7 @@ static int read_radix(void *a, const char *b, int radix)
|
|||||||
}
|
}
|
||||||
*q = 0;
|
*q = 0;
|
||||||
ret = mpz_set_str(a, tmp, 8);
|
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);
|
XFREE (tmp);
|
||||||
} else {
|
} else {
|
||||||
ret = mpz_set_str(a, b, radix);
|
ret = mpz_set_str(a, b, radix);
|
||||||
|
@ -29,7 +29,7 @@ typedef struct {
|
|||||||
#define _SZ_STRINGIFY_T(s) { #s, sizeof(s) }
|
#define _SZ_STRINGIFY_T(s) { #s, sizeof(s) }
|
||||||
|
|
||||||
static const crypt_size _crypt_sizes[] = {
|
static const crypt_size _crypt_sizes[] = {
|
||||||
// hash state sizes
|
/* hash state sizes */
|
||||||
_SZ_STRINGIFY_S(ltc_hash_descriptor),
|
_SZ_STRINGIFY_S(ltc_hash_descriptor),
|
||||||
_SZ_STRINGIFY_T(hash_state),
|
_SZ_STRINGIFY_T(hash_state),
|
||||||
#ifdef LTC_SHA256
|
#ifdef LTC_SHA256
|
||||||
@ -72,7 +72,7 @@ static const crypt_size _crypt_sizes[] = {
|
|||||||
_SZ_STRINGIFY_S(chc_state),
|
_SZ_STRINGIFY_S(chc_state),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// block cipher key sizes
|
/* block cipher key sizes */
|
||||||
_SZ_STRINGIFY_S(ltc_cipher_descriptor),
|
_SZ_STRINGIFY_S(ltc_cipher_descriptor),
|
||||||
_SZ_STRINGIFY_T(symmetric_key),
|
_SZ_STRINGIFY_T(symmetric_key),
|
||||||
#ifdef LTC_ANUBIS
|
#ifdef LTC_ANUBIS
|
||||||
@ -134,7 +134,7 @@ static const crypt_size _crypt_sizes[] = {
|
|||||||
_SZ_STRINGIFY_S(twofish_key),
|
_SZ_STRINGIFY_S(twofish_key),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// mode sizes
|
/* mode sizes */
|
||||||
#ifdef LTC_CBC_MODE
|
#ifdef LTC_CBC_MODE
|
||||||
_SZ_STRINGIFY_T(symmetric_CBC),
|
_SZ_STRINGIFY_T(symmetric_CBC),
|
||||||
#endif
|
#endif
|
||||||
@ -157,7 +157,7 @@ static const crypt_size _crypt_sizes[] = {
|
|||||||
_SZ_STRINGIFY_T(symmetric_OFB),
|
_SZ_STRINGIFY_T(symmetric_OFB),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// MAC sizes -- no states for ccm, lrw
|
/* MAC sizes -- no states for ccm, lrw */
|
||||||
#ifdef LTC_F9_MODE
|
#ifdef LTC_F9_MODE
|
||||||
_SZ_STRINGIFY_T(f9_state),
|
_SZ_STRINGIFY_T(f9_state),
|
||||||
#endif
|
#endif
|
||||||
@ -189,13 +189,13 @@ static const crypt_size _crypt_sizes[] = {
|
|||||||
_SZ_STRINGIFY_T(eax_state),
|
_SZ_STRINGIFY_T(eax_state),
|
||||||
#endif
|
#endif
|
||||||
#ifdef LTC_CCM_MODE
|
#ifdef LTC_CCM_MODE
|
||||||
// not defined
|
/* not defined */
|
||||||
#endif
|
#endif
|
||||||
#ifdef LRW_MODE
|
#ifdef LRW_MODE
|
||||||
// not defined
|
/* not defined */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// asymmetric keys
|
/* asymmetric keys */
|
||||||
#ifdef LTC_MRSA
|
#ifdef LTC_MRSA
|
||||||
_SZ_STRINGIFY_T(rsa_key),
|
_SZ_STRINGIFY_T(rsa_key),
|
||||||
#endif
|
#endif
|
||||||
@ -214,7 +214,7 @@ static const crypt_size _crypt_sizes[] = {
|
|||||||
_SZ_STRINGIFY_T(katja_key),
|
_SZ_STRINGIFY_T(katja_key),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// prng state sizes
|
/* prng state sizes */
|
||||||
_SZ_STRINGIFY_S(ltc_prng_descriptor),
|
_SZ_STRINGIFY_S(ltc_prng_descriptor),
|
||||||
_SZ_STRINGIFY_T(prng_state),
|
_SZ_STRINGIFY_T(prng_state),
|
||||||
#ifdef LTC_FORTUNA
|
#ifdef LTC_FORTUNA
|
||||||
@ -229,8 +229,8 @@ static const crypt_size _crypt_sizes[] = {
|
|||||||
#ifdef LTC_YARROW
|
#ifdef LTC_YARROW
|
||||||
_SZ_STRINGIFY_S(yarrow_prng),
|
_SZ_STRINGIFY_S(yarrow_prng),
|
||||||
#endif
|
#endif
|
||||||
// sprng has no state as it uses other potentially available sources
|
/* sprng has no state as it uses other potentially available sources */
|
||||||
// like /dev/random. See Developers Guide for more info.
|
/* like /dev/random. See Developers Guide for more info. */
|
||||||
|
|
||||||
#ifdef LTC_ADLER32
|
#ifdef LTC_ADLER32
|
||||||
_SZ_STRINGIFY_T(adler32_state),
|
_SZ_STRINGIFY_T(adler32_state),
|
||||||
|
@ -620,7 +620,7 @@ static void der_set_test(void)
|
|||||||
OID { 1, 2, 840, 113549 }
|
OID { 1, 2, 840, 113549 }
|
||||||
NULL
|
NULL
|
||||||
SET OF {
|
SET OF {
|
||||||
PRINTABLE "333" // WILL GET SORTED
|
PRINTABLE "333" -- WILL GET SORTED
|
||||||
PRINTABLE "222"
|
PRINTABLE "222"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user