~mdw
/
sgt
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
telnet:// URLs don't always have the //. (Incorrect but common.)
[sgt/putty]
/
sshrsa.c
diff --git
a/sshrsa.c
b/sshrsa.c
index
71e1d63
..
d13f6cf
100644
(file)
--- a/
sshrsa.c
+++ b/
sshrsa.c
@@
-126,7
+126,8
@@
static void bigmod(unsigned short *a, unsigned short *m, int len)
q--;
t -= m1;
r = (r + m0) & 0xffff; /* overflow? */
q--;
t -= m1;
r = (r + m0) & 0xffff; /* overflow? */
- if (r >= m0 && t > ((unsigned long) r << 16) + a[i+1])
+ if (r >= (unsigned long)m0 &&
+ t > ((unsigned long) r << 16) + a[i+1])
q--;
}
q--;
}
@@
-263,12
+264,12
@@
int makekey(unsigned char *data, struct RSAKey *result,
for (i=1; i<=w; i++)
bn[j][i] = 0;
for (i=1; i<=w; i++)
bn[j][i] = 0;
- for (i=
0; i<b; i++
) {
+ for (i=
b; i-- ;
) {
unsigned char byte = *p++;
unsigned char byte = *p++;
- if (
(b-i)
& 1)
- bn[j][
w-i/2] |= byte
;
+ if (
i
& 1)
+ bn[j][
1+i/2] |= byte<<8
;
else
else
- bn[j][
w-i/2] |= byte<<8
;
+ bn[j][
1+i/2] |= byte
;
}
debug(bn[j]);
}
debug(bn[j]);
@@
-307,12
+308,12
@@
void rsaencrypt(unsigned char *data, int length, struct RSAKey *key) {
p = data;
for (i=1; i<=w; i++)
b1[i] = 0;
p = data;
for (i=1; i<=w; i++)
b1[i] = 0;
- for (i=
0; i<key->bytes; i++
) {
+ for (i=
key->bytes; i-- ;
) {
unsigned char byte = *p++;
unsigned char byte = *p++;
- if (
(key->bytes-i)
& 1)
- b1[
w-i/2] |= byte
;
+ if (
i
& 1)
+ b1[
1+i/2] |= byte<<8
;
else
else
- b1[
w-i/2] |= byte<<8
;
+ b1[
1+i/2] |= byte
;
}
debug(b1);
}
debug(b1);
@@
-322,12
+323,12
@@
void rsaencrypt(unsigned char *data, int length, struct RSAKey *key) {
debug(b2);
p = data;
debug(b2);
p = data;
- for (i=
0; i<key->bytes; i++
) {
+ for (i=
key->bytes; i-- ;
) {
unsigned char b;
if (i & 1)
unsigned char b;
if (i & 1)
- b = b2[
w-i/2] & 0xFF
;
+ b = b2[
1+i/2] >> 8
;
else
else
- b = b2[
w-i/2] >> 8
;
+ b = b2[
1+i/2] & 0xFF
;
*p++ = b;
}
*p++ = b;
}