You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.5KB

  1. `(== 64 64)
  2. (seed (in "/dev/urandom" (rd 8)))
  3. (load "blake2s.l")
  4. (load "functions.l")
  5. (setq
  6. *Prv # WAmgVYXkbT2bCtdcDwolI88/iVi/aV3/PHcUBTQSYmo=
  7. (88 9 160 85 133 228 109 61 155 10 215 92 15 10 37
  8. 35 207 63 137 88 191 105 93 255 60 119 20 5 52 18 98 106 )
  9. *Pub # K5sF9yESrSBsOXPd6TcpKNgqoy1Ik3ZFKl4FolzrRyI=
  10. (43 155 5 247 33 18 173 32 108 57 115 221 233 55 41
  11. 40 216 42 163 45 72 147 118 69 42 94 5 162 92 235 71 34 )
  12. *RPub # qRCwZSKInrMAq5sepfCdaCsRJaoLe5jhtzfiw7CjbwM=
  13. (169 16 176 101 34 136 158 179 0 171 155 30 165 240 157
  14. 104 43 17 37 170 11 123 152 225 183 55 226 195 176 163 111 3 )
  15. *Pre # FpCyhws9cxwWoV4xELtfJvjJN+zQVRPISllRWgeopVE=
  16. (22 144 178 135 11 61 115 28 22 161 94 49 16 187 95
  17. 38 248 201 55 236 208 85 19 200 74 89 81 90 7 168 165 81 )
  18. *E (ephemrl-pair)
  19. *C (hash32 *CONSTRUCTION)
  20. *H (hash32 (append *C *IDENTIFIER))
  21. *H (hash32 (append *H *RPub))
  22. *K NIL
  23. *Nsend 0
  24. *Nrecv 0
  25. *IndexR NIL
  26. *Enc NIL
  27. *Dec NIL
  28. *Srv (server *DEMO_SERVER *DEMO_PORT) )
  29. (sendto *Srv (start-handshake))
  30. (fin-handshake (recvfrom *Srv))
  31. # handshake done, keys splitted.
  32. # send encrypted raw ping packet
  33. (sendto *Srv (encryption *PING_DATA))
  34. # retrieve ping response, decrypt and
  35. # find back 'WireGuard' label inside
  36. (test
  37. *PING_LABEL
  38. (head
  39. (length *PING_LABEL)
  40. (nth (decryption (recvfrom *Srv)) 29) ) )
  41. # send keepalive
  42. (sendto *Srv (encryption))
  43. (test *Nsend 2)
  44. (test *Nrecv 1)
  45. (msg 'OK)
  46. (bye)