Browse Source

Merge branch 'guile-interrop' into 'master'

Support CapTP protocol version check

See merge request spritely/goblins!29
fix-gitlab-ci
David Thompson 3 years ago
parent
commit
4898d80d2f
  1. 15
      goblins/ocapn/captp.rkt

15
goblins/ocapn/captp.rkt

@ -64,6 +64,7 @@
;; For the handoff stuff:
;; https://dustycloud.org/tmp/captp-handoff-musings.org.txt
;; https://dustycloud.org/misc/3vat-handoff-scaled.jpg
(define captp-version 0.1)
(struct captp-session-severed ())
@ -190,7 +191,8 @@
;; machinetp operations/descriptions
(define-recordable-struct mtp:op:start-session
(handoff-pubkey
(captp-version
handoff-pubkey
;; a sig-envelope signed by handoff-pubkey with a <my-location $location-data>
acceptable-location
acceptable-location-sig)
@ -1419,9 +1421,15 @@
;; TODO: Shouldn't the netlayer actually interpret this message
;; before it gets here? Ie, at this stage, we're already
;; "confident" this is from the right location
[(mtp:op:start-session remote-encoded-pubkey
[(mtp:op:start-session remote-captp-version
remote-encoded-pubkey
(? ocapn-machine? claimed-remote-location)
remote-location-sig)
(unless (= remote-captp-version captp-version)
(error (format "CapTP version is incompatible (our version: ~a, remove version: ~a)"
captp-version
remote-captp-version)))
(define remote-handoff-pubkey
(datum->pk-key (gcrypt->racket/public-key remote-encoded-pubkey) 'rkt-public))
;; TODO: I guess we didn't know by the time this was opened
@ -1512,7 +1520,8 @@
;; Now we'll need to send our side of the start-session and get the
;; other side... which will be handled by the ^setup-completer above
(send-to-remote (mtp:op:start-session handoff-pubkey
(send-to-remote (mtp:op:start-session captp-version
handoff-pubkey
our-location
our-location-sig))

Loading…
Cancel
Save