1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-27 13:21:11 +03:00

buffer: Use bool for secure buffer

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Andreas Schneider
2018-08-31 15:42:35 +02:00
parent be703974e9
commit a1b57d3b94
2 changed files with 18 additions and 16 deletions

View File

@@ -37,6 +37,21 @@
#include "libssh/misc.h"
#include "libssh/bignum.h"
/*
* Describes a buffer state
* [XXXXXXXXXXXXDATA PAYLOAD XXXXXXXXXXXXXXXXXXXXXXXX]
* ^ ^ ^ ^]
* \_data points\_pos points here \_used points here | /
* here Allocated
*/
struct ssh_buffer_struct {
bool secure;
char *data;
uint32_t used;
uint32_t allocated;
uint32_t pos;
};
/**
* @defgroup libssh_buffer The SSH buffer functions.
* @ingroup libssh
@@ -137,8 +152,9 @@ void ssh_buffer_free(struct ssh_buffer_struct *buffer) {
*
* @param[in] buffer buffer to set secure.
*/
void ssh_buffer_set_secure(ssh_buffer buffer){
buffer->secure = 1;
void ssh_buffer_set_secure(ssh_buffer buffer)
{
buffer->secure = true;
}
static int realloc_buffer(struct ssh_buffer_struct *buffer, size_t needed) {