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