• Home
  • Raw
  • Download

Lines Matching refs:len

32 sshbuf_get(struct sshbuf *buf, void *v, size_t len)  in sshbuf_get()  argument
37 if ((r = sshbuf_consume(buf, len)) < 0) in sshbuf_get()
39 if (v != NULL && len != 0) in sshbuf_get()
40 memcpy(v, p, len); in sshbuf_get()
100 size_t len; in sshbuf_get_string() local
107 if ((r = sshbuf_get_string_direct(buf, &val, &len)) < 0) in sshbuf_get_string()
110 if ((*valp = malloc(len + 1)) == NULL) { in sshbuf_get_string()
114 if (len != 0) in sshbuf_get_string()
115 memcpy(*valp, val, len); in sshbuf_get_string()
116 (*valp)[len] = '\0'; in sshbuf_get_string()
119 *lenp = len; in sshbuf_get_string()
126 size_t len; in sshbuf_get_string_direct() local
134 if ((r = sshbuf_peek_string_direct(buf, &p, &len)) < 0) in sshbuf_get_string_direct()
139 *lenp = len; in sshbuf_get_string_direct()
140 if (sshbuf_consume(buf, len + 4) != 0) { in sshbuf_get_string_direct()
153 u_int32_t len; in sshbuf_peek_string_direct() local
164 len = PEEK_U32(p); in sshbuf_peek_string_direct()
165 if (len > SSHBUF_SIZE_MAX - 4) { in sshbuf_peek_string_direct()
169 if (sshbuf_len(buf) - 4 < len) { in sshbuf_peek_string_direct()
176 *lenp = len; in sshbuf_peek_string_direct()
183 size_t len; in sshbuf_get_cstring() local
191 if ((r = sshbuf_peek_string_direct(buf, &p, &len)) != 0) in sshbuf_get_cstring()
194 if (len > 0 && in sshbuf_get_cstring()
195 (z = memchr(p , '\0', len)) != NULL && z < p + len - 1) { in sshbuf_get_cstring()
202 if ((*valp = malloc(len + 1)) == NULL) { in sshbuf_get_cstring()
206 if (len != 0) in sshbuf_get_cstring()
207 memcpy(*valp, p, len); in sshbuf_get_cstring()
208 (*valp)[len] = '\0'; in sshbuf_get_cstring()
211 *lenp = (size_t)len; in sshbuf_get_cstring()
218 u_int32_t len; in sshbuf_get_stringb() local
228 (r = sshbuf_get_u32(buf, &len)) != 0 || in sshbuf_get_stringb()
229 (r = sshbuf_reserve(v, len, &p)) != 0 || in sshbuf_get_stringb()
230 (r = sshbuf_get(buf, p, len)) != 0) in sshbuf_get_stringb()
236 sshbuf_put(struct sshbuf *buf, const void *v, size_t len) in sshbuf_put() argument
241 if ((r = sshbuf_reserve(buf, len, &p)) < 0) in sshbuf_put()
243 if (len != 0) in sshbuf_put()
244 memcpy(p, v, len); in sshbuf_put()
270 int r, len; in sshbuf_putfv() local
274 if ((len = vsnprintf(NULL, 0, fmt, ap2)) < 0) { in sshbuf_putfv()
278 if (len == 0) { in sshbuf_putfv()
284 if ((r = sshbuf_reserve(buf, (size_t)len + 1, &p)) < 0) in sshbuf_putfv()
286 if ((r = vsnprintf((char *)p, len + 1, fmt, ap2)) != len) { in sshbuf_putfv()
348 sshbuf_put_string(struct sshbuf *buf, const void *v, size_t len) in sshbuf_put_string() argument
353 if (len > SSHBUF_SIZE_MAX - 4) { in sshbuf_put_string()
357 if ((r = sshbuf_reserve(buf, len + 4, &d)) < 0) in sshbuf_put_string()
359 POKE_U32(d, len); in sshbuf_put_string()
360 if (len != 0) in sshbuf_put_string()
361 memcpy(d + 4, v, len); in sshbuf_put_string()
381 size_t len; in sshbuf_froms() local
388 if ((r = sshbuf_peek_string_direct(buf, &p, &len)) != 0) in sshbuf_froms()
390 if ((ret = sshbuf_from(p, len)) == NULL) in sshbuf_froms()
392 if ((r = sshbuf_consume(buf, len + 4)) != 0 || /* Shouldn't happen */ in sshbuf_froms()
402 sshbuf_put_bignum2_bytes(struct sshbuf *buf, const void *v, size_t len) in sshbuf_put_bignum2_bytes() argument
408 if (len > SSHBUF_SIZE_MAX - 5) { in sshbuf_put_bignum2_bytes()
413 for (; len > 0 && *s == 0; len--, s++) in sshbuf_put_bignum2_bytes()
419 prepend = len > 0 && (s[0] & 0x80) != 0; in sshbuf_put_bignum2_bytes()
420 if ((r = sshbuf_reserve(buf, len + 4 + prepend, &d)) < 0) in sshbuf_put_bignum2_bytes()
422 POKE_U32(d, len + prepend); in sshbuf_put_bignum2_bytes()
425 if (len != 0) in sshbuf_put_bignum2_bytes()
426 memcpy(d + 4 + prepend, s, len); in sshbuf_put_bignum2_bytes()
435 size_t len, olen; in sshbuf_get_bignum2_bytes_direct() local
440 len = olen; in sshbuf_get_bignum2_bytes_direct()
442 if ((len != 0 && (*d & 0x80) != 0)) in sshbuf_get_bignum2_bytes_direct()
445 if (len > SSHBUF_MAX_BIGNUM + 1 || in sshbuf_get_bignum2_bytes_direct()
446 (len == SSHBUF_MAX_BIGNUM + 1 && *d != 0)) in sshbuf_get_bignum2_bytes_direct()
449 while (len > 0 && *d == 0x00) { in sshbuf_get_bignum2_bytes_direct()
451 len--; in sshbuf_get_bignum2_bytes_direct()
456 *lenp = len; in sshbuf_get_bignum2_bytes_direct()