authfd.h revision 106121
198944Sobrien/*	$OpenBSD: authfd.h,v 1.31 2002/09/11 18:27:25 stevesk Exp $	*/
2130803Smarcel
398944Sobrien/*
498944Sobrien * Author: Tatu Ylonen <ylo@cs.hut.fi>
598944Sobrien * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
698944Sobrien *                    All rights reserved
798944Sobrien * Functions to interface with the SSH_AUTHENTICATION_FD socket.
898944Sobrien *
998944Sobrien * As far as I am concerned, the code I have written for this software
1098944Sobrien * can be used freely for any purpose.  Any derived versions of this
1198944Sobrien * software must be clearly marked as such, and if the derived work is
1298944Sobrien * incompatible with the protocol description in the RFC file, it must be
1398944Sobrien * called by a name other than "ssh" or "Secure Shell".
1498944Sobrien */
1598944Sobrien
1698944Sobrien#ifndef AUTHFD_H
1798944Sobrien#define AUTHFD_H
1898944Sobrien
1998944Sobrien#include "buffer.h"
2098944Sobrien
2198944Sobrien/* Messages for the authentication agent connection. */
2298944Sobrien#define SSH_AGENTC_REQUEST_RSA_IDENTITIES	1
2398944Sobrien#define SSH_AGENT_RSA_IDENTITIES_ANSWER		2
2498944Sobrien#define SSH_AGENTC_RSA_CHALLENGE		3
2598944Sobrien#define SSH_AGENT_RSA_RESPONSE			4
2698944Sobrien#define SSH_AGENT_FAILURE			5
2798944Sobrien#define SSH_AGENT_SUCCESS			6
2898944Sobrien#define SSH_AGENTC_ADD_RSA_IDENTITY		7
29130803Smarcel#define SSH_AGENTC_REMOVE_RSA_IDENTITY		8
3098944Sobrien#define SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES	9
3198944Sobrien
3298944Sobrien/* private OpenSSH extensions for SSH2 */
3398944Sobrien#define SSH2_AGENTC_REQUEST_IDENTITIES		11
3498944Sobrien#define SSH2_AGENT_IDENTITIES_ANSWER		12
3598944Sobrien#define SSH2_AGENTC_SIGN_REQUEST		13
36130803Smarcel#define SSH2_AGENT_SIGN_RESPONSE		14
37130803Smarcel#define SSH2_AGENTC_ADD_IDENTITY		17
3898944Sobrien#define SSH2_AGENTC_REMOVE_IDENTITY		18
3998944Sobrien#define SSH2_AGENTC_REMOVE_ALL_IDENTITIES	19
4098944Sobrien
4198944Sobrien/* smartcard */
4298944Sobrien#define SSH_AGENTC_ADD_SMARTCARD_KEY		20
4398944Sobrien#define SSH_AGENTC_REMOVE_SMARTCARD_KEY		21
4498944Sobrien
4598944Sobrien/* lock/unlock the agent */
4698944Sobrien#define SSH_AGENTC_LOCK				22
4798944Sobrien#define SSH_AGENTC_UNLOCK			23
4898944Sobrien
4998944Sobrien/* add key with constraints */
5098944Sobrien#define SSH_AGENTC_ADD_RSA_ID_CONSTRAINED	24
5198944Sobrien#define SSH2_AGENTC_ADD_ID_CONSTRAINED		25
5298944Sobrien
5398944Sobrien#define	SSH_AGENT_CONSTRAIN_LIFETIME		1
5498944Sobrien
5598944Sobrien/* extended failure messages */
5698944Sobrien#define SSH2_AGENT_FAILURE			30
5798944Sobrien
5898944Sobrien/* additional error code for ssh.com's ssh-agent2 */
5998944Sobrien#define SSH_COM_AGENT2_FAILURE			102
6098944Sobrien
6198944Sobrien#define	SSH_AGENT_OLD_SIGNATURE			0x01
6298944Sobrien
6398944Sobrientypedef struct {
6498944Sobrien	int	fd;
6598944Sobrien	Buffer	identities;
6698944Sobrien	int	howmany;
6798944Sobrien}	AuthenticationConnection;
6898944Sobrien
6998944Sobrienint	ssh_agent_present(void);
7098944Sobrienint	ssh_get_authentication_socket(void);
7198944Sobrienvoid	ssh_close_authentication_socket(int);
7298944Sobrien
7398944SobrienAuthenticationConnection *ssh_get_authentication_connection(void);
7498944Sobrienvoid	ssh_close_authentication_connection(AuthenticationConnection *);
7598944Sobrienint	 ssh_get_num_identities(AuthenticationConnection *, int);
7698944SobrienKey	*ssh_get_first_identity(AuthenticationConnection *, char **, int);
7798944SobrienKey	*ssh_get_next_identity(AuthenticationConnection *, char **, int);
7898944Sobrienint	 ssh_add_identity(AuthenticationConnection *, Key *, const char *);
7998944Sobrienint	 ssh_add_identity_constrained(AuthenticationConnection *, Key *, const char *, u_int);
8098944Sobrienint	 ssh_remove_identity(AuthenticationConnection *, Key *);
8198944Sobrienint	 ssh_remove_all_identities(AuthenticationConnection *, int);
8298944Sobrienint	 ssh_lock_agent(AuthenticationConnection *, int, const char *);
8398944Sobrienint	 ssh_update_card(AuthenticationConnection *, int, const char *, const char *);
8498944Sobrien
8598944Sobrienint
8698944Sobrienssh_decrypt_challenge(AuthenticationConnection *, Key *, BIGNUM *, u_char[16],
8798944Sobrien    u_int, u_char[16]);
8898944Sobrien
8998944Sobrienint
9098944Sobrienssh_agent_sign(AuthenticationConnection *, Key *, u_char **, u_int *, u_char *,
9198944Sobrien    u_int);
9298944Sobrien
9398944Sobrien#endif				/* AUTHFD_H */
9498944Sobrien