cl-rw

Layered streams for Common Lisp
git clone https://logand.com/git/cl-rw.git/
Log | Files | Refs

commit 91686d2cf6f38c9960dc59b68e268fa09285557a
parent 1a4746bddd65ad24eab7fdb7bb3d68f2e0f423b8
Author: Tomas Hlavaty <tom@logand.com>
Date:   Sun, 12 Oct 2014 15:31:52 +0200

tls uncompressed $ECPoint understood

Diffstat:
Mtls.lisp | 23+++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/tls.lisp b/tls.lisp @@ -373,8 +373,14 @@ (u8 a :length u8 :min 1) (u8 b :length u8 :min 1)) +;;http://stackoverflow.com/questions/10936171/how-do-i-compress-or-encode-the-elliptic-curve-public-key-and-put-it-over-the-ne (defstruc $ECPoint () - (u8 data :length u8 :min 1 :size t)) + ;;(u8 data :length u8 :min 1 :size t) + (u8 length) + (u8 #+nil $ECPointFormat format #+nil :check #+nil(= 4 format)) ;; 4=uncompressed 2|3=compressed + ;;(computed format :compute (progn (assert (= 4 %format)) %format)) + (u8 x :size (floor length 2)) + (u8 y :size (floor length 2))) ;; (defstruc %$ExplicitPrime () ;; opaque prime_p <1..2^8-1> @@ -648,9 +654,18 @@ :data (make-$ClientECDiffieHellmanPublic :type 'explicit :ecdh_public (make-$ECPoint - :data #(3 1 4 1 5 9)))))))) ;; TODO compute properly - -(defun next-server-hello (reader client-hello-time) + :length 65 + :format 4 ;;'uncompressed + :x #(47 33 158 197 200 79 233 37 253 19 + 101 180 145 99 27 72 189 79 195 35 + 43 226 40 247 85 134 48 189 7 134 + 71 97) + :y #(26 90 191 31 48 24 153 65 243 211 + 213 24 113 9 11 139 111 253 83 190 + 215 197 143 219 71 194 44 136 240 + 78 112 25)))))))) + +(defun next-server-hello (reader client-hello-time) ;; TODO extensions (let ((x (next-$Record reader))) ;;(print x) (let ((x ($Record-data x)))