Skip to content
Snippets Groups Projects
Commit c0b44e39 authored by Martin Nilsson's avatar Martin Nilsson
Browse files

Stricter types

Rev: lib/modules/SSL.pmod/session.pike:1.24
parent 387e7fba
No related branches found
No related tags found
No related merge requests found
#pike __REAL_VERSION__ //
// $Id: session.pike,v 1.24 2003/01/27 15:29:56 nilsson Exp $
/* $Id: session.pike,v 1.23 2003/01/27 15:03:00 nilsson Exp $ #pike __REAL_VERSION__
* // #pragma strict_types
*/
//! The most important information in a session object is a //! The most important information in a session object is a
//! choice of encryption algorithms and a "master secret" created by //! choice of encryption algorithms and a "master secret" created by
...@@ -29,7 +29,7 @@ int cipher_suite; ...@@ -29,7 +29,7 @@ int cipher_suite;
//! Information about the encryption method derived from the //! Information about the encryption method derived from the
//! cipher_suite. //! cipher_suite.
object cipher_spec; .Cipher.CipherSpec cipher_spec;
//! Key exchange method, also derived from the cipher_suite. //! Key exchange method, also derived from the cipher_suite.
int ke_method; int ke_method;
...@@ -49,8 +49,8 @@ void set_cipher_suite(int suite,int version) ...@@ -49,8 +49,8 @@ void set_cipher_suite(int suite,int version)
{ {
array res = .Cipher.lookup(suite,version); array res = .Cipher.lookup(suite,version);
cipher_suite = suite; cipher_suite = suite;
ke_method = res[0]; ke_method = [int]res[0];
cipher_spec = res[1]; cipher_spec = [object(.Cipher.CipherSpec)]res[1];
#ifdef SSL3_DEBUG #ifdef SSL3_DEBUG
werror("SSL.session: cipher_spec %O\n", werror("SSL.session: cipher_spec %O\n",
mkmapping(indices(cipher_spec), values(cipher_spec))); mkmapping(indices(cipher_spec), values(cipher_spec)));
...@@ -65,6 +65,7 @@ void set_compression_method(int compr) ...@@ -65,6 +65,7 @@ void set_compression_method(int compr)
compression_algorithm = compr; compression_algorithm = compr;
} }
//!
string generate_key_block(string client_random, string server_random, array(int) version) string generate_key_block(string client_random, string server_random, array(int) version)
{ {
int required = 2 * ( int required = 2 * (
...@@ -119,9 +120,10 @@ void printKey(string name , string key) { ...@@ -119,9 +120,10 @@ void printKey(string name , string key) {
} }
#endif #endif
//!
array generate_keys(string client_random, string server_random, array(int) version) array generate_keys(string client_random, string server_random, array(int) version)
{ {
object key_data = Struct(generate_key_block(client_random, server_random,version)); Struct key_data = Struct(generate_key_block(client_random, server_random,version));
array keys = allocate(6); array keys = allocate(6);
#ifdef SSL3_DEBUG #ifdef SSL3_DEBUG
...@@ -166,7 +168,10 @@ array generate_keys(string client_random, string server_random,array(int) versio ...@@ -166,7 +168,10 @@ array generate_keys(string client_random, string server_random,array(int) versio
2*cipher_spec->iv_size); 2*cipher_spec->iv_size);
keys[4]=iv_block[..cipher_spec->iv_size-1]; keys[4]=iv_block[..cipher_spec->iv_size-1];
keys[5]=iv_block[cipher_spec->iv_size..]; keys[5]=iv_block[cipher_spec->iv_size..];
werror("sizeof(keys[4]):"+sizeof(keys[4])+" sizeof(keys[5]):"+sizeof(keys[4])+"\n"); #ifdef SSL3_DEBUG
werror("sizeof(keys[4]):%d sizeof(keys[5]):%d\n",
sizeof([string]keys[4]), sizeof([string]keys[4]));
#endif
} }
} }
...@@ -208,12 +213,12 @@ array generate_keys(string client_random, string server_random,array(int) versio ...@@ -208,12 +213,12 @@ array generate_keys(string client_random, string server_random,array(int) versio
//! //!
//! @returns //! @returns
//! @array //! @array
//! @elem State read_state //! @elem SSL.state read_state
//! Read state //! Read state
//! @elem State write_state //! @elem SSL.state write_state
//! Write state //! Write state
//! @endarray //! @endarray
array new_server_states(string client_random, string server_random,array(int) version) array(State) new_server_states(string client_random, string server_random, array(int) version)
{ {
State write_state = State(this_object()); State write_state = State(this_object());
State read_state = State(this_object()); State read_state = State(this_object());
...@@ -249,12 +254,12 @@ array new_server_states(string client_random, string server_random,array(int) ve ...@@ -249,12 +254,12 @@ array new_server_states(string client_random, string server_random,array(int) ve
//! //!
//! @returns //! @returns
//! @array //! @array
//! @elem State read_state //! @elem SSL.state read_state
//! Read state //! Read state
//! @elem State write_state //! @elem SSL.state write_state
//! Write state //! Write state
//! @endarray //! @endarray
array new_client_states(string client_random, string server_random,array(int) version) array(State) new_client_states(string client_random, string server_random,array(int) version)
{ {
State write_state = State(this_object()); State write_state = State(this_object());
State read_state = State(this_object()); State read_state = State(this_object());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment