-/* $OpenBSD: tests.c,v 1.2 2021/07/24 01:54:23 djm Exp $ */
+/* $OpenBSD: tests.c,v 1.3 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for keys options functions.
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-/* $OpenBSD: tests.c,v 1.1 2015/01/15 07:36:28 djm Exp $ */
+/* $OpenBSD: tests.c,v 1.2 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for bitmap.h bitmap API
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-/* $OpenBSD: tests.c,v 1.3 2021/01/18 11:43:34 dtucker Exp $ */
+/* $OpenBSD: tests.c,v 1.4 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for conversions
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
+#include <limits.h>
#include <string.h>
#include "test_helper.h"
-/* $OpenBSD: test_iterate.c,v 1.7 2020/12/21 01:31:06 djm Exp $ */
+/* $OpenBSD: test_iterate.c,v 1.8 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for hostfile.h hostkeys_foreach()
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-/* $OpenBSD: test_kex.c,v 1.5 2020/12/29 01:02:15 djm Exp $ */
+/* $OpenBSD: test_kex.c,v 1.6 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test KEX
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-/* $OpenBSD: tests.c,v 1.7 2020/07/15 06:43:16 dtucker Exp $ */
+/* $OpenBSD: tests.c,v 1.8 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for matching functions
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-/* $OpenBSD: test_argv.c,v 1.3 2021/06/08 07:40:12 djm Exp $ */
+/* $OpenBSD: test_argv.c,v 1.4 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for misc argv handling functions.
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-/* $OpenBSD: test_convtime.c,v 1.1 2021/03/19 03:25:01 djm Exp $ */
+/* $OpenBSD: test_convtime.c,v 1.2 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for misc time conversion functions.
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
+#include <limits.h>
#include <string.h>
#include "test_helper.h"
-/* $OpenBSD: test_expand.c,v 1.2 2021/04/06 09:07:33 dtucker Exp $ */
+/* $OpenBSD: test_expand.c,v 1.3 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for misc string expansion functions.
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-/* $OpenBSD: test_parse.c,v 1.1 2021/03/19 03:25:01 djm Exp $ */
+/* $OpenBSD: test_parse.c,v 1.2 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for misc user/host/URI parsing functions.
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-/* $OpenBSD: test_strdelim.c,v 1.2 2021/05/21 03:59:01 djm Exp $ */
+/* $OpenBSD: test_strdelim.c,v 1.3 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for misc strdelim() and co
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-/* $OpenBSD: tests.c,v 1.7 2021/05/21 03:48:07 djm Exp $ */
+/* $OpenBSD: tests.c,v 1.8 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for misc helper functions.
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-/* $OpenBSD: test_sshbuf.c,v 1.1 2014/04/30 05:32:00 djm Exp $ */
+/* $OpenBSD: test_sshbuf.c,v 1.2 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for sshbuf.h buffer API
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
void sshbuf_tests(void);
+#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
+
void
sshbuf_tests(void)
{
-/* $OpenBSD: test_sshbuf_fixed.c,v 1.1 2014/04/30 05:32:00 djm Exp $ */
+/* $OpenBSD: test_sshbuf_fixed.c,v 1.2 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for sshbuf.h buffer API
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-/* $OpenBSD: test_sshbuf_fuzz.c,v 1.2 2018/10/17 23:28:05 djm Exp $ */
+/* $OpenBSD: test_sshbuf_fuzz.c,v 1.3 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for sshbuf.h buffer API
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-/* $OpenBSD: test_sshbuf_getput_basic.c,v 1.2 2019/07/14 23:33:19 djm Exp $ */
+/* $OpenBSD: test_sshbuf_getput_basic.c,v 1.3 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for sshbuf.h buffer API
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-/* $OpenBSD: test_sshbuf_getput_crypto.c,v 1.2 2019/01/21 12:29:35 djm Exp $ */
+/* $OpenBSD: test_sshbuf_getput_crypto.c,v 1.3 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for sshbuf.h buffer API
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-/* $OpenBSD: test_sshbuf_getput_fuzz.c,v 1.4 2019/01/21 12:29:35 djm Exp $ */
+/* $OpenBSD: test_sshbuf_getput_fuzz.c,v 1.5 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for sshbuf.h buffer API
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-/* $OpenBSD: test_sshbuf_misc.c,v 1.4 2019/07/16 22:16:49 djm Exp $ */
+/* $OpenBSD: test_sshbuf_misc.c,v 1.5 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for sshbuf.h buffer API
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-/* $OpenBSD: common.c,v 1.4 2020/01/26 00:09:50 djm Exp $ */
+/* $OpenBSD: common.c,v 1.5 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Helpers for key API tests
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
-/* $OpenBSD: test_file.c,v 1.9 2020/06/19 03:48:49 djm Exp $ */
+/* $OpenBSD: test_file.c,v 1.10 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for sshkey.h key management API
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
-/* $OpenBSD: test_fuzz.c,v 1.12 2020/08/27 03:55:22 djm Exp $ */
+/* $OpenBSD: test_fuzz.c,v 1.13 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Fuzz tests for key parsing
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
-/* $OpenBSD: test_sshkey.c,v 1.21 2020/08/27 03:55:22 djm Exp $ */
+/* $OpenBSD: test_sshkey.c,v 1.22 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for sshkey.h key management API
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
-/* $OpenBSD: tests.c,v 1.2 2020/06/22 06:00:06 djm Exp $ */
+/* $OpenBSD: tests.c,v 1.3 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Regress test for sshbuf.h buffer API
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
-/* $OpenBSD: test_helper.c,v 1.12 2019/08/02 01:41:24 djm Exp $ */
+/* $OpenBSD: test_helper.c,v 1.13 2021/12/14 21:25:27 deraadt Exp $ */
/*
* Copyright (c) 2011 Damien Miller <djm@mindrot.org>
*
/* Utility functions/framework for regress tests */
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/uio.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include <assert.h>
#include <unistd.h>
#include <signal.h>
#include <vis.h>
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
#include "test_helper.h"
#include "atomicio.h"
r = memcmp(aa1, aa2, l);
TEST_CHECK_INT(r, pred);
test_header(file, line, a1, a2, "STRING", pred);
- aa1_tohex = tohex(aa1, MIN(l, 256));
- aa2_tohex = tohex(aa2, MIN(l, 256));
+ aa1_tohex = tohex(aa1, MINIMUM(l, 256));
+ aa2_tohex = tohex(aa2, MINIMUM(l, 256));
fprintf(stderr, "%12s = %s (len %zu)\n", a1, aa1_tohex, l);
fprintf(stderr, "%12s = %s (len %zu)\n", a2, aa2_tohex, l);
free(aa1_tohex);
r = memvalcmp(aa1, v, l, &where);
TEST_CHECK_INT(r, pred);
test_header(file, line, a1, NULL, "MEM_ZERO", pred);
- aa1_tohex = tohex(aa1, MIN(l, 20));
+ aa1_tohex = tohex(aa1, MINIMUM(l, 20));
fprintf(stderr, "%20s = %s%s (len %zu)\n", a1,
aa1_tohex, l > 20 ? "..." : "", l);
free(aa1_tohex);