Home
last modified time | relevance | path

Searched refs:buf (Results 1 – 25 of 92) sorted by relevance

1234

/openssh-portable/
H A Dsshbuf.c36 (!buf->readonly && buf->d != buf->cd) || in sshbuf_check_sanity()
42 buf->off > buf->size)) { in sshbuf_check_sanity()
57 if (buf->off == 0 || buf->readonly || buf->refcount > 1) in sshbuf_maybe_pack()
61 memmove(buf->d, buf->d + buf->off, buf->size - buf->off); in sshbuf_maybe_pack()
62 buf->size -= buf->off; in sshbuf_maybe_pack()
177 buf->off = buf->size; in sshbuf_reset()
185 buf->cd = buf->d = d; in sshbuf_reset()
244 buf->cd = buf->d = dp; in sshbuf_set_max_size()
267 return buf->max_size - (buf->size - buf->off); in sshbuf_avail()
297 if (len > buf->max_size || buf->max_size - len < buf->size - buf->off) in sshbuf_check_reserve()
[all …]
H A Dsshbuf.h71 struct sshbuf *sshbuf_fromb(struct sshbuf *buf);
85 void sshbuf_free(struct sshbuf *buf);
90 void sshbuf_reset(struct sshbuf *buf);
95 size_t sshbuf_max_size(const struct sshbuf *buf);
106 size_t sshbuf_len(const struct sshbuf *buf);
111 size_t sshbuf_avail(const struct sshbuf *buf);
220 #define sshbuf_skip_string(buf) sshbuf_get_string_direct(buf, NULL, NULL) argument
251 char *sshbuf_dtob16(struct sshbuf *buf);
294 char *sshbuf_dup_string(struct sshbuf *buf);
364 size_t sshbuf_alloc(const struct sshbuf *buf);
[all …]
H A Dsshbuf-getput-basic.c37 const u_char *p = sshbuf_ptr(buf); in sshbuf_get()
50 const u_char *p = sshbuf_ptr(buf); in sshbuf_get_u64()
63 const u_char *p = sshbuf_ptr(buf); in sshbuf_get_u32()
76 const u_char *p = sshbuf_ptr(buf); in sshbuf_get_u16()
89 const u_char *p = sshbuf_ptr(buf); in sshbuf_get_u8()
122 *p = sshbuf_ptr(buf) + offset; in check_roffset()
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()
353 r = sshbuf_putfv(buf, fmt, ap); in sshbuf_putf()
[all …]
H A Dkexsntrup4591761x25519.c64 buf = NULL; in kex_kem_sntrup4591761x25519_keypair()
66 sshbuf_free(buf); in kex_kem_sntrup4591761x25519_keypair()
135 sshbuf_ptr(buf), sshbuf_len(buf)); in kex_kem_sntrup4591761x25519_enc()
138 sshbuf_reset(buf); in kex_kem_sntrup4591761x25519_enc()
148 buf = NULL; in kex_kem_sntrup4591761x25519_enc()
153 sshbuf_free(buf); in kex_kem_sntrup4591761x25519_enc()
193 buf, 1)) < 0) in kex_kem_sntrup4591761x25519_dec()
200 sshbuf_ptr(buf), sshbuf_len(buf)); in kex_kem_sntrup4591761x25519_dec()
202 sshbuf_reset(buf); in kex_kem_sntrup4591761x25519_dec()
214 buf = NULL; in kex_kem_sntrup4591761x25519_dec()
[all …]
H A Dentropy.c189 size_t len = sizeof(buf); in rexec_send_rng_seed()
192 if (RAND_bytes(buf, sizeof(buf)) <= 0) { in rexec_send_rng_seed()
199 explicit_bzero(buf, sizeof(buf)); in rexec_send_rng_seed()
205 const u_char *buf = NULL; in rexec_recv_rng_seed() local
214 RAND_add(buf, len, len); in rexec_recv_rng_seed()
236 if (seed_from_prngd(buf, sizeof(buf)) == -1) in seed_rng()
238 RAND_add(buf, sizeof(buf), sizeof(buf)); in seed_rng()
246 arc4random_buf(buf, sizeof(buf)); in seed_rng()
247 explicit_bzero(buf, sizeof(buf)); in seed_rng()
262 arc4random_buf(buf, sizeof(buf)); in seed_rng()
[all …]
H A Dprogressmeter.c122 char buf[MAX_WINSIZE + 1]; in refresh_progress_meter() local
168 buf[0] = '\0'; in refresh_progress_meter()
171 buf[0] = '\r'; in refresh_progress_meter()
172 snmprintf(buf+1, sizeof(buf)-1, &file_len, "%-*s", in refresh_progress_meter()
181 snprintf(buf + strlen(buf), win_size - strlen(buf), in refresh_progress_meter()
185 format_size(buf + strlen(buf), win_size - strlen(buf), in refresh_progress_meter()
187 strlcat(buf, " ", win_size); in refresh_progress_meter()
190 format_rate(buf + strlen(buf), win_size - strlen(buf), in refresh_progress_meter()
192 strlcat(buf, "/s ", win_size); in refresh_progress_meter()
216 snprintf(buf + strlen(buf), win_size - strlen(buf), in refresh_progress_meter()
[all …]
H A Dkexc25519.c106 kex->client_pub = buf; in kex_c25519_keypair()
107 buf = NULL; in kex_c25519_keypair()
109 sshbuf_free(buf); in kex_c25519_keypair()
152 dump_digest("encoded shared secret:", sshbuf_ptr(buf), sshbuf_len(buf)); in kex_c25519_enc()
155 *shared_secretp = buf; in kex_c25519_enc()
157 buf = NULL; in kex_c25519_enc()
161 sshbuf_free(buf); in kex_c25519_enc()
189 buf, 0)) < 0) in kex_c25519_dec()
192 dump_digest("encoded shared secret:", sshbuf_ptr(buf), sshbuf_len(buf)); in kex_c25519_dec()
195 buf = NULL; in kex_c25519_dec()
[all …]
H A Dttymodes.c282 struct sshbuf *buf; in ssh_tty_make_modes() local
285 if ((buf = sshbuf_new()) == NULL) in ssh_tty_make_modes()
306 (r = sshbuf_put_u32(buf, ibaud)) != 0) in ssh_tty_make_modes()
311 if ((r = sshbuf_put_u8(buf, OP)) != 0 || \ in ssh_tty_make_modes()
312 (r = sshbuf_put_u32(buf, \ in ssh_tty_make_modes()
335 sshbuf_free(buf); in ssh_tty_make_modes()
346 struct sshbuf *buf; in ssh_tty_parse_modes() local
372 while (sshbuf_len(buf) > 0) { in ssh_tty_parse_modes()
397 if ((r = sshbuf_get_u32(buf, &u)) != 0) \ in ssh_tty_parse_modes()
438 len = sshbuf_len(buf); in ssh_tty_parse_modes()
[all …]
H A Dmsg.c47 u_char buf[5]; in ssh_msg_send() local
52 put_u32(buf, mlen + 1); in ssh_msg_send()
53 buf[4] = type; /* 1st byte of payload is mesg-type */ in ssh_msg_send()
54 if (atomicio(vwrite, fd, buf, sizeof(buf)) != sizeof(buf)) { in ssh_msg_send()
68 u_char buf[4], *p; in ssh_msg_recv() local
74 if (atomicio(read, fd, buf, sizeof(buf)) != sizeof(buf)) { in ssh_msg_recv()
79 msg_len = get_u32(buf); in ssh_msg_recv()
H A Dkexdh.c118 struct sshbuf *buf = NULL; in kex_dh_keypair() local
124 if ((buf = sshbuf_new()) == NULL) in kex_dh_keypair()
135 kex->client_pub = buf; in kex_dh_keypair()
136 buf = NULL; in kex_dh_keypair()
138 sshbuf_free(buf); in kex_dh_keypair()
178 struct sshbuf *buf = NULL; in kex_dh_dec() local
184 if ((buf = sshbuf_new()) == NULL) { in kex_dh_dec()
191 sshbuf_reset(buf); in kex_dh_dec()
194 *shared_secretp = buf; in kex_dh_dec()
195 buf = NULL; in kex_dh_dec()
[all …]
H A Dsshbuf-getput-crypto.c36 sshbuf_get_bignum2(struct sshbuf *buf, BIGNUM **valp) in sshbuf_get_bignum2() argument
45 if ((r = sshbuf_get_bignum2_bytes_direct(buf, &d, &len)) != 0) in sshbuf_get_bignum2()
80 if ((r = sshbuf_peek_string_direct(buf, &d, &len)) < 0) in sshbuf_get_ec()
85 if (sshbuf_get_string_direct(buf, NULL, NULL) != 0) { in sshbuf_get_ec()
95 sshbuf_get_eckey(struct sshbuf *buf, EC_KEY *v) in sshbuf_get_eckey() argument
106 if ((r = sshbuf_peek_string_direct(buf, &d, &len)) < 0) { in sshbuf_get_eckey()
120 if (sshbuf_get_string_direct(buf, NULL, NULL) != 0) { in sshbuf_get_eckey()
131 sshbuf_put_bignum2(struct sshbuf *buf, const BIGNUM *v) in sshbuf_put_bignum2() argument
168 ret = sshbuf_put_string(buf, d, len); in sshbuf_put_ec()
174 sshbuf_put_eckey(struct sshbuf *buf, const EC_KEY *v) in sshbuf_put_eckey() argument
[all …]
H A Dauth-rhosts.c83 while (fgets(buf, sizeof(buf), f)) { in check_rhosts_file()
89 for (cp = buf; *cp == ' ' || *cp == '\t'; cp++) in check_rhosts_file()
105 switch (sscanf(buf, "%1023s %1023s %1023s", hostbuf, userbuf, in check_rhosts_file()
192 char buf[1024]; in auth_rhosts2() local
211 snprintf(buf, sizeof buf, "%.500s/%.100s", in auth_rhosts2()
213 if (stat(buf, &st) >= 0) in auth_rhosts2()
278 snprintf(buf, sizeof buf, "%.500s/%.100s", in auth_rhosts2()
280 if (stat(buf, &st) == -1) in auth_rhosts2()
293 pw->pw_name, buf); in auth_rhosts2()
294 auth_debug_add("Bad file modes for %.200s", buf); in auth_rhosts2()
[all …]
H A Dkexecdh.c55 struct sshbuf *buf = NULL; in kex_ecdh_keypair() local
69 if ((buf = sshbuf_new()) == NULL) { in kex_ecdh_keypair()
83 kex->client_pub = buf; in kex_ecdh_keypair()
84 buf = NULL; in kex_ecdh_keypair()
87 sshbuf_free(buf); in kex_ecdh_keypair()
141 struct sshbuf *buf = NULL; in kex_ecdh_dec_key_group() local
150 if ((buf = sshbuf_new()) == NULL) { in kex_ecdh_dec_key_group()
163 sshbuf_reset(buf); in kex_ecdh_dec_key_group()
189 *shared_secretp = buf; in kex_ecdh_dec_key_group()
190 buf = NULL; in kex_ecdh_dec_key_group()
[all …]
H A Dsshbuf-io.c36 u_char buf[4096]; in sshbuf_load_fd() local
52 if ((len = atomicio(read, fd, buf, sizeof(buf))) == 0) { in sshbuf_load_fd()
58 if ((r = sshbuf_put(blob, buf, len)) != 0) in sshbuf_load_fd()
75 explicit_bzero(buf, sizeof(buf)); in sshbuf_load_fd()
101 sshbuf_write_file(const char *path, struct sshbuf *buf) in sshbuf_write_file() argument
107 if (atomicio(vwrite, fd, sshbuf_mutable_ptr(buf), in sshbuf_write_file()
108 sshbuf_len(buf)) != sshbuf_len(buf) || close(fd) != 0) { in sshbuf_write_file()
H A Dxmss_hash.c43 unsigned char buf[inlen + n + keylen]; in core_hash_SHA2() local
48 to_byte(buf, type, n); in core_hash_SHA2()
51 buf[i+n] = key[i]; in core_hash_SHA2()
55 buf[keylen + n + i] = in[i]; in core_hash_SHA2()
59 SHA256(buf, inlen + keylen + n, out); in core_hash_SHA2()
64 SHA512(buf, inlen + keylen + n, out); in core_hash_SHA2()
97 unsigned char buf[2*n]; in hash_h() local
114 buf[i] = in[i] ^ bitmask[i]; in hash_h()
121 unsigned char buf[n]; in hash_f() local
136 buf[i] = in[i] ^ bitmask[i]; in hash_f()
[all …]
H A Dreadpass.c57 char buf[1024]; in ssh_askpass() local
87 ssize_t r = read(p[0], buf + len, sizeof(buf) - 1 - len); in ssh_askpass()
94 } while (sizeof(buf) - 1 - len > 0); in ssh_askpass()
95 buf[len] = '\0'; in ssh_askpass()
103 explicit_bzero(buf, sizeof(buf)); in ssh_askpass()
107 buf[strcspn(buf, "\r\n")] = '\0'; in ssh_askpass()
108 pass = xstrdup(buf); in ssh_askpass()
109 explicit_bzero(buf, sizeof(buf)); in ssh_askpass()
187 if (readpassphrase(prompt, buf, sizeof buf, rppflags) == NULL) { in read_passphrase()
193 ret = xstrdup(buf); in read_passphrase()
[all …]
H A Dhmac.c34 u_char *buf; member
57 if ((ret->buf = calloc(1, ret->buf_len)) == NULL) in ssh_hmac_start()
74 memcpy(ctx->buf, key, klen); in ssh_hmac_init()
79 ctx->buf[i] ^= 0x36; in ssh_hmac_init()
83 ctx->buf[i] ^= 0x36 ^ 0x5c; in ssh_hmac_init()
86 explicit_bzero(ctx->buf, ctx->buf_len); in ssh_hmac_init()
113 ssh_digest_final(ctx->digest, ctx->buf, len)) in ssh_hmac_final()
117 ssh_digest_update(ctx->digest, ctx->buf, len) < 0 || in ssh_hmac_final()
130 if (ctx->buf) { in ssh_hmac_free()
131 explicit_bzero(ctx->buf, ctx->buf_len); in ssh_hmac_free()
[all …]
/openssh-portable/regress/unittests/sshkey/
H A Dtest_file.c63 sshbuf_free(buf); in sshkey_file_tests()
80 sshbuf_free(buf); in sshkey_file_tests()
89 sshbuf_free(buf); in sshkey_file_tests()
99 sshbuf_free(buf); in sshkey_file_tests()
144 sshbuf_free(buf); in sshkey_file_tests()
153 sshbuf_free(buf); in sshkey_file_tests()
163 sshbuf_free(buf); in sshkey_file_tests()
172 sshbuf_free(buf); in sshkey_file_tests()
189 sshbuf_free(buf); in sshkey_file_tests()
198 sshbuf_free(buf); in sshkey_file_tests()
[all …]
H A Dtest_fuzz.c52 struct sshbuf *buf; in public_fuzz() local
63 fuzz = fuzz_begin(fuzzers, sshbuf_mutable_ptr(buf), sshbuf_len(buf)); in public_fuzz()
64 ASSERT_INT_EQ(sshkey_from_blob(sshbuf_ptr(buf), sshbuf_len(buf), in public_fuzz()
67 sshbuf_free(buf); in public_fuzz()
124 sshbuf_free(buf); in sshkey_fuzz_tests()
146 sshbuf_free(buf); in sshkey_fuzz_tests()
168 sshbuf_free(buf); in sshkey_fuzz_tests()
190 sshbuf_free(buf); in sshkey_fuzz_tests()
213 sshbuf_free(buf); in sshkey_fuzz_tests()
235 sshbuf_free(buf); in sshkey_fuzz_tests()
[all …]
/openssh-portable/regress/unittests/utf8/
H A Dtests.c23 char buf[16]; in badarg() local
28 len = snmprintf(buf, sizeof(buf), &width, "\377"); in badarg()
30 ASSERT_STRING_EQ(buf, ""); in badarg()
39 char buf[16]; in one() local
45 (void)strlcpy(buf, utf8 ? "utf8_" : "c_", sizeof(buf)); in one()
46 (void)strlcat(buf, name, sizeof(buf)); in one()
47 TEST_START(buf); in one()
49 len = snmprintf(buf, sizeof(buf), wp, "%s", mbs); in one()
51 ASSERT_STRING_EQ(buf, wants); in one()
/openssh-portable/regress/unittests/conversion/
H A Dtests.c26 char buf[1024]; in tests() local
43 snprintf(buf, sizeof buf, "%llu", (unsigned long long)LONG_MAX); in tests()
44 ASSERT_LONG_EQ(convtime(buf), -1); in tests()
45 snprintf(buf, sizeof buf, "%llu", (unsigned long long)LONG_MAX + 1); in tests()
46 ASSERT_LONG_EQ(convtime(buf), -1); in tests()
49 snprintf(buf, sizeof buf, "%lluM", (unsigned long long)LONG_MAX/60 + 1); in tests()
50 ASSERT_LONG_EQ(convtime(buf), -1); in tests()
/openssh-portable/openbsd-compat/
H A Dbsd-getline.c50 getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp) in getdelim() argument
55 if (*buf == NULL || *bufsiz == 0) { in getdelim()
56 if ((*buf = malloc(BUFSIZ)) == NULL) in getdelim()
61 for (ptr = *buf, eptr = *buf + *bufsiz;;) { in getdelim()
65 ssize_t diff = (ssize_t)(ptr - *buf); in getdelim()
76 return ptr - *buf; in getdelim()
81 ssize_t d = ptr - *buf; in getdelim()
82 if ((nbuf = realloc(*buf, nbufsiz)) == NULL) in getdelim()
84 *buf = nbuf; in getdelim()
93 getline(char **buf, size_t *bufsiz, FILE *fp) in getline() argument
[all …]
H A Dsetproctitle.c128 char buf[1024], ptitle[1024]; in setproctitle() local
141 strlcpy(buf, __progname, sizeof(buf)); in setproctitle()
146 len = strlcat(buf, ": ", sizeof(buf)); in setproctitle()
147 if (len < sizeof(buf)) in setproctitle()
148 r = vsnprintf(buf + len, sizeof(buf) - len , fmt, ap); in setproctitle()
151 if (r == -1 || (size_t)r >= sizeof(buf) - len) in setproctitle()
153 strnvis(ptitle, buf, sizeof(ptitle), in setproctitle()
/openssh-portable/regress/
H A Dnetcat.c978 memmove(buf, buf + n, adjust); in drainbuf()
1511 buf[1] = 1; in socks_connect()
1534 buf[2] = 0; in socks_connect()
1545 buf[2] = 0; in socks_connect()
1620 r = snprintf(buf, sizeof(buf), in socks_connect()
1624 r = snprintf(buf, sizeof(buf), in socks_connect()
1640 r = snprintf(buf, sizeof(buf), "%s:%s", in socks_connect()
1643 b64_ntop(buf, strlen(buf), resp, in socks_connect()
1646 r = snprintf(buf, sizeof(buf), "Proxy-Authorization: " in socks_connect()
1660 proxy_read_line(proxyfd, buf, sizeof(buf)); in socks_connect()
[all …]
H A Dcheck-perm.c97 char buf[PATH_MAX], homedir[PATH_MAX]; in auth_secure_path() local
102 if (realpath(name, buf) == NULL) { in auth_secure_path()
111 snprintf(err, errlen, "%s is not a regular file", buf); in auth_secure_path()
117 buf); in auth_secure_path()
123 if ((cp = dirname(buf)) == NULL) { in auth_secure_path()
127 strlcpy(buf, cp, sizeof(buf)); in auth_secure_path()
129 if (stat(buf, &st) < 0 || in auth_secure_path()
133 "bad ownership or modes for directory %s", buf); in auth_secure_path()
138 if (comparehome && strcmp(homedir, buf) == 0) in auth_secure_path()
145 if ((strcmp("/", buf) == 0) || (strcmp(".", buf) == 0)) in auth_secure_path()

Completed in 84 milliseconds

1234