authfd.h revision 113908
1113908Sdes/*	$OpenBSD: authfd.h,v 1.32 2003/01/23 13:50:27 markus Exp $	*/
292555Sdes
357429Smarkm/*
457429Smarkm * Author: Tatu Ylonen <ylo@cs.hut.fi>
557429Smarkm * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
657429Smarkm *                    All rights reserved
757429Smarkm * Functions to interface with the SSH_AUTHENTICATION_FD socket.
860573Skris *
965668Skris * As far as I am concerned, the code I have written for this software
1065668Skris * can be used freely for any purpose.  Any derived versions of this
1165668Skris * software must be clearly marked as such, and if the derived work is
1265668Skris * incompatible with the protocol description in the RFC file, it must be
1365668Skris * called by a name other than "ssh" or "Secure Shell".
1457429Smarkm */
1557429Smarkm
1657429Smarkm#ifndef AUTHFD_H
1757429Smarkm#define AUTHFD_H
1857429Smarkm
1957429Smarkm#include "buffer.h"
2057429Smarkm
2157429Smarkm/* Messages for the authentication agent connection. */
2257429Smarkm#define SSH_AGENTC_REQUEST_RSA_IDENTITIES	1
2357429Smarkm#define SSH_AGENT_RSA_IDENTITIES_ANSWER		2
2457429Smarkm#define SSH_AGENTC_RSA_CHALLENGE		3
2557429Smarkm#define SSH_AGENT_RSA_RESPONSE			4
2657429Smarkm#define SSH_AGENT_FAILURE			5
2757429Smarkm#define SSH_AGENT_SUCCESS			6
2857429Smarkm#define SSH_AGENTC_ADD_RSA_IDENTITY		7
2957429Smarkm#define SSH_AGENTC_REMOVE_RSA_IDENTITY		8
3057429Smarkm#define SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES	9
3157429Smarkm
3269587Sgreen/* private OpenSSH extensions for SSH2 */
3365668Skris#define SSH2_AGENTC_REQUEST_IDENTITIES		11
3465668Skris#define SSH2_AGENT_IDENTITIES_ANSWER		12
3565668Skris#define SSH2_AGENTC_SIGN_REQUEST		13
3665668Skris#define SSH2_AGENT_SIGN_RESPONSE		14
3765668Skris#define SSH2_AGENTC_ADD_IDENTITY		17
3865668Skris#define SSH2_AGENTC_REMOVE_IDENTITY		18
3965668Skris#define SSH2_AGENTC_REMOVE_ALL_IDENTITIES	19
4065668Skris
4192555Sdes/* smartcard */
4292555Sdes#define SSH_AGENTC_ADD_SMARTCARD_KEY		20
4398675Sdes#define SSH_AGENTC_REMOVE_SMARTCARD_KEY		21
4492555Sdes
4598675Sdes/* lock/unlock the agent */
4698675Sdes#define SSH_AGENTC_LOCK				22
4798675Sdes#define SSH_AGENTC_UNLOCK			23
4898675Sdes
4998675Sdes/* add key with constraints */
5098675Sdes#define SSH_AGENTC_ADD_RSA_ID_CONSTRAINED	24
5198675Sdes#define SSH2_AGENTC_ADD_ID_CONSTRAINED		25
5298675Sdes
5398675Sdes#define	SSH_AGENT_CONSTRAIN_LIFETIME		1
54113908Sdes#define	SSH_AGENT_CONSTRAIN_CONFIRM		2
5598675Sdes
5692555Sdes/* extended failure messages */
5792555Sdes#define SSH2_AGENT_FAILURE			30
5892555Sdes
5969587Sgreen/* additional error code for ssh.com's ssh-agent2 */
6098675Sdes#define SSH_COM_AGENT2_FAILURE			102
6169587Sgreen
6269587Sgreen#define	SSH_AGENT_OLD_SIGNATURE			0x01
6369587Sgreen
6457429Smarkmtypedef struct {
6598675Sdes	int	fd;
6698675Sdes	Buffer	identities;
6798675Sdes	int	howmany;
6898675Sdes}	AuthenticationConnection;
6965668Skris
70106121Sdesint	ssh_agent_present(void);
7198675Sdesint	ssh_get_authentication_socket(void);
7298675Sdesvoid	ssh_close_authentication_socket(int);
7357429Smarkm
7476259SgreenAuthenticationConnection *ssh_get_authentication_connection(void);
7598675Sdesvoid	ssh_close_authentication_connection(AuthenticationConnection *);
7692555Sdesint	 ssh_get_num_identities(AuthenticationConnection *, int);
7792555SdesKey	*ssh_get_first_identity(AuthenticationConnection *, char **, int);
7892555SdesKey	*ssh_get_next_identity(AuthenticationConnection *, char **, int);
7992555Sdesint	 ssh_add_identity(AuthenticationConnection *, Key *, const char *);
80113908Sdesint	 ssh_add_identity_constrained(AuthenticationConnection *, Key *,
81113908Sdes    const char *, u_int, u_int);
8292555Sdesint	 ssh_remove_identity(AuthenticationConnection *, Key *);
8392555Sdesint	 ssh_remove_all_identities(AuthenticationConnection *, int);
8498675Sdesint	 ssh_lock_agent(AuthenticationConnection *, int, const char *);
8598675Sdesint	 ssh_update_card(AuthenticationConnection *, int, const char *, const char *);
8657429Smarkm
8760573Skrisint
8892555Sdesssh_decrypt_challenge(AuthenticationConnection *, Key *, BIGNUM *, u_char[16],
8992555Sdes    u_int, u_char[16]);
9057429Smarkm
9165668Skrisint
9292555Sdesssh_agent_sign(AuthenticationConnection *, Key *, u_char **, u_int *, u_char *,
9392555Sdes    u_int);
9465668Skris
9557429Smarkm#endif				/* AUTHFD_H */
96