summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2019-07-30 05:04:50 +0000
committerDamien Miller <djm@cvs.openbsd.org>2019-07-30 05:04:50 +0000
commit21b1ddb0a79c109d6f7a162172c4c202695112b8 (patch)
tree38a62415da555d109d653b6e25ee0c19690f321e /usr.bin
parent71b3ce9ed231a30879f9698a18d7de1c90feb10a (diff)
let sshbuf_find/cmp take a void* for the search/comparison
argument, instead of a u_char*. Saves callers needing to cast.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/sshbuf-misc.c7
-rw-r--r--usr.bin/ssh/sshbuf.h6
2 files changed, 6 insertions, 7 deletions
diff --git a/usr.bin/ssh/sshbuf-misc.c b/usr.bin/ssh/sshbuf-misc.c
index 89149e06d06..b30eaeaabb3 100644
--- a/usr.bin/ssh/sshbuf-misc.c
+++ b/usr.bin/ssh/sshbuf-misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshbuf-misc.c,v 1.10 2019/07/18 13:26:00 djm Exp $ */
+/* $OpenBSD: sshbuf-misc.c,v 1.11 2019/07/30 05:04:49 djm Exp $ */
/*
* Copyright (c) 2011 Damien Miller
*
@@ -191,7 +191,7 @@ sshbuf_dup_string(struct sshbuf *buf)
int
sshbuf_cmp(const struct sshbuf *b, size_t offset,
- const u_char *s, size_t len)
+ const void *s, size_t len)
{
if (sshbuf_ptr(b) == NULL)
return SSH_ERR_INTERNAL_ERROR;
@@ -206,13 +206,12 @@ sshbuf_cmp(const struct sshbuf *b, size_t offset,
int
sshbuf_find(const struct sshbuf *b, size_t start_offset,
- const u_char *s, size_t len, size_t *offsetp)
+ const void *s, size_t len, size_t *offsetp)
{
void *p;
if (offsetp != NULL)
*offsetp = 0;
-
if (sshbuf_ptr(b) == NULL)
return SSH_ERR_INTERNAL_ERROR;
if (start_offset > SSHBUF_SIZE_MAX || len > SSHBUF_SIZE_MAX || len == 0)
diff --git a/usr.bin/ssh/sshbuf.h b/usr.bin/ssh/sshbuf.h
index 045ac3deece..255de5d8ad1 100644
--- a/usr.bin/ssh/sshbuf.h
+++ b/usr.bin/ssh/sshbuf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshbuf.h,v 1.16 2019/07/16 13:18:39 djm Exp $ */
+/* $OpenBSD: sshbuf.h,v 1.17 2019/07/30 05:04:49 djm Exp $ */
/*
* Copyright (c) 2011 Damien Miller
*
@@ -262,7 +262,7 @@ int sshbuf_b64tod(struct sshbuf *buf, const char *b64);
* all.
*/
int sshbuf_cmp(const struct sshbuf *b, size_t offset,
- const u_char *s, size_t len);
+ const void *s, size_t len);
/*
* Searches the buffer for the specified string. Returns 0 on success
@@ -274,7 +274,7 @@ int sshbuf_cmp(const struct sshbuf *b, size_t offset,
*/
int
sshbuf_find(const struct sshbuf *b, size_t start_offset,
- const u_char *s, size_t len, size_t *offsetp);
+ const void *s, size_t len, size_t *offsetp);
/*
* Duplicate the contents of a buffer to a string (caller to free).