Beispiel #1
0
/*
 * send s->init_buf in records of type 'type' (SSL3_RT_HANDSHAKE or
 * SSL3_RT_CHANGE_CIPHER_SPEC)
 */
int ssl3_do_write(SSL *s, int type)
{
    int ret;

    ret = ssl3_write_bytes(s, type, &s->init_buf->data[s->init_off],
                           s->init_num);
    if (ret < 0)
        return (-1);
    if (type == SSL3_RT_HANDSHAKE)
        /*
         * should not be done for 'Hello Request's, but in that case we'll
         * ignore the result anyway
         */
        ssl3_finish_mac(s, (unsigned char *)&s->init_buf->data[s->init_off],
                        ret);

    if (ret == s->init_num) {
        if (s->msg_callback)
            s->msg_callback(1, s->version, type, s->init_buf->data,
                            (size_t)(s->init_off + s->init_num), s,
                            s->msg_callback_arg);
        return (1);
    }
    s->init_off += ret;
    s->init_num -= ret;
    return (0);
}
Beispiel #2
0
/* ssl3_do_write sends |ssl->init_buf| in records of type 'type'
 * (SSL3_RT_HANDSHAKE or SSL3_RT_CHANGE_CIPHER_SPEC). It returns 1 on success
 * and <= 0 on error. */
int ssl3_do_write(SSL *ssl, int type) {
  int ret = ssl3_write_bytes(ssl, type, ssl->init_buf->data, ssl->init_num);
  if (ret <= 0) {
    return ret;
  }

  /* ssl3_write_bytes writes the data in its entirety. */
  assert(ret == ssl->init_num);
  ssl_do_msg_callback(ssl, 1 /* write */, ssl->version, type,
                      ssl->init_buf->data, (size_t)ssl->init_num);
  ssl->init_num = 0;
  return 1;
}
/* send s->init_buf in records of type 'type' */
int ssl3_do_write(SSL *s, int type)
	{
	int ret;

	ret=ssl3_write_bytes(s,type,&s->init_buf->data[s->init_off],
	                     s->init_num);
	if (ret < 0) return(-1);
	if (type == SSL3_RT_HANDSHAKE)
		/* should not be done for 'Hello Request's, but in that case
		 * we'll ignore the result anyway */
		ssl3_finish_mac(s,(unsigned char *)&s->init_buf->data[s->init_off],ret);
	
	if (ret == s->init_num)
		return(1);
	s->init_off+=ret;
	s->init_num-=ret;
	return(0);
	}
Beispiel #4
0
/* ssl3_do_write sends |s->init_buf| in records of type 'type'
 * (SSL3_RT_HANDSHAKE or SSL3_RT_CHANGE_CIPHER_SPEC). It returns -1 on error, 1
 * on success or zero if the transmission is still incomplete. */
int ssl3_do_write(SSL *s, int type) {
  int n;

  n = ssl3_write_bytes(s, type, &s->init_buf->data[s->init_off], s->init_num);
  if (n < 0) {
    return -1;
  }

  if (n == s->init_num) {
    if (s->msg_callback) {
      s->msg_callback(1, s->version, type, s->init_buf->data,
                      (size_t)(s->init_off + s->init_num), s,
                      s->msg_callback_arg);
    }
    return 1;
  }

  s->init_off += n;
  s->init_num -= n;
  return 0;
}
Beispiel #5
0
int ssl3_write_app_data(SSL *ssl, const void *buf, int len) {
  return ssl3_write_bytes(ssl, SSL3_RT_APPLICATION_DATA, buf, len);
}
Beispiel #6
0
int ssl3_write_app_data(SSL *ssl, const void *buf, int len) {
  assert(!SSL_in_init(ssl) || SSL_in_false_start(ssl));

  return ssl3_write_bytes(ssl, SSL3_RT_APPLICATION_DATA, buf, len);
}