summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2008-06-13 04:45:50 +1000
committerDarren Tucker <dtucker@zip.com.au>2008-06-13 04:45:50 +1000
commitd32b28a307b308e5b5b052b4eb2a2c8f396c380b (patch)
treef936843e8590e48e5e9c79e366683a31ff3cfb9a
parentdcc1ab5483a5f0f0a72c14149ace9979c8dea085 (diff)
- grunk@cvs.openbsd.org 2008/06/11 23:51:57
[key.c] #define statements that are not atoms need braces around them, else they will cause trouble in some cases. Also do a computation of -1 once, and not in a loop several times. spotted by otto@
-rw-r--r--ChangeLog8
-rw-r--r--key.c10
2 files changed, 12 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 3e7f20152..c62492eb1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -41,6 +41,12 @@
41 [ssh_config.5] 41 [ssh_config.5]
42 CheckHostIP set to ``fingerprint'' will display both hex and random art 42 CheckHostIP set to ``fingerprint'' will display both hex and random art
43 spotted by naddy@ 43 spotted by naddy@
44 - grunk@cvs.openbsd.org 2008/06/11 23:51:57
45 [key.c]
46 #define statements that are not atoms need braces around them, else they
47 will cause trouble in some cases.
48 Also do a computation of -1 once, and not in a loop several times.
49 spotted by otto@
44 50
4520080611 5120080611
46 - (djm) [channels.c configure.ac] 52 - (djm) [channels.c configure.ac]
@@ -4203,4 +4209,4 @@
4203 OpenServer 6 and add osr5bigcrypt support so when someone migrates 4209 OpenServer 6 and add osr5bigcrypt support so when someone migrates
4204 passwords between UnixWare and OpenServer they will still work. OK dtucker@ 4210 passwords between UnixWare and OpenServer they will still work. OK dtucker@
4205 4211
4206$Id: ChangeLog,v 1.4973 2008/06/12 18:44:25 dtucker Exp $ 4212$Id: ChangeLog,v 1.4974 2008/06/12 18:45:50 dtucker Exp $
diff --git a/key.c b/key.c
index 80ce855d8..ef047463b 100644
--- a/key.c
+++ b/key.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: key.c,v 1.71 2008/06/11 23:02:22 otto Exp $ */ 1/* $OpenBSD: key.c,v 1.72 2008/06/11 23:51:57 grunk Exp $ */
2/* 2/*
3 * read_bignum(): 3 * read_bignum():
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -319,8 +319,8 @@ key_fingerprint_bubblebabble(u_char *dgst_raw, u_int dgst_raw_len)
319 * Graphs are not unambiguous, because circles in graphs can be 319 * Graphs are not unambiguous, because circles in graphs can be
320 * walked in either direction. 320 * walked in either direction.
321 */ 321 */
322#define FLDSIZE_Y 8 322#define FLDSIZE_Y 8
323#define FLDSIZE_X FLDSIZE_Y * 2 323#define FLDSIZE_X (FLDSIZE_Y * 2)
324static char * 324static char *
325key_fingerprint_randomart(u_char *dgst_raw, u_int dgst_raw_len) 325key_fingerprint_randomart(u_char *dgst_raw, u_int dgst_raw_len)
326{ 326{
@@ -333,7 +333,7 @@ key_fingerprint_randomart(u_char *dgst_raw, u_int dgst_raw_len)
333 u_char field[FLDSIZE_X][FLDSIZE_Y]; 333 u_char field[FLDSIZE_X][FLDSIZE_Y];
334 u_int i, b; 334 u_int i, b;
335 int x, y; 335 int x, y;
336 size_t len = strlen(augmentation_string); 336 size_t len = strlen(augmentation_string) - 1;
337 337
338 retval = xcalloc(1, (FLDSIZE_X + 3) * (FLDSIZE_Y + 2)); 338 retval = xcalloc(1, (FLDSIZE_X + 3) * (FLDSIZE_Y + 2));
339 339
@@ -379,7 +379,7 @@ key_fingerprint_randomart(u_char *dgst_raw, u_int dgst_raw_len)
379 for (y = 0; y < FLDSIZE_Y; y++) { 379 for (y = 0; y < FLDSIZE_Y; y++) {
380 *p++ = '|'; 380 *p++ = '|';
381 for (x = 0; x < FLDSIZE_X; x++) 381 for (x = 0; x < FLDSIZE_X; x++)
382 *p++ = augmentation_string[MIN(field[x][y], len - 1)]; 382 *p++ = augmentation_string[MIN(field[x][y], len)];
383 *p++ = '|'; 383 *p++ = '|';
384 *p++ = '\n'; 384 *p++ = '\n';
385 } 385 }