aboutsummaryrefslogtreecommitdiff
path: root/crypto/openssl/test/testutil/format_output.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/openssl/test/testutil/format_output.c')
-rw-r--r--crypto/openssl/test/testutil/format_output.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/crypto/openssl/test/testutil/format_output.c b/crypto/openssl/test/testutil/format_output.c
index 8e84e1a6b6a6..bfab6babbcf2 100644
--- a/crypto/openssl/test/testutil/format_output.c
+++ b/crypto/openssl/test/testutil/format_output.c
@@ -15,9 +15,9 @@
#include <ctype.h>
/* The size of memory buffers to display on failure */
-#define MEM_BUFFER_SIZE (2000)
-#define MAX_STRING_WIDTH (80)
-#define BN_OUTPUT_SIZE (8)
+#define MEM_BUFFER_SIZE (2000)
+#define MAX_STRING_WIDTH (80)
+#define BN_OUTPUT_SIZE (8)
/* Output a diff header */
static void test_diff_header(const char *left, const char *right)
@@ -36,13 +36,12 @@ static void test_string_null_empty(const char *m, char c)
}
static void test_fail_string_common(const char *prefix, const char *file,
- int line, const char *type,
- const char *left, const char *right,
- const char *op, const char *m1, size_t l1,
- const char *m2, size_t l2)
+ int line, const char *type,
+ const char *left, const char *right,
+ const char *op, const char *m1, size_t l1,
+ const char *m2, size_t l2)
{
- const size_t width =
- (MAX_STRING_WIDTH - BIO_get_indent(bio_err) - 12) / 16 * 16;
+ const size_t width = (MAX_STRING_WIDTH - BIO_get_indent(bio_err) - 12) / 16 * 16;
char b1[MAX_STRING_WIDTH + 1], b2[MAX_STRING_WIDTH + 1];
char bdiff[MAX_STRING_WIDTH + 1];
size_t n1, n2, i;
@@ -101,7 +100,7 @@ static void test_fail_string_common(const char *prefix, const char *file,
else if (n1 > 0)
test_printf_stderr("%4u:- '%s'\n", cnt, b1);
if (cnt == 0 && (m2 == NULL || *m2 == '\0'))
- test_string_null_empty(m2, '+');
+ test_string_null_empty(m2, '+');
else if (n2 > 0)
test_printf_stderr("%4u:+ '%s'\n", cnt, b2);
if (diff && i > 0)
@@ -125,20 +124,20 @@ fin:
* fails. The second is the user's call to dump a string.
*/
void test_fail_string_message(const char *prefix, const char *file,
- int line, const char *type,
- const char *left, const char *right,
- const char *op, const char *m1, size_t l1,
- const char *m2, size_t l2)
+ int line, const char *type,
+ const char *left, const char *right,
+ const char *op, const char *m1, size_t l1,
+ const char *m2, size_t l2)
{
test_fail_string_common(prefix, file, line, type, left, right, op,
- m1, l1, m2, l2);
+ m1, l1, m2, l2);
test_printf_stderr("\n");
}
void test_output_string(const char *name, const char *m, size_t l)
{
test_fail_string_common("string", NULL, 0, NULL, NULL, NULL, name,
- m, l, m, l);
+ m, l, m, l);
}
/* BIGNUM formatted output routines */
@@ -148,7 +147,7 @@ void test_output_string(const char *name, const char *m, size_t l)
* every so often.
*/
static void hex_convert_memory(const unsigned char *m, size_t n, char *b,
- size_t width)
+ size_t width)
{
size_t i;
@@ -168,9 +167,10 @@ static void hex_convert_memory(const unsigned char *m, size_t n, char *b,
* of characters these take.
*/
static const int bn_bytes = (MAX_STRING_WIDTH - 9) / (BN_OUTPUT_SIZE * 2 + 1)
- * BN_OUTPUT_SIZE;
+ * BN_OUTPUT_SIZE;
static const int bn_chars = (MAX_STRING_WIDTH - 9) / (BN_OUTPUT_SIZE * 2 + 1)
- * (BN_OUTPUT_SIZE * 2 + 1) - 1;
+ * (BN_OUTPUT_SIZE * 2 + 1)
+ - 1;
/*
* Output the header line for the bignum
@@ -204,7 +204,7 @@ static void test_bignum_zero_print(const BIGNUM *bn, char sep)
* string with appropriate visual aid spaces inserted.
*/
static int convert_bn_memory(const unsigned char *in, size_t bytes,
- char *out, int *lz, const BIGNUM *bn)
+ char *out, int *lz, const BIGNUM *bn)
{
int n = bytes * 2, i;
char *p = out, *q = NULL;
@@ -241,7 +241,7 @@ static int convert_bn_memory(const unsigned char *in, size_t bytes,
}
}
}
- return n;
+ return n;
}
for (i = 0; i < n; i++) {
@@ -263,10 +263,10 @@ static int convert_bn_memory(const unsigned char *in, size_t bytes,
* pointers for changes (only when there are two).
*/
static void test_fail_bignum_common(const char *prefix, const char *file,
- int line, const char *type,
- const char *left, const char *right,
- const char *op,
- const BIGNUM *bn1, const BIGNUM *bn2)
+ int line, const char *type,
+ const char *left, const char *right,
+ const char *op,
+ const BIGNUM *bn1, const BIGNUM *bn2)
{
const size_t bytes = bn_bytes;
char b1[MAX_STRING_WIDTH + 1], b2[MAX_STRING_WIDTH + 1];
@@ -322,7 +322,7 @@ static void test_fail_bignum_common(const char *prefix, const char *file,
diff = real_diff = 0;
i = 0;
p = bdiff;
- for (i=0; b1[i] != '\0'; i++)
+ for (i = 0; b1[i] != '\0'; i++)
if (b1[i] == b2[i] || b1[i] == ' ' || b2[i] == ' ') {
*p++ = ' ';
diff |= b1[i] != b2[i];
@@ -343,7 +343,7 @@ static void test_fail_bignum_common(const char *prefix, const char *file,
else if (cnt == 0 || n2 > 0)
test_printf_stderr("+%s:% 5d\n", b2, cnt);
if (real_diff && (cnt == 0 || (n1 > 0 && n2 > 0))
- && bn1 != NULL && bn2 != NULL)
+ && bn1 != NULL && bn2 != NULL)
test_printf_stderr(" %s\n", bdiff);
}
if (m1 != NULL)
@@ -364,19 +364,19 @@ fin:
* fails. The third is the user's call to dump a bignum.
*/
void test_fail_bignum_message(const char *prefix, const char *file,
- int line, const char *type,
- const char *left, const char *right,
- const char *op,
- const BIGNUM *bn1, const BIGNUM *bn2)
+ int line, const char *type,
+ const char *left, const char *right,
+ const char *op,
+ const BIGNUM *bn1, const BIGNUM *bn2)
{
test_fail_bignum_common(prefix, file, line, type, left, right, op, bn1, bn2);
test_printf_stderr("\n");
}
void test_fail_bignum_mono_message(const char *prefix, const char *file,
- int line, const char *type,
- const char *left, const char *right,
- const char *op, const BIGNUM *bn)
+ int line, const char *type,
+ const char *left, const char *right,
+ const char *op, const BIGNUM *bn)
{
test_fail_bignum_common(prefix, file, line, type, left, right, op, bn, bn);
test_printf_stderr("\n");
@@ -386,7 +386,7 @@ void test_output_bignum(const char *name, const BIGNUM *bn)
{
if (bn == NULL || BN_is_zero(bn)) {
test_printf_stderr("bignum: '%s' = %s\n", name,
- test_bignum_zero_null(bn));
+ test_bignum_zero_null(bn));
} else if (BN_num_bytes(bn) <= BN_OUTPUT_SIZE) {
unsigned char buf[BN_OUTPUT_SIZE];
char out[2 * sizeof(buf) + 1];
@@ -397,10 +397,10 @@ void test_output_bignum(const char *name, const BIGNUM *bn)
while (*p == '0' && *++p != '\0')
;
test_printf_stderr("bignum: '%s' = %s0x%s\n", name,
- BN_is_negative(bn) ? "-" : "", p);
+ BN_is_negative(bn) ? "-" : "", p);
} else {
test_fail_bignum_common("bignum", NULL, 0, NULL, NULL, NULL, name,
- bn, bn);
+ bn, bn);
}
}
@@ -421,11 +421,11 @@ static void test_memory_null_empty(const unsigned char *m, char c)
* Common code to display one or two blocks of memory.
*/
static void test_fail_memory_common(const char *prefix, const char *file,
- int line, const char *type,
- const char *left, const char *right,
- const char *op,
- const unsigned char *m1, size_t l1,
- const unsigned char *m2, size_t l2)
+ int line, const char *type,
+ const char *left, const char *right,
+ const char *op,
+ const unsigned char *m1, size_t l1,
+ const unsigned char *m2, size_t l2)
{
const size_t bytes = (MAX_STRING_WIDTH - 9) / 17 * 8;
char b1[MAX_STRING_WIDTH + 1], b2[MAX_STRING_WIDTH + 1];
@@ -516,19 +516,19 @@ fin:
* fails. The second is the user's call to dump memory.
*/
void test_fail_memory_message(const char *prefix, const char *file,
- int line, const char *type,
- const char *left, const char *right,
- const char *op,
- const unsigned char *m1, size_t l1,
- const unsigned char *m2, size_t l2)
+ int line, const char *type,
+ const char *left, const char *right,
+ const char *op,
+ const unsigned char *m1, size_t l1,
+ const unsigned char *m2, size_t l2)
{
test_fail_memory_common(prefix, file, line, type, left, right, op,
- m1, l1, m2, l2);
+ m1, l1, m2, l2);
test_printf_stderr("\n");
}
void test_output_memory(const char *name, const unsigned char *m, size_t l)
{
test_fail_memory_common("memory", NULL, 0, NULL, NULL, NULL, name,
- m, l, m, l);
+ m, l, m, l);
}