summaryrefslogtreecommitdiff
path: root/sshkey.c
diff options
context:
space:
mode:
authorderaadt@openbsd.org <deraadt@openbsd.org>2016-09-12 01:22:38 +0000
committerDarren Tucker <dtucker@zip.com.au>2016-09-12 13:46:29 +1000
commit9136ec134c97a8aff2917760c03134f52945ff3c (patch)
treebfcab357e6e0f510d9b63bac43b18097e89fa58a /sshkey.c
parentf219fc8f03caca7ac82a38ed74bbd6432a1195e7 (diff)
upstream commit
Add MAXIMUM(), MINIMUM(), and ROUNDUP() to misc.h, then use those definitions rather than pulling <sys/param.h> and unknown namespace pollution. ok djm markus dtucker Upstream-ID: 712cafa816c9f012a61628b66b9fbd5687223fb8
Diffstat (limited to 'sshkey.c')
-rw-r--r--sshkey.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/sshkey.c b/sshkey.c
index 166ac714d..8f6173e27 100644
--- a/sshkey.c
+++ b/sshkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshkey.c,v 1.36 2016/08/03 05:41:57 djm Exp $ */ 1/* $OpenBSD: sshkey.c,v 1.37 2016/09/12 01:22:38 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
4 * Copyright (c) 2008 Alexander von Gernler. All rights reserved. 4 * Copyright (c) 2008 Alexander von Gernler. All rights reserved.
@@ -27,7 +27,6 @@
27 27
28#include "includes.h" 28#include "includes.h"
29 29
30#include <sys/param.h> /* MIN MAX */
31#include <sys/types.h> 30#include <sys/types.h>
32#include <netinet/in.h> 31#include <netinet/in.h>
33 32
@@ -1082,10 +1081,10 @@ fingerprint_randomart(const char *alg, u_char *dgst_raw, size_t dgst_raw_len,
1082 y += (input & 0x2) ? 1 : -1; 1081 y += (input & 0x2) ? 1 : -1;
1083 1082
1084 /* assure we are still in bounds */ 1083 /* assure we are still in bounds */
1085 x = MAX(x, 0); 1084 x = MAXIMUM(x, 0);
1086 y = MAX(y, 0); 1085 y = MAXIMUM(y, 0);
1087 x = MIN(x, FLDSIZE_X - 1); 1086 x = MINIMUM(x, FLDSIZE_X - 1);
1088 y = MIN(y, FLDSIZE_Y - 1); 1087 y = MINIMUM(y, FLDSIZE_Y - 1);
1089 1088
1090 /* augment the field */ 1089 /* augment the field */
1091 if (field[x][y] < len - 2) 1090 if (field[x][y] < len - 2)
@@ -1126,7 +1125,7 @@ fingerprint_randomart(const char *alg, u_char *dgst_raw, size_t dgst_raw_len,
1126 for (y = 0; y < FLDSIZE_Y; y++) { 1125 for (y = 0; y < FLDSIZE_Y; y++) {
1127 *p++ = '|'; 1126 *p++ = '|';
1128 for (x = 0; x < FLDSIZE_X; x++) 1127 for (x = 0; x < FLDSIZE_X; x++)
1129 *p++ = augmentation_string[MIN(field[x][y], len)]; 1128 *p++ = augmentation_string[MINIMUM(field[x][y], len)];
1130 *p++ = '|'; 1129 *p++ = '|';
1131 *p++ = '\n'; 1130 *p++ = '\n';
1132 } 1131 }