/*
* Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#include <stdio.h>
#include <limits.h>
#include <errno.h>
#include "../ssl_local.h"
#include <openssl/evp.h>
#include <openssl/buffer.h>
#include <openssl/rand.h>
#include <openssl/core_names.h>
#include "record_local.h"
#include "internal/packet.h"
void RECORD_LAYER_init(RECORD_LAYER *rl, SSL_CONNECTION *s)
{
rl->s = s;
}
void RECORD_LAYER_clear(RECORD_LAYER *rl)
{
rl->wnum = 0;
memset(rl->handshake_fragment, 0, sizeof(rl->handshake_fragment));
rl->handshake_fragment_len = 0;
rl->wpend_tot = 0;
rl->wpend_type = 0;
rl->wpend_ret = 0;
rl->wpend_buf = NULL;
RECORD_LAYER_reset_write_sequence(rl);
if (rl->rrlmethod != NULL)
rl->rrlmethod->free(rl->rrl); /* Ignore return value */
if (rl->wrlmethod != NULL)
rl->wrlmethod->free(rl->wrl); /* Ignore return value */
BIO_free(rl->rrlnext);
rl->rrlmethod = NULL;
rl->wrlmethod = NULL;
rl->rrlnext = NULL;
rl->rrl = NULL;
rl->wrl = NULL;
if (rl->d)
DTLS_RECORD_LAYER_clear(rl);
}
void RECORD_LAYER_release(RECORD_LAYER *rl)
{
/*
* TODO(RECLAYER): Need a way to release the write buffers in the record
* layer on demand
*/
}
/* Checks if we have u