Skip to content

Commit

Permalink
Merge pull request #45 from dansarie/master
Browse files Browse the repository at this point in the history
Fix interoperability issues with draft-11
  • Loading branch information
int08h authored Nov 8, 2024
2 parents 33d1e44 + 38fd9e8 commit 58a4a2c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ by the RFC is used to distinguish classic vs. RFC requests).

The new `-p/--protocol` flag of `roughenough-client` controls the protocol version to
use in requests. `0` = classic protocol (no `VER` tag), `1` = anticipated RFC protocol
(`VER` tag with value `0x00000001`), and `8` is the RFC Draft11 protocol (`VER` tag with
(`VER` tag with value `0x00000001`), and `11` is the RFC Draft11 protocol (`VER` tag with
value `0x0b000008`). The default is `0` the "classic" protocol, until the RFC is finalized.

```
Expand Down Expand Up @@ -87,7 +87,7 @@ sudo date -u "$(roughenough-client -z roughtime.int08h.com 2002 -f %Y%m%d%H%M.%S

### Validating Server Responses

Use the `-p` flag with the client to validate the server's response with its public key.
Use the `-k` flag with the client to validate the server's response with its public key.

```bash
# The public key of 'roughtime.int08h.com' is stored in a DNS TXT record
Expand Down
4 changes: 2 additions & 2 deletions src/bin/roughenough-client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ fn main() {
.short("p")
.long("protocol")
.takes_value(true)
.help("Roughtime protocol version to use (0 = classic, 1 = rfc, 8 = draft8)")
.help("Roughtime protocol version to use (0 = classic, 1 = rfc, 11 = draft11)")
.default_value("0")
)
.arg(Arg::with_name("timeout")
Expand Down Expand Up @@ -428,7 +428,7 @@ fn main() {
1 => Version::Rfc,
11 => Version::RfcDraft11,
_ => panic!(
"Invalid protocol '{}'; valid values are 0, 1, or 8",
"Invalid protocol '{}'; valid values are 0, 1, or 11",
protocol
),
};
Expand Down
4 changes: 3 additions & 1 deletion src/responder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl Responder {
for (idx, &(ref nonce, ref src_addr)) in self.requests.iter().enumerate() {
let paths = self.merkle.get_paths(idx);
let resp_msg = {
let r = self.make_response(&srep, &self.cert_bytes, &paths, idx as u32);
let r = self.make_response(&srep, &self.cert_bytes, &paths, idx as u32, nonce);
if self.grease.should_add_error() {
self.grease.add_errors(&r)
} else {
Expand Down Expand Up @@ -155,6 +155,7 @@ impl Responder {
cert_bytes: &[u8],
path: &[u8],
idx: u32,
nonce: &Vec<u8>,
) -> RtMessage {
let mut index = [0; 4];
(&mut index as &mut [u8])
Expand All @@ -173,6 +174,7 @@ impl Responder {
.unwrap();
}

response.add_field(Tag::NONC, nonce).unwrap();
response.add_field(Tag::PATH, path).unwrap();
response.add_field(Tag::SREP, srep_bytes).unwrap();
response.add_field(Tag::CERT, cert_bytes).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ pub enum Tag {
//
// Tags are written here in ascending order
SIG,
SRV,
VER,
SRV,
DUT1,
NONC,
DELE,
Expand Down

0 comments on commit 58a4a2c

Please sign in to comment.