authfd.h revision 126274
1126274Sdes/*	$OpenBSD: authfd.h,v 1.34 2003/11/21 11:57:03 djm 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
52124208Sdes#define SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED 26
5398675Sdes
5498675Sdes#define	SSH_AGENT_CONSTRAIN_LIFETIME		1
55113908Sdes#define	SSH_AGENT_CONSTRAIN_CONFIRM		2
5698675Sdes
5792555Sdes/* extended failure messages */
5892555Sdes#define SSH2_AGENT_FAILURE			30
5992555Sdes
6069587Sgreen/* additional error code for ssh.com's ssh-agent2 */
6198675Sdes#define SSH_COM_AGENT2_FAILURE			102
6269587Sgreen
6369587Sgreen#define	SSH_AGENT_OLD_SIGNATURE			0x01
6469587Sgreen
6557429Smarkmtypedef struct {
6698675Sdes	int	fd;
6798675Sdes	Buffer	identities;
6898675Sdes	int	howmany;
6998675Sdes}	AuthenticationConnection;
7065668Skris
71106121Sdesint	ssh_agent_present(void);
7298675Sdesint	ssh_get_authentication_socket(void);
7398675Sdesvoid	ssh_close_authentication_socket(int);
7457429Smarkm
7576259SgreenAuthenticationConnection *ssh_get_authentication_connection(void);
7698675Sdesvoid	ssh_close_authentication_connection(AuthenticationConnection *);
7792555Sdesint	 ssh_get_num_identities(AuthenticationConnection *, int);
7892555SdesKey	*ssh_get_first_identity(AuthenticationConnection *, char **, int);
7992555SdesKey	*ssh_get_next_identity(AuthenticationConnection *, char **, int);
8092555Sdesint	 ssh_add_identity(AuthenticationConnection *, Key *, const char *);
81113908Sdesint	 ssh_add_identity_constrained(AuthenticationConnection *, Key *,
82113908Sdes    const char *, u_int, u_int);
8392555Sdesint	 ssh_remove_identity(AuthenticationConnection *, Key *);
8492555Sdesint	 ssh_remove_all_identities(AuthenticationConnection *, int);
8598675Sdesint	 ssh_lock_agent(AuthenticationConnection *, int, const char *);
86126274Sdesint	 ssh_update_card(AuthenticationConnection *, int, const char *,
87124208Sdes    const char *, u_int, u_int);
8857429Smarkm
8960573Skrisint
9092555Sdesssh_decrypt_challenge(AuthenticationConnection *, Key *, BIGNUM *, u_char[16],
9192555Sdes    u_int, u_char[16]);
9257429Smarkm
9365668Skrisint
9492555Sdesssh_agent_sign(AuthenticationConnection *, Key *, u_char **, u_int *, u_char *,
9592555Sdes    u_int);
9665668Skris
9757429Smarkm#endif				/* AUTHFD_H */
98