From e0de564626f74ecd59107568366a7229729862cd Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Sat, 17 Jun 2017 08:22:19 +1000 Subject: ABNF for Noise protocol names --- patterns/grammar-abnf.txt | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/patterns/grammar-abnf.txt b/patterns/grammar-abnf.txt index f1c2c04..e968d6f 100644 --- a/patterns/grammar-abnf.txt +++ b/patterns/grammar-abnf.txt @@ -7,6 +7,9 @@ ; The "pattern-single" element is intended for applications that wish to ; provide an API to define the specific pattern to use in a handshake. ; +; The "protocol-name" lexical token describes the structure of Noise +; protocol names in ABNF. +; ; Productions that start with "extension-" apply to extension features like ; Hybrid Forward Secrecy and are not part of the core Noise standard. @@ -18,7 +21,7 @@ pattern-single = wsp pattern wsp pattern = header wsp [pre-message wsp "..." wsp] messages -header = name wsp "(" wsp params wsp ")" wsp ":" +header = "Noise_" pattern-name wsp "(" wsp params wsp ")" wsp ":" params = param *(wsp "," wsp param) @@ -49,9 +52,22 @@ extension-token = "f" / "ff" ; Hybrid Forward Secrecy ; Lexical tokens -name = "Noise_" name-component *("+" name-component) +protocol-name = "Noise_" pattern-name "_" dh-algorithms + "_" cipher-algorithms "_" hash-algorithms + +pattern-name = base-pattern-name [modifier-name *("+" modifier-name)] + +base-pattern-name = 1*(%x41-5A) ; 1 or more uppercase letters + +modifier-name = 1*(%x61-7A / DIGIT) ; Lower case and digits + +dh-algorithms = name-component *("+" name-component) + +cipher-algorithms = name-component *("+" name-component) + +hash-algorithms = name-component *("+" name-component) -name-component = 1*(ALPHA / DIGIT) +name-component = 1*(ALPHA / DIGIT / "/") wsp = *(WSP / eol / comment) -- cgit v1.2.3-59-g8ed1b