version 1.27, 2022/05/25 06:03:44 |
version 1.28, 2022/12/02 04:40:27 |
|
|
#define SSHBUF_MAX_BIGNUM (16384 / 8) /* Max bignum *bytes* */ |
#define SSHBUF_MAX_BIGNUM (16384 / 8) /* Max bignum *bytes* */ |
#define SSHBUF_MAX_ECPOINT ((528 * 2 / 8) + 1) /* Max EC point *bytes* */ |
#define SSHBUF_MAX_ECPOINT ((528 * 2 / 8) + 1) /* Max EC point *bytes* */ |
|
|
/* |
struct sshbuf; |
* NB. do not depend on the internals of this. It will be made opaque |
|
* one day. |
|
*/ |
|
struct sshbuf { |
|
u_char *d; /* Data */ |
|
const u_char *cd; /* Const data */ |
|
size_t off; /* First available byte is buf->d + buf->off */ |
|
size_t size; /* Last byte is buf->d + buf->size - 1 */ |
|
size_t max_size; /* Maximum size of buffer */ |
|
size_t alloc; /* Total bytes allocated to buf->d */ |
|
int readonly; /* Refers to external, const data */ |
|
int dont_free; /* Kludge to support sshbuf_init */ |
|
u_int refcount; /* Tracks self and number of child buffers */ |
|
struct sshbuf *parent; /* If child, pointer to parent */ |
|
}; |
|
|
|
/* |
/* |
* Create a new sshbuf buffer. |
* Create a new sshbuf buffer. |
|
|
# endif |
# endif |
|
|
# ifdef SSHBUF_DEBUG |
# ifdef SSHBUF_DEBUG |
# define SSHBUF_TELL(what) do { \ |
|
printf("%s:%d %s: %s size %zu alloc %zu off %zu max %zu\n", \ |
|
__FILE__, __LINE__, __func__, what, \ |
|
buf->size, buf->alloc, buf->off, buf->max_size); \ |
|
fflush(stdout); \ |
|
} while (0) |
|
# define SSHBUF_DBG(x) do { \ |
# define SSHBUF_DBG(x) do { \ |
printf("%s:%d %s: ", __FILE__, __LINE__, __func__); \ |
printf("%s:%d %s: ", __FILE__, __LINE__, __func__); \ |
printf x; \ |
printf x; \ |
|
|
fflush(stdout); \ |
fflush(stdout); \ |
} while (0) |
} while (0) |
# else |
# else |
# define SSHBUF_TELL(what) |
|
# define SSHBUF_DBG(x) |
# define SSHBUF_DBG(x) |
# endif |
# endif |
#endif /* SSHBUF_INTERNAL */ |
#endif /* SSHBUF_INTERNAL */ |