]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: make struct sshbuf private
authordjm@openbsd.org <djm@openbsd.org>
Fri, 2 Dec 2022 04:40:27 +0000 (04:40 +0000)
committerDarren Tucker <dtucker@dtucker.net>
Sun, 4 Dec 2022 11:39:42 +0000 (22:39 +1100)
and remove an unused field; ok dtucker

OpenBSD-Commit-ID: c7a3d77c0b8c153d463398606a8d57569186a0c3

sshbuf.c
sshbuf.h

index d5757b7264ed273a4bd0db5258d682a985cb9267..d7f4e4ab6504a5a1dd6061cc1926ddb23f2cba54 100644 (file)
--- a/sshbuf.c
+++ b/sshbuf.c
@@ -1,4 +1,4 @@
-/*     $OpenBSD: sshbuf.c,v 1.18 2022/05/25 06:03:44 djm Exp $ */
+/*     $OpenBSD: sshbuf.c,v 1.19 2022/12/02 04:40:27 djm Exp $ */
 /*
  * Copyright (c) 2011 Damien Miller
  *
@@ -15,7 +15,6 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define SSHBUF_INTERNAL
 #include "includes.h"
 
 #include <sys/types.h>
 #include <string.h>
 
 #include "ssherr.h"
+#define SSHBUF_INTERNAL
 #include "sshbuf.h"
 #include "misc.h"
 
+#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)
+#else
+# define SSHBUF_TELL(what)
+#endif
+
+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 */
+       u_int refcount;         /* Tracks self and number of child buffers */
+       struct sshbuf *parent;  /* If child, pointer to parent */
+};
+
 static inline int
 sshbuf_check_sanity(const struct sshbuf *buf)
 {
index feb91f762b9dc7da8642a28282807e2099bd83ad..e2155f9a4d7e3b80e3c0469be575272917e1ca5f 100644 (file)
--- a/sshbuf.h
+++ b/sshbuf.h
@@ -1,4 +1,4 @@
-/*     $OpenBSD: sshbuf.h,v 1.27 2022/05/25 06:03:44 djm Exp $ */
+/*     $OpenBSD: sshbuf.h,v 1.28 2022/12/02 04:40:27 djm Exp $ */
 /*
  * Copyright (c) 2011 Damien Miller
  *
 #define SSHBUF_MAX_BIGNUM      (16384 / 8)     /* Max bignum *bytes* */
 #define SSHBUF_MAX_ECPOINT     ((528 * 2 / 8) + 1) /* Max EC point *bytes* */
 
-/*
- * 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 */
-};
+struct sshbuf;
 
 /*
  * Create a new sshbuf buffer.
@@ -394,12 +379,6 @@ u_int      sshbuf_refcount(const struct sshbuf *buf);
 # endif
 
 # 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 { \
                printf("%s:%d %s: ", __FILE__, __LINE__, __func__); \
                printf x; \
@@ -407,7 +386,6 @@ u_int       sshbuf_refcount(const struct sshbuf *buf);
                fflush(stdout); \
        } while (0)
 # else
-#  define SSHBUF_TELL(what)
 #  define SSHBUF_DBG(x)
 # endif
 #endif /* SSHBUF_INTERNAL */