Branch: Tag:

2014-11-24

2014-11-24 16:29:55 by Martin Nilsson <nilsson@opera.com>

Use SSL.Buffer instead of ADT.struct

33:   #define State .State   #define Session .Session   #define Context .Context + #define Buffer .Buffer      #ifdef SSL3_DEBUG   #define SSL3_DEBUG_MSG(X ...) werror(X)
89:      string(8bit) get_signature_algorithms()   { -  Stdio.Buffer sign_algs = Stdio.Buffer(); +  Buffer sign_algs = Buffer();    foreach(context->get_signature_algorithms(), [int hash, int sign])    {    sign_algs->add_int(hash, 1);
147:      Packet certificate_packet(array(string(8bit)) certificates)   { -  ADT.struct struct = ADT.struct(); +  Buffer struct = Buffer();    struct->put_var_string_array(certificates, 3, 3);    return handshake_packet(HANDSHAKE_certificate, struct->pop_data());   }
190:    //    // Note that we detect the packet on return by it having all zeros    // in the second field. -  Stdio.Buffer hb_msg = Stdio.Buffer(); +  Buffer hb_msg = Buffer();    hb_msg->add_int(HEARTBEAT_MESSAGE_request, 1);    hb_msg->add_int(16, 2);    int now = gethrtime();
620:    return;    }    -  Stdio.Buffer hb_msg = Stdio.Buffer(); +  Buffer hb_msg = Buffer();    hb_msg->add_int(HEARTBEAT_MESSAGE_request, 1);    hb_msg->add_int(16, 2);    int now = gethrtime();
633:   void handle_heartbeat(string(8bit) s)   {    if (sizeof(s) < 19) return; // Minimum size for valid heartbeats. -  Stdio.Buffer hb_msg = Stdio.Buffer(s); +  Buffer hb_msg = Buffer(s);    int hb_type = hb_msg->read_int(1);    int hb_len = hb_msg->read_int(2);   
670:    // this document, the receiver MUST send a corresponding    // HeartbeatResponse message carrying an exact copy of the payload    // of the received HeartbeatRequest. -  hb_msg = Stdio.Buffer(); +  hb_msg = Buffer();    hb_msg->add_int(HEARTBEAT_MESSAGE_response, 1);    hb_msg->add_int(hb_len, 2);    hb_msg->add(payload);
682:    // If a received HeartbeatResponse message does not contain the    // expected payload, the message MUST be discarded silently.    if ((sizeof(payload) == 16) && heartbeat_decode) { -  hb_msg = Stdio.Buffer(heartbeat_decode->crypt(payload)); +  hb_msg = Buffer(heartbeat_decode->crypt(payload));    int a = hb_msg->read_int(8);    int b = hb_msg->read_int(8);    if (a != b) {
878:    };    if( exception )    { -  if( objectp(exception) && ([object]exception)->ADT_struct ) +  if( objectp(exception) && ([object]exception)->buffer_error )    {    Error.Generic e = [object(Error.Generic)]exception;    send_packet(alert(ALERT_fatal, ALERT_decode_error,
933:    };    if( exception )    { -  if( objectp(exception) && ([object]exception)->ADT_struct ) +  if( objectp(exception) && ([object]exception)->buffer_error )    {    Error.Generic e = [object(Error.Generic)]exception;    send_packet(alert(ALERT_fatal, ALERT_decode_error,