commit 1a4746bddd65ad24eab7fdb7bb3d68f2e0f423b8
parent 0a7018a83ca03cb4438aa203d9a1c6e052cc143a
Author: Tomas Hlavaty <tom@logand.com>
Date: Sun, 21 Sep 2014 23:27:56 +0200
parse ECPointFormatList extension
Diffstat:
M | tls.lisp | | | 57 | ++++++++++++++++++++++++++++++++++++++++----------------- |
1 file changed, 40 insertions(+), 17 deletions(-)
diff --git a/tls.lisp b/tls.lisp
@@ -268,6 +268,12 @@
(defenum %$SignatureHashAlgorithmSignature (:nbits 8)
(rsa . 1))
+(defenum $ECPointFormat (:nbits 8)
+ (uncompressed . 0)
+ (ansiX962_compressed_prime . 1)
+ (ansiX962_compressed_char2 . 2)
+ #+nil(reserved 248..255))
+
(defun PublicValueEncoding ()
;;'implicit
'explicit)
@@ -322,6 +328,25 @@
(defstruc $Certificate ()
(%$Certificate list :length u24 :min 0 :max #.(1- (expt 2 24)) :size t))
+(defstruc %$ECPointFormatList ()
+ ($ECPointFormat ec_point_format_list :length u8 :min 1 :size t))
+
+(defstruc $ECPointFormatList ()
+ (%$ECPointFormatList data :length u16))
+
+(defstruc $Extension ()
+ ($ExtensionType type)
+ ((ecase type
+ ;;(status_request)
+ ;;(server_name)
+ ;;(renegotiation_info)
+ ;;(SessionTicket_TLS)
+ ;;(elliptic_curves)
+ (ec_point_formats $ECPointFormatList)
+ #+nil(signature_algorithms))
+ data)
+ #+nil(u8 data :length u16 :min 0 :max #.(1- (expt 2 16)) :size t))
+
(defstruc $ClientHello ()
($ContentVersion #+nil $ProtocolVersion version)
($Random random)
@@ -330,19 +355,6 @@
($CompressionMethod compression_methods :length u8 :min 1 :max #.(1- (expt 2 8)) :size t)
($Extension extensions :length u16 :min 0 :max #.(1- (expt 2 16)) :size t))
-(defstruc $Extension ()
- ($ExtensionType type)
- #+nil
- (ecase type
- (status_request)
- (server_name)
- (renegotiation_info)
- (SessionTicket_TLS)
- (elliptic_curves)
- (ec_point_formats)
- (signature_algorithms))
- (u8 data :length u16 :min 0 :max #.(1- (expt 2 16)) :size t))
-
(defstruc $ServerDHParams ()
(u8 dh_p :length u16 :min 1 :max #.(1- (expt 2 16)))
(u8 dh_g :length u16 :min 1 :max #.(1- (expt 2 16)))
@@ -598,18 +610,29 @@
)
:compression_methods (list 'null)
:extensions (list
+ #+nil
(make-$Extension :type 'status_request
:data '(1 0 0 0 0))
+ #+nil
(make-$Extension :type 'server_name
:data '(0 #x10 0 0 #xd #x77 #x69 #x6b #x69 #x70 #x65 #x64 #x69 #x61 #x2e #x6f #x72 #x67))
+ #+nil
(make-$Extension :type 'renegotiation_info
:data '(0))
+ #+nil
(make-$Extension :type 'SessionTicket_TLS :data nil)
- (make-$Extension :type 'elliptic_curves
+ #+nil
+ (make-$Extension :type 'elliptic_curves ;; TODO
:data '(0 10 0 #x13 0 #x15 0 #x17 0 #x18 0 #x19))
- (make-$Extension :type 'ec_point_formats
- :data '(1 0))
- (make-$Extension :type 'signature_algorithms
+ (make-$Extension
+ :type 'ec_point_formats ;; TODO
+ :data (make-$ECPointFormatList
+ :data
+ (make-%$ECPointFormatList
+ :ec_point_format_list
+ '(uncompressed))))
+ #+nil
+ (make-$Extension :type 'signature_algorithms ;; TODO
:data '(0 #x1a 4 1 4 2 4 3 5 1 5 3 6 1 6 3 3 1 3 2 3 3 2 1 2 2 2 3))))))))
(defun write-client-key-exchange (writer)