README.code Info for hackers of pssh. ## Compilation ## pssh is built using prc-tools, PilRC 3.0, and Peal on Mac OS X. pssh can probably be built on any platform supported by prc-tools. It probably cannot be built with CodeWarrior without significant porting work (multi-segment support, in particular). pssh uses prc-tools to compile code. http://prc-tools.sourceforge.net/ http://www.zenonez.com/prctoolsx/ (binaries for Mac OS X) pssh uses PilRC 3.0 or later to build resources. http://sourceforge.net/projects/pilrc/ http://zenonez.com/prctoolsx/PilRC-3.1.dmg.gz (binaries for Mac OS X) pssh requires Peal to link and load ARM code. http://www.sealiesoftware.com/peal/ pssh requires libc.a and libgcc.a built as Thumb code with ARM interworking enabled. Current versions of prc-tools do not provide them. Instructions for building them from prc-tools 2.3 are available on request (gparker-pssh@sealiesoftware.com), or use: http://www.sealiesoftware.com/pssh/dist/libc.a http://www.sealiesoftware.com/pssh/dist/libgcc.a To build: 1. Set up your directories as follows: libc.a libgcc.a peal/ ... pssh-source/ README.code ... 2. In directory peal/postlink, run `make` if you have not already. This builds Peal's postlinker. 3. In directory pssh-source, run `make`. This builds pssh's m68K code, ARM code, and resources, generating pssh.prc. If you see build messages like "warning: interworking not enabled", "thumb call to arm", and "internal error: dangerous error", then your libc.a or libgcc.a isn't set up right. pssh.prc will crash if you try to run it. WARNING: pssh's Makefile does NOT handle all dependencies like changed .h files. Use `make clean` as necessary. ## Directories ## Note: some of these directories have components under the arm/ directory. crypto: Basic cryptographic algorithms crypto/openssl: Cryptography algorithms from OpenSSL crypto/rand: Fortuna random number generator crypto/sha2: SHA256 algorithm by Aaron Gifford data: Manipulation and display of data in Palm OS databases forms: Event handlers and other form code rsrc: Palm OS resource descriptions and font data rsrc/pssh.rsrc: Palm OS Constructor mockups of some forms (not actually used) ssh: SSH 2 protocol ssh/openssh: SSH 2 code from OpenSSH util: Miscellaneous utility code and headers util/oem: Headers from various SDKs like palmOne and Sony vt100: Terminal emulator from PuTTY ## SSH 2 protocol code ## Palm OS programs are event-driven. OpenSSH's ssh client is not. To prevent blocking in socket I/O, much of OpenSSH's protocol code was rewritten as follows. ssh.c The highest-level wrapper around an SSH 2 session and its associated terminal emulator. All manipulation from outside goes through here. packetizer.c SSH 2 binary packet protocol. Handles socket I/O, version check, encryption, decryption, MAC check, padding. Sends unencrypted packet payloads to the transport layer. transport.c SSH 2 transport protocol. Handles algorithm negotiation and key exchange. Sends other data to the connection layer. connection.c SSH 2 connection protocol. Handles authentication and stream data. Sends stream data to the terminal emulator. The packetizer, transport, and connection layers are each a state machine whose states are generally defined by blocking network operations. This allows program control to return to the main event loop when waiting for packets to arrive.