Exemple #1
0
int _gnutls_recv_server_kx_message(gnutls_session_t session)
{
	gnutls_buffer_st buf;
	int ret = 0;
	unsigned int optflag = 0;

	if (session->internals.auth_struct->gnutls_process_server_kx !=
	    NULL) {
		/* Server key exchange packet is optional for PSK. */
		if (_gnutls_session_is_psk(session))
			optflag = 1;

		ret =
		    _gnutls_recv_handshake(session,
					   GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE,
					   optflag, &buf);
		if (ret < 0) {
			gnutls_assert();
			return ret;
		}

		ret =
		    session->internals.auth_struct->
		    gnutls_process_server_kx(session, buf.data,
					     buf.length);
		_gnutls_buffer_clear(&buf);

		if (ret < 0) {
			gnutls_assert();
			return ret;
		}

	}
	return ret;
}
Exemple #2
0
int
_gnutls_recv_server_kx_message (gnutls_session_t session)
{
    uint8_t *data = NULL;
    int datasize;
    int ret = 0;
    Optional optflag = MANDATORY_PACKET;

    if (session->internals.auth_struct->gnutls_process_server_kx != NULL)
    {

        /* EXCEPTION FOR RSA_EXPORT cipher suite
         */
        if (_gnutls_session_is_export (session) != 0 &&
                _gnutls_peers_cert_less_512 (session) != 0)
        {
            gnutls_assert ();
            return 0;
        }

        /* Server key exchange packet is optional for PSK. */
        if (_gnutls_session_is_psk (session))
            optflag = OPTIONAL_PACKET;

        ret =
            _gnutls_recv_handshake (session, &data,
                                    &datasize,
                                    GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE,
                                    optflag);
        if (ret < 0)
        {
            gnutls_assert ();
            return ret;
        }

        ret =
            session->internals.auth_struct->gnutls_process_server_kx (session,
                    data,
                    datasize);
        gnutls_free (data);

        if (ret < 0)
        {
            gnutls_assert ();
            return ret;
        }

    }
    return ret;
}
int
_gnutls_recv_server_kx_message (gnutls_session_t session)
{
  gnutls_buffer_st buf;
  int ret = 0;
  optional_t optflag = MANDATORY_PACKET;

  if (session->internals.auth_struct->gnutls_process_server_kx != NULL)
    {

      /* EXCEPTION FOR RSA_EXPORT cipher suite 
       */
      if (_gnutls_session_is_export (session) != 0 &&
          _gnutls_peers_cert_less_512 (session) != 0)
        {
          gnutls_assert ();
          return 0;
        }

      /* Server key exchange packet is optional for PSK. */
      if (_gnutls_session_is_psk (session))
        optflag = OPTIONAL_PACKET;

      ret =
        _gnutls_recv_handshake (session, 
                                GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE,
                                optflag, &buf);
      if (ret < 0)
        {
          gnutls_assert ();
          return ret;
        }

      ret =
        session->internals.auth_struct->gnutls_process_server_kx (session,
                                                                  buf.data,
                                                                  buf.length);
      _gnutls_buffer_clear(&buf);

      if (ret < 0)
        {
          gnutls_assert ();
          return ret;
        }

    }
  return ret;
}