}
#ifndef OPENSSL_NO_HEARTBEATS
-int dtls1_process_heartbeat(SSL *s)
+int dtls1_process_heartbeat(SSL *s, unsigned char *p, unsigned int length)
{
- unsigned char *p, *pl;
+ unsigned char *pl;
unsigned short hbtype;
unsigned int payload;
unsigned int padding = 16; /* Use minimum padding */
- unsigned int length;
-
- p = SSL3_RECORD_get_data(RECORD_LAYER_get_rrec(&s->rlayer));
- length = SSL3_RECORD_get_length(RECORD_LAYER_get_rrec(&s->rlayer));
if (s->msg_callback)
s->msg_callback(0, s->version, TLS1_RT_HEARTBEAT,
SSL_CTX *ctx;
SSL *s;
const char *test_case_name;
- int (*process_heartbeat) (SSL *s);
+ int (*process_heartbeat) (SSL *s, unsigned char *p, unsigned int length);
unsigned char *payload;
int sent_payload_len;
int expected_return_value;
* zeroed in opt mode and will cause spurious test failures that will
* change with each execution.
*/
- memset(fixture.s->s3->wbuf.buf, 0, fixture.s->s3->wbuf.len);
+ memset(fixture.s->rlayer.wbuf.buf, 0, fixture.s->rlayer.wbuf.len);
fail:
if (!setup_ok) {
unsigned const char *p;
int actual_payload_len;
- s->s3->rrec.data = payload;
- s->s3->rrec.length = strlen((const char *)payload);
+ s->rlayer.rrec.data = payload;
+ s->rlayer.rrec.length = strlen((const char *)payload);
*payload++ = TLS1_HB_REQUEST;
s2n(fixture.sent_payload_len, payload);
*/
memcpy((char *)sent_buf, (const char *)payload, sizeof(sent_buf));
- return_value = fixture.process_heartbeat(s);
+ return_value = fixture.process_heartbeat(s, s->rlayer.rrec.data,
+ s->rlayer.rrec.length);
if (return_value != fixture.expected_return_value) {
printf("%s failed: expected return value %d, received %d\n",
/*
* If there is any byte alignment, it will be stored in wbuf.offset.
*/
- p = &(s->s3->
- wbuf.buf[fixture.return_payload_offset + s->s3->wbuf.offset]);
+ p = &(s->rlayer.
+ wbuf.buf[fixture.return_payload_offset + s->rlayer.wbuf.offset]);
actual_payload_len = 0;
n2s(p, actual_payload_len);
#ifndef OPENSSL_NO_HEARTBEATS
else if (rr->type == TLS1_RT_HEARTBEAT) {
/* We allow a 0 return */
- if(dtls1_process_heartbeat(s) < 0) {
+ if(dtls1_process_heartbeat(s, SSL3_RECORD_get_data(&s->rlayer.rrec),
+ SSL3_RECORD_get_length(&s->rlayer.rrec)) < 0) {
return -1;
}
-
/* Exit and notify application to read again */
rr->length = 0;
s->rwstate = SSL_READING;
#ifndef OPENSSL_NO_HEARTBEATS
else if (rr->type == TLS1_RT_HEARTBEAT) {
/* We can ignore 0 return values */
- if(tls1_process_heartbeat(s) < 0) {
+ if(tls1_process_heartbeat(s, SSL3_RECORD_get_data(&s->rlayer.rrec),
+ SSL3_RECORD_get_length(&s->rlayer.rrec)) < 0) {
return -1;
}
struct openssl_ssl_test_functions {
int (*p_ssl_init_wbio_buffer) (SSL *s, int push);
int (*p_ssl3_setup_buffers) (SSL *s);
- int (*p_tls1_process_heartbeat) (SSL *s);
- int (*p_dtls1_process_heartbeat) (SSL *s);
+ int (*p_tls1_process_heartbeat) (SSL *s,
+ unsigned char *p, unsigned int length);
+ int (*p_dtls1_process_heartbeat) (SSL *s,
+ unsigned char *p, unsigned int length);
};
# ifndef OPENSSL_UNIT_TEST
# ifndef OPENSSL_NO_HEARTBEATS
__owur int tls1_heartbeat(SSL *s);
__owur int dtls1_heartbeat(SSL *s);
-__owur int tls1_process_heartbeat(SSL *s);
-__owur int dtls1_process_heartbeat(SSL *s);
+__owur int tls1_process_heartbeat(SSL *s, unsigned char *p, unsigned int length);
+__owur int dtls1_process_heartbeat(SSL *s, unsigned char *p, unsigned int length);
# endif
__owur int tls1_process_ticket(SSL *s, unsigned char *session_id, int len,
}
# ifndef OPENSSL_NO_HEARTBEATS
-int tls1_process_heartbeat(SSL *s)
+int tls1_process_heartbeat(SSL *s, unsigned char *p, unsigned int length)
{
- unsigned char *p, *pl;
+ unsigned char *pl;
unsigned short hbtype;
unsigned int payload;
unsigned int padding = 16; /* Use minimum padding */
- unsigned int length;
-
- p = SSL3_RECORD_get_data(RECORD_LAYER_get_rrec(&s->rlayer));
- length = SSL3_RECORD_get_length(RECORD_LAYER_get_rrec(&s->rlayer));
if (s->msg_callback)
s->msg_callback(0, s->version, TLS1_RT_HEARTBEAT,