(int) TLS_MAX_KEY_EXPANSION_SIZE);
DEBUG_DUMP_HEX_LABEL("CLIENT KEY", clientkey, key_length);
DEBUG_DUMP_HEX_LABEL("CLIENT IV", clientiv, iv_length);
+#if 0
DEBUG_DUMP_HEX_LABEL("CLIENT MAC KEY",
context->is_server ? context->crypto.
ctx_remote_mac.remote_mac : context->
crypto.ctx_local_mac.local_mac,
mac_length);
+#endif
DEBUG_DUMP_HEX_LABEL("SERVER KEY", serverkey, key_length);
DEBUG_DUMP_HEX_LABEL("SERVER IV", serveriv, iv_length);
+#if 0
DEBUG_DUMP_HEX_LABEL("SERVER MAC KEY",
context->is_server ? context->crypto.
ctx_local_mac.local_mac : context->crypto.
ctx_remote_mac.remote_mac, mac_length);
+#endif
if (context->is_server) {
if (is_aead == 2) {
memcpy(context->crypto.ctx_remote_mac.remote_nonce,
}
if (certificate_verify_alert != no_error) {
+ MARK;
tls_alert(context, 1, certificate_verify_alert);
context->critical_error = 1;
}
if (payload_res < 0) {
switch (payload_res) {
case TLS_UNEXPECTED_MESSAGE:
+ MARK;
tls_alert(context, 1, unexpected_message);
break;
case TLS_COMPRESSION_NOT_SUPPORTED:
+ MARK;
tls_alert(context, 1, decompression_failure_RESERVED);
break;
case TLS_BROKEN_PACKET:
+ MARK;
tls_alert(context, 1, decode_error);
break;
case TLS_NO_MEMORY:
+ MARK;
tls_alert(context, 1, internal_error);
break;
case TLS_NOT_VERIFIED:
+ MARK;
tls_alert(context, 1, bad_record_mac);
break;
case TLS_BAD_CERTIFICATE:
+ MARK;
if (context->is_server) {
/* bad client certificate, continue */
tls_alert(context, 0, bad_certificate);
}
break;
case TLS_UNSUPPORTED_CERTIFICATE:
+ MARK;
tls_alert(context, 1, unsupported_certificate);
break;
case TLS_NO_COMMON_CIPHER:
+ MARK;
tls_alert(context, 1, insufficient_security);
break;
case TLS_NOT_UNDERSTOOD:
+ MARK;
tls_alert(context, 1, internal_error);
break;
case TLS_NO_RENEGOTIATION:
+ MARK;
tls_alert(context, 0, no_renegotiation_RESERVED);
payload_res = 0;
break;
case TLS_DECRYPTION_FAILED:
+ MARK;
tls_alert(context, 1, decryption_failed_RESERVED);
break;
}
if (certificate_verify_alert != no_error) {
payload_res = TLS_BAD_CERTIFICATE;
+ /* TODO this is set but not used */
}
/* except renegotiation */
}
tls_send_certificate(context);
-
tls_send_certificate_verify(context);
-
tls_send_finished(context);
/* new key */
#define DEBUG_PRINTI(...) do { INDENT; fprintf(stderr, __VA_ARGS__); } while (0)
#define DEBUG_PRINT(...) do { fprintf(stderr, __VA_ARGS__); } while (0)
-#define DEBUG_DUMP_HEX(buf, len) do {int _i_; for (_i_ = 0; _i_ < (int)len; _i_++) { DEBUG_PRINT("%02X ", (unsigned int)((unsigned char *)buf)[_i_]); } } while (0)
+#define DEBUG_DUMP_HEX(buf, len) do {int _i_; for (_i_ = 0; _i_ < (int)len; _i_++) { DEBUG_PRINT("%02x ", (unsigned int)((unsigned char *)buf)[_i_]); } } while (0)
#define DEBUG_INDEX(fields) print_index(fields)
#define DEBUG_DUMP(buf, length) fwrite(buf, 1, length, stderr);
-#define DEBUG_DUMP_HEX_LABEL(title, buf, len) do {fprintf(stderr, "%s (%i): ", title, (int)len); DEBUG_DUMP_HEX(buf, len); fprintf(stderr, "\n");} while (0)
+#define DEBUG_DUMP_HEX_LABEL(title, buf, len) do {fprintf(stderr, "%s (%d): ", title, (int)len); DEBUG_DUMP_HEX(buf, len); fprintf(stderr, "\n");} while (0)
#define ENTER do { MARKP; fprintf(stderr, "enter function\n"); tls_indent++; } while (0)
#define LEAVE do { tls_indent--; MARKP; fprintf(stderr, "leave function\n");} while (0)