authfd.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* $OpenBSD: authfd.h,v 1.49 2020/06/26 05:03:36 djm Exp $ */
  2. /*
  3. * Author: Tatu Ylonen <ylo@cs.hut.fi>
  4. * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
  5. * All rights reserved
  6. * Functions to interface with the SSH_AUTHENTICATION_FD socket.
  7. *
  8. * As far as I am concerned, the code I have written for this software
  9. * can be used freely for any purpose. Any derived versions of this
  10. * software must be clearly marked as such, and if the derived work is
  11. * incompatible with the protocol description in the RFC file, it must be
  12. * called by a name other than "ssh" or "Secure Shell".
  13. */
  14. #ifndef AUTHFD_H
  15. #define AUTHFD_H
  16. /* List of identities returned by ssh_fetch_identitylist() */
  17. struct ssh_identitylist {
  18. size_t nkeys;
  19. struct sshkey **keys;
  20. char **comments;
  21. };
  22. int ssh_get_authentication_socket(int *fdp);
  23. int ssh_get_authentication_socket_path(const char *authsocket, int *fdp);
  24. void ssh_close_authentication_socket(int sock);
  25. int ssh_lock_agent(int sock, int lock, const char *password);
  26. int ssh_fetch_identitylist(int sock, struct ssh_identitylist **idlp);
  27. void ssh_free_identitylist(struct ssh_identitylist *idl);
  28. int ssh_add_identity_constrained(int sock, struct sshkey *key,
  29. const char *comment, u_int life, u_int confirm, u_int maxsign,
  30. const char *provider);
  31. int ssh_agent_has_key(int sock, const struct sshkey *key);
  32. int ssh_remove_identity(int sock, const struct sshkey *key);
  33. int ssh_update_card(int sock, int add, const char *reader_id,
  34. const char *pin, u_int life, u_int confirm);
  35. int ssh_remove_all_identities(int sock, int version);
  36. int ssh_agent_sign(int sock, const struct sshkey *key,
  37. u_char **sigp, size_t *lenp,
  38. const u_char *data, size_t datalen, const char *alg, u_int compat);
  39. /* Messages for the authentication agent connection. */
  40. #define SSH_AGENTC_REQUEST_RSA_IDENTITIES 1
  41. #define SSH_AGENT_RSA_IDENTITIES_ANSWER 2
  42. #define SSH_AGENTC_RSA_CHALLENGE 3
  43. #define SSH_AGENT_RSA_RESPONSE 4
  44. #define SSH_AGENT_FAILURE 5
  45. #define SSH_AGENT_SUCCESS 6
  46. #define SSH_AGENTC_ADD_RSA_IDENTITY 7
  47. #define SSH_AGENTC_REMOVE_RSA_IDENTITY 8
  48. #define SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES 9
  49. /* private OpenSSH extensions for SSH2 */
  50. #define SSH2_AGENTC_REQUEST_IDENTITIES 11
  51. #define SSH2_AGENT_IDENTITIES_ANSWER 12
  52. #define SSH2_AGENTC_SIGN_REQUEST 13
  53. #define SSH2_AGENT_SIGN_RESPONSE 14
  54. #define SSH2_AGENTC_ADD_IDENTITY 17
  55. #define SSH2_AGENTC_REMOVE_IDENTITY 18
  56. #define SSH2_AGENTC_REMOVE_ALL_IDENTITIES 19
  57. /* smartcard */
  58. #define SSH_AGENTC_ADD_SMARTCARD_KEY 20
  59. #define SSH_AGENTC_REMOVE_SMARTCARD_KEY 21
  60. /* lock/unlock the agent */
  61. #define SSH_AGENTC_LOCK 22
  62. #define SSH_AGENTC_UNLOCK 23
  63. /* add key with constraints */
  64. #define SSH_AGENTC_ADD_RSA_ID_CONSTRAINED 24
  65. #define SSH2_AGENTC_ADD_ID_CONSTRAINED 25
  66. #define SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED 26
  67. #define SSH_AGENT_CONSTRAIN_LIFETIME 1
  68. #define SSH_AGENT_CONSTRAIN_CONFIRM 2
  69. #define SSH_AGENT_CONSTRAIN_MAXSIGN 3
  70. #define SSH_AGENT_CONSTRAIN_EXTENSION 255
  71. /* extended failure messages */
  72. #define SSH2_AGENT_FAILURE 30
  73. /* additional error code for ssh.com's ssh-agent2 */
  74. #define SSH_COM_AGENT2_FAILURE 102
  75. #define SSH_AGENT_OLD_SIGNATURE 0x01
  76. #define SSH_AGENT_RSA_SHA2_256 0x02
  77. #define SSH_AGENT_RSA_SHA2_512 0x04
  78. #endif /* AUTHFD_H */