[BACK]Return to authfd.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Annotation of src/usr.bin/ssh/authfd.h, Revision 1.2

1.1       deraadt     1: /*
                      2:
                      3: authfd.h
                      4:
                      5: Author: Tatu Ylonen <ylo@cs.hut.fi>
                      6:
                      7: Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
                      8:                    All rights reserved
                      9:
                     10: Created: Wed Mar 29 01:17:41 1995 ylo
                     11:
                     12: Functions to interface with the SSH_AUTHENTICATION_FD socket.
                     13:
                     14: */
                     15:
                     16: /* RCSID("$Id: authfd.h,v 1.2 1999/05/04 11:58:27 bg Exp $"); */
                     17:
                     18: #ifndef AUTHFD_H
                     19: #define AUTHFD_H
                     20:
                     21: #include "buffer.h"
                     22:
                     23: /* Message types for SSH_AUTHENTICATION_FD socket. */
                     24: #define SSH_AUTHFD_CONNECT     0xf0
                     25:
                     26: /* Messages for the authentication agent connection. */
                     27: #define SSH_AGENTC_REQUEST_RSA_IDENTITIES      1
                     28: #define SSH_AGENT_RSA_IDENTITIES_ANSWER                2
                     29: #define SSH_AGENTC_RSA_CHALLENGE               3
                     30: #define SSH_AGENT_RSA_RESPONSE                 4
                     31: #define SSH_AGENT_FAILURE                      5
                     32: #define SSH_AGENT_SUCCESS                      6
                     33: #define SSH_AGENTC_ADD_RSA_IDENTITY            7
                     34: #define SSH_AGENTC_REMOVE_RSA_IDENTITY         8
                     35: #define SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES   9
                     36:
                     37: typedef struct
                     38: {
                     39:   int fd;
                     40:   Buffer packet;
                     41:   Buffer identities;
                     42:   int howmany;
                     43: } AuthenticationConnection;
                     44:
                     45: /* Returns the number of the authentication fd, or -1 if there is none. */
                     46: int ssh_get_authentication_fd();
                     47:
                     48: /* This should be called for any descriptor returned by
                     49:    ssh_get_authentication_fd().  Depending on the way the descriptor was
                     50:    obtained, this may close the descriptor. */
                     51: void ssh_close_authentication_socket(int authfd);
                     52:
                     53: /* Opens a socket to the authentication server.  Returns the number of
                     54:    that socket, or -1 if no connection could be made. */
                     55: int ssh_get_authentication_connection_fd();
                     56:
                     57: /* Opens and connects a private socket for communication with the
                     58:    authentication agent.  Returns NULL if an error occurred and the
                     59:    connection could not be opened.  The connection should be closed by
                     60:    the caller by calling ssh_close_authentication_connection(). */
                     61: AuthenticationConnection *ssh_get_authentication_connection();
                     62:
                     63: /* Closes the connection to the authentication agent and frees any associated
                     64:    memory. */
                     65: void ssh_close_authentication_connection(AuthenticationConnection *ac);
                     66:
                     67: /* Returns the first authentication identity held by the agent.
                     68:    Returns true if an identity is available, 0 otherwise.
                     69:    The caller must initialize the integers before the call, and free the
                     70:    comment after a successful call (before calling ssh_get_next_identity). */
                     71: int ssh_get_first_identity(AuthenticationConnection *connection,
1.2     ! provos     72:                           int *bitsp, BIGNUM *e, BIGNUM *n, char **comment);
1.1       deraadt    73:
                     74: /* Returns the next authentication identity for the agent.  Other functions
                     75:    can be called between this and ssh_get_first_identity or two calls of this
                     76:    function.  This returns 0 if there are no more identities.  The caller
                     77:    must free comment after a successful return. */
                     78: int ssh_get_next_identity(AuthenticationConnection *connection,
1.2     ! provos     79:                          int *bitsp, BIGNUM *e, BIGNUM *n, char **comment);
1.1       deraadt    80:
                     81: /* Requests the agent to decrypt the given challenge.  Returns true if
                     82:    the agent claims it was able to decrypt it. */
                     83: int ssh_decrypt_challenge(AuthenticationConnection *auth,
1.2     ! provos     84:                          int bits, BIGNUM *e, BIGNUM *n, BIGNUM *challenge,
1.1       deraadt    85:                          unsigned char session_id[16],
                     86:                          unsigned int response_type,
                     87:                          unsigned char response[16]);
                     88:
                     89: /* Adds an identity to the authentication server.  This call is not meant to
                     90:    be used by normal applications.  This returns true if the identity
                     91:    was successfully added. */
                     92: int ssh_add_identity(AuthenticationConnection *connection,
1.2     ! provos     93:                     RSA *key, const char *comment);
1.1       deraadt    94:
                     95: /* Removes the identity from the authentication server.  This call is
                     96:    not meant to be used by normal applications.  This returns true if the
                     97:    identity was successfully added. */
                     98: int ssh_remove_identity(AuthenticationConnection *connection,
1.2     ! provos     99:                        RSA *key);
1.1       deraadt   100:
                    101: /* Removes all identities from the authentication agent.  This call is not
                    102:    meant to be used by normal applications.  This returns true if the
                    103:    operation was successful. */
                    104: int ssh_remove_all_identities(AuthenticationConnection *connection);
                    105:
                    106: /* Closes the connection to the authentication agent. */
                    107: void ssh_close_authentication(AuthenticationConnection *connection);
                    108:
                    109: #endif /* AUTHFD_H */