|
Packit Service |
31306d |
/*
|
|
Packit Service |
31306d |
* This file is part of the SSH Library
|
|
Packit Service |
31306d |
*
|
|
Packit Service |
31306d |
* Copyright (c) 2009 by Aris Adamantiadis
|
|
Packit Service |
31306d |
*
|
|
Packit Service |
31306d |
* This library is free software; you can redistribute it and/or
|
|
Packit Service |
31306d |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
31306d |
* License as published by the Free Software Foundation; either
|
|
Packit Service |
31306d |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
31306d |
*
|
|
Packit Service |
31306d |
* This library is distributed in the hope that it will be useful,
|
|
Packit Service |
31306d |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
31306d |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
31306d |
* Lesser General Public License for more details.
|
|
Packit Service |
31306d |
*
|
|
Packit Service |
31306d |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
31306d |
* License along with this library; if not, write to the Free Software
|
|
Packit Service |
31306d |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
Packit Service |
31306d |
*/
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#ifndef DH_H_
|
|
Packit Service |
31306d |
#define DH_H_
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#include "config.h"
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#include "libssh/crypto.h"
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
struct dh_ctx;
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#define DH_CLIENT_KEYPAIR 0
|
|
Packit Service |
31306d |
#define DH_SERVER_KEYPAIR 1
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/* functions implemented by crypto backends */
|
|
Packit Service |
31306d |
int ssh_dh_init_common(struct ssh_crypto_struct *crypto);
|
|
Packit Service |
31306d |
void ssh_dh_cleanup(struct ssh_crypto_struct *crypto);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
int ssh_dh_get_parameters(struct dh_ctx *ctx,
|
|
Packit Service |
31306d |
const_bignum *modulus, const_bignum *generator);
|
|
Packit Service |
31306d |
int ssh_dh_set_parameters(struct dh_ctx *ctx,
|
|
Packit Service |
31306d |
const bignum modulus, const bignum generator);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
int ssh_dh_keypair_gen_keys(struct dh_ctx *ctx, int peer);
|
|
Packit Service |
31306d |
int ssh_dh_keypair_get_keys(struct dh_ctx *ctx, int peer,
|
|
Packit Service |
31306d |
const_bignum *priv, const_bignum *pub);
|
|
Packit Service |
31306d |
int ssh_dh_keypair_set_keys(struct dh_ctx *ctx, int peer,
|
|
Packit Service |
31306d |
const bignum priv, const bignum pub);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
int ssh_dh_compute_shared_secret(struct dh_ctx *ctx, int local, int remote,
|
|
Packit Service |
31306d |
bignum *dest);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
void ssh_dh_debug_crypto(struct ssh_crypto_struct *c);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
/* common functions */
|
|
Packit Service |
31306d |
int ssh_dh_init(void);
|
|
Packit Service |
31306d |
void ssh_dh_finalize(void);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
int ssh_dh_import_next_pubkey_blob(ssh_session session,
|
|
Packit Service |
31306d |
ssh_string pubkey_blob);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
ssh_key ssh_dh_get_current_server_publickey(ssh_session session);
|
|
Packit Service |
31306d |
int ssh_dh_get_current_server_publickey_blob(ssh_session session,
|
|
Packit Service |
31306d |
ssh_string *pubkey_blob);
|
|
Packit Service |
31306d |
ssh_key ssh_dh_get_next_server_publickey(ssh_session session);
|
|
Packit Service |
31306d |
int ssh_dh_get_next_server_publickey_blob(ssh_session session,
|
|
Packit Service |
31306d |
ssh_string *pubkey_blob);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
int ssh_client_dh_init(ssh_session session);
|
|
Packit Service |
31306d |
#ifdef WITH_SERVER
|
|
Packit Service |
31306d |
void ssh_server_dh_init(ssh_session session);
|
|
Packit Service |
31306d |
#endif /* WITH_SERVER */
|
|
Packit Service |
31306d |
int ssh_server_dh_process_init(ssh_session session, ssh_buffer packet);
|
|
Packit Service |
31306d |
int ssh_fallback_group(uint32_t pmax, bignum *p, bignum *g);
|
|
Packit Service |
31306d |
bool ssh_dh_is_known_group(bignum modulus, bignum generator);
|
|
Packit Service |
31306d |
|
|
Packit Service |
31306d |
#endif /* DH_H_ */
|