/* Sends the change cipher spec message. We have just read a finished message from the client.  */
int ICACHE_FLASH_ATTR send_change_cipher_spec(SSL *ssl)
/* Sends the change cipher spec message. We have just read a finished message from the client.  */
int ICACHE_FLASH_ATTR send_change_cipher_spec(SSL *ssl)
{
    uint8 g_chg_cipher_spec_pkt_ram[4];
    memcpy(g_chg_cipher_spec_pkt_ram, g_chg_cipher_spec_pkt, 4);
    int ret = send_packet(ssl, PT_CHANGE_CIPHER_SPEC, 
            g_chg_cipher_spec_pkt_ram, sizeof(g_chg_cipher_spec_pkt));
    if (ret >= 0 && set_key_block(ssl, 1) < 0)
        ret = SSL_ERROR_INVALID_HANDSHAKE;
    if (ssl->cipher_info)
        SET_SSL_FLAG(SSL_TX_ENCRYPTED);
    if (ssl->cipher_info)
        SET_SSL_FLAG(SSL_TX_ENCRYPTED);
    memset(ssl->write_sequence, 0, 8);
    return ret;
}