|
libssh
0.7.2
|
00001 /* 00002 * This file is part of the SSH Library 00003 * 00004 * Copyright (c) 2013 by Aris Adamantiadis <aris@badcode.be> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation, 00009 * version 2.1 of the License. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 #ifndef CURVE25519_H_ 00022 #define CURVE25519_H_ 00023 00024 #include "config.h" 00025 #include "libssh.h" 00026 00027 #ifdef WITH_NACL 00028 00029 #include <nacl/crypto_scalarmult_curve25519.h> 00030 #define CURVE25519_PUBKEY_SIZE crypto_scalarmult_curve25519_BYTES 00031 #define CURVE25519_PRIVKEY_SIZE crypto_scalarmult_curve25519_SCALARBYTES 00032 #define crypto_scalarmult_base crypto_scalarmult_curve25519_base 00033 #define crypto_scalarmult crypto_scalarmult_curve25519 00034 #else 00035 00036 #define CURVE25519_PUBKEY_SIZE 32 00037 #define CURVE25519_PRIVKEY_SIZE 32 00038 int crypto_scalarmult_base(unsigned char *q, const unsigned char *n); 00039 int crypto_scalarmult(unsigned char *q, const unsigned char *n, const unsigned char *p); 00040 #endif /* WITH_NACL */ 00041 00042 #ifdef HAVE_ECC 00043 #define HAVE_CURVE25519 1 00044 #endif 00045 00046 typedef unsigned char ssh_curve25519_pubkey[CURVE25519_PUBKEY_SIZE]; 00047 typedef unsigned char ssh_curve25519_privkey[CURVE25519_PRIVKEY_SIZE]; 00048 00049 00050 int ssh_client_curve25519_init(ssh_session session); 00051 int ssh_client_curve25519_reply(ssh_session session, ssh_buffer packet); 00052 00053 #ifdef WITH_SERVER 00054 int ssh_server_curve25519_init(ssh_session session, ssh_buffer packet); 00055 #endif /* WITH_SERVER */ 00056 00057 #endif /* CURVE25519_H_ */
1.7.5.1