mirror of
https://github.com/cryb-to/cryb-to.git
synced 2024-12-22 04:21:08 +00:00
Reorder for consistency
This commit is contained in:
parent
63bcbcca20
commit
c41c51d901
4 changed files with 50 additions and 46 deletions
47
t/t_md2.c
47
t/t_md2.c
|
@ -153,6 +153,30 @@ t_md2_vector(char **desc CRYB_UNUSED, void *arg)
|
|||
return (1);
|
||||
}
|
||||
|
||||
|
||||
#if !defined(WITH_RSAREF)
|
||||
/*
|
||||
* Various corner cases and error conditions
|
||||
*/
|
||||
static int
|
||||
t_md2_short_updates(char **desc CRYB_UNUSED, void *arg)
|
||||
{
|
||||
struct t_vector *vector = (struct t_vector *)arg;
|
||||
uint8_t digest[MD2_DIGEST_LEN];
|
||||
md2_ctx ctx;
|
||||
int i, len;
|
||||
|
||||
md2_init(&ctx);
|
||||
len = strlen(vector->msg);
|
||||
for (i = 0; i + 5 < len; i += 5)
|
||||
md2_update(&ctx, vector->msg + i, 5);
|
||||
md2_update(&ctx, vector->msg + i, len - i);
|
||||
md2_final(&ctx, digest);
|
||||
return (memcmp(digest, vector->digest, MD2_DIGEST_LEN) == 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef BENCHMARKS
|
||||
/*
|
||||
* Performance test: measure the time spent computing the MD2 sum of a
|
||||
|
@ -186,29 +210,6 @@ t_md2_perf(char **desc, void *arg)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(WITH_RSAREF)
|
||||
/*
|
||||
* Various corner cases and error conditions
|
||||
*/
|
||||
static int
|
||||
t_md2_short_updates(char **desc CRYB_UNUSED, void *arg)
|
||||
{
|
||||
struct t_vector *vector = (struct t_vector *)arg;
|
||||
uint8_t digest[MD2_DIGEST_LEN];
|
||||
md2_ctx ctx;
|
||||
int i, len;
|
||||
|
||||
md2_init(&ctx);
|
||||
len = strlen(vector->msg);
|
||||
for (i = 0; i + 5 < len; i += 5)
|
||||
md2_update(&ctx, vector->msg + i, 5);
|
||||
md2_update(&ctx, vector->msg + i, len - i);
|
||||
md2_final(&ctx, digest);
|
||||
return (memcmp(digest, vector->digest, MD2_DIGEST_LEN) == 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Boilerplate
|
||||
|
|
47
t/t_md5.c
47
t/t_md5.c
|
@ -169,6 +169,30 @@ t_md5_vector(char **desc CRYB_UNUSED, void *arg)
|
|||
return (1);
|
||||
}
|
||||
|
||||
|
||||
#if !defined(WITH_OPENSSL) && !defined(WITH_RSAREF)
|
||||
/*
|
||||
* Various corner cases and error conditions
|
||||
*/
|
||||
static int
|
||||
t_md5_short_updates(char **desc CRYB_UNUSED, void *arg)
|
||||
{
|
||||
struct t_vector *vector = (struct t_vector *)arg;
|
||||
uint8_t digest[MD5_DIGEST_LEN];
|
||||
md5_ctx ctx;
|
||||
int i, len;
|
||||
|
||||
md5_init(&ctx);
|
||||
len = strlen(vector->msg);
|
||||
for (i = 0; i + 5 < len; i += 5)
|
||||
md5_update(&ctx, vector->msg + i, 5);
|
||||
md5_update(&ctx, vector->msg + i, len - i);
|
||||
md5_final(&ctx, digest);
|
||||
return (memcmp(digest, vector->digest, MD5_DIGEST_LEN) == 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef BENCHMARKS
|
||||
/*
|
||||
* Performance test: measure the time spent computing the MD5 sum of a
|
||||
|
@ -202,29 +226,6 @@ t_md5_perf(char **desc, void *arg)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(WITH_OPENSSL) && !defined(WITH_RSAREF)
|
||||
/*
|
||||
* Various corner cases and error conditions
|
||||
*/
|
||||
static int
|
||||
t_md5_short_updates(char **desc CRYB_UNUSED, void *arg)
|
||||
{
|
||||
struct t_vector *vector = (struct t_vector *)arg;
|
||||
uint8_t digest[MD5_DIGEST_LEN];
|
||||
md5_ctx ctx;
|
||||
int i, len;
|
||||
|
||||
md5_init(&ctx);
|
||||
len = strlen(vector->msg);
|
||||
for (i = 0; i + 5 < len; i += 5)
|
||||
md5_update(&ctx, vector->msg + i, 5);
|
||||
md5_update(&ctx, vector->msg + i, len - i);
|
||||
md5_final(&ctx, digest);
|
||||
return (memcmp(digest, vector->digest, MD5_DIGEST_LEN) == 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Boilerplate
|
||||
|
|
|
@ -194,6 +194,7 @@ t_sha256_short_updates(char **desc CRYB_UNUSED, void *arg)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef BENCHMARKS
|
||||
/*
|
||||
* Performance test: measure the time spent computing the SHA256 sum of a
|
||||
|
|
|
@ -215,6 +215,7 @@ t_sha512_short_updates(char **desc CRYB_UNUSED, void *arg)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef BENCHMARKS
|
||||
/*
|
||||
* Performance test: measure the time spent computing the SHA512 sum of a
|
||||
|
|
Loading…
Reference in a new issue