ARM Shanghai IoT Team (Internal) / newMiniTLS-GPL

Fork of MiniTLS-GPL by Donatien Garnier

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers crypto_rsa.h Source File

crypto_rsa.h

Go to the documentation of this file.
00001 /*
00002 MiniTLS - A super trimmed down TLS/SSL Library for embedded devices
00003 Author: Donatien Garnier
00004 Copyright (C) 2013-2014 AppNearMe Ltd
00005 
00006 This program is free software; you can redistribute it and/or
00007 modify it under the terms of the GNU General Public License
00008 as published by the Free Software Foundation; either version 2
00009 of the License, or (at your option) any later version.
00010 
00011 This program 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
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with this program; if not, write to the Free Software
00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00019 *//**
00020  * \file crypto_rsa.h
00021  * \copyright Copyright (c) AppNearMe Ltd 2014
00022  * \author Donatien Garnier
00023  */
00024 
00025 //This module has been adapted from libtomcrypt (http://libtom.org/)
00026 
00027 #ifndef CRYPTO_RSA_H_
00028 #define CRYPTO_RSA_H_
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033 
00034 #include "core/fwk.h"
00035 #include "inc/minitls_errors.h"
00036 #include "inc/minitls_config.h"
00037 #include "crypto_prng.h"
00038 #include "crypto_math.h"
00039 
00040 typedef struct __crypto_rsa_public_key
00041 {
00042   fp_int N;
00043   fp_int e;
00044 } crypto_rsa_public_key_t;
00045 
00046 minitls_err_t crypto_rsa_pkcs1_import(crypto_rsa_public_key_t* key, const uint8_t* pkcs1, size_t size);
00047 minitls_err_t crypto_rsa_encrypt(const crypto_rsa_public_key_t* public_key,
00048     uint8_t* plaintext, size_t plaintext_size,
00049     uint8_t* secret, size_t max_secret_size, size_t* secret_size, crypto_prng_t* prng);
00050 
00051 #ifdef __cplusplus
00052 }
00053 #endif
00054 
00055 #endif /* CRYPTO_RSA_H_ */