summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--key.c16
2 files changed, 11 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index d9b27bd43..28aaf6091 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -34,6 +34,9 @@
34 that is not how it was envisioned. 34 that is not how it was envisioned.
35 Also correct manpage saying that -v is needed along with -l for it to work. 35 Also correct manpage saying that -v is needed along with -l for it to work.
36 spotted by naddy@ 36 spotted by naddy@
37 - otto@cvs.openbsd.org 2008/06/11 23:02:22
38 [key.c]
39 simpler way of computing the augmentations; ok grunk@
37 40
3820080611 4120080611
39 - (djm) [channels.c configure.ac] 42 - (djm) [channels.c configure.ac]
@@ -4196,4 +4199,4 @@
4196 OpenServer 6 and add osr5bigcrypt support so when someone migrates 4199 OpenServer 6 and add osr5bigcrypt support so when someone migrates
4197 passwords between UnixWare and OpenServer they will still work. OK dtucker@ 4200 passwords between UnixWare and OpenServer they will still work. OK dtucker@
4198 4201
4199$Id: ChangeLog,v 1.4971 2008/06/12 18:43:15 dtucker Exp $ 4202$Id: ChangeLog,v 1.4972 2008/06/12 18:43:51 dtucker Exp $
diff --git a/key.c b/key.c
index 5d357a8d6..80ce855d8 100644
--- a/key.c
+++ b/key.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: key.c,v 1.70 2008/06/11 21:01:35 grunk Exp $ */ 1/* $OpenBSD: key.c,v 1.71 2008/06/11 23:02:22 otto 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
@@ -330,17 +330,18 @@ key_fingerprint_randomart(u_char *dgst_raw, u_int dgst_raw_len)
330 */ 330 */
331 char *augmentation_string = " .o+=*BOX@%&#/^"; 331 char *augmentation_string = " .o+=*BOX@%&#/^";
332 char *retval, *p; 332 char *retval, *p;
333 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 337
337 retval = xcalloc(1, (FLDSIZE_X + 3) * (FLDSIZE_Y + 2)); 338 retval = xcalloc(1, (FLDSIZE_X + 3) * (FLDSIZE_Y + 2));
338 339
339 /* initialize field */ 340 /* initialize field */
340 memset(field, ' ', FLDSIZE_X * FLDSIZE_Y * sizeof(char)); 341 memset(field, 0, FLDSIZE_X * FLDSIZE_Y * sizeof(char));
341 x = FLDSIZE_X / 2; 342 x = FLDSIZE_X / 2;
342 y = FLDSIZE_Y / 2; 343 y = FLDSIZE_Y / 2;
343 field[x][y] = '.'; 344 field[x][y] = 1;
344 345
345 /* process raw key */ 346 /* process raw key */
346 for (i = 0; i < dgst_raw_len; i++) { 347 for (i = 0; i < dgst_raw_len; i++) {
@@ -359,10 +360,7 @@ key_fingerprint_randomart(u_char *dgst_raw, u_int dgst_raw_len)
359 y = MIN(y, FLDSIZE_Y - 1); 360 y = MIN(y, FLDSIZE_Y - 1);
360 361
361 /* augment the field */ 362 /* augment the field */
362 p = strchr(augmentation_string, field[x][y]); 363 field[x][y]++;
363 if (*++p != '\0')
364 field[x][y] = *p;
365
366 input = input >> 2; 364 input = input >> 2;
367 } 365 }
368 } 366 }
@@ -381,7 +379,7 @@ key_fingerprint_randomart(u_char *dgst_raw, u_int dgst_raw_len)
381 for (y = 0; y < FLDSIZE_Y; y++) { 379 for (y = 0; y < FLDSIZE_Y; y++) {
382 *p++ = '|'; 380 *p++ = '|';
383 for (x = 0; x < FLDSIZE_X; x++) 381 for (x = 0; x < FLDSIZE_X; x++)
384 *p++ = field[x][y]; 382 *p++ = augmentation_string[MIN(field[x][y], len - 1)];
385 *p++ = '|'; 383 *p++ = '|';
386 *p++ = '\n'; 384 *p++ = '\n';
387 } 385 }