From 315f00d1e4073fe649e3f3310f698776cbdef201 Mon Sep 17 00:00:00 2001 From: str4d Date: Mon, 10 Jun 2013 07:47:26 +0000 Subject: [PATCH] Tag datastructure definitions in docs/transport/* for highlighting --- i2p2www/pages/site/docs/transport/ntcp.html | 68 ++++++++++----------- i2p2www/pages/site/docs/transport/ssu.html | 16 ++--- 2 files changed, 41 insertions(+), 43 deletions(-) diff --git a/i2p2www/pages/site/docs/transport/ntcp.html b/i2p2www/pages/site/docs/transport/ntcp.html index bb7053e0..6424b215 100644 --- a/i2p2www/pages/site/docs/transport/ntcp.html +++ b/i2p2www/pages/site/docs/transport/ntcp.html @@ -34,11 +34,11 @@ After establishment, the NTCP transport sends individual I2NP messages, with a simple checksum. The unencrypted message is encoded as follows: {%- endtrans %}

-
- *  +-------+-------+--//--+---//----+-------+-------+-------+-------+
- *  | sizeof(data)  | data | padding | Adler checksum of sz+data+pad |
- *  +-------+-------+--//--+---//----+-------+-------+-------+-------+
-
+{% highlight %} ++-------+-------+--//--+---//----+-------+-------+-------+-------+ +| sizeof(data) | data | padding | Adler checksum of sz+data+pad | ++-------+-------+--//--+---//----+-------+-------+-------+-------+ +{% endhighlight %}

{% trans -%} The data is then AES/256/CBC encrypted. The session key for the encryption is negotiated during establishment (using Diffie-Hellman 2048 bit). @@ -60,13 +60,13 @@ The minimum data size is 1. One special case is a metadata message where the sizeof(data) is 0. In that case, the unencrypted message is encoded as: {%- endtrans %}

-
- *  +-------+-------+-------+-------+-------+-------+-------+-------+
- *  |       0       |      timestamp in seconds     | uninterpreted             
- *  +-------+-------+-------+-------+-------+-------+-------+-------+
- *          uninterpreted           | Adler checksum of bytes 0-11  |
- *  +-------+-------+-------+-------+-------+-------+-------+-------+
-
+{% highlight %} ++-------+-------+-------+-------+-------+-------+-------+-------+ +| 0 | timestamp in seconds | uninterpreted ++-------+-------+-------+-------+-------+-------+-------+-------+ + uninterpreted | Adler checksum of bytes 0-11 | ++-------+-------+-------+-------+-------+-------+-------+-------+ +{% endhighlight %}

{% trans -%} Total length: 16 bytes. The time sync message is sent at approximately 15 minute intervals. The message is encrypted just as standard messages are. @@ -86,17 +86,15 @@ In the establish state, there is a 4-phase message sequence to exchange DH keys In the first two messages there is a 2048-bit Diffie Hellman exchange. Then, DSA signatures of the critical data are exchanged to confirm the connection. {%- endtrans %}

-
- * Alice                   contacts                      Bob
- * =========================================================
- *  X+(H(X) xor Bob.identHash)----------------------------->
- *  <----------------------------------------Y+E(H(X+Y)+tsB+padding, sk, Y[239:255])
- *  E(sz+Alice.identity+tsA+padding+S(X+Y+Bob.identHash+tsA+tsB), sk, hX_xor_Bob.identHash[16:31])--->
- *  <----------------------E(S(X+Y+Alice.identHash+tsA+tsB)+padding, sk, prev)
+{% highlight %}
+Alice                   contacts                      Bob
+=========================================================
+ X+(H(X) xor Bob.identHash)----------------------------->
+ <----------------------------------------Y+E(H(X+Y)+tsB+padding, sk, Y[239:255])
+ E(sz+Alice.identity+tsA+padding+S(X+Y+Bob.identHash+tsA+tsB), sk, hX_xor_Bob.identHash[16:31])--->
+ <----------------------E(S(X+Y+Alice.identHash+tsA+tsB)+padding, sk, prev)
 
-
-
   {% trans %}Legend:{% endtrans %}
     X, Y: {% trans %}256 byte DH public keys{% endtrans %}
     H(): 32 byte SHA256 Hash
@@ -105,7 +103,7 @@ Then, DSA signatures of the critical data are exchanged to confirm the connectio
     tsA, tsB: {% trans %}timestamps (4 bytes, seconds since epoch){% endtrans %}
     sk: {% trans %}32 byte Session key{% endtrans %}
     sz: {% trans %}2 byte size of Alice identity to follow{% endtrans %}
-
+{% endhighlight %}

{% trans %}DH Key Exchange{% endtrans %}

{% trans cryptography=site_url('docs/how/cryptography') -%} @@ -143,11 +141,11 @@ which was published to the network database. Alice sends Bob: {%- endtrans %}

-
- *  X+(H(X) xor Bob.identHash)----------------------------->
+{% highlight %}
+ X+(H(X) xor Bob.identHash)----------------------------->
 
     {% trans %}Size:{% endtrans %} 288 bytes
-
+{% endhighlight %}

{% trans %}Contents:{% endtrans %}

  +----+----+----+----+----+----+----+----+
@@ -186,13 +184,13 @@ Alice has contacted the wrong router, and Bob drops the connection.
 

{% trans -%} This is the DH reply. Bob sends Alice: {%- endtrans %}

-
- *  <----------------------------------------Y+E(H(X+Y)+tsB+padding, sk, Y[239:255])
+{% highlight %}
+ <----------------------------------------Y+E(H(X+Y)+tsB+padding, sk, Y[239:255])
 
     {% trans %}Size:{% endtrans %} 304 bytes
-
+{% endhighlight %}

{% trans %}Unencrypted Contents:{% endtrans %}

-
+{% highlight %}
  +----+----+----+----+----+----+----+----+
  |         Y as calculated from DH       |
  +                                       +
@@ -222,7 +220,7 @@ This is the DH reply. Bob sends Alice:
 
   padding: {% trans %}12 bytes random data{% endtrans %}
 
-
+{% endhighlight %}

{% trans %}Encrypted Contents:{% endtrans %}

@@ -266,11 +264,11 @@ Alice may drop the connection if the clock skew with Bob is too high as calculat

{% trans -%} This contains Alice's router identity, and a DSA signature of the critical data. Alice sends Bob: {%- endtrans %}

-
- *  E(sz+Alice.identity+tsA+padding+S(X+Y+Bob.identHash+tsA+tsB), sk, hX_xor_Bob.identHash[16:31])--->
+{% highlight %}
+ E(sz+Alice.identity+tsA+padding+S(X+Y+Bob.identHash+tsA+tsB), sk, hX_xor_Bob.identHash[16:31])--->
 
     {% trans %}Size:{% endtrans %} 448 bytes (typ. for 387 byte identity)
-
+{% endhighlight %}

{% trans %}Unencrypted Contents:{% endtrans %}

  +----+----+----+----+----+----+----+----+
@@ -349,11 +347,11 @@ Bob may drop the connection if the clock skew with Alice is too high as calculat
 

{% trans -%} This is a DSA signature of the critical data. Bob sends Alice: {%- endtrans %}

-
+{% highlight %}
  *  <----------------------E(S(X+Y+Alice.identHash+tsA+tsB)+padding, sk, prev)
 
     {% trans %}Size:{% endtrans %} 48 bytes
-
+{% endhighlight %}

{% trans %}Unencrypted Contents:{% endtrans %}

  +----+----+----+----+----+----+----+----+
diff --git a/i2p2www/pages/site/docs/transport/ssu.html b/i2p2www/pages/site/docs/transport/ssu.html
index c157a45e..d846503c 100644
--- a/i2p2www/pages/site/docs/transport/ssu.html
+++ b/i2p2www/pages/site/docs/transport/ssu.html
@@ -214,10 +214,10 @@ indirect address, for using a third party to introduce the peer.
 There is no restriction on the number of addresses a peer may have.
 {%- endtrans %}

-
+{% highlight %}
     Direct: host, port, introKey, options
   Indirect: tag, relayhost, port, relayIntroKey, targetIntroKey, options
-
+{% endhighlight %}

{% trans -%} Each of the addresses may also expose a series of options - special @@ -240,7 +240,7 @@ The message sequence is as follows:

{% trans -%} Alice connects directly to Bob. {%- endtrans %}

-
+{% highlight %}
         Alice                         Bob
     SessionRequest --------------------->
           <--------------------- SessionCreated
@@ -249,7 +249,7 @@ Alice connects directly to Bob.
           <--------------------- DatabaseStoreMessage
     DatabaseStoreMessage --------------->
     Data <---------------------------> Data
-
+{% endhighlight %}

{% trans i2npspec=site_url('docs/spec/i2np') -%} After the SessionConfirmed message is received, Bob sends a small @@ -324,7 +324,7 @@ full direction session establishment with the specified IP and port. Alice first connects to introducer Bob, who relays the request to Charlie. {%- endtrans %}

-
+{% highlight %}
         Alice                         Bob                  Charlie
     RelayRequest ---------------------->
          <-------------- RelayResponse    RelayIntro ----------->
@@ -336,7 +336,7 @@ Alice first connects to introducer Bob, who relays the request to Charlie.
          <-------------------------------------------- DatabaseStoreMessage
     DatabaseStoreMessage -------------------------------------->
     Data <--------------------------------------------------> Data
-
+{% endhighlight %}

{% trans -%} After the hole punch, the session is established between Alice and Charlie as in a direct establishment. @@ -359,7 +359,7 @@ and may update its behavior accordingly. The testing process is quite simple: {%- endtrans %}

-
+{% highlight %}
         Alice                  Bob                  Charlie
     PeerTest ------------------->
                              PeerTest-------------------->
@@ -368,7 +368,7 @@ quite simple:
          <------------------------------------------PeerTest
     PeerTest------------------------------------------>
          <------------------------------------------PeerTest
-
+{% endhighlight %}

{% trans -%} Each of the PeerTest messages carry a nonce identifying the