Christian Hesse
2014-Jan-28 11:22 UTC
[PATCH 1/1] rework printing for visual host key upper border
Key types are getting longer and the current implementation of visual host key breaks with ED25519, resulting in (note the missing bracket): +--[ED25519 256--+ This reworks the calculation of visual host key upper border. Please be aware that this may change the output for other key types as well. --- key.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/key.c b/key.c index 9142338..430f290 100644 --- a/key.c +++ b/key.c @@ -530,13 +530,14 @@ key_fingerprint_randomart(u_char *dgst_raw, u_int dgst_raw_len, const Key *k) * intersects with itself. Matter of taste. */ char *augmentation_string = " .o+=*BOX@%&#/^SE"; - char *retval, *p; + char *retval, *p, key_details[FLDSIZE_X + 1]; u_char field[FLDSIZE_X][FLDSIZE_Y]; u_int i, b; int x, y; size_t len = strlen(augmentation_string) - 1; retval = xcalloc(1, (FLDSIZE_X + 3) * (FLDSIZE_Y + 2)); + p = retval; /* initialize field */ memset(field, 0, FLDSIZE_X * FLDSIZE_Y * sizeof(char)); @@ -570,11 +571,14 @@ key_fingerprint_randomart(u_char *dgst_raw, u_int dgst_raw_len, const Key *k) field[FLDSIZE_X / 2][FLDSIZE_Y / 2] = len - 1; field[x][y] = len; - /* fill in retval */ - snprintf(retval, FLDSIZE_X, "+--[%4s %4u]", key_type(k), key_size(k)); - p = strchr(retval, '\0'); + /* assemble key detail string */ + snprintf(key_details, FLDSIZE_X, "[%s %u]", key_type(k), key_size(k)); /* output upper border */ + *p++ = '+'; + for (i = 0; i < (FLDSIZE_X - strlen(key_details)) / 2; i++) + *p++ = '-'; + p += sprintf(p, "%s", key_details); for (i = p - retval - 1; i < FLDSIZE_X; i++) *p++ = '-'; *p++ = '+'; -- 1.8.5.3
Christian Hesse
2014-Jan-29 07:32 UTC
[PATCH 1/1] rework printing for visual host key upper border
Christian Hesse <mail at eworm.de> on Tue, 2014/01/28 12:22:> Key types are getting longer and the current implementation of visual > host key breaks with ED25519, resulting in (note the missing bracket): > > +--[ED25519 256--+ > > This reworks the calculation of visual host key upper border. Please be > aware that this may change the output for other key types as well.Just to show the differences... This is a before and after comparison: +--[ DSA 1024]----+ +---[DSA 1024]----+ +--[ RSA 2048]----+ +---[RSA 2048]----+ +--[ECDSA 256]---+ +---[ECDSA 256]---+ +--[ED25519 256--+ +--[ED25519 256]--+ -- main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/* Chris get my mail address: */=0;b=c[a++];) putchar(b-1/(/* gcc -o sig sig.c && ./sig */b/42*2-3)*42);} -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 490 bytes Desc: not available URL: <http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20140129/65c705e9/attachment.bin>
Christian Hesse
2014-Feb-20 09:07 UTC
[PATCH 1/1] rework printing for visual host key upper border
Christian Hesse <mail at eworm.de> on Tue, 2014/01/28 12:22:> Key types are getting longer and the current implementation of visual > host key breaks with ED25519, resulting in (note the missing bracket): > > +--[ED25519 256--+ > > This reworks the calculation of visual host key upper border. Please be > aware that this may change the output for other key types as well.Wondering if this is in anybody'y queue... Or did I post to the wrong place? Any reason not to apply this? -- main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/* Chris get my mail address: */=0;b=c[a++];) putchar(b-1/(/* gcc -o sig sig.c && ./sig */b/42*2-3)*42);} -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 490 bytes Desc: not available URL: <http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20140220/f3b00a20/attachment.bin>
Possibly Parallel Threads
- [PATCH 1/1] rework printing for visual host key upper border
- [PATCH 1/1] paint visual host key with unicode box-drawing characters
- [PATCH v2 1/1] paint visual host key with unicode box-drawing characters
- [PATCH 1/1] paint visual host key with unicode box-drawing characters
- bubblebabble patch