xref: /netbsd-src/crypto/external/bsd/openssh/dist/authfd.h (revision 9616dacfef448e70e3fbbd865bddf60d54b656c5)
1 /*	$NetBSD: authfd.h,v 1.7 2016/12/25 00:07:46 christos Exp $	*/
2 /* $OpenBSD: authfd.h,v 1.39 2015/12/04 16:41:28 markus 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 **comments;
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, int version,
32 	    struct ssh_identitylist **idlp);
33 void	ssh_free_identitylist(struct ssh_identitylist *idl);
34 int	ssh_add_identity_constrained(int sock, struct sshkey *key,
35 	    const char *comment, u_int life, u_int confirm);
36 int	ssh_remove_identity(int sock, struct sshkey *key);
37 int	ssh_update_card(int sock, int add, const char *reader_id,
38 	    const char *pin, u_int life, u_int confirm);
39 int	ssh_remove_all_identities(int sock, int version);
40 
41 int	ssh_decrypt_challenge(int sock, struct sshkey* key, BIGNUM *challenge,
42 	    u_char session_id[16], u_char response[16]);
43 int	ssh_agent_sign(int sock, struct sshkey *key,
44 	    u_char **sigp, size_t *lenp,
45 	    const u_char *data, size_t datalen, const char *alg, u_int compat);
46 
47 /* Messages for the authentication agent connection. */
48 #define SSH_AGENTC_REQUEST_RSA_IDENTITIES	1
49 #define SSH_AGENT_RSA_IDENTITIES_ANSWER		2
50 #define SSH_AGENTC_RSA_CHALLENGE		3
51 #define SSH_AGENT_RSA_RESPONSE			4
52 #define SSH_AGENT_FAILURE			5
53 #define SSH_AGENT_SUCCESS			6
54 #define SSH_AGENTC_ADD_RSA_IDENTITY		7
55 #define SSH_AGENTC_REMOVE_RSA_IDENTITY		8
56 #define SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES	9
57 
58 /* private OpenSSH extensions for SSH2 */
59 #define SSH2_AGENTC_REQUEST_IDENTITIES		11
60 #define SSH2_AGENT_IDENTITIES_ANSWER		12
61 #define SSH2_AGENTC_SIGN_REQUEST		13
62 #define SSH2_AGENT_SIGN_RESPONSE		14
63 #define SSH2_AGENTC_ADD_IDENTITY		17
64 #define SSH2_AGENTC_REMOVE_IDENTITY		18
65 #define SSH2_AGENTC_REMOVE_ALL_IDENTITIES	19
66 
67 /* smartcard */
68 #define SSH_AGENTC_ADD_SMARTCARD_KEY		20
69 #define SSH_AGENTC_REMOVE_SMARTCARD_KEY		21
70 
71 /* lock/unlock the agent */
72 #define SSH_AGENTC_LOCK				22
73 #define SSH_AGENTC_UNLOCK			23
74 
75 /* add key with constraints */
76 #define SSH_AGENTC_ADD_RSA_ID_CONSTRAINED	24
77 #define SSH2_AGENTC_ADD_ID_CONSTRAINED		25
78 #define SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED 26
79 
80 #define	SSH_AGENT_CONSTRAIN_LIFETIME		1
81 #define	SSH_AGENT_CONSTRAIN_CONFIRM		2
82 
83 /* extended failure messages */
84 #define SSH2_AGENT_FAILURE			30
85 
86 /* additional error code for ssh.com's ssh-agent2 */
87 #define SSH_COM_AGENT2_FAILURE			102
88 
89 #define	SSH_AGENT_OLD_SIGNATURE			0x01
90 #define	SSH_AGENT_RSA_SHA2_256			0x02
91 #define	SSH_AGENT_RSA_SHA2_512			0x04
92 
93 #endif				/* AUTHFD_H */
94