hammer2 - Crypto handshake work for message stream
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 12 May 2012 07:43:26 +0000 (00:43 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 12 May 2012 08:00:38 +0000 (01:00 -0700)
commit62efe6ec4de59dc37e5790107c400be430d3bc49
treefdfb54bf4c125123219465c2533bd3d8c4092665
parente864c670ade516c6a877dcae8ff7d67bd6556ba9
hammer2 - Crypto handshake work for message stream

* 'hammer2 debug' can now take a destination host argument (and will
  default to localhost).  This is the debug shell connection.

* Add 'hammer2 rsainit' to initialize hammer2's keys /etc/hammer2/rsa.*

* Change the 'hammer2 node' directive to 'hammer2 service'.

* Flesh out the initial public key exchange handshake.  Currently the
  handshake consists of a symmetric 512 byte write and 512 byte read.
  The data is encrypted with our private key and the remote end's public
  key.

  Currently a very simple verifier has been constructed, but we will
  ultimately want to use sha or md5 or something like that for the
  verifier.

  Since I am doing a double-encryption here the first stage encrypt
  has to check that the result does not exceed the modulus (typically
  bit 7 of the first byte must be zero).  If it does we increment
  a 32 bit quantity in our pad*[] area and retry until we get a good
  result.

* The exchange is used to calculate the AES session key.  Session
  encryption is not yet implemented.  A random session key is sent
  by both ends.  The actual session key will be the XOR of the one
  we send and the one we receive.

* When a connection is accepted the remote end's public key is looked
  up in /etc/hammer2/remotes/<IP>.pub.  If this file does not exist
  then the connection is not allowed.
13 files changed:
sbin/hammer2/Makefile
sbin/hammer2/cmd_debug.c
sbin/hammer2/cmd_rsa.c [new file with mode: 0644]
sbin/hammer2/cmd_service.c [moved from sbin/hammer2/cmd_node.c with 79% similarity]
sbin/hammer2/crypto.c [new file with mode: 0644]
sbin/hammer2/hammer2.h
sbin/hammer2/main.c
sbin/hammer2/msg.c
sbin/hammer2/network.h
sbin/newfs_hammer2/newfs_hammer2.c
sys/vfs/hammer2/DESIGN
sys/vfs/hammer2/hammer2_disk.h
sys/vfs/hammer2/hammer2_vfsops.c