Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Unify GET_32BIT()/PUT_32BIT() et al from numerous source files into misc.h. I've done a bit of testing (not exhaustive), and I don't _think_ I've broken anything... |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
a434996c3e54681c612aa9e8f7f721af |
| User & Date: | jacob 2005-04-12 15:04:56.000 |
Context
|
2005-04-14
| ||
| 17:58 | Implement my experimental arcfour modes. The 256-bit version is disabled until I can test it against someone else's implementation. check-in: 3782733aa1 user: ben tags: trunk | |
|
2005-04-12
| ||
| 15:04 | Unify GET_32BIT()/PUT_32BIT() et al from numerous source files into misc.h. I've done a bit of testing (not exhaustive), and I don't _think_ I've broken anything... check-in: a434996c3e user: jacob tags: trunk | |
|
2005-04-11
| ||
| 12:37 | Comment: change "window.c" to "the front end" check-in: b50106acc1 user: jacob tags: trunk | |
Changes
Changes to import.c.
| ︙ | ︙ | |||
8 9 10 11 12 13 14 | #include <assert.h> #include <ctype.h> #include "putty.h" #include "ssh.h" #include "misc.h" | < < < < < < < < < < < < | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <assert.h> #include <ctype.h> #include "putty.h" #include "ssh.h" #include "misc.h" int openssh_encrypted(const Filename *filename); struct ssh2_userkey *openssh_read(const Filename *filename, char *passphrase, const char **errmsg_p); int openssh_write(const Filename *filename, struct ssh2_userkey *key, char *passphrase); int sshcom_encrypted(const Filename *filename, char **comment); |
| ︙ | ︙ |
Changes to misc.h.
| ︙ | ︙ | |||
76 77 78 79 80 81 82 83 | #ifndef min #define min(x,y) ( (x) < (y) ? (x) : (y) ) #endif #ifndef max #define max(x,y) ( (x) > (y) ? (x) : (y) ) #endif #endif | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | #ifndef min #define min(x,y) ( (x) < (y) ? (x) : (y) ) #endif #ifndef max #define max(x,y) ( (x) > (y) ? (x) : (y) ) #endif #define GET_32BIT_LSB_FIRST(cp) \ (((unsigned long)(unsigned char)(cp)[0]) | \ ((unsigned long)(unsigned char)(cp)[1] << 8) | \ ((unsigned long)(unsigned char)(cp)[2] << 16) | \ ((unsigned long)(unsigned char)(cp)[3] << 24)) #define PUT_32BIT_LSB_FIRST(cp, value) ( \ (cp)[0] = (unsigned char)(value), \ (cp)[1] = (unsigned char)((value) >> 8), \ (cp)[2] = (unsigned char)((value) >> 16), \ (cp)[3] = (unsigned char)((value) >> 24) ) #define GET_16BIT_LSB_FIRST(cp) \ (((unsigned long)(unsigned char)(cp)[0]) | \ ((unsigned long)(unsigned char)(cp)[1] << 8)) #define PUT_16BIT_LSB_FIRST(cp, value) ( \ (cp)[0] = (unsigned char)(value), \ (cp)[1] = (unsigned char)((value) >> 8) ) #define GET_32BIT_MSB_FIRST(cp) \ (((unsigned long)(unsigned char)(cp)[0] << 24) | \ ((unsigned long)(unsigned char)(cp)[1] << 16) | \ ((unsigned long)(unsigned char)(cp)[2] << 8) | \ ((unsigned long)(unsigned char)(cp)[3])) #define GET_32BIT(cp) GET_32BIT_MSB_FIRST(cp) #define PUT_32BIT_MSB_FIRST(cp, value) ( \ (cp)[0] = (unsigned char)((value) >> 24), \ (cp)[1] = (unsigned char)((value) >> 16), \ (cp)[2] = (unsigned char)((value) >> 8), \ (cp)[3] = (unsigned char)(value) ) #define PUT_32BIT(cp, value) PUT_32BIT_MSB_FIRST(cp, value) #define GET_16BIT_MSB_FIRST(cp) \ (((unsigned long)(unsigned char)(cp)[0] << 8) | \ ((unsigned long)(unsigned char)(cp)[1])) #define PUT_16BIT_MSB_FIRST(cp, value) ( \ (cp)[0] = (unsigned char)((value) >> 8), \ (cp)[1] = (unsigned char)(value) ) #endif |
Changes to portfwd.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | #include <stdio.h> #include <stdlib.h> #include "putty.h" #include "ssh.h" #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE 1 #endif | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#include <stdio.h>
#include <stdlib.h>
#include "putty.h"
#include "ssh.h"
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
struct PFwdPrivate {
const struct plug_function_table *fn;
/* the above variable absolutely *must* be the first in this structure */
void *c; /* (channel) data used by ssh.c */
void *backhandle; /* instance of SSH backend itself */
/* Note that backhandle need not be filled in if c is non-NULL */
Socket s;
|
| ︙ | ︙ |
Changes to sftp.c.
| ︙ | ︙ | |||
9 10 11 12 13 14 15 | #include <limits.h> #include "misc.h" #include "int64.h" #include "tree234.h" #include "sftp.h" | < < < < < < < < < < < < | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#include <limits.h>
#include "misc.h"
#include "int64.h"
#include "tree234.h"
#include "sftp.h"
struct sftp_packet {
char *data;
unsigned length, maxlen;
unsigned savedpos;
int type;
};
|
| ︙ | ︙ |
Changes to ssh.c.
| ︙ | ︙ | |||
252 253 254 255 256 257 258 |
translate(SSH2_MSG_CHANNEL_SUCCESS);
translate(SSH2_MSG_CHANNEL_FAILURE);
return "unknown";
}
#undef translate
#undef translatec
| < < < < < < < < < < < < | 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
translate(SSH2_MSG_CHANNEL_SUCCESS);
translate(SSH2_MSG_CHANNEL_FAILURE);
return "unknown";
}
#undef translate
#undef translatec
/* Enumeration values for fields in SSH-1 packets */
enum {
PKT_END, PKT_INT, PKT_CHAR, PKT_DATA, PKT_STR, PKT_BIGNUM,
/* These values are for communicating relevant semantics of
* fields to the packet logging code. */
PKTT_OTHER, PKTT_PASSWORD, PKTT_DATA
};
|
| ︙ | ︙ |
Changes to sshaes.c.
| ︙ | ︙ | |||
34 35 36 37 38 39 40 | #define MAX_NR 14 /* max no of rounds */ #define MAX_NK 8 /* max no of words in input key */ #define MAX_NB 8 /* max no of words in cipher blk */ #define mulby2(x) ( ((x&0x7F) << 1) ^ (x & 0x80 ? 0x1B : 0) ) | < < < < < < < < < < < < | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
#define MAX_NR 14 /* max no of rounds */
#define MAX_NK 8 /* max no of words in input key */
#define MAX_NB 8 /* max no of words in cipher blk */
#define mulby2(x) ( ((x&0x7F) << 1) ^ (x & 0x80 ? 0x1B : 0) )
typedef struct AESContext AESContext;
struct AESContext {
word32 keysched[(MAX_NR + 1) * MAX_NB];
word32 invkeysched[(MAX_NR + 1) * MAX_NB];
void (*encrypt) (AESContext * ctx, word32 * block);
void (*decrypt) (AESContext * ctx, word32 * block);
|
| ︙ | ︙ |
Changes to sshblowf.c.
| ︙ | ︙ | |||
9 10 11 12 13 14 15 |
#include "ssh.h"
typedef struct {
word32 S0[256], S1[256], S2[256], S3[256], P[18];
word32 iv0, iv1; /* for CBC mode */
} BlowfishContext;
| < < < < < < < < < < < < < < < < < < < < < < < < | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#include "ssh.h"
typedef struct {
word32 S0[256], S1[256], S2[256], S3[256], P[18];
word32 iv0, iv1; /* for CBC mode */
} BlowfishContext;
/*
* The Blowfish init data: hex digits of the fractional part of pi.
* (ie pi as a hex fraction is 3.243F6A8885A308D3...)
*/
static const word32 parray[] = {
0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344, 0xA4093822, 0x299F31D0,
0x082EFA98, 0xEC4E6C89, 0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C,
|
| ︙ | ︙ |
Changes to sshcrcda.c.
| ︙ | ︙ | |||
38 39 40 41 42 43 44 | #define HASH_FACTOR(x) ((x)*3/2) #define HASH_UNUSEDCHAR (0xff) #define HASH_UNUSED (0xffff) #define HASH_IV (0xfffe) #define HASH_MINBLOCKS (7*SSH_BLOCKSIZE) | < < < < < < | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
#define HASH_FACTOR(x) ((x)*3/2)
#define HASH_UNUSEDCHAR (0xff)
#define HASH_UNUSED (0xffff)
#define HASH_IV (0xfffe)
#define HASH_MINBLOCKS (7*SSH_BLOCKSIZE)
/* Hash function (Input keys are cipher results) */
#define HASH(x) GET_32BIT_MSB_FIRST(x)
#define CMP(a, b) (memcmp(a, b, SSH_BLOCKSIZE))
uchar ONE[4] = { 1, 0, 0, 0 };
uchar ZERO[4] = { 0, 0, 0, 0 };
|
| ︙ | ︙ |
Changes to sshdes.c.
| ︙ | ︙ | |||
596 597 598 599 600 601 602 |
FP(L, R);
output[0] = L;
output[1] = R;
}
| < < < < < < < < < < < < | 596 597 598 599 600 601 602 603 604 605 606 607 608 609 |
FP(L, R);
output[0] = L;
output[1] = R;
}
static void des_cbc_encrypt(unsigned char *dest, const unsigned char *src,
unsigned int len, DESContext * sched)
{
word32 out[2], iv0, iv1;
unsigned int i;
assert((len & 7) == 0);
|
| ︙ | ︙ |
Changes to sshdss.c.
1 2 3 4 5 6 7 | #include <stdio.h> #include <stdlib.h> #include <assert.h> #include "ssh.h" #include "misc.h" | < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "ssh.h"
#include "misc.h"
static void sha_mpint(SHA_State * s, Bignum b)
{
unsigned char lenbuf[4];
int len;
len = (bignum_bitcount(b) + 8) / 8;
PUT_32BIT(lenbuf, len);
SHA_Bytes(s, lenbuf, 4);
|
| ︙ | ︙ |
Changes to sshpubk.c.
| ︙ | ︙ | |||
9 10 11 12 13 14 15 | #include <stdlib.h> #include <assert.h> #include "putty.h" #include "ssh.h" #include "misc.h" | < < < < < < < < < < < < | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#include <stdlib.h>
#include <assert.h>
#include "putty.h"
#include "ssh.h"
#include "misc.h"
#define rsa_signature "SSH PRIVATE KEY FILE FORMAT 1.1\n"
#define BASE64_TOINT(x) ( (x)-'A'<26 ? (x)-'A'+0 :\
(x)-'a'<26 ? (x)-'a'+26 :\
(x)-'0'<10 ? (x)-'0'+52 :\
(x)=='+' ? 62 : \
(x)=='/' ? 63 : 0 )
|
| ︙ | ︙ |
Changes to sshrsa.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * RSA implementation for PuTTY. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include "ssh.h" #include "misc.h" | < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
/*
* RSA implementation for PuTTY.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "ssh.h"
#include "misc.h"
int makekey(unsigned char *data, int len, struct RSAKey *result,
unsigned char **keystr, int order)
{
unsigned char *p = data;
int i, n;
if (len < 4)
|
| ︙ | ︙ |
Changes to unix/uxagentc.c.
| ︙ | ︙ | |||
10 11 12 13 14 15 16 | #include <sys/un.h> #include "putty.h" #include "misc.h" #include "tree234.h" #include "puttymem.h" | < < < < < < | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
#include <sys/un.h>
#include "putty.h"
#include "misc.h"
#include "tree234.h"
#include "puttymem.h"
int agent_exists(void)
{
if (getenv("SSH_AUTH_SOCK") != NULL)
return TRUE;
return FALSE;
}
|
| ︙ | ︙ |
Changes to unix/uxnet.c.
| ︙ | ︙ | |||
807 808 809 810 811 812 813 |
del234(sktree, s);
close(s->s);
if (s->addr)
sk_addr_free(s->addr);
sfree(s);
}
| < < < < < < < < < < | 807 808 809 810 811 812 813 814 815 816 817 818 819 820 |
del234(sktree, s);
close(s->s);
if (s->addr)
sk_addr_free(s->addr);
sfree(s);
}
void *sk_getxdmdata(void *sock, int *lenp)
{
Actual_Socket s = (Actual_Socket) sock;
#ifdef NO_IPV6
struct sockaddr_in addr;
#else
struct sockaddr_storage addr;
|
| ︙ | ︙ |
Changes to windows/winpgnt.c.
| ︙ | ︙ | |||
152 153 154 155 156 157 158 |
*/
struct blob {
unsigned char *blob;
int len;
};
static int cmpkeys_ssh2_asymm(void *av, void *bv);
| < < < < < < < < < < < < | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
*/
struct blob {
unsigned char *blob;
int len;
};
static int cmpkeys_ssh2_asymm(void *av, void *bv);
#define PASSPHRASE_MAXLEN 512
struct PassphraseProcStruct {
char *passphrase;
char *comment;
};
|
| ︙ | ︙ |
Changes to windows/winpgntc.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * Pageant client code. */ #include <stdio.h> #include <stdlib.h> #include "putty.h" #define AGENT_COPYDATA_ID 0x804e50ba /* random goop */ #define AGENT_MAX_MSGLEN 8192 | < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
/*
* Pageant client code.
*/
#include <stdio.h>
#include <stdlib.h>
#include "putty.h"
#define AGENT_COPYDATA_ID 0x804e50ba /* random goop */
#define AGENT_MAX_MSGLEN 8192
int agent_exists(void)
{
HWND hwnd;
hwnd = FindWindow("Pageant", "Pageant");
if (!hwnd)
return FALSE;
else
|
| ︙ | ︙ |
Changes to x11fwd.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * Platform-independent bits of X11 forwarding. */ #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <time.h> #include "putty.h" #include "ssh.h" #include "tree234.h" | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
/*
* Platform-independent bits of X11 forwarding.
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <time.h>
#include "putty.h"
#include "ssh.h"
#include "tree234.h"
#define GET_16BIT(endian, cp) \
(endian=='B' ? GET_16BIT_MSB_FIRST(cp) : GET_16BIT_LSB_FIRST(cp))
#define PUT_16BIT(endian, cp, val) \
(endian=='B' ? PUT_16BIT_MSB_FIRST(cp, val) : PUT_16BIT_LSB_FIRST(cp, val))
const char *const x11_authnames[] = {
|
| ︙ | ︙ |