projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Peter Schellenbach's patch: re-implement the PuTTY cryptographic
[u/mdw/putty]
/
scpssh.c
diff --git
a/scpssh.c
b/scpssh.c
index
3c45c9a
..
3d2c824
100644
(file)
--- a/
scpssh.c
+++ b/
scpssh.c
@@
-121,8
+121,15
@@
next_packet:
pktin.length = len;
if (pktin.maxlen < biglen) {
pktin.maxlen = biglen;
pktin.length = len;
if (pktin.maxlen < biglen) {
pktin.maxlen = biglen;
+#ifdef MSCRYPTOAPI
+ /* allocate enough buffer space for extra block
+ * for MS CryptEncrypt() */
+ pktin.data = (pktin.data == NULL) ?
+ smalloc(biglen+8) : srealloc(pktin.data, biglen+8);
+#else
pktin.data = (pktin.data == NULL) ?
pktin.data = (pktin.data == NULL) ?
- smalloc(biglen) : srealloc(pktin.data, biglen);
+ smalloc(biglen) : srealloc(pktin.data, biglen);
+#endif
}
ret = s_read(pktin.data, biglen);
}
ret = s_read(pktin.data, biglen);
@@
-162,8
+169,15
@@
static void s_wrpkt_start(int type, int len) {
pktout.length = len-5;
if (pktout.maxlen < biglen) {
pktout.maxlen = biglen;
pktout.length = len-5;
if (pktout.maxlen < biglen) {
pktout.maxlen = biglen;
+#ifdef MSCRYPTOAPI
+ /* Allocate enough buffer space for extra block
+ * for MS CryptEncrypt() */
+ pktout.data = (pktout.data == NULL ? malloc(biglen+8) :
+ realloc(pktout.data, biglen+8));
+#else
pktout.data = (pktout.data == NULL ? malloc(biglen+4) :
realloc(pktout.data, biglen+4));
pktout.data = (pktout.data == NULL ? malloc(biglen+4) :
realloc(pktout.data, biglen+4));
+#endif
if (!pktout.data)
fatalbox("Out of memory");
}
if (!pktout.data)
fatalbox("Out of memory");
}
@@
-488,6
+502,11
@@
char *ssh_init(char *host, int port, char *cmd, char **realhost) {
int FWport;
#endif
int FWport;
#endif
+#ifdef MSCRYPTOAPI
+ if(crypto_startup() == 0)
+ return "Microsoft high encryption pack not installed!";
+#endif
+
savedhost = malloc(1+strlen(host));
if (!savedhost)
fatalbox("Out of memory");
savedhost = malloc(1+strlen(host));
if (!savedhost)
fatalbox("Out of memory");