Lines Matching refs:r

142           int r;  in ssh_request_reply()  local
175 if ((r = sshbuf_put(reply, buf, l)) != 0) in ssh_request_reply()
176 return r; in ssh_request_reply()
187 int r; in ssh_request_reply_decode() local
192 if ((r = ssh_request_reply(sock, request, reply)) != 0 || in ssh_request_reply_decode()
193 (r = sshbuf_get_u8(reply, &type)) != 0 || in ssh_request_reply_decode()
194 (r = decode_reply(type)) != 0) in ssh_request_reply_decode()
197 r = 0; in ssh_request_reply_decode()
200 return r; in ssh_request_reply_decode()
219 int r; in ssh_lock_agent() local
225 if ((r = sshbuf_put_u8(msg, type)) != 0 || in ssh_lock_agent()
226 (r = sshbuf_put_cstring(msg, password)) != 0 || in ssh_lock_agent()
227 (r = ssh_request_reply_decode(sock, msg)) != 0) in ssh_lock_agent()
230 r = 0; in ssh_lock_agent()
233 return r; in ssh_lock_agent()
240 int r; in deserialise_identity2() local
245 if ((r = sshbuf_get_string_direct(ids, &blob, &blen)) != 0 || in deserialise_identity2()
246 (r = sshbuf_get_cstring(ids, &comment, NULL)) != 0) in deserialise_identity2()
248 if ((r = sshkey_from_blob(blob, blen, keyp)) != 0) in deserialise_identity2()
254 r = 0; in deserialise_identity2()
257 return r; in deserialise_identity2()
270 int r; in ssh_fetch_identitylist() local
278 if ((r = sshbuf_put_u8(msg, SSH2_AGENTC_REQUEST_IDENTITIES)) != 0) in ssh_fetch_identitylist()
281 if ((r = ssh_request_reply(sock, msg, msg)) != 0) in ssh_fetch_identitylist()
285 if ((r = sshbuf_get_u8(msg, &type)) != 0) in ssh_fetch_identitylist()
288 r = SSH_ERR_AGENT_FAILURE; in ssh_fetch_identitylist()
291 r = SSH_ERR_INVALID_FORMAT; in ssh_fetch_identitylist()
296 if ((r = sshbuf_get_u32(msg, &num)) != 0) in ssh_fetch_identitylist()
299 r = SSH_ERR_INVALID_FORMAT; in ssh_fetch_identitylist()
303 r = SSH_ERR_AGENT_NO_IDENTITIES; in ssh_fetch_identitylist()
311 r = SSH_ERR_ALLOC_FAIL; in ssh_fetch_identitylist()
315 if ((r = deserialise_identity2(msg, &(idl->keys[i]), in ssh_fetch_identitylist()
317 if (r == SSH_ERR_KEY_TYPE_UNKNOWN) { in ssh_fetch_identitylist()
329 r = 0; in ssh_fetch_identitylist()
334 return r; in ssh_fetch_identitylist()
362 int r, ret = SSH_ERR_KEY_NOT_FOUND; in ssh_agent_has_key() local
366 if ((r = ssh_fetch_identitylist(sock, &idlist)) != 0) { in ssh_agent_has_key()
367 return r; in ssh_agent_has_key()
414 int r = SSH_ERR_INTERNAL_ERROR; in ssh_agent_sign() local
424 if ((r = sshbuf_put_u8(msg, SSH2_AGENTC_SIGN_REQUEST)) != 0 || in ssh_agent_sign()
425 (r = sshkey_puts(key, msg)) != 0 || in ssh_agent_sign()
426 (r = sshbuf_put_string(msg, data, datalen)) != 0 || in ssh_agent_sign()
427 (r = sshbuf_put_u32(msg, flags)) != 0) in ssh_agent_sign()
429 if ((r = ssh_request_reply(sock, msg, msg)) != 0) in ssh_agent_sign()
431 if ((r = sshbuf_get_u8(msg, &type)) != 0) in ssh_agent_sign()
434 r = SSH_ERR_AGENT_FAILURE; in ssh_agent_sign()
437 r = SSH_ERR_INVALID_FORMAT; in ssh_agent_sign()
440 if ((r = sshbuf_get_string(msg, &sig, &len)) != 0) in ssh_agent_sign()
443 if ((r = sshkey_check_sigtype(sig, len, alg)) != 0) in ssh_agent_sign()
450 r = 0; in ssh_agent_sign()
454 return r; in ssh_agent_sign()
465 int r; in encode_dest_constraint_hop() local
469 if ((r = sshbuf_put_cstring(b, dch->user)) != 0 || in encode_dest_constraint_hop()
470 (r = sshbuf_put_cstring(b, dch->hostname)) != 0 || in encode_dest_constraint_hop()
471 (r = sshbuf_put_string(b, NULL, 0)) != 0) /* reserved */ in encode_dest_constraint_hop()
474 if ((r = sshkey_puts(dch->keys[i], b)) != 0 || in encode_dest_constraint_hop()
475 (r = sshbuf_put_u8(b, dch->key_is_ca[i] != 0)) != 0) in encode_dest_constraint_hop()
478 if ((r = sshbuf_put_stringb(m, b)) != 0) in encode_dest_constraint_hop()
481 r = 0; in encode_dest_constraint_hop()
484 return r; in encode_dest_constraint_hop()
491 int r; in encode_dest_constraint() local
495 if ((r = encode_dest_constraint_hop(b, &dc->from)) != 0 || in encode_dest_constraint()
496 (r = encode_dest_constraint_hop(b, &dc->to)) != 0 || in encode_dest_constraint()
497 (r = sshbuf_put_string(b, NULL, 0)) != 0) /* reserved */ in encode_dest_constraint()
499 if ((r = sshbuf_put_stringb(m, b)) != 0) in encode_dest_constraint()
502 r = 0; in encode_dest_constraint()
505 return r; in encode_dest_constraint()
514 int r; in encode_constraints() local
519 if ((r = sshbuf_put_u8(m, SSH_AGENT_CONSTRAIN_LIFETIME)) != 0 || in encode_constraints()
520 (r = sshbuf_put_u32(m, life)) != 0) in encode_constraints()
524 if ((r = sshbuf_put_u8(m, SSH_AGENT_CONSTRAIN_CONFIRM)) != 0) in encode_constraints()
528 if ((r = sshbuf_put_u8(m, SSH_AGENT_CONSTRAIN_MAXSIGN)) != 0 || in encode_constraints()
529 (r = sshbuf_put_u32(m, maxsign)) != 0) in encode_constraints()
533 if ((r = sshbuf_put_u8(m, in encode_constraints()
535 (r = sshbuf_put_cstring(m, in encode_constraints()
537 (r = sshbuf_put_cstring(m, provider)) != 0) in encode_constraints()
542 r = SSH_ERR_ALLOC_FAIL; in encode_constraints()
546 if ((r = encode_dest_constraint(b, in encode_constraints()
550 if ((r = sshbuf_put_u8(m, in encode_constraints()
552 (r = sshbuf_put_cstring(m, in encode_constraints()
554 (r = sshbuf_put_stringb(m, b)) != 0) in encode_constraints()
561 r = SSH_ERR_ALLOC_FAIL; in encode_constraints()
565 if ((r = sshkey_puts(certs[i], b)) != 0) in encode_constraints()
568 if ((r = sshbuf_put_u8(m, in encode_constraints()
570 (r = sshbuf_put_cstring(m, in encode_constraints()
572 (r = sshbuf_put_u8(m, cert_only != 0)) != 0 || in encode_constraints()
573 (r = sshbuf_put_stringb(m, b)) != 0) in encode_constraints()
578 r = 0; in encode_constraints()
581 return r; in encode_constraints()
595 int r, constrained = (life || confirm || maxsign || in ssh_add_identity_constrained() local
622 if ((r = sshbuf_put_u8(msg, type)) != 0 || in ssh_add_identity_constrained()
623 (r = sshkey_private_serialize_maxsign(key, msg, maxsign, in ssh_add_identity_constrained()
625 (r = sshbuf_put_cstring(msg, comment)) != 0) in ssh_add_identity_constrained()
629 r = SSH_ERR_INVALID_ARGUMENT; in ssh_add_identity_constrained()
633 (r = encode_constraints(msg, life, confirm, maxsign, in ssh_add_identity_constrained()
636 if ((r = ssh_request_reply_decode(sock, msg)) != 0) in ssh_add_identity_constrained()
639 r = 0; in ssh_add_identity_constrained()
642 return r; in ssh_add_identity_constrained()
653 int r; in ssh_remove_identity() local
661 if ((r = sshkey_to_blob(key, &blob, &blen)) != 0) in ssh_remove_identity()
663 if ((r = sshbuf_put_u8(msg, in ssh_remove_identity()
665 (r = sshbuf_put_string(msg, blob, blen)) != 0) in ssh_remove_identity()
668 r = SSH_ERR_INVALID_ARGUMENT; in ssh_remove_identity()
671 if ((r = ssh_request_reply_decode(sock, msg)) != 0) in ssh_remove_identity()
674 r = 0; in ssh_remove_identity()
679 return r; in ssh_remove_identity()
693 int r, constrained = (life || confirm || dest_constraints || certs); in ssh_update_card() local
705 if ((r = sshbuf_put_u8(msg, type)) != 0 || in ssh_update_card()
706 (r = sshbuf_put_cstring(msg, reader_id)) != 0 || in ssh_update_card()
707 (r = sshbuf_put_cstring(msg, pin)) != 0) in ssh_update_card()
710 (r = encode_constraints(msg, life, confirm, 0, NULL, in ssh_update_card()
714 if ((r = ssh_request_reply_decode(sock, msg)) != 0) in ssh_update_card()
717 r = 0; in ssh_update_card()
720 return r; in ssh_update_card()
738 int r; in ssh_remove_all_identities() local
742 if ((r = sshbuf_put_u8(msg, type)) != 0) in ssh_remove_all_identities()
744 if ((r = ssh_request_reply_decode(sock, msg)) != 0) in ssh_remove_all_identities()
747 r = 0; in ssh_remove_all_identities()
750 return r; in ssh_remove_all_identities()
760 int r; in ssh_agent_bind_hostkey() local
766 if ((r = sshbuf_put_u8(msg, SSH_AGENTC_EXTENSION)) != 0 || in ssh_agent_bind_hostkey()
767 (r = sshbuf_put_cstring(msg, "session-bind@openssh.com")) != 0 || in ssh_agent_bind_hostkey()
768 (r = sshkey_puts(key, msg)) != 0 || in ssh_agent_bind_hostkey()
769 (r = sshbuf_put_stringb(msg, session_id)) != 0 || in ssh_agent_bind_hostkey()
770 (r = sshbuf_put_stringb(msg, signature)) != 0 || in ssh_agent_bind_hostkey()
771 (r = sshbuf_put_u8(msg, forwarding ? 1 : 0)) != 0) in ssh_agent_bind_hostkey()
773 if ((r = ssh_request_reply_decode(sock, msg)) != 0) in ssh_agent_bind_hostkey()
776 r = 0; in ssh_agent_bind_hostkey()
779 return r; in ssh_agent_bind_hostkey()