summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-07-02 19:13:56 +1000
committerDamien Miller <djm@mindrot.org>2000-07-02 19:13:56 +1000
commit484118ea0f6871c2429c45f0736ba07b8289561d (patch)
tree8e0434ce196d095be196d54f7741871a9c54e777
parentc708843e6a209b1c1f1a6d3e60b29be56d1d8894 (diff)
- (djm) Use standard OpenSSL functions in auth-skey.c. Patch from
Chris, the Young One <cky@pobox.com>
-rw-r--r--ChangeLog2
-rw-r--r--auth-skey.c9
-rw-r--r--scp.c14
3 files changed, 16 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 118416f6b..a17e435e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
2 - (djm) Fix brace mismatch from Corinna Vinschen <vinschen@cygnus.com> 2 - (djm) Fix brace mismatch from Corinna Vinschen <vinschen@cygnus.com>
3 - (djm) Stop shadow expiry checking from preventing logins with NIS. Based 3 - (djm) Stop shadow expiry checking from preventing logins with NIS. Based
4 on fix from HARUYAMA Seigo <haruyama@nt.phys.s.u-tokyo.ac.jp> 4 on fix from HARUYAMA Seigo <haruyama@nt.phys.s.u-tokyo.ac.jp>
5 - (djm) Use standard OpenSSL functions in auth-skey.c. Patch from
6 Chris, the Young One <cky@pobox.com>
5 7
620000701 820000701
7 - (djm) Fix Tru64 SIA problems reported by John P Speno <speno@isc.upenn.edu> 9 - (djm) Fix Tru64 SIA problems reported by John P Speno <speno@isc.upenn.edu>
diff --git a/auth-skey.c b/auth-skey.c
index d66d84e7d..208d380bb 100644
--- a/auth-skey.c
+++ b/auth-skey.c
@@ -4,7 +4,7 @@ RCSID("$OpenBSD: auth-skey.c,v 1.7 2000/06/20 01:39:38 markus Exp $");
4 4
5#include "ssh.h" 5#include "ssh.h"
6#include "packet.h" 6#include "packet.h"
7#include <sha1.h> 7#include <openssl/sha.h>
8 8
9/* from %OpenBSD: skeylogin.c,v 1.32 1999/08/16 14:46:56 millert Exp % */ 9/* from %OpenBSD: skeylogin.c,v 1.32 1999/08/16 14:46:56 millert Exp % */
10 10
@@ -74,7 +74,6 @@ skey_fake_keyinfo(char *username)
74 size_t secretlen = 0; 74 size_t secretlen = 0;
75 SHA_CTX ctx; 75 SHA_CTX ctx;
76 char *p, *u; 76 char *p, *u;
77 char md[SHA_DIGEST_LENGTH];
78 77
79 /* 78 /*
80 * Base first 4 chars of seed on hostname. 79 * Base first 4 chars of seed on hostname.
@@ -99,7 +98,7 @@ skey_fake_keyinfo(char *username)
99 98
100 SHA1_Init(&ctx); 99 SHA1_Init(&ctx);
101 SHA1_Update(&ctx, username, strlen(username)); 100 SHA1_Update(&ctx, username, strlen(username));
102 SHA1_End(&ctx, up); 101 SHA1_Final(up, &ctx);
103 102
104 /* Collapse the hash */ 103 /* Collapse the hash */
105 ptr = hash_collapse(up); 104 ptr = hash_collapse(up);
@@ -133,7 +132,7 @@ skey_fake_keyinfo(char *username)
133 SHA1_Init(&ctx); 132 SHA1_Init(&ctx);
134 SHA1_Update(&ctx, secret, secretlen); 133 SHA1_Update(&ctx, secret, secretlen);
135 SHA1_Update(&ctx, username, strlen(username)); 134 SHA1_Update(&ctx, username, strlen(username));
136 SHA1_End(&ctx, up); 135 SHA1_Final(up, &ctx);
137 136
138 /* Zero out */ 137 /* Zero out */
139 memset(secret, 0, secretlen); 138 memset(secret, 0, secretlen);
@@ -141,7 +140,7 @@ skey_fake_keyinfo(char *username)
141 /* Now hash the hash */ 140 /* Now hash the hash */
142 SHA1_Init(&ctx); 141 SHA1_Init(&ctx);
143 SHA1_Update(&ctx, up, strlen(up)); 142 SHA1_Update(&ctx, up, strlen(up));
144 SHA1_End(&ctx, up); 143 SHA1_Final(up, &ctx);
145 144
146 ptr = hash_collapse(up + 4); 145 ptr = hash_collapse(up + 4);
147 146
diff --git a/scp.c b/scp.c
index 0a89985de..5f849cc13 100644
--- a/scp.c
+++ b/scp.c
@@ -56,6 +56,14 @@ RCSID("$OpenBSD: scp.c,v 1.32 2000/06/20 01:39:44 markus Exp $");
56/* For progressmeter() -- number of seconds before xfer considered "stalled" */ 56/* For progressmeter() -- number of seconds before xfer considered "stalled" */
57#define STALLTIME 5 57#define STALLTIME 5
58 58
59/* Progress meter bar */
60#define BAR \
61 "************************************************************"\
62 "************************************************************"\
63 "************************************************************"\
64 "************************************************************"
65#define MAX_BARLENGTH (sizeof(BAR) - 1)
66
59/* Visual statistics about files as they are transferred. */ 67/* Visual statistics about files as they are transferred. */
60void progressmeter(int); 68void progressmeter(int);
61 69
@@ -1172,13 +1180,11 @@ progressmeter(int flag)
1172 snprintf(buf, sizeof(buf), "\r%-20.20s %3d%% ", curfile, ratio); 1180 snprintf(buf, sizeof(buf), "\r%-20.20s %3d%% ", curfile, ratio);
1173 1181
1174 barlength = getttywidth() - 51; 1182 barlength = getttywidth() - 51;
1183 barlength = (barlength <= MAX_BARLENGTH)?barlength:MAX_BARLENGTH;
1175 if (barlength > 0) { 1184 if (barlength > 0) {
1176 i = barlength * ratio / 100; 1185 i = barlength * ratio / 100;
1177 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), 1186 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
1178 "|%.*s%*s|", i, 1187 "|%.*s%*s|", i, BAR, barlength - i, "");
1179 "*****************************************************************************"
1180 "*****************************************************************************",
1181 barlength - i, "");
1182 } 1188 }
1183 i = 0; 1189 i = 0;
1184 abbrevsize = cursize; 1190 abbrevsize = cursize;