Lines Matching refs:buf

35 sshbuf_get(struct sshbuf *buf, void *v, size_t len)  in sshbuf_get()  argument
37 const u_char *p = sshbuf_ptr(buf); in sshbuf_get()
40 if ((r = sshbuf_consume(buf, len)) < 0) in sshbuf_get()
48 sshbuf_get_u64(struct sshbuf *buf, u_int64_t *valp) in sshbuf_get_u64() argument
50 const u_char *p = sshbuf_ptr(buf); in sshbuf_get_u64()
53 if ((r = sshbuf_consume(buf, 8)) < 0) in sshbuf_get_u64()
61 sshbuf_get_u32(struct sshbuf *buf, u_int32_t *valp) in sshbuf_get_u32() argument
63 const u_char *p = sshbuf_ptr(buf); in sshbuf_get_u32()
66 if ((r = sshbuf_consume(buf, 4)) < 0) in sshbuf_get_u32()
74 sshbuf_get_u16(struct sshbuf *buf, u_int16_t *valp) in sshbuf_get_u16() argument
76 const u_char *p = sshbuf_ptr(buf); in sshbuf_get_u16()
79 if ((r = sshbuf_consume(buf, 2)) < 0) in sshbuf_get_u16()
87 sshbuf_get_u8(struct sshbuf *buf, u_char *valp) in sshbuf_get_u8() argument
89 const u_char *p = sshbuf_ptr(buf); in sshbuf_get_u8()
92 if ((r = sshbuf_consume(buf, 1)) < 0) in sshbuf_get_u8()
100 check_offset(const struct sshbuf *buf, int wr, size_t offset, size_t len) in check_offset() argument
102 if (sshbuf_ptr(buf) == NULL) /* calls sshbuf_check_sanity() */ in check_offset()
106 if (offset + len > sshbuf_len(buf)) { in check_offset()
114 check_roffset(const struct sshbuf *buf, size_t offset, size_t len, in check_roffset() argument
120 if ((r = check_offset(buf, 0, offset, len)) != 0) in check_roffset()
122 *p = sshbuf_ptr(buf) + offset; in check_roffset()
127 sshbuf_peek_u64(const struct sshbuf *buf, size_t offset, u_int64_t *valp) in sshbuf_peek_u64() argument
134 if ((r = check_roffset(buf, offset, 8, &p)) != 0) in sshbuf_peek_u64()
142 sshbuf_peek_u32(const struct sshbuf *buf, size_t offset, u_int32_t *valp) in sshbuf_peek_u32() argument
149 if ((r = check_roffset(buf, offset, 4, &p)) != 0) in sshbuf_peek_u32()
157 sshbuf_peek_u16(const struct sshbuf *buf, size_t offset, u_int16_t *valp) in sshbuf_peek_u16() argument
164 if ((r = check_roffset(buf, offset, 2, &p)) != 0) in sshbuf_peek_u16()
172 sshbuf_peek_u8(const struct sshbuf *buf, size_t offset, u_char *valp) in sshbuf_peek_u8() argument
179 if ((r = check_roffset(buf, offset, 1, &p)) != 0) in sshbuf_peek_u8()
187 sshbuf_get_string(struct sshbuf *buf, u_char **valp, size_t *lenp) in sshbuf_get_string() argument
197 if ((r = sshbuf_get_string_direct(buf, &val, &len)) < 0) in sshbuf_get_string()
214 sshbuf_get_string_direct(struct sshbuf *buf, const u_char **valp, size_t *lenp) in sshbuf_get_string_direct() argument
224 if ((r = sshbuf_peek_string_direct(buf, &p, &len)) < 0) in sshbuf_get_string_direct()
230 if (sshbuf_consume(buf, len + 4) != 0) { in sshbuf_get_string_direct()
240 sshbuf_peek_string_direct(const struct sshbuf *buf, const u_char **valp, in sshbuf_peek_string_direct() argument
244 const u_char *p = sshbuf_ptr(buf); in sshbuf_peek_string_direct()
250 if (sshbuf_len(buf) < 4) { in sshbuf_peek_string_direct()
259 if (sshbuf_len(buf) - 4 < len) { in sshbuf_peek_string_direct()
271 sshbuf_get_cstring(struct sshbuf *buf, char **valp, size_t *lenp) in sshbuf_get_cstring() argument
281 if ((r = sshbuf_peek_string_direct(buf, &p, &len)) != 0) in sshbuf_get_cstring()
289 if ((r = sshbuf_skip_string(buf)) != 0) in sshbuf_get_cstring()
306 sshbuf_get_stringb(struct sshbuf *buf, struct sshbuf *v) in sshbuf_get_stringb() argument
317 if ((r = sshbuf_peek_string_direct(buf, NULL, NULL)) != 0 || in sshbuf_get_stringb()
318 (r = sshbuf_get_u32(buf, &len)) != 0 || in sshbuf_get_stringb()
320 (r = sshbuf_get(buf, p, len)) != 0) in sshbuf_get_stringb()
326 sshbuf_put(struct sshbuf *buf, const void *v, size_t len) in sshbuf_put() argument
331 if ((r = sshbuf_reserve(buf, len, &p)) < 0) in sshbuf_put()
339 sshbuf_putb(struct sshbuf *buf, const struct sshbuf *v) in sshbuf_putb() argument
343 return sshbuf_put(buf, sshbuf_ptr(v), sshbuf_len(v)); in sshbuf_putb()
347 sshbuf_putf(struct sshbuf *buf, const char *fmt, ...) in sshbuf_putf() argument
353 r = sshbuf_putfv(buf, fmt, ap); in sshbuf_putf()
359 sshbuf_putfv(struct sshbuf *buf, const char *fmt, va_list ap) in sshbuf_putfv() argument
376 if ((r = sshbuf_reserve(buf, (size_t)len + 1, &p)) < 0) in sshbuf_putfv()
383 if ((r = sshbuf_consume_end(buf, 1)) != 0) in sshbuf_putfv()
392 sshbuf_put_u64(struct sshbuf *buf, u_int64_t val) in sshbuf_put_u64() argument
397 if ((r = sshbuf_reserve(buf, 8, &p)) < 0) in sshbuf_put_u64()
404 sshbuf_put_u32(struct sshbuf *buf, u_int32_t val) in sshbuf_put_u32() argument
409 if ((r = sshbuf_reserve(buf, 4, &p)) < 0) in sshbuf_put_u32()
416 sshbuf_put_u16(struct sshbuf *buf, u_int16_t val) in sshbuf_put_u16() argument
421 if ((r = sshbuf_reserve(buf, 2, &p)) < 0) in sshbuf_put_u16()
428 sshbuf_put_u8(struct sshbuf *buf, u_char val) in sshbuf_put_u8() argument
433 if ((r = sshbuf_reserve(buf, 1, &p)) < 0) in sshbuf_put_u8()
440 check_woffset(struct sshbuf *buf, size_t offset, size_t len, u_char **p) in check_woffset() argument
445 if ((r = check_offset(buf, 1, offset, len)) != 0) in check_woffset()
447 if (sshbuf_mutable_ptr(buf) == NULL) in check_woffset()
449 *p = sshbuf_mutable_ptr(buf) + offset; in check_woffset()
454 sshbuf_poke_u64(struct sshbuf *buf, size_t offset, u_int64_t val) in sshbuf_poke_u64() argument
459 if ((r = check_woffset(buf, offset, 8, &p)) != 0) in sshbuf_poke_u64()
466 sshbuf_poke_u32(struct sshbuf *buf, size_t offset, u_int32_t val) in sshbuf_poke_u32() argument
471 if ((r = check_woffset(buf, offset, 4, &p)) != 0) in sshbuf_poke_u32()
478 sshbuf_poke_u16(struct sshbuf *buf, size_t offset, u_int16_t val) in sshbuf_poke_u16() argument
483 if ((r = check_woffset(buf, offset, 2, &p)) != 0) in sshbuf_poke_u16()
490 sshbuf_poke_u8(struct sshbuf *buf, size_t offset, u_char val) in sshbuf_poke_u8() argument
495 if ((r = check_woffset(buf, offset, 1, &p)) != 0) in sshbuf_poke_u8()
502 sshbuf_poke(struct sshbuf *buf, size_t offset, void *v, size_t len) in sshbuf_poke() argument
507 if ((r = check_woffset(buf, offset, len, &p)) != 0) in sshbuf_poke()
514 sshbuf_put_string(struct sshbuf *buf, const void *v, size_t len) in sshbuf_put_string() argument
523 if ((r = sshbuf_reserve(buf, len + 4, &d)) < 0) in sshbuf_put_string()
532 sshbuf_put_cstring(struct sshbuf *buf, const char *v) in sshbuf_put_cstring() argument
534 return sshbuf_put_string(buf, v, v == NULL ? 0 : strlen(v)); in sshbuf_put_cstring()
538 sshbuf_put_stringb(struct sshbuf *buf, const struct sshbuf *v) in sshbuf_put_stringb() argument
541 return sshbuf_put_string(buf, NULL, 0); in sshbuf_put_stringb()
543 return sshbuf_put_string(buf, sshbuf_ptr(v), sshbuf_len(v)); in sshbuf_put_stringb()
547 sshbuf_froms(struct sshbuf *buf, struct sshbuf **bufp) in sshbuf_froms() argument
554 if (buf == NULL || bufp == NULL) in sshbuf_froms()
557 if ((r = sshbuf_peek_string_direct(buf, &p, &len)) != 0) in sshbuf_froms()
561 if ((r = sshbuf_consume(buf, len + 4)) != 0 || /* Shouldn't happen */ in sshbuf_froms()
562 (r = sshbuf_set_parent(ret, buf)) != 0) { in sshbuf_froms()
571 sshbuf_put_bignum2_bytes(struct sshbuf *buf, const void *v, size_t len) in sshbuf_put_bignum2_bytes() argument
589 if ((r = sshbuf_reserve(buf, len + 4 + prepend, &d)) < 0) in sshbuf_put_bignum2_bytes()
600 sshbuf_get_bignum2_bytes_direct(struct sshbuf *buf, in sshbuf_get_bignum2_bytes_direct() argument
607 if ((r = sshbuf_peek_string_direct(buf, &d, &olen)) < 0) in sshbuf_get_bignum2_bytes_direct()
626 if (sshbuf_consume(buf, olen + 4) != 0) { in sshbuf_get_bignum2_bytes_direct()