mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-03 07:45:47 +00:00
Quiet compiler warnings.
This commit is contained in:
@@ -79,13 +79,13 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
const int ntests = (sizeof(test_strings) / sizeof(test_strings[0]));
|
const int ntests = (sizeof(test_strings) / sizeof(test_strings[0]));
|
||||||
int i, errors = 0;
|
int i, errors = 0;
|
||||||
char buf[32];
|
unsigned char buf[32];
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
for (i = 0; i < ntests; i++) {
|
for (i = 0; i < ntests; i++) {
|
||||||
len = base64_decode(test_strings[i].encoded, buf, sizeof(buf));
|
len = base64_decode(test_strings[i].encoded, buf, sizeof(buf));
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
if (strcmp(test_strings[i].ascii, buf) != 0) {
|
if (strcmp(test_strings[i].ascii, (char *)buf) != 0) {
|
||||||
fprintf(stderr, "check_base64: expected %s, got %s",
|
fprintf(stderr, "check_base64: expected %s, got %s",
|
||||||
test_strings[i].ascii, buf);
|
test_strings[i].ascii, buf);
|
||||||
errors++;
|
errors++;
|
||||||
|
@@ -81,6 +81,19 @@ static struct digest_function {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define NUM_TESTS 8
|
||||||
|
static const char *test_strings[NUM_TESTS] = {
|
||||||
|
"",
|
||||||
|
"a",
|
||||||
|
"abc",
|
||||||
|
"message digest",
|
||||||
|
"abcdefghijklmnopqrstuvwxyz",
|
||||||
|
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
|
||||||
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
|
||||||
|
"12345678901234567890123456789012345678901234567890123456789"
|
||||||
|
"012345678901234567890",
|
||||||
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@@ -90,23 +103,12 @@ main(int argc, char *argv[])
|
|||||||
unsigned char digest[SHA512_DIGEST_LENGTH];
|
unsigned char digest[SHA512_DIGEST_LENGTH];
|
||||||
static const char hex[] = "0123456789abcdef";
|
static const char hex[] = "0123456789abcdef";
|
||||||
unsigned char buf[1000];
|
unsigned char buf[1000];
|
||||||
unsigned const char *test_strings[] = {
|
|
||||||
"",
|
|
||||||
"a",
|
|
||||||
"abc",
|
|
||||||
"message digest",
|
|
||||||
"abcdefghijklmnopqrstuvwxyz",
|
|
||||||
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
|
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
|
||||||
"0123456789",
|
|
||||||
"12345678901234567890123456789012345678901234567890123456789"
|
|
||||||
"012345678901234567890",
|
|
||||||
};
|
|
||||||
|
|
||||||
for (func = digest_functions; func->digest_name != NULL; func++) {
|
for (func = digest_functions; func->digest_name != NULL; func++) {
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < NUM_TESTS; i++) {
|
||||||
func->init(&ctx);
|
func->init(&ctx);
|
||||||
func->update(&ctx, test_strings[i], strlen(test_strings[i]));
|
func->update(&ctx, (unsigned char *)test_strings[i],
|
||||||
|
strlen(test_strings[i]));
|
||||||
func->final(digest, &ctx);
|
func->final(digest, &ctx);
|
||||||
printf("%s (\"%s\") = ", func->digest_name, test_strings[i]);
|
printf("%s (\"%s\") = ", func->digest_name, test_strings[i]);
|
||||||
for (j = 0; j < func->digest_len; j++) {
|
for (j = 0; j < func->digest_len; j++) {
|
||||||
|
Reference in New Issue
Block a user