18876Srgrimes/* $OpenBSD: authfd.h,v 1.39 2015/12/04 16:41:28 markus Exp $ */
24Srgrimes
34Srgrimes/*
44Srgrimes * Author: Tatu Ylonen <ylo@cs.hut.fi>
58876Srgrimes * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
64Srgrimes *                    All rights reserved
74Srgrimes * Functions to interface with the SSH_AUTHENTICATION_FD socket.
84Srgrimes *
94Srgrimes * As far as I am concerned, the code I have written for this software
104Srgrimes * can be used freely for any purpose.  Any derived versions of this
118876Srgrimes * software must be clearly marked as such, and if the derived work is
128876Srgrimes * incompatible with the protocol description in the RFC file, it must be
134Srgrimes * called by a name other than "ssh" or "Secure Shell".
144Srgrimes */
158876Srgrimes
164Srgrimes#ifndef AUTHFD_H
178876Srgrimes#define AUTHFD_H
184Srgrimes
194Srgrimes/* List of identities returned by ssh_fetch_identitylist() */
204Srgrimesstruct ssh_identitylist {
214Srgrimes	size_t nkeys;
228876Srgrimes	struct sshkey **keys;
234Srgrimes	char **comments;
244Srgrimes};
25118Srgrimes
2614887Swollmanint	ssh_get_authentication_socket(int *fdp);
274Srgrimesvoid	ssh_close_authentication_socket(int sock);
284Srgrimes
294Srgrimesint	ssh_lock_agent(int sock, int lock, const char *password);
304Srgrimesint	ssh_fetch_identitylist(int sock, int version,
314Srgrimes	    struct ssh_identitylist **idlp);
322056Swollmanvoid	ssh_free_identitylist(struct ssh_identitylist *idl);
332056Swollmanint	ssh_add_identity_constrained(int sock, struct sshkey *key,
342056Swollman	    const char *comment, u_int life, u_int confirm);
3512662Sdgint	ssh_remove_identity(int sock, struct sshkey *key);
3612662Sdgint	ssh_update_card(int sock, int add, const char *reader_id,
372056Swollman	    const char *pin, u_int life, u_int confirm);
384Srgrimesint	ssh_remove_all_identities(int sock, int version);
394Srgrimes
404Srgrimesint	ssh_decrypt_challenge(int sock, struct sshkey* key, BIGNUM *challenge,
414Srgrimes	    u_char session_id[16], u_char response[16]);
424Srgrimesint	ssh_agent_sign(int sock, struct sshkey *key,
434Srgrimes	    u_char **sigp, size_t *lenp,
444Srgrimes	    const u_char *data, size_t datalen, const char *alg, u_int compat);
454Srgrimes
464Srgrimes/* Messages for the authentication agent connection. */
474Srgrimes#define SSH_AGENTC_REQUEST_RSA_IDENTITIES	1
484Srgrimes#define SSH_AGENT_RSA_IDENTITIES_ANSWER		2
494Srgrimes#define SSH_AGENTC_RSA_CHALLENGE		3
504Srgrimes#define SSH_AGENT_RSA_RESPONSE			4
514Srgrimes#define SSH_AGENT_FAILURE			5
524Srgrimes#define SSH_AGENT_SUCCESS			6
534Srgrimes#define SSH_AGENTC_ADD_RSA_IDENTITY		7
544Srgrimes#define SSH_AGENTC_REMOVE_RSA_IDENTITY		8
554Srgrimes#define SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES	9
564Srgrimes
574Srgrimes/* private OpenSSH extensions for SSH2 */
584Srgrimes#define SSH2_AGENTC_REQUEST_IDENTITIES		11
594Srgrimes#define SSH2_AGENT_IDENTITIES_ANSWER		12
604Srgrimes#define SSH2_AGENTC_SIGN_REQUEST		13
614Srgrimes#define SSH2_AGENT_SIGN_RESPONSE		14
624Srgrimes#define SSH2_AGENTC_ADD_IDENTITY		17
634Srgrimes#define SSH2_AGENTC_REMOVE_IDENTITY		18
644Srgrimes#define SSH2_AGENTC_REMOVE_ALL_IDENTITIES	19
654Srgrimes
664Srgrimes/* smartcard */
674Srgrimes#define SSH_AGENTC_ADD_SMARTCARD_KEY		20
684Srgrimes#define SSH_AGENTC_REMOVE_SMARTCARD_KEY		21
694Srgrimes
704Srgrimes/* lock/unlock the agent */
714Srgrimes#define SSH_AGENTC_LOCK				22
724Srgrimes#define SSH_AGENTC_UNLOCK			23
734Srgrimes
744Srgrimes/* add key with constraints */
754Srgrimes#define SSH_AGENTC_ADD_RSA_ID_CONSTRAINED	24
764Srgrimes#define SSH2_AGENTC_ADD_ID_CONSTRAINED		25
774Srgrimes#define SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED 26
784Srgrimes
794Srgrimes#define	SSH_AGENT_CONSTRAIN_LIFETIME		1
804Srgrimes#define	SSH_AGENT_CONSTRAIN_CONFIRM		2
814Srgrimes
824Srgrimes/* extended failure messages */
834Srgrimes#define SSH2_AGENT_FAILURE			30
844Srgrimes
854Srgrimes/* additional error code for ssh.com's ssh-agent2 */
864Srgrimes#define SSH_COM_AGENT2_FAILURE			102
874Srgrimes
884Srgrimes#define	SSH_AGENT_OLD_SIGNATURE			0x01
894Srgrimes#define	SSH_AGENT_RSA_SHA2_256			0x02
904Srgrimes#define	SSH_AGENT_RSA_SHA2_512			0x04
914Srgrimes
924Srgrimes#endif				/* AUTHFD_H */
9311940Sbde