xref: /titanic_50/usr/src/cmd/ssh/include/authfd.h (revision ef4d27fba69298571e509867dd27ea8bca349ec9)
17c478bd9Sstevel@tonic-gate /*	$OpenBSD: authfd.h,v 1.31 2002/09/11 18:27:25 stevesk Exp $	*/
27c478bd9Sstevel@tonic-gate 
37c478bd9Sstevel@tonic-gate #ifndef	_AUTHFD_H
47c478bd9Sstevel@tonic-gate #define	_AUTHFD_H
57c478bd9Sstevel@tonic-gate 
67c478bd9Sstevel@tonic-gate #ifdef __cplusplus
77c478bd9Sstevel@tonic-gate extern "C" {
87c478bd9Sstevel@tonic-gate #endif
97c478bd9Sstevel@tonic-gate 
107c478bd9Sstevel@tonic-gate 
117c478bd9Sstevel@tonic-gate /*
127c478bd9Sstevel@tonic-gate  * Author: Tatu Ylonen <ylo@cs.hut.fi>
137c478bd9Sstevel@tonic-gate  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
147c478bd9Sstevel@tonic-gate  *                    All rights reserved
157c478bd9Sstevel@tonic-gate  * Functions to interface with the SSH_AUTHENTICATION_FD socket.
167c478bd9Sstevel@tonic-gate  *
177c478bd9Sstevel@tonic-gate  * As far as I am concerned, the code I have written for this software
187c478bd9Sstevel@tonic-gate  * can be used freely for any purpose.  Any derived versions of this
197c478bd9Sstevel@tonic-gate  * software must be clearly marked as such, and if the derived work is
207c478bd9Sstevel@tonic-gate  * incompatible with the protocol description in the RFC file, it must be
217c478bd9Sstevel@tonic-gate  * called by a name other than "ssh" or "Secure Shell".
227c478bd9Sstevel@tonic-gate  */
237c478bd9Sstevel@tonic-gate 
247c478bd9Sstevel@tonic-gate #include "buffer.h"
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate /* Messages for the authentication agent connection. */
277c478bd9Sstevel@tonic-gate #define SSH_AGENTC_REQUEST_RSA_IDENTITIES	1
287c478bd9Sstevel@tonic-gate #define SSH_AGENT_RSA_IDENTITIES_ANSWER		2
297c478bd9Sstevel@tonic-gate #define SSH_AGENTC_RSA_CHALLENGE		3
307c478bd9Sstevel@tonic-gate #define SSH_AGENT_RSA_RESPONSE			4
317c478bd9Sstevel@tonic-gate #define SSH_AGENT_FAILURE			5
327c478bd9Sstevel@tonic-gate #define SSH_AGENT_SUCCESS			6
337c478bd9Sstevel@tonic-gate #define SSH_AGENTC_ADD_RSA_IDENTITY		7
347c478bd9Sstevel@tonic-gate #define SSH_AGENTC_REMOVE_RSA_IDENTITY		8
357c478bd9Sstevel@tonic-gate #define SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES	9
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate /* private OpenSSH extensions for SSH2 */
387c478bd9Sstevel@tonic-gate #define SSH2_AGENTC_REQUEST_IDENTITIES		11
397c478bd9Sstevel@tonic-gate #define SSH2_AGENT_IDENTITIES_ANSWER		12
407c478bd9Sstevel@tonic-gate #define SSH2_AGENTC_SIGN_REQUEST		13
417c478bd9Sstevel@tonic-gate #define SSH2_AGENT_SIGN_RESPONSE		14
427c478bd9Sstevel@tonic-gate #define SSH2_AGENTC_ADD_IDENTITY		17
437c478bd9Sstevel@tonic-gate #define SSH2_AGENTC_REMOVE_IDENTITY		18
447c478bd9Sstevel@tonic-gate #define SSH2_AGENTC_REMOVE_ALL_IDENTITIES	19
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate /* smartcard */
477c478bd9Sstevel@tonic-gate #define SSH_AGENTC_ADD_SMARTCARD_KEY		20
487c478bd9Sstevel@tonic-gate #define SSH_AGENTC_REMOVE_SMARTCARD_KEY		21
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate /* lock/unlock the agent */
517c478bd9Sstevel@tonic-gate #define SSH_AGENTC_LOCK				22
527c478bd9Sstevel@tonic-gate #define SSH_AGENTC_UNLOCK			23
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate /* add key with constraints */
557c478bd9Sstevel@tonic-gate #define SSH_AGENTC_ADD_RSA_ID_CONSTRAINED	24
567c478bd9Sstevel@tonic-gate #define SSH2_AGENTC_ADD_ID_CONSTRAINED		25
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate #define	SSH_AGENT_CONSTRAIN_LIFETIME		1
59*ef4d27fbSHuie-Ying Lee #define	SSH_AGENT_CONSTRAIN_CONFIRM		2
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate /* extended failure messages */
627c478bd9Sstevel@tonic-gate #define SSH2_AGENT_FAILURE			30
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate /* additional error code for ssh.com's ssh-agent2 */
657c478bd9Sstevel@tonic-gate #define SSH_COM_AGENT2_FAILURE			102
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate #define	SSH_AGENT_OLD_SIGNATURE			0x01
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate typedef struct {
707c478bd9Sstevel@tonic-gate 	int	fd;
717c478bd9Sstevel@tonic-gate 	Buffer	identities;
727c478bd9Sstevel@tonic-gate 	int	howmany;
737c478bd9Sstevel@tonic-gate }	AuthenticationConnection;
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate int	ssh_agent_present(void);
767c478bd9Sstevel@tonic-gate int	ssh_get_authentication_socket(void);
777c478bd9Sstevel@tonic-gate void	ssh_close_authentication_socket(int);
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate AuthenticationConnection *ssh_get_authentication_connection(void);
807c478bd9Sstevel@tonic-gate void	ssh_close_authentication_connection(AuthenticationConnection *);
817c478bd9Sstevel@tonic-gate int	 ssh_get_num_identities(AuthenticationConnection *, int);
827c478bd9Sstevel@tonic-gate Key	*ssh_get_first_identity(AuthenticationConnection *, char **, int);
837c478bd9Sstevel@tonic-gate Key	*ssh_get_next_identity(AuthenticationConnection *, char **, int);
847c478bd9Sstevel@tonic-gate int	 ssh_add_identity(AuthenticationConnection *, Key *, const char *);
857c478bd9Sstevel@tonic-gate int	 ssh_add_identity_constrained(AuthenticationConnection *, Key *, const char *, u_int);
867c478bd9Sstevel@tonic-gate int	 ssh_remove_identity(AuthenticationConnection *, Key *);
877c478bd9Sstevel@tonic-gate int	 ssh_remove_all_identities(AuthenticationConnection *, int);
887c478bd9Sstevel@tonic-gate int	 ssh_lock_agent(AuthenticationConnection *, int, const char *);
897c478bd9Sstevel@tonic-gate int	 ssh_update_card(AuthenticationConnection *, int, const char *, const char *);
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate int
927c478bd9Sstevel@tonic-gate ssh_decrypt_challenge(AuthenticationConnection *, Key *, BIGNUM *, u_char[16],
937c478bd9Sstevel@tonic-gate     u_int, u_char[16]);
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate int
967c478bd9Sstevel@tonic-gate ssh_agent_sign(AuthenticationConnection *, Key *, u_char **, u_int *, u_char *,
977c478bd9Sstevel@tonic-gate     u_int);
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate #ifdef __cplusplus
1007c478bd9Sstevel@tonic-gate }
1017c478bd9Sstevel@tonic-gate #endif
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate #endif /* _AUTHFD_H */
104