Re: SRP-related Improvements
Klaus Trainer <[email protected]>
| Newsgroups | gmane.comp.lang.erlang.patches |
|---|---|
| Message-ID | <1368972924.13279.7.camel@devil> |
I forgot to fix a small issue regarding the documentations of `srp_public()` and `srp_private()`. I updated the branch and also attached the new version of the patch here. On Sun, 2013-05-19 at 02:44 +0200, Klaus Trainer wrote: > Hi. > > I'm using the new SRP code that has landed on the 'maint' branch > recently. I'd like to thank everybody who's been involved for that > awesome work! > > This patch fixes three small issues that I've found in the SRP-related > code and documentation. > > git fetch https://github.com/KlausTrainer/otp.git srp-improvements > > https://github.com/KlausTrainer/otp/compare/erlang:maint...srp-improvements > https://github.com/KlausTrainer/otp/compare/erlang:maint...srp-improvements.patch > > Kind Regards, > Klaus > _______________________________________________ > erlang-patches mailing list > [email protected] > http://erlang.org/mailman/listinfo/erlang-patches _______________________________________________ erlang-patches mailing list [email protected] http://erlang.org/mailman/listinfo/erlang-patches
srp-improvements.patch
(text/x-patch, 6.7 KB)
From 678b4bc0b487a8e5f078f61b310401e2349b473d Mon Sep 17 00:00:00 2001 From: Klaus Trainer <[email protected]> Date: Sat, 18 May 2013 23:42:20 +0200 Subject: [PATCH 1/4] ssl: Remove unused `srp_parameters` type spec As the file 'lib/ssl/src/ssl_srp_primes.hrl' only contains a specification of a `srp_parameters` type that isn't exported and also isn't referenced anywhere (neither in the code nor in the documentation), the type specification (and hence the file as well) can be removed. --- lib/ssl/src/Makefile | 2 +- lib/ssl/src/ssl.erl | 1 - lib/ssl/src/ssl_connection.erl | 1 - lib/ssl/src/ssl_srp_primes.hrl | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) delete mode 100644 lib/ssl/src/ssl_srp_primes.hrl diff --git a/lib/ssl/src/Makefile b/lib/ssl/src/Makefile index d3ba76d..3b81450 100644 --- a/lib/ssl/src/Makefile +++ b/lib/ssl/src/Makefile @@ -66,7 +66,7 @@ MODULES= \ INTERNAL_HRL_FILES = \ ssl_alert.hrl ssl_cipher.hrl ssl_handshake.hrl ssl_internal.hrl \ - ssl_record.hrl ssl_srp.hrl ssl_srp_primes.hrl + ssl_record.hrl ssl_srp.hrl ERL_FILES= \ $(MODULES:%=%.erl) \ diff --git a/lib/ssl/src/ssl.erl b/lib/ssl/src/ssl.erl index f528627..fb64a66 100644 --- a/lib/ssl/src/ssl.erl +++ b/lib/ssl/src/ssl.erl @@ -37,7 +37,6 @@ -include("ssl_record.hrl"). -include("ssl_cipher.hrl"). -include("ssl_handshake.hrl"). --include("ssl_srp_primes.hrl"). -include_lib("public_key/include/public_key.hrl"). diff --git a/lib/ssl/src/ssl_connection.erl b/lib/ssl/src/ssl_connection.erl index 54eed03..b190782 100644 --- a/lib/ssl/src/ssl_connection.erl +++ b/lib/ssl/src/ssl_connection.erl @@ -35,7 +35,6 @@ -include("ssl_cipher.hrl"). -include("ssl_internal.hrl"). -include("ssl_srp.hrl"). --include("ssl_srp_primes.hrl"). -include_lib("public_key/include/public_key.hrl"). %% Internal application API diff --git a/lib/ssl/src/ssl_srp_primes.hrl b/lib/ssl/src/ssl_srp_primes.hrl deleted file mode 100644 index 4bd534e..0000000 --- a/lib/ssl/src/ssl_srp_primes.hrl +++ /dev/null @@ -1 +0,0 @@ --type srp_parameters() :: srp_1024 | srp_1536 | srp_2048 | srp_3072 | srp_4096 | srp_6144 | srp_8192. -- 1.8.1.6 From 76b0b7293dd00cf353ca599badbb0e60e86d9d9a Mon Sep 17 00:00:00 2001 From: Klaus Trainer <[email protected]> Date: Sun, 19 May 2013 00:55:42 +0200 Subject: [PATCH 2/4] crypto: Fix `crypto:compute_key/4` documentation If the function's first argument (i.e. the key-agreement protocol) is `srp`, the third argument has to be a tuple of public and private key instead of only the private key. This changes the documentation to reflect that fact. --- lib/crypto/doc/src/crypto.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml index df765ad..0da41e8 100644 --- a/lib/crypto/doc/src/crypto.xml +++ b/lib/crypto/doc/src/crypto.xml @@ -188,12 +188,12 @@ </func> <func> - <name>compute_key(Type, OthersPublicKey, MyPrivateKey, Params) -> SharedSecret</name> + <name>compute_key(Type, OthersPublicKey, MyPrivate, Params) -> SharedSecret</name> <fsummary>Computes the shared secret</fsummary> <type> - <v> Type = dh | ecdh | srp </v> + <v>Type = dh | ecdh | srp </v> <v>OthersPublicKey = dh_public() | ecdh_public() | srp_public() </v> - <v>MyPrivate = dh_private() | ecdh_private() | srp_private() </v> + <v>MyPrivate = dh_private() | ecdh_private() | {srp_public(), srp_private()} </v> <v>Params = dh_params() | edhc_params() | srp_params() </v> <v>SharedSecret = binary()</v> </type> -- 1.8.1.6 From 0dabf8bc4a43063f391e9e735e7ae04c50d4a72f Mon Sep 17 00:00:00 2001 From: Klaus Trainer <[email protected]> Date: Sun, 19 May 2013 01:24:55 +0200 Subject: [PATCH 3/4] crypto: Fix typo in documentation While at it, remove trailing whitespace as well. --- lib/crypto/doc/src/crypto.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml index 0da41e8..bfdb758 100644 --- a/lib/crypto/doc/src/crypto.xml +++ b/lib/crypto/doc/src/crypto.xml @@ -58,7 +58,7 @@ <section> <title>DATA TYPES </title> - + <p><code>key_value() = integer() | binary() </code></p> <p><code>rsa_public() = [key_value()] = [E, N] </code></p> @@ -91,7 +91,7 @@ | {host,[Verifier::binary(), Prime::binary(), Version::atom() | [Scrambler::binary]]} </code></p> <p>Where Verifier is <c>v</c>, Generator is <c>g</c> and Prime is<c> N</c>, DerivedKey is <c>X</c>, and Scrambler is - <c>u</c> (optional will be genrated if not provided) from <url href="http://srp.stanford.edu/design.html">SRP design</url> + <c>u</c> (optional will be generated if not provided) from <url href="http://srp.stanford.edu/design.html">SRP design</url> Version = '3' | '6' | '6a' </p> @@ -333,7 +333,7 @@ </type> <desc> <p>Updates the HMAC represented by <c>Context</c> using the given <c>Data</c>. <c>Context</c> - must have been generated using an HMAC init function (such as + must have been generated using an HMAC init function (such as <seealso marker="#hmac_init/2">hmac_init</seealso>). <c>Data</c> can be any length. <c>NewContext</c> must be passed into the next call to <c>hmac_update</c> or to one of the functions <seealso marker="#hmac_final/1">hmac_final</seealso> and -- 1.8.1.6 From 099e240c4c656a86931af32ffc020d06237e62fc Mon Sep 17 00:00:00 2001 From: Klaus Trainer <[email protected]> Date: Sun, 19 May 2013 15:41:00 +0200 Subject: [PATCH 4/4] crypto: Fix documentation of SRP key data types `srp_public()` and `srp_private()` have to be of type `binary()`. --- lib/crypto/doc/src/crypto.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml index bfdb758..b9c7425 100644 --- a/lib/crypto/doc/src/crypto.xml +++ b/lib/crypto/doc/src/crypto.xml @@ -79,11 +79,11 @@ <p><code>dss_public() = [key_value()] =[P, Q, G, Y] </code></p> - <p><code>srp_public() = key_value() </code></p> + <p><code>srp_public() = binary() </code></p> <p>Where is <c>A</c> or <c>B</c> from <url href="http://srp.stanford.edu/design.html">SRP design</url></p> - <p><code>srp_private() = key_value() </code></p> - <p>Where is <c>a</c> or <c>b</c> from <url href="http://srp.stanford.edu/design.html">SRP design</url></p> + <p><code>srp_private() = binary() </code></p> + <p>Where is <c>a</c> or <c>b</c> from <url href="http://srp.stanford.edu/design.html">SRP design</url></p> <p><code>srp_params() = {user, [Generator::binary(), Prime::binary(), Version::atom()]} | {host, [Verifier::binary(), Generator::binary(), Prime::binary(), Version::atom()]} -- 1.8.1.6