ssh lib

Dependents:   OS

Committer:
sPymbed
Date:
Mon Nov 25 14:23:49 2019 +0000
Revision:
1:e4ea39eba2fb
Parent:
0:1387ff3eed4a
improved

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sPymbed 0:1387ff3eed4a 1 /* sp.h
sPymbed 0:1387ff3eed4a 2 *
sPymbed 0:1387ff3eed4a 3 * Copyright (C) 2006-2017 wolfSSL Inc.
sPymbed 0:1387ff3eed4a 4 *
sPymbed 0:1387ff3eed4a 5 * This file is part of wolfSSL.
sPymbed 0:1387ff3eed4a 6 *
sPymbed 0:1387ff3eed4a 7 * wolfSSL is free software; you can redistribute it and/or modify
sPymbed 0:1387ff3eed4a 8 * it under the terms of the GNU General Public License as published by
sPymbed 0:1387ff3eed4a 9 * the Free Software Foundation; either version 2 of the License, or
sPymbed 0:1387ff3eed4a 10 * (at your option) any later version.
sPymbed 0:1387ff3eed4a 11 *
sPymbed 0:1387ff3eed4a 12 * wolfSSL is distributed in the hope that it will be useful,
sPymbed 0:1387ff3eed4a 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
sPymbed 0:1387ff3eed4a 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
sPymbed 0:1387ff3eed4a 15 * GNU General Public License for more details.
sPymbed 0:1387ff3eed4a 16 *
sPymbed 0:1387ff3eed4a 17 * You should have received a copy of the GNU General Public License
sPymbed 0:1387ff3eed4a 18 * along with this program; if not, write to the Free Software
sPymbed 0:1387ff3eed4a 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
sPymbed 0:1387ff3eed4a 20 */
sPymbed 0:1387ff3eed4a 21
sPymbed 0:1387ff3eed4a 22
sPymbed 0:1387ff3eed4a 23 #ifndef WOLF_CRYPT_SP_H
sPymbed 0:1387ff3eed4a 24 #define WOLF_CRYPT_SP_H
sPymbed 0:1387ff3eed4a 25
sPymbed 0:1387ff3eed4a 26 #include <wolfcrypt/types.h>
sPymbed 0:1387ff3eed4a 27
sPymbed 0:1387ff3eed4a 28 #if defined(WOLFSSL_HAVE_SP_RSA) || defined(WOLFSSL_HAVE_SP_DH) || \
sPymbed 0:1387ff3eed4a 29 defined(WOLFSSL_HAVE_SP_ECC)
sPymbed 0:1387ff3eed4a 30
sPymbed 0:1387ff3eed4a 31 #include <stdint.h>
sPymbed 0:1387ff3eed4a 32
sPymbed 0:1387ff3eed4a 33 #include <wolfcrypt/integer.h>
sPymbed 0:1387ff3eed4a 34 #include <wolfcrypt/sp_int.h>
sPymbed 0:1387ff3eed4a 35
sPymbed 0:1387ff3eed4a 36 #include <wolfcrypt/ecc.h>
sPymbed 0:1387ff3eed4a 37
sPymbed 0:1387ff3eed4a 38 #if defined(_MSC_VER)
sPymbed 0:1387ff3eed4a 39 #define SP_NOINLINE __declspec(noinline)
sPymbed 0:1387ff3eed4a 40 #elif defined(__GNUC__)
sPymbed 0:1387ff3eed4a 41 #define SP_NOINLINE __attribute__((noinline))
sPymbed 0:1387ff3eed4a 42 #else
sPymbed 0:1387ff3eed4a 43 #define 5P_NOINLINE
sPymbed 0:1387ff3eed4a 44 #endif
sPymbed 0:1387ff3eed4a 45
sPymbed 0:1387ff3eed4a 46
sPymbed 0:1387ff3eed4a 47 #ifdef __cplusplus
sPymbed 0:1387ff3eed4a 48 extern "C" {
sPymbed 0:1387ff3eed4a 49 #endif
sPymbed 0:1387ff3eed4a 50
sPymbed 0:1387ff3eed4a 51 #ifdef WOLFSSL_HAVE_SP_RSA
sPymbed 0:1387ff3eed4a 52
sPymbed 0:1387ff3eed4a 53 WOLFSSL_LOCAL int sp_RsaPublic_2048(const byte* in, word32 inLen,
sPymbed 0:1387ff3eed4a 54 mp_int* em, mp_int* mm, byte* out, word32* outLen);
sPymbed 0:1387ff3eed4a 55 WOLFSSL_LOCAL int sp_RsaPrivate_2048(const byte* in, word32 inLen,
sPymbed 0:1387ff3eed4a 56 mp_int* dm, mp_int* pm, mp_int* qm, mp_int* dpm, mp_int* dqm, mp_int* qim,
sPymbed 0:1387ff3eed4a 57 mp_int* mm, byte* out, word32* outLen);
sPymbed 0:1387ff3eed4a 58
sPymbed 0:1387ff3eed4a 59 WOLFSSL_LOCAL int sp_RsaPublic_3072(const byte* in, word32 inLen,
sPymbed 0:1387ff3eed4a 60 mp_int* em, mp_int* mm, byte* out, word32* outLen);
sPymbed 0:1387ff3eed4a 61 WOLFSSL_LOCAL int sp_RsaPrivate_3072(const byte* in, word32 inLen,
sPymbed 0:1387ff3eed4a 62 mp_int* dm, mp_int* pm, mp_int* qm, mp_int* dpm, mp_int* dqm, mp_int* qim,
sPymbed 0:1387ff3eed4a 63 mp_int* mm, byte* out, word32* outLen);
sPymbed 0:1387ff3eed4a 64
sPymbed 0:1387ff3eed4a 65 #endif /* WOLFSSL_HAVE_SP_RSA */
sPymbed 0:1387ff3eed4a 66
sPymbed 0:1387ff3eed4a 67 #ifdef WOLFSSL_HAVE_SP_DH
sPymbed 0:1387ff3eed4a 68
sPymbed 0:1387ff3eed4a 69 WOLFSSL_LOCAL int sp_ModExp_2048(mp_int* base, mp_int* exp, mp_int* mod,
sPymbed 0:1387ff3eed4a 70 mp_int* res);
sPymbed 0:1387ff3eed4a 71 WOLFSSL_LOCAL int sp_ModExp_3072(mp_int* base, mp_int* exp, mp_int* mod,
sPymbed 0:1387ff3eed4a 72 mp_int* res);
sPymbed 0:1387ff3eed4a 73
sPymbed 0:1387ff3eed4a 74 WOLFSSL_LOCAL int sp_DhExp_2048(mp_int* base, const byte* exp, word32 expLen,
sPymbed 0:1387ff3eed4a 75 mp_int* mod, byte* out, word32* outLen);
sPymbed 0:1387ff3eed4a 76 WOLFSSL_LOCAL int sp_DhExp_3072(mp_int* base, const byte* exp, word32 expLen,
sPymbed 0:1387ff3eed4a 77 mp_int* mod, byte* out, word32* outLen);
sPymbed 0:1387ff3eed4a 78
sPymbed 0:1387ff3eed4a 79 #endif /* WOLFSSL_HAVE_SP_DH */
sPymbed 0:1387ff3eed4a 80
sPymbed 0:1387ff3eed4a 81 #ifdef WOLFSSL_HAVE_SP_ECC
sPymbed 0:1387ff3eed4a 82
sPymbed 0:1387ff3eed4a 83 int sp_ecc_mulmod_256(mp_int* km, ecc_point* gm, ecc_point* rm, int map,
sPymbed 0:1387ff3eed4a 84 void* heap);
sPymbed 0:1387ff3eed4a 85 int sp_ecc_mulmod_base_256(mp_int* km, ecc_point* rm, int map, void* heap);
sPymbed 0:1387ff3eed4a 86
sPymbed 0:1387ff3eed4a 87 int sp_ecc_make_key_256(WC_RNG* rng, mp_int* priv, ecc_point* pub, void* heap);
sPymbed 0:1387ff3eed4a 88 int sp_ecc_secret_gen_256(mp_int* priv, ecc_point* pub, byte* out,
sPymbed 0:1387ff3eed4a 89 word32* outlen, void* heap);
sPymbed 0:1387ff3eed4a 90 int sp_ecc_sign_256(const byte* hash, word32 hashLen, WC_RNG* rng, mp_int* priv,
sPymbed 0:1387ff3eed4a 91 mp_int* rm, mp_int* sm, void* heap);
sPymbed 0:1387ff3eed4a 92 int sp_ecc_verify_256(const byte* hash, word32 hashLen, mp_int* pX, mp_int* pY,
sPymbed 0:1387ff3eed4a 93 mp_int* pZ, mp_int* r, mp_int* sm, int* res, void* heap);
sPymbed 0:1387ff3eed4a 94 int sp_ecc_is_point_256(mp_int* pX, mp_int* pY);
sPymbed 0:1387ff3eed4a 95 int sp_ecc_check_key_256(mp_int* pX, mp_int* pY, mp_int* privm, void* heap);
sPymbed 0:1387ff3eed4a 96 int sp_ecc_proj_add_point_256(mp_int* pX, mp_int* pY, mp_int* pZ,
sPymbed 0:1387ff3eed4a 97 mp_int* qX, mp_int* qY, mp_int* qZ,
sPymbed 0:1387ff3eed4a 98 mp_int* rX, mp_int* rY, mp_int* rZ);
sPymbed 0:1387ff3eed4a 99 int sp_ecc_proj_dbl_point_256(mp_int* pX, mp_int* pY, mp_int* pZ,
sPymbed 0:1387ff3eed4a 100 mp_int* rX, mp_int* rY, mp_int* rZ);
sPymbed 0:1387ff3eed4a 101 int sp_ecc_map_256(mp_int* pX, mp_int* pY, mp_int* pZ);
sPymbed 0:1387ff3eed4a 102 int sp_ecc_uncompress_256(mp_int* xm, int odd, mp_int* ym);
sPymbed 0:1387ff3eed4a 103
sPymbed 0:1387ff3eed4a 104 #endif /*ifdef WOLFSSL_HAVE_SP_ECC */
sPymbed 0:1387ff3eed4a 105
sPymbed 0:1387ff3eed4a 106
sPymbed 0:1387ff3eed4a 107 #ifdef __cplusplus
sPymbed 0:1387ff3eed4a 108 } /* extern "C" */
sPymbed 0:1387ff3eed4a 109 #endif
sPymbed 0:1387ff3eed4a 110
sPymbed 0:1387ff3eed4a 111 #endif /* WOLFSSL_HAVE_SP_RSA || WOLFSSL_HAVE_SP_DH || WOLFSSL_HAVE_SP_ECC */
sPymbed 0:1387ff3eed4a 112
sPymbed 0:1387ff3eed4a 113 #endif /* WOLF_CRYPT_SP_H */
sPymbed 0:1387ff3eed4a 114
sPymbed 0:1387ff3eed4a 115