SRP-related Improvements

Klaus Trainer <[email protected]>
Newsgroups gmane.comp.lang.erlang.patches
Message-ID <1368924287.24091.21.camel@devil>
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
srp-improvements.patch (text/x-patch, 4.6 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/3] 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/3] 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 809b0c5d674f25efbf9aa84214e199149e1dc1cb Mon Sep 17 00:00:00 2001
From: Klaus Trainer <[email protected]>
Date: Sun, 19 May 2013 01:24:55 +0200
Subject: [PATCH 3/3] crypto: Fix typo in documentation

---
 lib/crypto/doc/src/crypto.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml
index 0da41e8..c4b79a8 100644
--- a/lib/crypto/doc/src/crypto.xml
+++ b/lib/crypto/doc/src/crypto.xml
@@ -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>
 
-- 
1.8.1.6
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.