base64.h | base64.h | |||
---|---|---|---|---|
skipping to change at line 66 | skipping to change at line 66 | |||
/** | /** | |||
* \brief Decode a base64-formatted buffer | * \brief Decode a base64-formatted buffer | |||
* | * | |||
* \param dst destination buffer | * \param dst destination buffer | |||
* \param dlen size of the buffer | * \param dlen size of the buffer | |||
* \param src source buffer | * \param src source buffer | |||
* \param slen amount of data to be decoded | * \param slen amount of data to be decoded | |||
* | * | |||
* \return 0 if successful, POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL, o r | * \return 0 if successful, POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL, o r | |||
* POLARSSL_ERR_BASE64_INVALID_DATA if the input data is no | * POLARSSL_ERR_BASE64_INVALID_CHARACTER if the input data | |||
t | is | |||
* correct. *dlen is always updated to reflect the amount | * not correct. *dlen is always updated to reflect the amou | |||
nt | ||||
* of data that has (or would have) been written. | * of data that has (or would have) been written. | |||
* | * | |||
* \note Call this function with *dlen = 0 to obtain the | * \note Call this function with *dlen = 0 to obtain the | |||
* required buffer size in *dlen | * required buffer size in *dlen | |||
*/ | */ | |||
int base64_decode( unsigned char *dst, size_t *dlen, | int base64_decode( unsigned char *dst, size_t *dlen, | |||
const unsigned char *src, size_t slen ); | const unsigned char *src, size_t slen ); | |||
/** | /** | |||
* \brief Checkup routine | * \brief Checkup routine | |||
End of changes. 1 change blocks. | ||||
3 lines changed or deleted | 4 lines changed or added | |||
bignum.h | bignum.h | |||
---|---|---|---|---|
skipping to change at line 45 | skipping to change at line 45 | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
#include <basetsd.h> | #include <basetsd.h> | |||
#if (_MSC_VER <= 1200) | #if (_MSC_VER <= 1200) | |||
typedef signed short int16_t; | typedef signed short int16_t; | |||
typedef unsigned short uint16_t; | typedef unsigned short uint16_t; | |||
#else | #else | |||
typedef INT16 int16_t; | typedef INT16 int16_t; | |||
typedef UINT16 uint16_t; | typedef UINT16 uint16_t; | |||
#endif | #endif | |||
typedef INT32 int32_t; | typedef INT32 int32_t; | |||
typedef INT64 int64_t; | ||||
typedef UINT32 uint32_t; | typedef UINT32 uint32_t; | |||
typedef UINT64 uint64_t; | typedef UINT64 uint64_t; | |||
#else | #else | |||
#include <inttypes.h> | #include <inttypes.h> | |||
#endif | #endif | |||
#define POLARSSL_ERR_MPI_FILE_IO_ERROR -0x0002 /**< An error occurred while reading from or writing to a file. */ | #define POLARSSL_ERR_MPI_FILE_IO_ERROR -0x0002 /**< An error occurred while reading from or writing to a file. */ | |||
#define POLARSSL_ERR_MPI_BAD_INPUT_DATA -0x0004 /**< Ba d input parameters to function. */ | #define POLARSSL_ERR_MPI_BAD_INPUT_DATA -0x0004 /**< Ba d input parameters to function. */ | |||
#define POLARSSL_ERR_MPI_INVALID_CHARACTER -0x0006 /**< Th ere is an invalid character in the digit string. */ | #define POLARSSL_ERR_MPI_INVALID_CHARACTER -0x0006 /**< Th ere is an invalid character in the digit string. */ | |||
#define POLARSSL_ERR_MPI_BUFFER_TOO_SMALL -0x0008 /**< Th e buffer is too small to write to. */ | #define POLARSSL_ERR_MPI_BUFFER_TOO_SMALL -0x0008 /**< Th e buffer is too small to write to. */ | |||
skipping to change at line 125 | skipping to change at line 126 | |||
typedef unsigned char t_uint; | typedef unsigned char t_uint; | |||
typedef uint16_t t_udbl; | typedef uint16_t t_udbl; | |||
#define POLARSSL_HAVE_UDBL | #define POLARSSL_HAVE_UDBL | |||
#else | #else | |||
#if defined(POLARSSL_HAVE_INT16) | #if defined(POLARSSL_HAVE_INT16) | |||
typedef int16_t t_sint; | typedef int16_t t_sint; | |||
typedef uint16_t t_uint; | typedef uint16_t t_uint; | |||
typedef uint32_t t_udbl; | typedef uint32_t t_udbl; | |||
#define POLARSSL_HAVE_UDBL | #define POLARSSL_HAVE_UDBL | |||
#else | #else | |||
#if ( defined(__MSC_VER) && defined(_M_AMD64) ) | #if ( defined(_MSC_VER) && defined(_M_AMD64) ) | |||
typedef int64_t t_sint; | typedef int64_t t_sint; | |||
typedef uint64_t t_uint; | typedef uint64_t t_uint; | |||
#else | #else | |||
#if ( defined(__GNUC__) && ( \ | #if ( defined(__GNUC__) && ( \ | |||
defined(__amd64__) || defined(__x86_64__) || \ | defined(__amd64__) || defined(__x86_64__) || \ | |||
defined(__ppc64__) || defined(__powerpc64__) || \ | defined(__ppc64__) || defined(__powerpc64__) || \ | |||
defined(__ia64__) || defined(__alpha__) || \ | defined(__ia64__) || defined(__alpha__) || \ | |||
(defined(__sparc__) && defined(__arch64__)) || \ | (defined(__sparc__) && defined(__arch64__)) || \ | |||
defined(__s390x__) ) ) | defined(__s390x__) ) ) | |||
typedef int64_t t_sint; | typedef int64_t t_sint; | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
bn_mul.h | bn_mul.h | |||
---|---|---|---|---|
skipping to change at line 554 | skipping to change at line 554 | |||
asm( "st.a %0, %%a2 " : "=m" (s) :: \ | asm( "st.a %0, %%a2 " : "=m" (s) :: \ | |||
"d0", "d1", "e2", "d4", "a2", "a3" ); | "d0", "d1", "e2", "d4", "a2", "a3" ); | |||
#endif /* TriCore */ | #endif /* TriCore */ | |||
#if defined(__arm__) | #if defined(__arm__) | |||
#if defined(__thumb__) | #if defined(__thumb__) | |||
#define MULADDC_INIT \ | #define MULADDC_INIT \ | |||
asm( "ldr r0, %0 " :: "m" (s)); \ | asm( \ | |||
asm( "ldr r1, %0 " :: "m" (d)); \ | " \ | |||
asm( "ldr r2, %0 " :: "m" (c)); \ | ldr r0, %3; \ | |||
asm( "ldr r3, %0 " :: "m" (b)); \ | ldr r1, %4; \ | |||
asm( "lsr r7, r3, #16 " ); \ | ldr r2, %5; \ | |||
asm( "mov r9, r7 " ); \ | ldr r3, %6; \ | |||
asm( "lsl r7, r3, #16 " ); \ | lsr r7, r3, #16; \ | |||
asm( "lsr r7, r7, #16 " ); \ | mov r9, r7; \ | |||
asm( "mov r8, r7 " ); | lsl r7, r3, #16; \ | |||
lsr r7, r7, #16; \ | ||||
mov r8, r7; \ | ||||
" | ||||
#define MULADDC_CORE \ | #define MULADDC_CORE \ | |||
asm( "ldmia r0!, {r6} " ); \ | " \ | |||
asm( "lsr r7, r6, #16 " ); \ | ldmia r0!, {r6}; \ | |||
asm( "lsl r6, r6, #16 " ); \ | lsr r7, r6, #16; \ | |||
asm( "lsr r6, r6, #16 " ); \ | lsl r6, r6, #16; \ | |||
asm( "mov r4, r8 " ); \ | lsr r6, r6, #16; \ | |||
asm( "mul r4, r6 " ); \ | mov r4, r8; \ | |||
asm( "mov r3, r9 " ); \ | mul r4, r6; \ | |||
asm( "mul r6, r3 " ); \ | mov r3, r9; \ | |||
asm( "mov r5, r9 " ); \ | mul r6, r3; \ | |||
asm( "mul r5, r7 " ); \ | mov r5, r9; \ | |||
asm( "mov r3, r8 " ); \ | mul r5, r7; \ | |||
asm( "mul r7, r3 " ); \ | mov r3, r8; \ | |||
asm( "lsr r3, r6, #16 " ); \ | mul r7, r3; \ | |||
asm( "add r5, r5, r3 " ); \ | lsr r3, r6, #16; \ | |||
asm( "lsr r3, r7, #16 " ); \ | add r5, r5, r3; \ | |||
asm( "add r5, r5, r3 " ); \ | lsr r3, r7, #16; \ | |||
asm( "add r4, r4, r2 " ); \ | add r5, r5, r3; \ | |||
asm( "mov r2, #0 " ); \ | add r4, r4, r2; \ | |||
asm( "adc r5, r2 " ); \ | mov r2, #0; \ | |||
asm( "lsl r3, r6, #16 " ); \ | adc r5, r2; \ | |||
asm( "add r4, r4, r3 " ); \ | lsl r3, r6, #16; \ | |||
asm( "adc r5, r2 " ); \ | add r4, r4, r3; \ | |||
asm( "lsl r3, r7, #16 " ); \ | adc r5, r2; \ | |||
asm( "add r4, r4, r3 " ); \ | lsl r3, r7, #16; \ | |||
asm( "adc r5, r2 " ); \ | add r4, r4, r3; \ | |||
asm( "ldr r3, [r1] " ); \ | adc r5, r2; \ | |||
asm( "add r4, r4, r3 " ); \ | ldr r3, [r1]; \ | |||
asm( "adc r2, r5 " ); \ | add r4, r4, r3; \ | |||
asm( "stmia r1!, {r4} " ); | adc r2, r5; \ | |||
stmia r1!, {r4}; \ | ||||
" | ||||
#define MULADDC_STOP \ | #define MULADDC_STOP \ | |||
asm( "str r2, %0 " : "=m" (c)); \ | " \ | |||
asm( "str r1, %0 " : "=m" (d)); \ | str r2, %0; \ | |||
asm( "str r0, %0 " : "=m" (s) :: \ | str r1, %1; \ | |||
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9" ); | str r0, %2; \ | |||
" \ | ||||
: "=m" (c), "=m" (d), "=m" (s) \ | ||||
: "m" (s), "m" (d), "m" (c), "m" (b) \ | ||||
: "r0", "r1", "r2", "r3", "r4", "r5", \ | ||||
"r6", "r7", "r8", "r9" \ | ||||
); | ||||
#else | #else | |||
#define MULADDC_INIT \ | #define MULADDC_INIT \ | |||
asm( "ldr r0, %0 " :: "m" (s)); \ | asm( \ | |||
asm( "ldr r1, %0 " :: "m" (d)); \ | " \ | |||
asm( "ldr r2, %0 " :: "m" (c)); \ | ldr r0, %3; \ | |||
asm( "ldr r3, %0 " :: "m" (b)); | ldr r1, %4; \ | |||
ldr r2, %5; \ | ||||
ldr r3, %6; \ | ||||
" | ||||
#define MULADDC_CORE \ | #define MULADDC_CORE \ | |||
asm( "ldr r4, [r0], #4 " ); \ | " \ | |||
asm( "mov r5, #0 " ); \ | ldr r4, [r0], #4; \ | |||
asm( "ldr r6, [r1] " ); \ | mov r5, #0; \ | |||
asm( "umlal r2, r5, r3, r4 " ); \ | ldr r6, [r1]; \ | |||
asm( "adds r7, r6, r2 " ); \ | umlal r2, r5, r3, r4; \ | |||
asm( "adc r2, r5, #0 " ); \ | adds r7, r6, r2; \ | |||
asm( "str r7, [r1], #4 " ); | adc r2, r5, #0; \ | |||
str r7, [r1], #4; \ | ||||
" | ||||
#define MULADDC_STOP \ | #define MULADDC_STOP \ | |||
asm( "str r2, %0 " : "=m" (c)); \ | " \ | |||
asm( "str r1, %0 " : "=m" (d)); \ | str r2, %0; \ | |||
asm( "str r0, %0 " : "=m" (s) :: \ | str r1, %1; \ | |||
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7" ); | str r0, %2; \ | |||
" \ | ||||
: "=m" (c), "=m" (d), "=m" (s) \ | ||||
: "m" (s), "m" (d), "m" (c), "m" (b) \ | ||||
: "r0", "r1", "r2", "r3", "r4", "r5", \ | ||||
"r6", "r7" \ | ||||
); | ||||
#endif /* Thumb */ | #endif /* Thumb */ | |||
#endif /* ARMv3 */ | #endif /* ARMv3 */ | |||
#if defined(__alpha__) | #if defined(__alpha__) | |||
#define MULADDC_INIT \ | #define MULADDC_INIT \ | |||
asm( "ldq $1, %0 " :: "m" (s)); \ | asm( "ldq $1, %0 " :: "m" (s)); \ | |||
asm( "ldq $2, %0 " :: "m" (d)); \ | asm( "ldq $2, %0 " :: "m" (d)); \ | |||
End of changes. 6 change blocks. | ||||
57 lines changed or deleted | 79 lines changed or added | |||
config.h | config.h | |||
---|---|---|---|---|
skipping to change at line 282 | skipping to change at line 282 | |||
* \def POLARSSL_SSL_HW_RECORD_ACCEL | * \def POLARSSL_SSL_HW_RECORD_ACCEL | |||
* | * | |||
* Enable hooking functions in SSL module for hardware acceleration of | * Enable hooking functions in SSL module for hardware acceleration of | |||
* individual records. | * individual records. | |||
* | * | |||
* Uncomment this macro to enable hooking functions. | * Uncomment this macro to enable hooking functions. | |||
#define POLARSSL_SSL_HW_RECORD_ACCEL | #define POLARSSL_SSL_HW_RECORD_ACCEL | |||
*/ | */ | |||
/** | /** | |||
* \def POLARSSL_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO | ||||
* | ||||
* Enable support for receiving and parsing SSLv2 Client Hello messages for | ||||
the | ||||
* SSL Server module (POLARSSL_SSL_SRV_C) | ||||
* | ||||
* Comment this macro to disable support for SSLv2 Client Hello messages. | ||||
*/ | ||||
#define POLARSSL_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO | ||||
/** | ||||
* \def POLARSSL_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION | * \def POLARSSL_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION | |||
* | * | |||
* If set, the X509 parser will not break-off when parsing an X509 certific ate | * If set, the X509 parser will not break-off when parsing an X509 certific ate | |||
* and encountering an unknown critical extension. | * and encountering an unknown critical extension. | |||
* | * | |||
* Uncomment to prevent an error. | * Uncomment to prevent an error. | |||
* | * | |||
#define POLARSSL_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION | #define POLARSSL_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION | |||
*/ | */ | |||
skipping to change at line 338 | skipping to change at line 348 | |||
* TLS_RSA_WITH_AES_128_CBC_SHA | * TLS_RSA_WITH_AES_128_CBC_SHA | |||
* TLS_RSA_WITH_AES_256_CBC_SHA | * TLS_RSA_WITH_AES_256_CBC_SHA | |||
* TLS_DHE_RSA_WITH_AES_128_CBC_SHA | * TLS_DHE_RSA_WITH_AES_128_CBC_SHA | |||
* TLS_DHE_RSA_WITH_AES_256_CBC_SHA | * TLS_DHE_RSA_WITH_AES_256_CBC_SHA | |||
* TLS_RSA_WITH_AES_128_CBC_SHA256 | * TLS_RSA_WITH_AES_128_CBC_SHA256 | |||
* TLS_RSA_WITH_AES_256_CBC_SHA256 | * TLS_RSA_WITH_AES_256_CBC_SHA256 | |||
* TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 | * TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 | |||
* TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 | * TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 | |||
* TLS_RSA_WITH_AES_128_GCM_SHA256 | * TLS_RSA_WITH_AES_128_GCM_SHA256 | |||
* TLS_RSA_WITH_AES_256_GCM_SHA384 | * TLS_RSA_WITH_AES_256_GCM_SHA384 | |||
* | ||||
* PEM uses AES for decrypting encrypted keys. | ||||
*/ | */ | |||
#define POLARSSL_AES_C | #define POLARSSL_AES_C | |||
/** | /** | |||
* \def POLARSSL_ARC4_C | * \def POLARSSL_ARC4_C | |||
* | * | |||
* Enable the ARCFOUR stream cipher. | * Enable the ARCFOUR stream cipher. | |||
* | * | |||
* Module: library/arc4.c | * Module: library/arc4.c | |||
* Caller: library/ssl_tls.c | * Caller: library/ssl_tls.c | |||
skipping to change at line 489 | skipping to change at line 501 | |||
* This module provides debugging functions. | * This module provides debugging functions. | |||
*/ | */ | |||
#define POLARSSL_DEBUG_C | #define POLARSSL_DEBUG_C | |||
/** | /** | |||
* \def POLARSSL_DES_C | * \def POLARSSL_DES_C | |||
* | * | |||
* Enable the DES block cipher. | * Enable the DES block cipher. | |||
* | * | |||
* Module: library/des.c | * Module: library/des.c | |||
* Caller: library/ssl_tls.c | * Caller: library/pem.c | |||
* library/ssl_tls.c | ||||
* | * | |||
* This module enables the following ciphersuites (if other requisites are | * This module enables the following ciphersuites (if other requisites are | |||
* enabled as well): | * enabled as well): | |||
* TLS_RSA_WITH_3DES_EDE_CBC_SHA | * TLS_RSA_WITH_3DES_EDE_CBC_SHA | |||
* TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA | * TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA | |||
* | ||||
* PEM uses DES/3DES for decrypting encrypted keys. | ||||
*/ | */ | |||
#define POLARSSL_DES_C | #define POLARSSL_DES_C | |||
/** | /** | |||
* \def POLARSSL_DHM_C | * \def POLARSSL_DHM_C | |||
* | * | |||
* Enable the Diffie-Hellman-Merkle key exchange. | * Enable the Diffie-Hellman-Merkle key exchange. | |||
* | * | |||
* Module: library/dhm.c | * Module: library/dhm.c | |||
* Caller: library/ssl_cli.c | * Caller: library/ssl_cli.c | |||
skipping to change at line 624 | skipping to change at line 639 | |||
* | * | |||
#define POLARSSL_MD4_C | #define POLARSSL_MD4_C | |||
*/ | */ | |||
/** | /** | |||
* \def POLARSSL_MD5_C | * \def POLARSSL_MD5_C | |||
* | * | |||
* Enable the MD5 hash algorithm | * Enable the MD5 hash algorithm | |||
* | * | |||
* Module: library/md5.c | * Module: library/md5.c | |||
* Caller: library/ssl_tls.c | * Caller: library/pem.c | |||
* library/ssl_tls.c | ||||
* library/x509parse.c | * library/x509parse.c | |||
* | * | |||
* This module is required for SSL/TLS and X.509. | * This module is required for SSL/TLS and X.509. | |||
* PEM uses MD5 for decrypting encrypted keys. | ||||
*/ | */ | |||
#define POLARSSL_MD5_C | #define POLARSSL_MD5_C | |||
/** | /** | |||
* \def POLARSSL_NET_C | * \def POLARSSL_NET_C | |||
* | * | |||
* Enable the TCP/IP networking routines. | * Enable the TCP/IP networking routines. | |||
* | * | |||
* Module: library/net.c | * Module: library/net.c | |||
* Caller: | * Caller: | |||
End of changes. 6 change blocks. | ||||
2 lines changed or deleted | 20 lines changed or added | |||
md5.h | md5.h | |||
---|---|---|---|---|
skipping to change at line 157 | skipping to change at line 157 | |||
const unsigned char *input, size_t ilen, | const unsigned char *input, size_t ilen, | |||
unsigned char output[16] ); | unsigned char output[16] ); | |||
/** | /** | |||
* \brief Checkup routine | * \brief Checkup routine | |||
* | * | |||
* \return 0 if successful, or 1 if the test failed | * \return 0 if successful, or 1 if the test failed | |||
*/ | */ | |||
int md5_self_test( int verbose ); | int md5_self_test( int verbose ); | |||
/* Internal use */ | ||||
void md5_process( md5_context *ctx, const unsigned char data[64] ); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* md5.h */ | #endif /* md5.h */ | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 3 lines changed or added | |||
rsa.h | rsa.h | |||
---|---|---|---|---|
skipping to change at line 258 | skipping to change at line 258 | |||
* \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code | * \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code | |||
* | * | |||
* \note The input and output buffers must be large | * \note The input and output buffers must be large | |||
* enough (eg. 128 bytes if RSA-1024 is used). | * enough (eg. 128 bytes if RSA-1024 is used). | |||
*/ | */ | |||
int rsa_private( rsa_context *ctx, | int rsa_private( rsa_context *ctx, | |||
const unsigned char *input, | const unsigned char *input, | |||
unsigned char *output ); | unsigned char *output ); | |||
/** | /** | |||
* \brief Add the message padding, then do an RSA operation | * \brief Generic wrapper to perform a PKCS#1 encryption using the | |||
* mode from the context. Add the message padding, then do | ||||
an | ||||
* RSA operation. | ||||
* | * | |||
* \param ctx RSA context | * \param ctx RSA context | |||
* \param f_rng RNG function (Needed for padding and PKCS#1 v2.1 encodin g) | * \param f_rng RNG function (Needed for padding and PKCS#1 v2.1 encodin g) | |||
* \param p_rng RNG parameter | * \param p_rng RNG parameter | |||
* \param mode RSA_PUBLIC or RSA_PRIVATE | * \param mode RSA_PUBLIC or RSA_PRIVATE | |||
* \param ilen contains the plaintext length | * \param ilen contains the plaintext length | |||
* \param input buffer holding the data to be encrypted | * \param input buffer holding the data to be encrypted | |||
* \param output buffer that will hold the ciphertext | * \param output buffer that will hold the ciphertext | |||
* | * | |||
* \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code | * \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code | |||
skipping to change at line 281 | skipping to change at line 283 | |||
* of ctx->N (eg. 128 bytes if RSA-1024 is used). | * of ctx->N (eg. 128 bytes if RSA-1024 is used). | |||
*/ | */ | |||
int rsa_pkcs1_encrypt( rsa_context *ctx, | int rsa_pkcs1_encrypt( rsa_context *ctx, | |||
int (*f_rng)(void *, unsigned char *, size_t), | int (*f_rng)(void *, unsigned char *, size_t), | |||
void *p_rng, | void *p_rng, | |||
int mode, size_t ilen, | int mode, size_t ilen, | |||
const unsigned char *input, | const unsigned char *input, | |||
unsigned char *output ); | unsigned char *output ); | |||
/** | /** | |||
* \brief Do an RSA operation, then remove the message padding | * \brief Perform a PKCS#1 v1.5 encryption (RSAES-PKCS1-v1_5-ENCRY | |||
PT) | ||||
* | ||||
* \param ctx RSA context | ||||
* \param f_rng RNG function (Needed for padding) | ||||
* \param p_rng RNG parameter | ||||
* \param mode RSA_PUBLIC or RSA_PRIVATE | ||||
* \param ilen contains the plaintext length | ||||
* \param input buffer holding the data to be encrypted | ||||
* \param output buffer that will hold the ciphertext | ||||
* | ||||
* \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code | ||||
* | ||||
* \note The output buffer must be as large as the size | ||||
* of ctx->N (eg. 128 bytes if RSA-1024 is used). | ||||
*/ | ||||
int rsa_rsaes_pkcs1_v15_encrypt( rsa_context *ctx, | ||||
int (*f_rng)(void *, unsigned char *, size | ||||
_t), | ||||
void *p_rng, | ||||
int mode, size_t ilen, | ||||
const unsigned char *input, | ||||
unsigned char *output ); | ||||
/** | ||||
* \brief Perform a PKCS#1 v2.1 OAEP encryption (RSAES-OAEP-ENCRYP | ||||
T) | ||||
* | ||||
* \param ctx RSA context | ||||
* \param f_rng RNG function (Needed for padding and PKCS#1 v2.1 encodin | ||||
g) | ||||
* \param p_rng RNG parameter | ||||
* \param mode RSA_PUBLIC or RSA_PRIVATE | ||||
* \param label buffer holding the custom label to use | ||||
* \param label_len contains the label length | ||||
* \param ilen contains the plaintext length | ||||
* \param input buffer holding the data to be encrypted | ||||
* \param output buffer that will hold the ciphertext | ||||
* | ||||
* \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code | ||||
* | ||||
* \note The output buffer must be as large as the size | ||||
* of ctx->N (eg. 128 bytes if RSA-1024 is used). | ||||
*/ | ||||
int rsa_rsaes_oaep_encrypt( rsa_context *ctx, | ||||
int (*f_rng)(void *, unsigned char *, size_t), | ||||
void *p_rng, | ||||
int mode, | ||||
const unsigned char *label, size_t label_len, | ||||
size_t ilen, | ||||
const unsigned char *input, | ||||
unsigned char *output ); | ||||
/** | ||||
* \brief Generic wrapper to perform a PKCS#1 decryption using the | ||||
* mode from the context. Do an RSA operation, then remove | ||||
* the message padding | ||||
* | * | |||
* \param ctx RSA context | * \param ctx RSA context | |||
* \param mode RSA_PUBLIC or RSA_PRIVATE | * \param mode RSA_PUBLIC or RSA_PRIVATE | |||
* \param olen will contain the plaintext length | * \param olen will contain the plaintext length | |||
* \param input buffer holding the encrypted data | * \param input buffer holding the encrypted data | |||
* \param output buffer that will hold the plaintext | * \param output buffer that will hold the plaintext | |||
* \param output_max_len maximum length of the output buffer | * \param output_max_len maximum length of the output buffer | |||
* | * | |||
* \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code | * \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code | |||
* | * | |||
skipping to change at line 303 | skipping to change at line 357 | |||
* of ctx->N (eg. 128 bytes if RSA-1024 is used) otherwise | * of ctx->N (eg. 128 bytes if RSA-1024 is used) otherwise | |||
* an error is thrown. | * an error is thrown. | |||
*/ | */ | |||
int rsa_pkcs1_decrypt( rsa_context *ctx, | int rsa_pkcs1_decrypt( rsa_context *ctx, | |||
int mode, size_t *olen, | int mode, size_t *olen, | |||
const unsigned char *input, | const unsigned char *input, | |||
unsigned char *output, | unsigned char *output, | |||
size_t output_max_len ); | size_t output_max_len ); | |||
/** | /** | |||
* \brief Do a private RSA to sign a message digest | * \brief Perform a PKCS#1 v1.5 decryption (RSAES-PKCS1-v1_5-DECRY | |||
PT) | ||||
* | ||||
* \param ctx RSA context | ||||
* \param mode RSA_PUBLIC or RSA_PRIVATE | ||||
* \param olen will contain the plaintext length | ||||
* \param input buffer holding the encrypted data | ||||
* \param output buffer that will hold the plaintext | ||||
* \param output_max_len maximum length of the output buffer | ||||
* | ||||
* \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code | ||||
* | ||||
* \note The output buffer must be as large as the size | ||||
* of ctx->N (eg. 128 bytes if RSA-1024 is used) otherwise | ||||
* an error is thrown. | ||||
*/ | ||||
int rsa_rsaes_pkcs1_v15_decrypt( rsa_context *ctx, | ||||
int mode, size_t *olen, | ||||
const unsigned char *input, | ||||
unsigned char *output, | ||||
size_t output_max_len ); | ||||
/** | ||||
* \brief Perform a PKCS#1 v2.1 OAEP decryption (RSAES-OAEP-DECRYP | ||||
T) | ||||
* | ||||
* \param ctx RSA context | ||||
* \param mode RSA_PUBLIC or RSA_PRIVATE | ||||
* \param label buffer holding the custom label to use | ||||
* \param label_len contains the label length | ||||
* \param olen will contain the plaintext length | ||||
* \param input buffer holding the encrypted data | ||||
* \param output buffer that will hold the plaintext | ||||
* \param output_max_len maximum length of the output buffer | ||||
* | ||||
* \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code | ||||
* | ||||
* \note The output buffer must be as large as the size | ||||
* of ctx->N (eg. 128 bytes if RSA-1024 is used) otherwise | ||||
* an error is thrown. | ||||
*/ | ||||
int rsa_rsaes_oaep_decrypt( rsa_context *ctx, | ||||
int mode, | ||||
const unsigned char *label, size_t label_len, | ||||
size_t *olen, | ||||
const unsigned char *input, | ||||
unsigned char *output, | ||||
size_t output_max_len ); | ||||
/** | ||||
* \brief Generic wrapper to perform a PKCS#1 signature using the | ||||
* mode from the context. Do a private RSA operation to sig | ||||
n | ||||
* a message digest | ||||
* | * | |||
* \param ctx RSA context | * \param ctx RSA context | |||
* \param f_rng RNG function (Needed for PKCS#1 v2.1 encoding) | * \param f_rng RNG function (Needed for PKCS#1 v2.1 encoding) | |||
* \param p_rng RNG parameter | * \param p_rng RNG parameter | |||
* \param mode RSA_PUBLIC or RSA_PRIVATE | * \param mode RSA_PUBLIC or RSA_PRIVATE | |||
* \param hash_id SIG_RSA_RAW, SIG_RSA_MD{2,4,5} or SIG_RSA_SHA{1,224,256, 384,512} | * \param hash_id SIG_RSA_RAW, SIG_RSA_MD{2,4,5} or SIG_RSA_SHA{1,224,256, 384,512} | |||
* \param hashlen message digest length (for SIG_RSA_RAW only) | * \param hashlen message digest length (for SIG_RSA_RAW only) | |||
* \param hash buffer holding the message digest | * \param hash buffer holding the message digest | |||
* \param sig buffer that will hold the ciphertext | * \param sig buffer that will hold the ciphertext | |||
* | * | |||
skipping to change at line 336 | skipping to change at line 440 | |||
int rsa_pkcs1_sign( rsa_context *ctx, | int rsa_pkcs1_sign( rsa_context *ctx, | |||
int (*f_rng)(void *, unsigned char *, size_t), | int (*f_rng)(void *, unsigned char *, size_t), | |||
void *p_rng, | void *p_rng, | |||
int mode, | int mode, | |||
int hash_id, | int hash_id, | |||
unsigned int hashlen, | unsigned int hashlen, | |||
const unsigned char *hash, | const unsigned char *hash, | |||
unsigned char *sig ); | unsigned char *sig ); | |||
/** | /** | |||
* \brief Do a public RSA and check the message digest | * \brief Perform a PKCS#1 v1.5 signature (RSASSA-PKCS1-v1_5-SIGN) | |||
* | ||||
* \param ctx RSA context | ||||
* \param mode RSA_PUBLIC or RSA_PRIVATE | ||||
* \param hash_id SIG_RSA_RAW, SIG_RSA_MD{2,4,5} or SIG_RSA_SHA{1,224,256, | ||||
384,512} | ||||
* \param hashlen message digest length (for SIG_RSA_RAW only) | ||||
* \param hash buffer holding the message digest | ||||
* \param sig buffer that will hold the ciphertext | ||||
* | ||||
* \return 0 if the signing operation was successful, | ||||
* or an POLARSSL_ERR_RSA_XXX error code | ||||
* | ||||
* \note The "sig" buffer must be as large as the size | ||||
* of ctx->N (eg. 128 bytes if RSA-1024 is used). | ||||
*/ | ||||
int rsa_rsassa_pkcs1_v15_sign( rsa_context *ctx, | ||||
int mode, | ||||
int hash_id, | ||||
unsigned int hashlen, | ||||
const unsigned char *hash, | ||||
unsigned char *sig ); | ||||
/** | ||||
* \brief Perform a PKCS#1 v2.1 PSS signature (RSASSA-PSS-SIGN) | ||||
* | ||||
* \param ctx RSA context | ||||
* \param f_rng RNG function (Needed for PKCS#1 v2.1 encoding) | ||||
* \param p_rng RNG parameter | ||||
* \param mode RSA_PUBLIC or RSA_PRIVATE | ||||
* \param hash_id SIG_RSA_RAW, SIG_RSA_MD{2,4,5} or SIG_RSA_SHA{1,224,256, | ||||
384,512} | ||||
* \param hashlen message digest length (for SIG_RSA_RAW only) | ||||
* \param hash buffer holding the message digest | ||||
* \param sig buffer that will hold the ciphertext | ||||
* | ||||
* \return 0 if the signing operation was successful, | ||||
* or an POLARSSL_ERR_RSA_XXX error code | ||||
* | ||||
* \note The "sig" buffer must be as large as the size | ||||
* of ctx->N (eg. 128 bytes if RSA-1024 is used). | ||||
* | ||||
* \note In case of PKCS#1 v2.1 encoding keep in mind that | ||||
* the hash_id in the RSA context is the one used for the | ||||
* encoding. hash_id in the function call is the type of ha | ||||
sh | ||||
* that is encoded. According to RFC 3447 it is advised to | ||||
* keep both hashes the same. | ||||
*/ | ||||
int rsa_rsassa_pss_sign( rsa_context *ctx, | ||||
int (*f_rng)(void *, unsigned char *, size_t), | ||||
void *p_rng, | ||||
int mode, | ||||
int hash_id, | ||||
unsigned int hashlen, | ||||
const unsigned char *hash, | ||||
unsigned char *sig ); | ||||
/** | ||||
* \brief Generic wrapper to perform a PKCS#1 verification using t | ||||
he | ||||
* mode from the context. Do a public RSA operation and che | ||||
ck | ||||
* the message digest | ||||
* | * | |||
* \param ctx points to an RSA public key | * \param ctx points to an RSA public key | |||
* \param mode RSA_PUBLIC or RSA_PRIVATE | * \param mode RSA_PUBLIC or RSA_PRIVATE | |||
* \param hash_id SIG_RSA_RAW, SIG_RSA_MD{2,4,5} or SIG_RSA_SHA{1,224,256, 384,512} | * \param hash_id SIG_RSA_RAW, SIG_RSA_MD{2,4,5} or SIG_RSA_SHA{1,224,256, 384,512} | |||
* \param hashlen message digest length (for SIG_RSA_RAW only) | * \param hashlen message digest length (for SIG_RSA_RAW only) | |||
* \param hash buffer holding the message digest | * \param hash buffer holding the message digest | |||
* \param sig buffer holding the ciphertext | * \param sig buffer holding the ciphertext | |||
* | * | |||
* \return 0 if the verify operation was successful, | * \return 0 if the verify operation was successful, | |||
* or an POLARSSL_ERR_RSA_XXX error code | * or an POLARSSL_ERR_RSA_XXX error code | |||
skipping to change at line 365 | skipping to change at line 527 | |||
* keep both hashes the same. | * keep both hashes the same. | |||
*/ | */ | |||
int rsa_pkcs1_verify( rsa_context *ctx, | int rsa_pkcs1_verify( rsa_context *ctx, | |||
int mode, | int mode, | |||
int hash_id, | int hash_id, | |||
unsigned int hashlen, | unsigned int hashlen, | |||
const unsigned char *hash, | const unsigned char *hash, | |||
unsigned char *sig ); | unsigned char *sig ); | |||
/** | /** | |||
* \brief Perform a PKCS#1 v1.5 verification (RSASSA-PKCS1-v1_5-VE | ||||
RIFY) | ||||
* | ||||
* \param ctx points to an RSA public key | ||||
* \param mode RSA_PUBLIC or RSA_PRIVATE | ||||
* \param hash_id SIG_RSA_RAW, SIG_RSA_MD{2,4,5} or SIG_RSA_SHA{1,224,256, | ||||
384,512} | ||||
* \param hashlen message digest length (for SIG_RSA_RAW only) | ||||
* \param hash buffer holding the message digest | ||||
* \param sig buffer holding the ciphertext | ||||
* | ||||
* \return 0 if the verify operation was successful, | ||||
* or an POLARSSL_ERR_RSA_XXX error code | ||||
* | ||||
* \note The "sig" buffer must be as large as the size | ||||
* of ctx->N (eg. 128 bytes if RSA-1024 is used). | ||||
*/ | ||||
int rsa_rsassa_pkcs1_v15_verify( rsa_context *ctx, | ||||
int mode, | ||||
int hash_id, | ||||
unsigned int hashlen, | ||||
const unsigned char *hash, | ||||
unsigned char *sig ); | ||||
/** | ||||
* \brief Perform a PKCS#1 v2.1 PSS verification (RSASSA-PSS-VERIF | ||||
Y) | ||||
* \brief Do a public RSA and check the message digest | ||||
* | ||||
* \param ctx points to an RSA public key | ||||
* \param mode RSA_PUBLIC or RSA_PRIVATE | ||||
* \param hash_id SIG_RSA_RAW, SIG_RSA_MD{2,4,5} or SIG_RSA_SHA{1,224,256, | ||||
384,512} | ||||
* \param hashlen message digest length (for SIG_RSA_RAW only) | ||||
* \param hash buffer holding the message digest | ||||
* \param sig buffer holding the ciphertext | ||||
* | ||||
* \return 0 if the verify operation was successful, | ||||
* or an POLARSSL_ERR_RSA_XXX error code | ||||
* | ||||
* \note The "sig" buffer must be as large as the size | ||||
* of ctx->N (eg. 128 bytes if RSA-1024 is used). | ||||
* | ||||
* \note In case of PKCS#1 v2.1 encoding keep in mind that | ||||
* the hash_id in the RSA context is the one used for the | ||||
* verification. hash_id in the function call is the type o | ||||
f hash | ||||
* that is verified. According to RFC 3447 it is advised to | ||||
* keep both hashes the same. | ||||
*/ | ||||
int rsa_rsassa_pss_verify( rsa_context *ctx, | ||||
int mode, | ||||
int hash_id, | ||||
unsigned int hashlen, | ||||
const unsigned char *hash, | ||||
unsigned char *sig ); | ||||
/** | ||||
* \brief Free the components of an RSA key | * \brief Free the components of an RSA key | |||
* | * | |||
* \param ctx RSA Context to free | * \param ctx RSA Context to free | |||
*/ | */ | |||
void rsa_free( rsa_context *ctx ); | void rsa_free( rsa_context *ctx ); | |||
/** | /** | |||
* \brief Checkup routine | * \brief Checkup routine | |||
* | * | |||
* \return 0 if successful, or 1 if the test failed | * \return 0 if successful, or 1 if the test failed | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 237 lines changed or added | |||
sha1.h | sha1.h | |||
---|---|---|---|---|
skipping to change at line 155 | skipping to change at line 155 | |||
const unsigned char *input, size_t ilen, | const unsigned char *input, size_t ilen, | |||
unsigned char output[20] ); | unsigned char output[20] ); | |||
/** | /** | |||
* \brief Checkup routine | * \brief Checkup routine | |||
* | * | |||
* \return 0 if successful, or 1 if the test failed | * \return 0 if successful, or 1 if the test failed | |||
*/ | */ | |||
int sha1_self_test( int verbose ); | int sha1_self_test( int verbose ); | |||
/* Internal use */ | ||||
void sha1_process( sha1_context *ctx, const unsigned char data[64] ); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* sha1.h */ | #endif /* sha1.h */ | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 3 lines changed or added | |||
sha2.h | sha2.h | |||
---|---|---|---|---|
skipping to change at line 163 | skipping to change at line 163 | |||
const unsigned char *input, size_t ilen, | const unsigned char *input, size_t ilen, | |||
unsigned char output[32], int is224 ); | unsigned char output[32], int is224 ); | |||
/** | /** | |||
* \brief Checkup routine | * \brief Checkup routine | |||
* | * | |||
* \return 0 if successful, or 1 if the test failed | * \return 0 if successful, or 1 if the test failed | |||
*/ | */ | |||
int sha2_self_test( int verbose ); | int sha2_self_test( int verbose ); | |||
/* Internal use */ | ||||
void sha2_process( sha2_context *ctx, const unsigned char data[64] ); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* sha2.h */ | #endif /* sha2.h */ | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 3 lines changed or added | |||
ssl_cache.h | ssl_cache.h | |||
---|---|---|---|---|
skipping to change at line 49 | skipping to change at line 49 | |||
typedef struct _ssl_cache_context ssl_cache_context; | typedef struct _ssl_cache_context ssl_cache_context; | |||
typedef struct _ssl_cache_entry ssl_cache_entry; | typedef struct _ssl_cache_entry ssl_cache_entry; | |||
/** | /** | |||
* \brief This structure is used for storing cache entries | * \brief This structure is used for storing cache entries | |||
*/ | */ | |||
struct _ssl_cache_entry | struct _ssl_cache_entry | |||
{ | { | |||
time_t timestamp; /*!< entry timestamp */ | time_t timestamp; /*!< entry timestamp */ | |||
ssl_session session; /*!< entry session */ | ssl_session session; /*!< entry session */ | |||
x509_buf peer_cert; /*!< entry peer_cert */ | ||||
ssl_cache_entry *next; /*!< chain pointer */ | ssl_cache_entry *next; /*!< chain pointer */ | |||
}; | }; | |||
/** | /** | |||
* \brief Cache context | * \brief Cache context | |||
*/ | */ | |||
struct _ssl_cache_context | struct _ssl_cache_context | |||
{ | { | |||
ssl_cache_entry *chain; /*!< start of the chain */ | ssl_cache_entry *chain; /*!< start of the chain */ | |||
int timeout; /*!< cache entry timeout */ | int timeout; /*!< cache entry timeout */ | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 1 lines changed or added | |||
version.h | version.h | |||
---|---|---|---|---|
skipping to change at line 42 | skipping to change at line 42 | |||
#define POLARSSL_VERSION_H | #define POLARSSL_VERSION_H | |||
#include "config.h" | #include "config.h" | |||
/** | /** | |||
* The version number x.y.z is split into three parts. | * The version number x.y.z is split into three parts. | |||
* Major, Minor, Patchlevel | * Major, Minor, Patchlevel | |||
*/ | */ | |||
#define POLARSSL_VERSION_MAJOR 1 | #define POLARSSL_VERSION_MAJOR 1 | |||
#define POLARSSL_VERSION_MINOR 2 | #define POLARSSL_VERSION_MINOR 2 | |||
#define POLARSSL_VERSION_PATCH 5 | #define POLARSSL_VERSION_PATCH 6 | |||
/** | /** | |||
* The single version number has the following structure: | * The single version number has the following structure: | |||
* MMNNPP00 | * MMNNPP00 | |||
* Major version | Minor version | Patch version | * Major version | Minor version | Patch version | |||
*/ | */ | |||
#define POLARSSL_VERSION_NUMBER 0x01020500 | #define POLARSSL_VERSION_NUMBER 0x01020600 | |||
#define POLARSSL_VERSION_STRING "1.2.5" | #define POLARSSL_VERSION_STRING "1.2.6" | |||
#define POLARSSL_VERSION_STRING_FULL "PolarSSL 1.2.5" | #define POLARSSL_VERSION_STRING_FULL "PolarSSL 1.2.6" | |||
#if defined(POLARSSL_VERSION_C) | #if defined(POLARSSL_VERSION_C) | |||
/** | /** | |||
* Get the version number. | * Get the version number. | |||
* | * | |||
* \return The constructed version number in the format | * \return The constructed version number in the format | |||
* MMNNPP00 (Major, Minor, Patch). | * MMNNPP00 (Major, Minor, Patch). | |||
*/ | */ | |||
unsigned int version_get_number( void ); | unsigned int version_get_number( void ); | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||