aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-07-15 14:45:05 +0000
committerlloyd <[email protected]>2009-07-15 14:45:05 +0000
commit11470400cd77cbd20f60247f0a07fcac45772646 (patch)
tree1d61637224d4718b98e5b8d540600617eff81daf /src
parentd5ee63b00a11b72442cf7f38a78f262b7728f130 (diff)
Add a script that analyzes the source and prints module dependencies.
Useful for tracking where the big balls of mud are. Fix dependencies in gost_3411 (depends on the gost block cipher), and the TLS PRF (depends on HMAC). Also hide TLS_PRF::P_hash in an anonymous namespace instead of making it a private static function. I don't think this will affect binary compat, since it was statically linked.
Diffstat (limited to 'src')
-rw-r--r--src/hash/gost_3411/info.txt4
-rw-r--r--src/kdf/tls_prf/info.txt3
-rw-r--r--src/kdf/tls_prf/prf_tls.cpp62
-rw-r--r--src/kdf/tls_prf/prf_tls.h5
4 files changed, 39 insertions, 35 deletions
diff --git a/src/hash/gost_3411/info.txt b/src/hash/gost_3411/info.txt
index ef2879823..65b9475e1 100644
--- a/src/hash/gost_3411/info.txt
+++ b/src/hash/gost_3411/info.txt
@@ -8,3 +8,7 @@ load_on auto
gost_3411.cpp
gost_3411.h
</add>
+
+<requires>
+gost_28147
+</requires>
diff --git a/src/kdf/tls_prf/info.txt b/src/kdf/tls_prf/info.txt
index 58c1ed029..c775c90ba 100644
--- a/src/kdf/tls_prf/info.txt
+++ b/src/kdf/tls_prf/info.txt
@@ -5,9 +5,10 @@ define TLS_V10_PRF
load_on auto
<requires>
+hmac
kdf
-sha1
md5
+sha1
</requires>
<add>
diff --git a/src/kdf/tls_prf/prf_tls.cpp b/src/kdf/tls_prf/prf_tls.cpp
index a04c9045d..7c638b994 100644
--- a/src/kdf/tls_prf/prf_tls.cpp
+++ b/src/kdf/tls_prf/prf_tls.cpp
@@ -13,6 +13,39 @@
namespace Botan {
+namespace {
+
+/*
+* TLS PRF P_hash function
+*/
+SecureVector<byte> P_hash(MessageAuthenticationCode* mac,
+ u32bit len,
+ const byte secret[], u32bit secret_len,
+ const byte seed[], u32bit seed_len)
+ {
+ SecureVector<byte> out;
+
+ mac->set_key(secret, secret_len);
+
+ SecureVector<byte> A(seed, seed_len);
+ while(len)
+ {
+ const u32bit this_block_len = std::min(mac->OUTPUT_LENGTH, len);
+
+ A = mac->process(A);
+
+ mac->update(A);
+ mac->update(seed, seed_len);
+ SecureVector<byte> block = mac->final();
+
+ out.append(block, this_block_len);
+ len -= this_block_len;
+ }
+ return out;
+ }
+
+}
+
/*
* TLS PRF Constructor and Destructor
*/
@@ -49,33 +82,4 @@ SecureVector<byte> TLS_PRF::derive(u32bit key_len,
return key1;
}
-/*
-* TLS PRF P_hash function
-*/
-SecureVector<byte> TLS_PRF::P_hash(MessageAuthenticationCode* mac,
- u32bit len,
- const byte secret[], u32bit secret_len,
- const byte seed[], u32bit seed_len)
- {
- SecureVector<byte> out;
-
- mac->set_key(secret, secret_len);
-
- SecureVector<byte> A(seed, seed_len);
- while(len)
- {
- const u32bit this_block_len = std::min(mac->OUTPUT_LENGTH, len);
-
- A = mac->process(A);
-
- mac->update(A);
- mac->update(seed, seed_len);
- SecureVector<byte> block = mac->final();
-
- out.append(block, this_block_len);
- len -= this_block_len;
- }
- return out;
- }
-
}
diff --git a/src/kdf/tls_prf/prf_tls.h b/src/kdf/tls_prf/prf_tls.h
index 6b81c155f..d21279588 100644
--- a/src/kdf/tls_prf/prf_tls.h
+++ b/src/kdf/tls_prf/prf_tls.h
@@ -25,11 +25,6 @@ class BOTAN_DLL TLS_PRF : public KDF
TLS_PRF();
~TLS_PRF();
private:
- static SecureVector<byte> P_hash(MessageAuthenticationCode*,
- u32bit,
- const byte[], u32bit,
- const byte[], u32bit);
-
MessageAuthenticationCode* hmac_md5;
MessageAuthenticationCode* hmac_sha1;
};