libssh 0.5.2
include/libssh/dh.h
00001 /*
00002  * This file is part of the SSH Library
00003  *
00004  * Copyright (c) 2009 by Aris Adamantiadis
00005  *
00006  * The SSH Library is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU Lesser General Public License as published by
00008  * the Free Software Foundation; either version 2.1 of the License, or (at your
00009  * option) any later version.
00010  *
00011  * The SSH Library is distributed in the hope that it will be useful, but
00012  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00013  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00014  * License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public License
00017  * along with the SSH Library; see the file COPYING.  If not, write to
00018  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00019  * MA 02111-1307, USA.
00020  */
00021 
00022 #ifndef DH_H_
00023 #define DH_H_
00024 #include "config.h"
00025 
00026 /* DH key generation */
00027 #include "libssh/keys.h"
00028 
00029 void ssh_print_bignum(const char *which,bignum num);
00030 int dh_generate_e(ssh_session session);
00031 int dh_generate_f(ssh_session session);
00032 int dh_generate_x(ssh_session session);
00033 int dh_generate_y(ssh_session session);
00034 
00035 int ssh_crypto_init(void);
00036 void ssh_crypto_finalize(void);
00037 
00038 ssh_string dh_get_e(ssh_session session);
00039 ssh_string dh_get_f(ssh_session session);
00040 int dh_import_f(ssh_session session,ssh_string f_string);
00041 int dh_import_e(ssh_session session, ssh_string e_string);
00042 void dh_import_pubkey(ssh_session session,ssh_string pubkey_string);
00043 int dh_build_k(ssh_session session);
00044 int make_sessionid(ssh_session session);
00045 /* add data for the final cookie */
00046 int hashbufin_add_cookie(ssh_session session, unsigned char *cookie);
00047 int hashbufout_add_cookie(ssh_session session);
00048 int generate_session_keys(ssh_session session);
00049 int sig_verify(ssh_session session, ssh_public_key pubkey,
00050     SIGNATURE *signature, unsigned char *digest, int size);
00051 /* returns 1 if server signature ok, 0 otherwise. The NEXT crypto is checked, not the current one */
00052 int signature_verify(ssh_session session,ssh_string signature);
00053 bignum make_string_bn(ssh_string string);
00054 ssh_string make_bignum_string(bignum num);
00055 
00056 
00057 #endif /* DH_H_ */