Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
da12099d
Commit
da12099d
authored
26 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
Implemented the Server Key Exchange message.
Rev: lib/modules/SSL.pmod/handshake.pike:1.10
parent
2d076943
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/modules/SSL.pmod/handshake.pike
+40
-5
40 additions, 5 deletions
lib/modules/SSL.pmod/handshake.pike
with
40 additions
and
5 deletions
lib/modules/SSL.pmod/handshake.pike
+
40
−
5
View file @
da12099d
/* $Id: handshake.pike,v 1.
9
1998/0
6
/26
22:25:02
nisse Exp $
/* $Id: handshake.pike,v 1.
10
1998/0
8
/26
07:10:36
nisse Exp $
*
*
*/
*/
...
@@ -30,7 +30,11 @@ constant CERT_received = 2;
...
@@ -30,7 +30,11 @@ constant CERT_received = 2;
constant CERT_no_certificate = 3;
constant CERT_no_certificate = 3;
int certificate_state;
int certificate_state;
int expect_change_cipher; /* Reset to 0 if a change_cipher message is received */
int expect_change_cipher; /* Reset to 0 if a change_cipher message is
* received */
object temp_key; /* Key used for session key exchange (if not the same
* as the server's certified key) */
int rsa_message_was_bad;
int rsa_message_was_bad;
...
@@ -130,10 +134,40 @@ int reply_new_session(array(int) cipher_suites, array(int) compression_methods)
...
@@ -130,10 +134,40 @@ int reply_new_session(array(int) cipher_suites, array(int) compression_methods)
struct->put_var_string(cert, 3);
struct->put_var_string(cert, 3);
send_packet(handshake_packet(HANDSHAKE_certificate, struct->pop_data()));
send_packet(handshake_packet(HANDSHAKE_certificate, struct->pop_data()));
}
}
if (0)
temp_key = (session->cipher_spec->is_exportable
? context->short_rsa
: context->long_rsa);
if (temp_key)
{
{
/* Send a ServerKeyExchange message. Not supported, so far. */
/* Send a ServerKeyExchange message. */
#ifdef SSL3_DEBUG
werror(sprintf("Sending a server key exchange-message, "
"with a %d-bits key.\n", temp_key->rsa_size()));
#endif
object struct = Struct();
struct->put_bignum(temp_key->n);
struct->put_bignum(temp_key->e);
/* Exactly how is the signature process defined? */
string params = other_random + my_random + struct->contents();
string digest = Crypto.md5()->update(params)->digest()
+ Crypto.sha()->update(params)->digest();
object s = context->rsa->raw_sign(digest);
#ifdef SSL3_DEBUG
werror(sprintf(" Digest: '%s'\n"
" Signature: '%s'\n",
digest, s->digits(256)));
#endif
struct->put_bignum(s);
send_packet(handshake_packet(HANDSHAKE_server_key_exchange,
struct->pop_data()));
}
}
if (context->auth_level >= AUTHLEVEL_ask)
if (context->auth_level >= AUTHLEVEL_ask)
{
{
/* Send a CertificateRequest message */
/* Send a CertificateRequest message */
...
@@ -191,7 +225,7 @@ string server_derive_master_secret(string data)
...
@@ -191,7 +225,7 @@ string server_derive_master_secret(string data)
werror(sprintf("encrypted premaster_secret: '%s'\n", data));
werror(sprintf("encrypted premaster_secret: '%s'\n", data));
#endif
#endif
// trace(1);
// trace(1);
string s = context->rsa->decrypt(data);
string s =
(temp_key ||
context->rsa
)
->decrypt(data);
#ifdef SSL3_DEBUG
#ifdef SSL3_DEBUG
werror(sprintf("premaster_secret: '%O'\n", s));
werror(sprintf("premaster_secret: '%O'\n", s));
#endif
#endif
...
@@ -252,6 +286,7 @@ int handle_handshake(int type, string data, string raw)
...
@@ -252,6 +286,7 @@ int handle_handshake(int type, string data, string raw)
/* Reset all extra state variables */
/* Reset all extra state variables */
expect_change_cipher = certificate_state = 0;
expect_change_cipher = certificate_state = 0;
rsa_message_was_bad = 0;
rsa_message_was_bad = 0;
temp_key = 0;
handshake_messages = raw;
handshake_messages = raw;
my_random = sprintf("%4c%s", time(), context->random(28));
my_random = sprintf("%4c%s", time(), context->random(28));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment