- First replacement of xyssl by polarssl where needed
This commit is contained in:
parent
8e831edc24
commit
40e46940df
70 changed files with 833 additions and 1201 deletions
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* \file aes.h
|
||||
*/
|
||||
#ifndef XYSSL_AES_H
|
||||
#define XYSSL_AES_H
|
||||
#ifndef POLARSSL_AES_H
|
||||
#define POLARSSL_AES_H
|
||||
|
||||
#define AES_ENCRYPT 1
|
||||
#define AES_DECRYPT 0
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* \file arc4.h
|
||||
*/
|
||||
#ifndef XYSSL_ARC4_H
|
||||
#define XYSSL_ARC4_H
|
||||
#ifndef POLARSSL_ARC4_H
|
||||
#define POLARSSL_ARC4_H
|
||||
|
||||
/**
|
||||
* \brief ARC4 context structure
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/**
|
||||
* \file base64.h
|
||||
*/
|
||||
#ifndef XYSSL_BASE64_H
|
||||
#define XYSSL_BASE64_H
|
||||
#ifndef POLARSSL_BASE64_H
|
||||
#define POLARSSL_BASE64_H
|
||||
|
||||
#define XYSSL_ERR_BASE64_BUFFER_TOO_SMALL -0x0010
|
||||
#define XYSSL_ERR_BASE64_INVALID_CHARACTER -0x0012
|
||||
#define POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL -0x0010
|
||||
#define POLARSSL_ERR_BASE64_INVALID_CHARACTER -0x0012
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -19,7 +19,7 @@ extern "C" {
|
|||
* \param src source buffer
|
||||
* \param slen amount of data to be encoded
|
||||
*
|
||||
* \return 0 if successful, or XYSSL_ERR_BASE64_BUFFER_TOO_SMALL.
|
||||
* \return 0 if successful, or POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL.
|
||||
* *dlen is always updated to reflect the amount
|
||||
* of data that has (or would have) been written.
|
||||
*
|
||||
|
@ -37,8 +37,8 @@ int base64_encode( unsigned char *dst, int *dlen,
|
|||
* \param src source buffer
|
||||
* \param slen amount of data to be decoded
|
||||
*
|
||||
* \return 0 if successful, XYSSL_ERR_BASE64_BUFFER_TOO_SMALL, or
|
||||
* XYSSL_ERR_BASE64_INVALID_DATA if the input data is not
|
||||
* \return 0 if successful, POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL, or
|
||||
* POLARSSL_ERR_BASE64_INVALID_DATA if the input data is not
|
||||
* correct. *dlen is always updated to reflect the amount
|
||||
* of data that has (or would have) been written.
|
||||
*
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
/**
|
||||
* \file bignum.h
|
||||
*/
|
||||
#ifndef XYSSL_BIGNUM_H
|
||||
#define XYSSL_BIGNUM_H
|
||||
#ifndef POLARSSL_BIGNUM_H
|
||||
#define POLARSSL_BIGNUM_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define XYSSL_ERR_MPI_FILE_IO_ERROR -0x0002
|
||||
#define XYSSL_ERR_MPI_BAD_INPUT_DATA -0x0004
|
||||
#define XYSSL_ERR_MPI_INVALID_CHARACTER -0x0006
|
||||
#define XYSSL_ERR_MPI_BUFFER_TOO_SMALL -0x0008
|
||||
#define XYSSL_ERR_MPI_NEGATIVE_VALUE -0x000A
|
||||
#define XYSSL_ERR_MPI_DIVISION_BY_ZERO -0x000C
|
||||
#define XYSSL_ERR_MPI_NOT_ACCEPTABLE -0x000E
|
||||
#define POLARSSL_ERR_MPI_FILE_IO_ERROR -0x0002
|
||||
#define POLARSSL_ERR_MPI_BAD_INPUT_DATA -0x0004
|
||||
#define POLARSSL_ERR_MPI_INVALID_CHARACTER -0x0006
|
||||
#define POLARSSL_ERR_MPI_BUFFER_TOO_SMALL -0x0008
|
||||
#define POLARSSL_ERR_MPI_NEGATIVE_VALUE -0x000A
|
||||
#define POLARSSL_ERR_MPI_DIVISION_BY_ZERO -0x000C
|
||||
#define POLARSSL_ERR_MPI_NOT_ACCEPTABLE -0x000E
|
||||
|
||||
#define MPI_CHK(f) if( ( ret = f ) != 0 ) goto cleanup
|
||||
|
||||
/*
|
||||
* Define the base integer type, architecture-wise
|
||||
*/
|
||||
#if defined(XYSSL_HAVE_INT8)
|
||||
#if defined(POLARSSL_HAVE_INT8)
|
||||
typedef unsigned char t_int;
|
||||
typedef unsigned short t_dbl;
|
||||
#else
|
||||
#if defined(XYSSL_HAVE_INT16)
|
||||
#if defined(POLARSSL_HAVE_INT16)
|
||||
typedef unsigned short t_int;
|
||||
typedef unsigned long t_dbl;
|
||||
#else
|
||||
|
@ -118,7 +118,7 @@ int mpi_size( mpi *X );
|
|||
* \param radix input numeric base
|
||||
* \param s null-terminated string buffer
|
||||
*
|
||||
* \return 0 if successful, or an XYSSL_ERR_MPI_XXX error code
|
||||
* \return 0 if successful, or an POLARSSL_ERR_MPI_XXX error code
|
||||
*/
|
||||
int mpi_read_string( mpi *X, int radix, char *s );
|
||||
|
||||
|
@ -130,7 +130,7 @@ int mpi_read_string( mpi *X, int radix, char *s );
|
|||
* \param s string buffer
|
||||
* \param slen string buffer size
|
||||
*
|
||||
* \return 0 if successful, or an XYSSL_ERR_MPI_XXX error code
|
||||
* \return 0 if successful, or an POLARSSL_ERR_MPI_XXX error code
|
||||
*
|
||||
* \note Call this function with *slen = 0 to obtain the
|
||||
* minimum required buffer size in *slen.
|
||||
|
@ -144,7 +144,7 @@ int mpi_write_string( mpi *X, int radix, char *s, int *slen );
|
|||
* \param radix input numeric base
|
||||
* \param fin input file handle
|
||||
*
|
||||
* \return 0 if successful, or an XYSSL_ERR_MPI_XXX error code
|
||||
* \return 0 if successful, or an POLARSSL_ERR_MPI_XXX error code
|
||||
*/
|
||||
int mpi_read_file( mpi *X, int radix, FILE *fin );
|
||||
|
||||
|
@ -156,7 +156,7 @@ int mpi_read_file( mpi *X, int radix, FILE *fin );
|
|||
* \param radix output numeric base
|
||||
* \param fout output file handle
|
||||
*
|
||||
* \return 0 if successful, or an XYSSL_ERR_MPI_XXX error code
|
||||
* \return 0 if successful, or an POLARSSL_ERR_MPI_XXX error code
|
||||
*
|
||||
* \note Set fout == NULL to print X on the console.
|
||||
*/
|
||||
|
@ -182,7 +182,7 @@ int mpi_read_binary( mpi *X, unsigned char *buf, int buflen );
|
|||
* \param buflen output buffer size
|
||||
*
|
||||
* \return 0 if successful,
|
||||
* XYSSL_ERR_MPI_BUFFER_TOO_SMALL if buf isn't large enough
|
||||
* POLARSSL_ERR_MPI_BUFFER_TOO_SMALL if buf isn't large enough
|
||||
*
|
||||
* \note Call this function with *buflen = 0 to obtain the
|
||||
* minimum required buffer size in *buflen.
|
||||
|
@ -244,7 +244,7 @@ int mpi_add_abs( mpi *X, mpi *A, mpi *B );
|
|||
* \brief Unsigned substraction: X = |A| - |B|
|
||||
*
|
||||
* \return 0 if successful,
|
||||
* XYSSL_ERR_MPI_NEGATIVE_VALUE if B is greater than A
|
||||
* POLARSSL_ERR_MPI_NEGATIVE_VALUE if B is greater than A
|
||||
*/
|
||||
int mpi_sub_abs( mpi *X, mpi *A, mpi *B );
|
||||
|
||||
|
@ -301,7 +301,7 @@ int mpi_mul_int( mpi *X, mpi *A, t_int b );
|
|||
*
|
||||
* \return 0 if successful,
|
||||
* 1 if memory allocation failed,
|
||||
* XYSSL_ERR_MPI_DIVISION_BY_ZERO if B == 0
|
||||
* POLARSSL_ERR_MPI_DIVISION_BY_ZERO if B == 0
|
||||
*
|
||||
* \note Either Q or R can be NULL.
|
||||
*/
|
||||
|
@ -312,7 +312,7 @@ int mpi_div_mpi( mpi *Q, mpi *R, mpi *A, mpi *B );
|
|||
*
|
||||
* \return 0 if successful,
|
||||
* 1 if memory allocation failed,
|
||||
* XYSSL_ERR_MPI_DIVISION_BY_ZERO if b == 0
|
||||
* POLARSSL_ERR_MPI_DIVISION_BY_ZERO if b == 0
|
||||
*
|
||||
* \note Either Q or R can be NULL.
|
||||
*/
|
||||
|
@ -323,7 +323,7 @@ int mpi_div_int( mpi *Q, mpi *R, mpi *A, int b );
|
|||
*
|
||||
* \return 0 if successful,
|
||||
* 1 if memory allocation failed,
|
||||
* XYSSL_ERR_MPI_DIVISION_BY_ZERO if B == 0
|
||||
* POLARSSL_ERR_MPI_DIVISION_BY_ZERO if B == 0
|
||||
*/
|
||||
int mpi_mod_mpi( mpi *R, mpi *A, mpi *B );
|
||||
|
||||
|
@ -332,7 +332,7 @@ int mpi_mod_mpi( mpi *R, mpi *A, mpi *B );
|
|||
*
|
||||
* \return 0 if successful,
|
||||
* 1 if memory allocation failed,
|
||||
* XYSSL_ERR_MPI_DIVISION_BY_ZERO if b == 0
|
||||
* POLARSSL_ERR_MPI_DIVISION_BY_ZERO if b == 0
|
||||
*/
|
||||
int mpi_mod_int( t_int *r, mpi *A, int b );
|
||||
|
||||
|
@ -341,7 +341,7 @@ int mpi_mod_int( t_int *r, mpi *A, int b );
|
|||
*
|
||||
* \return 0 if successful,
|
||||
* 1 if memory allocation failed,
|
||||
* XYSSL_ERR_MPI_BAD_INPUT_DATA if N is negative or even
|
||||
* POLARSSL_ERR_MPI_BAD_INPUT_DATA if N is negative or even
|
||||
*
|
||||
* \note _RR is used to avoid re-computing R*R mod N across
|
||||
* multiple calls, which speeds up things a bit. It can
|
||||
|
@ -362,8 +362,8 @@ int mpi_gcd( mpi *G, mpi *A, mpi *B );
|
|||
*
|
||||
* \return 0 if successful,
|
||||
* 1 if memory allocation failed,
|
||||
* XYSSL_ERR_MPI_BAD_INPUT_DATA if N is negative or nil
|
||||
* XYSSL_ERR_MPI_NOT_ACCEPTABLE if A has no inverse mod N
|
||||
* POLARSSL_ERR_MPI_BAD_INPUT_DATA if N is negative or nil
|
||||
* POLARSSL_ERR_MPI_NOT_ACCEPTABLE if A has no inverse mod N
|
||||
*/
|
||||
int mpi_inv_mod( mpi *X, mpi *A, mpi *N );
|
||||
|
||||
|
@ -372,7 +372,7 @@ int mpi_inv_mod( mpi *X, mpi *A, mpi *N );
|
|||
*
|
||||
* \return 0 if successful (probably prime),
|
||||
* 1 if memory allocation failed,
|
||||
* XYSSL_ERR_MPI_NOT_ACCEPTABLE if X is not prime
|
||||
* POLARSSL_ERR_MPI_NOT_ACCEPTABLE if X is not prime
|
||||
*/
|
||||
int mpi_is_prime( mpi *X, int (*f_rng)(void *), void *p_rng );
|
||||
|
||||
|
@ -387,7 +387,7 @@ int mpi_is_prime( mpi *X, int (*f_rng)(void *), void *p_rng );
|
|||
*
|
||||
* \return 0 if successful (probably prime),
|
||||
* 1 if memory allocation failed,
|
||||
* XYSSL_ERR_MPI_BAD_INPUT_DATA if nbits is < 3
|
||||
* POLARSSL_ERR_MPI_BAD_INPUT_DATA if nbits is < 3
|
||||
*/
|
||||
int mpi_gen_prime( mpi *X, int nbits, int dh_flag,
|
||||
int (*f_rng)(void *), void *p_rng );
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
* . Alpha . MIPS32
|
||||
* . C, longlong . C, generic
|
||||
*/
|
||||
#ifndef XYSSL_BN_MUL_H
|
||||
#define XYSSL_BN_MUL_H
|
||||
#ifndef POLARSSL_BN_MUL_H
|
||||
#define POLARSSL_BN_MUL_H
|
||||
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_HAVE_ASM)
|
||||
#if defined(POLARSSL_HAVE_ASM)
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#if defined(__i386__)
|
||||
|
@ -42,7 +42,7 @@
|
|||
asm( "movl %edx, %ecx " ); \
|
||||
asm( "stosl " );
|
||||
|
||||
#if defined(XYSSL_HAVE_SSE2)
|
||||
#if defined(POLARSSL_HAVE_SSE2)
|
||||
|
||||
#define MULADDC_HUIT \
|
||||
asm( "movd %ecx, %mm1 " ); \
|
||||
|
@ -565,7 +565,7 @@
|
|||
__asm mov ecx, edx \
|
||||
__asm stosd
|
||||
|
||||
#if defined(XYSSL_HAVE_SSE2)
|
||||
#if defined(POLARSSL_HAVE_SSE2)
|
||||
|
||||
#define EMIT __asm _emit
|
||||
|
||||
|
@ -648,10 +648,10 @@
|
|||
#endif /* SSE2 */
|
||||
#endif /* MSVC */
|
||||
|
||||
#endif /* XYSSL_HAVE_ASM */
|
||||
#endif /* POLARSSL_HAVE_ASM */
|
||||
|
||||
#if !defined(MULADDC_CORE)
|
||||
#if defined(XYSSL_HAVE_LONGLONG)
|
||||
#if defined(POLARSSL_HAVE_LONGLONG)
|
||||
|
||||
#define MULADDC_INIT \
|
||||
{ \
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* \file certs.h
|
||||
*/
|
||||
#ifndef XYSSL_CERTS_H
|
||||
#define XYSSL_CERTS_H
|
||||
#ifndef POLARSSL_CERTS_H
|
||||
#define POLARSSL_CERTS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* or disable features selectively, and reduce the global
|
||||
* memory footprint.
|
||||
*/
|
||||
#ifndef XYSSL_CONFIG_H
|
||||
#define XYSSL_CONFIG_H
|
||||
#ifndef POLARSSL_CONFIG_H
|
||||
#define POLARSSL_CONFIG_H
|
||||
|
||||
#ifndef _CRT_SECURE_NO_DEPRECATE
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
|
@ -15,51 +15,51 @@
|
|||
/*
|
||||
* Uncomment if native integers are 8-bit wide.
|
||||
*
|
||||
#define XYSSL_HAVE_INT8
|
||||
#define POLARSSL_HAVE_INT8
|
||||
*/
|
||||
|
||||
/*
|
||||
* Uncomment if native integers are 16-bit wide.
|
||||
*
|
||||
#define XYSSL_HAVE_INT16
|
||||
#define POLARSSL_HAVE_INT16
|
||||
*/
|
||||
|
||||
/*
|
||||
* Uncomment if the compiler supports long long.
|
||||
*
|
||||
#define XYSSL_HAVE_LONGLONG
|
||||
#define POLARSSL_HAVE_LONGLONG
|
||||
*/
|
||||
|
||||
/*
|
||||
* Uncomment to enable the use of assembly code.
|
||||
*/
|
||||
#define XYSSL_HAVE_ASM
|
||||
#define POLARSSL_HAVE_ASM
|
||||
|
||||
/*
|
||||
* Uncomment if the CPU supports SSE2 (IA-32 specific).
|
||||
*
|
||||
#define XYSSL_HAVE_SSE2
|
||||
#define POLARSSL_HAVE_SSE2
|
||||
*/
|
||||
|
||||
/*
|
||||
* Enable all SSL/TLS debugging messages.
|
||||
*/
|
||||
#define XYSSL_DEBUG_MSG
|
||||
#define POLARSSL_DEBUG_MSG
|
||||
|
||||
/*
|
||||
* Enable the checkup functions (*_self_test).
|
||||
*/
|
||||
#define XYSSL_SELF_TEST
|
||||
#define POLARSSL_SELF_TEST
|
||||
|
||||
/*
|
||||
* Enable the prime-number generation code.
|
||||
*/
|
||||
#define XYSSL_GENPRIME
|
||||
#define POLARSSL_GENPRIME
|
||||
|
||||
/*
|
||||
* Uncomment this macro to store the AES tables in ROM.
|
||||
*
|
||||
#define XYSSL_AES_ROM_TABLES
|
||||
#define POLARSSL_AES_ROM_TABLES
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -71,7 +71,7 @@
|
|||
* SSL_RSA_AES_256_SHA
|
||||
* SSL_EDH_RSA_AES_256_SHA
|
||||
*/
|
||||
#define XYSSL_AES_C
|
||||
#define POLARSSL_AES_C
|
||||
|
||||
/*
|
||||
* Module: library/arc4.c
|
||||
|
@ -81,7 +81,7 @@
|
|||
* SSL_RSA_RC4_128_MD5
|
||||
* SSL_RSA_RC4_128_SHA
|
||||
*/
|
||||
#define XYSSL_ARC4_C
|
||||
#define POLARSSL_ARC4_C
|
||||
|
||||
/*
|
||||
* Module: library/base64.c
|
||||
|
@ -89,7 +89,7 @@
|
|||
*
|
||||
* This module is required for X.509 support.
|
||||
*/
|
||||
#define XYSSL_BASE64_C
|
||||
#define POLARSSL_BASE64_C
|
||||
|
||||
/*
|
||||
* Module: library/bignum.c
|
||||
|
@ -100,7 +100,7 @@
|
|||
*
|
||||
* This module is required for RSA and DHM support.
|
||||
*/
|
||||
#define XYSSL_BIGNUM_C
|
||||
#define POLARSSL_BIGNUM_C
|
||||
|
||||
/*
|
||||
* Module: library/certs.c
|
||||
|
@ -108,7 +108,7 @@
|
|||
*
|
||||
* This module is used for testing (ssl_client/server).
|
||||
*/
|
||||
#define XYSSL_CERTS_C
|
||||
#define POLARSSL_CERTS_C
|
||||
|
||||
/*
|
||||
* Module: library/debug.c
|
||||
|
@ -118,7 +118,7 @@
|
|||
*
|
||||
* This module provides debugging functions.
|
||||
*/
|
||||
#define XYSSL_DEBUG_C
|
||||
#define POLARSSL_DEBUG_C
|
||||
|
||||
/*
|
||||
* Module: library/des.c
|
||||
|
@ -128,7 +128,7 @@
|
|||
* SSL_RSA_DES_168_SHA
|
||||
* SSL_EDH_RSA_DES_168_SHA
|
||||
*/
|
||||
#define XYSSL_DES_C
|
||||
#define POLARSSL_DES_C
|
||||
|
||||
/*
|
||||
* Module: library/dhm.c
|
||||
|
@ -139,7 +139,7 @@
|
|||
* SSL_EDH_RSA_DES_168_SHA
|
||||
* SSL_EDH_RSA_AES_256_SHA
|
||||
*/
|
||||
#define XYSSL_DHM_C
|
||||
#define POLARSSL_DHM_C
|
||||
|
||||
/*
|
||||
* Module: library/havege.c
|
||||
|
@ -147,7 +147,7 @@
|
|||
*
|
||||
* This module enables the HAVEGE random number generator.
|
||||
*/
|
||||
#define XYSSL_HAVEGE_C
|
||||
#define POLARSSL_HAVEGE_C
|
||||
|
||||
/*
|
||||
* Module: library/md2.c
|
||||
|
@ -155,7 +155,7 @@
|
|||
*
|
||||
* Uncomment to enable support for (rare) MD2-signed X.509 certs.
|
||||
*
|
||||
#define XYSSL_MD2_C
|
||||
#define POLARSSL_MD2_C
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -164,7 +164,7 @@
|
|||
*
|
||||
* Uncomment to enable support for (rare) MD4-signed X.509 certs.
|
||||
*
|
||||
#define XYSSL_MD4_C
|
||||
#define POLARSSL_MD4_C
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -174,7 +174,7 @@
|
|||
*
|
||||
* This module is required for SSL/TLS and X.509.
|
||||
*/
|
||||
#define XYSSL_MD5_C
|
||||
#define POLARSSL_MD5_C
|
||||
|
||||
/*
|
||||
* Module: library/net.c
|
||||
|
@ -182,7 +182,7 @@
|
|||
*
|
||||
* This module provides TCP/IP networking routines.
|
||||
*/
|
||||
#define XYSSL_NET_C
|
||||
#define POLARSSL_NET_C
|
||||
|
||||
/*
|
||||
* Module: library/padlock.c
|
||||
|
@ -190,7 +190,7 @@
|
|||
*
|
||||
* This modules adds support for the VIA PadLock on x86.
|
||||
*/
|
||||
#define XYSSL_PADLOCK_C
|
||||
#define POLARSSL_PADLOCK_C
|
||||
|
||||
/*
|
||||
* Module: library/rsa.c
|
||||
|
@ -201,7 +201,7 @@
|
|||
*
|
||||
* This module is required for SSL/TLS and MD5-signed certificates.
|
||||
*/
|
||||
#define XYSSL_RSA_C
|
||||
#define POLARSSL_RSA_C
|
||||
|
||||
/*
|
||||
* Module: library/sha1.c
|
||||
|
@ -212,7 +212,7 @@
|
|||
*
|
||||
* This module is required for SSL/TLS and SHA1-signed certificates.
|
||||
*/
|
||||
#define XYSSL_SHA1_C
|
||||
#define POLARSSL_SHA1_C
|
||||
|
||||
/*
|
||||
* Module: library/sha2.c
|
||||
|
@ -220,7 +220,7 @@
|
|||
*
|
||||
* This module adds support for SHA-224 and SHA-256.
|
||||
*/
|
||||
#define XYSSL_SHA2_C
|
||||
#define POLARSSL_SHA2_C
|
||||
|
||||
/*
|
||||
* Module: library/sha4.c
|
||||
|
@ -228,7 +228,7 @@
|
|||
*
|
||||
* This module adds support for SHA-384 and SHA-512.
|
||||
*/
|
||||
#define XYSSL_SHA4_C
|
||||
#define POLARSSL_SHA4_C
|
||||
|
||||
/*
|
||||
* Module: library/ssl_cli.c
|
||||
|
@ -236,7 +236,7 @@
|
|||
*
|
||||
* This module is required for SSL/TLS client support.
|
||||
*/
|
||||
#define XYSSL_SSL_CLI_C
|
||||
#define POLARSSL_SSL_CLI_C
|
||||
|
||||
/*
|
||||
* Module: library/ssl_srv.c
|
||||
|
@ -244,7 +244,7 @@
|
|||
*
|
||||
* This module is required for SSL/TLS server support.
|
||||
*/
|
||||
#define XYSSL_SSL_SRV_C
|
||||
#define POLARSSL_SSL_SRV_C
|
||||
|
||||
/*
|
||||
* Module: library/ssl_tls.c
|
||||
|
@ -253,7 +253,7 @@
|
|||
*
|
||||
* This module is required for SSL/TLS.
|
||||
*/
|
||||
#define XYSSL_SSL_TLS_C
|
||||
#define POLARSSL_SSL_TLS_C
|
||||
|
||||
/*
|
||||
* Module: library/timing.c
|
||||
|
@ -261,7 +261,7 @@
|
|||
*
|
||||
* This module is used by the HAVEGE random number generator.
|
||||
*/
|
||||
#define XYSSL_TIMING_C
|
||||
#define POLARSSL_TIMING_C
|
||||
|
||||
/*
|
||||
* Module: library/x509parse.c
|
||||
|
@ -271,7 +271,7 @@
|
|||
*
|
||||
* This module is required for X.509 certificate parsing.
|
||||
*/
|
||||
#define XYSSL_X509_PARSE_C
|
||||
#define POLARSSL_X509_PARSE_C
|
||||
|
||||
/*
|
||||
* Module: library/x509_write.c
|
||||
|
@ -279,6 +279,6 @@
|
|||
*
|
||||
* This module is required for X.509 certificate writing.
|
||||
*/
|
||||
#define XYSSL_X509_WRITE_C
|
||||
#define POLARSSL_X509_WRITE_C
|
||||
|
||||
#endif /* config.h */
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "polarssl/config.h"
|
||||
#include "polarssl/ssl.h"
|
||||
|
||||
#if defined(XYSSL_DEBUG_MSG)
|
||||
#if defined(POLARSSL_DEBUG_MSG)
|
||||
|
||||
#define SSL_DEBUG_MSG( level, args ) \
|
||||
debug_print_msg( ssl, level, __FILE__, __LINE__, debug_fmt args );
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* \file des.h
|
||||
*/
|
||||
#ifndef XYSSL_DES_H
|
||||
#define XYSSL_DES_H
|
||||
#ifndef POLARSSL_DES_H
|
||||
#define POLARSSL_DES_H
|
||||
|
||||
#define DES_ENCRYPT 1
|
||||
#define DES_DECRYPT 0
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/**
|
||||
* \file dhm.h
|
||||
*/
|
||||
#ifndef XYSSL_DHM_H
|
||||
#define XYSSL_DHM_H
|
||||
#ifndef POLARSSL_DHM_H
|
||||
#define POLARSSL_DHM_H
|
||||
|
||||
#include "polarssl/bignum.h"
|
||||
|
||||
#define XYSSL_ERR_DHM_BAD_INPUT_DATA -0x0480
|
||||
#define XYSSL_ERR_DHM_READ_PARAMS_FAILED -0x0490
|
||||
#define XYSSL_ERR_DHM_MAKE_PARAMS_FAILED -0x04A0
|
||||
#define XYSSL_ERR_DHM_READ_PUBLIC_FAILED -0x04B0
|
||||
#define XYSSL_ERR_DHM_MAKE_PUBLIC_FAILED -0x04C0
|
||||
#define XYSSL_ERR_DHM_CALC_SECRET_FAILED -0x04D0
|
||||
#define POLARSSL_ERR_DHM_BAD_INPUT_DATA -0x0480
|
||||
#define POLARSSL_ERR_DHM_READ_PARAMS_FAILED -0x0490
|
||||
#define POLARSSL_ERR_DHM_MAKE_PARAMS_FAILED -0x04A0
|
||||
#define POLARSSL_ERR_DHM_READ_PUBLIC_FAILED -0x04B0
|
||||
#define POLARSSL_ERR_DHM_MAKE_PUBLIC_FAILED -0x04C0
|
||||
#define POLARSSL_ERR_DHM_CALC_SECRET_FAILED -0x04D0
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ extern "C" {
|
|||
* \param p &(start of input buffer)
|
||||
* \param end end of buffer
|
||||
*
|
||||
* \return 0 if successful, or an XYSSL_ERR_DHM_XXX error code
|
||||
* \return 0 if successful, or an POLARSSL_ERR_DHM_XXX error code
|
||||
*/
|
||||
int dhm_read_params( dhm_context *ctx,
|
||||
unsigned char **p,
|
||||
|
@ -57,7 +57,7 @@ int dhm_read_params( dhm_context *ctx,
|
|||
* have already been properly set (for example
|
||||
* using mpi_read_string or mpi_read_binary).
|
||||
*
|
||||
* \return 0 if successful, or an XYSSL_ERR_DHM_XXX error code
|
||||
* \return 0 if successful, or an POLARSSL_ERR_DHM_XXX error code
|
||||
*/
|
||||
int dhm_make_params( dhm_context *ctx, int s_size,
|
||||
unsigned char *output, int *olen,
|
||||
|
@ -70,7 +70,7 @@ int dhm_make_params( dhm_context *ctx, int s_size,
|
|||
* \param input input buffer
|
||||
* \param ilen size of buffer
|
||||
*
|
||||
* \return 0 if successful, or an XYSSL_ERR_DHM_XXX error code
|
||||
* \return 0 if successful, or an POLARSSL_ERR_DHM_XXX error code
|
||||
*/
|
||||
int dhm_read_public( dhm_context *ctx,
|
||||
unsigned char *input, int ilen );
|
||||
|
@ -85,7 +85,7 @@ int dhm_read_public( dhm_context *ctx,
|
|||
* \param f_rng RNG function
|
||||
* \param p_rng RNG parameter
|
||||
*
|
||||
* \return 0 if successful, or an XYSSL_ERR_DHM_XXX error code
|
||||
* \return 0 if successful, or an POLARSSL_ERR_DHM_XXX error code
|
||||
*/
|
||||
int dhm_make_public( dhm_context *ctx, int s_size,
|
||||
unsigned char *output, int olen,
|
||||
|
@ -98,7 +98,7 @@ int dhm_make_public( dhm_context *ctx, int s_size,
|
|||
* \param output destination buffer
|
||||
* \param olen number of chars written
|
||||
*
|
||||
* \return 0 if successful, or an XYSSL_ERR_DHM_XXX error code
|
||||
* \return 0 if successful, or an POLARSSL_ERR_DHM_XXX error code
|
||||
*/
|
||||
int dhm_calc_secret( dhm_context *ctx,
|
||||
unsigned char *output, int *olen );
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* \file havege.h
|
||||
*/
|
||||
#ifndef XYSSL_HAVEGE_H
|
||||
#define XYSSL_HAVEGE_H
|
||||
#ifndef POLARSSL_HAVEGE_H
|
||||
#define POLARSSL_HAVEGE_H
|
||||
|
||||
#define COLLECT_SIZE 1024
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* \file md2.h
|
||||
*/
|
||||
#ifndef XYSSL_MD2_H
|
||||
#define XYSSL_MD2_H
|
||||
#ifndef POLARSSL_MD2_H
|
||||
#define POLARSSL_MD2_H
|
||||
|
||||
/**
|
||||
* \brief MD2 context structure
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* \file md4.h
|
||||
*/
|
||||
#ifndef XYSSL_MD4_H
|
||||
#define XYSSL_MD4_H
|
||||
#ifndef POLARSSL_MD4_H
|
||||
#define POLARSSL_MD4_H
|
||||
|
||||
/**
|
||||
* \brief MD4 context structure
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* \file md5.h
|
||||
*/
|
||||
#ifndef XYSSL_MD5_H
|
||||
#define XYSSL_MD5_H
|
||||
#ifndef POLARSSL_MD5_H
|
||||
#define POLARSSL_MD5_H
|
||||
|
||||
/**
|
||||
* \brief MD5 context structure
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
/**
|
||||
* \file net.h
|
||||
*/
|
||||
#ifndef XYSSL_NET_H
|
||||
#define XYSSL_NET_H
|
||||
#ifndef POLARSSL_NET_H
|
||||
#define POLARSSL_NET_H
|
||||
|
||||
#define XYSSL_ERR_NET_UNKNOWN_HOST -0x0F00
|
||||
#define XYSSL_ERR_NET_SOCKET_FAILED -0x0F10
|
||||
#define XYSSL_ERR_NET_CONNECT_FAILED -0x0F20
|
||||
#define XYSSL_ERR_NET_BIND_FAILED -0x0F30
|
||||
#define XYSSL_ERR_NET_LISTEN_FAILED -0x0F40
|
||||
#define XYSSL_ERR_NET_ACCEPT_FAILED -0x0F50
|
||||
#define XYSSL_ERR_NET_RECV_FAILED -0x0F60
|
||||
#define XYSSL_ERR_NET_SEND_FAILED -0x0F70
|
||||
#define XYSSL_ERR_NET_CONN_RESET -0x0F80
|
||||
#define XYSSL_ERR_NET_TRY_AGAIN -0x0F90
|
||||
#define POLARSSL_ERR_NET_UNKNOWN_HOST -0x0F00
|
||||
#define POLARSSL_ERR_NET_SOCKET_FAILED -0x0F10
|
||||
#define POLARSSL_ERR_NET_CONNECT_FAILED -0x0F20
|
||||
#define POLARSSL_ERR_NET_BIND_FAILED -0x0F30
|
||||
#define POLARSSL_ERR_NET_LISTEN_FAILED -0x0F40
|
||||
#define POLARSSL_ERR_NET_ACCEPT_FAILED -0x0F50
|
||||
#define POLARSSL_ERR_NET_RECV_FAILED -0x0F60
|
||||
#define POLARSSL_ERR_NET_SEND_FAILED -0x0F70
|
||||
#define POLARSSL_ERR_NET_CONN_RESET -0x0F80
|
||||
#define POLARSSL_ERR_NET_TRY_AGAIN -0x0F90
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -23,9 +23,9 @@ extern "C" {
|
|||
* \brief Initiate a TCP connection with host:port
|
||||
*
|
||||
* \return 0 if successful, or one of:
|
||||
* XYSSL_ERR_NET_SOCKET_FAILED,
|
||||
* XYSSL_ERR_NET_UNKNOWN_HOST,
|
||||
* XYSSL_ERR_NET_CONNECT_FAILED
|
||||
* POLARSSL_ERR_NET_SOCKET_FAILED,
|
||||
* POLARSSL_ERR_NET_UNKNOWN_HOST,
|
||||
* POLARSSL_ERR_NET_CONNECT_FAILED
|
||||
*/
|
||||
int net_connect( int *fd, char *host, int port );
|
||||
|
||||
|
@ -34,17 +34,17 @@ int net_connect( int *fd, char *host, int port );
|
|||
* If bind_ip == NULL, all interfaces are binded.
|
||||
*
|
||||
* \return 0 if successful, or one of:
|
||||
* XYSSL_ERR_NET_SOCKET_FAILED,
|
||||
* XYSSL_ERR_NET_BIND_FAILED,
|
||||
* XYSSL_ERR_NET_LISTEN_FAILED
|
||||
* POLARSSL_ERR_NET_SOCKET_FAILED,
|
||||
* POLARSSL_ERR_NET_BIND_FAILED,
|
||||
* POLARSSL_ERR_NET_LISTEN_FAILED
|
||||
*/
|
||||
int net_bind( int *fd, char *bind_ip, int port );
|
||||
|
||||
/**
|
||||
* \brief Accept a connection from a remote client
|
||||
*
|
||||
* \return 0 if successful, XYSSL_ERR_NET_ACCEPT_FAILED, or
|
||||
* XYSSL_ERR_NET_WOULD_BLOCK is bind_fd was set to
|
||||
* \return 0 if successful, POLARSSL_ERR_NET_ACCEPT_FAILED, or
|
||||
* POLARSSL_ERR_NET_WOULD_BLOCK is bind_fd was set to
|
||||
* non-blocking and accept() is blocking.
|
||||
*/
|
||||
int net_accept( int bind_fd, int *client_fd, void *client_ip );
|
||||
|
@ -76,7 +76,7 @@ void net_usleep( unsigned long usec );
|
|||
* reflect the actual number of characters read.
|
||||
*
|
||||
* \return This function returns the number of bytes received,
|
||||
* or a negative error code; XYSSL_ERR_NET_TRY_AGAIN
|
||||
* or a negative error code; POLARSSL_ERR_NET_TRY_AGAIN
|
||||
* indicates read() is blocking.
|
||||
*/
|
||||
int net_recv( void *ctx, unsigned char *buf, int len );
|
||||
|
@ -86,7 +86,7 @@ int net_recv( void *ctx, unsigned char *buf, int len );
|
|||
* reflect the number of characters _not_ written.
|
||||
*
|
||||
* \return This function returns the number of bytes sent,
|
||||
* or a negative error code; XYSSL_ERR_NET_TRY_AGAIN
|
||||
* or a negative error code; POLARSSL_ERR_NET_TRY_AGAIN
|
||||
* indicates write() is blocking.
|
||||
*/
|
||||
int net_send( void *ctx, unsigned char *buf, int len );
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
/*
|
||||
* OpenSSL wrapper contributed by David Barett
|
||||
*/
|
||||
#ifndef XYSSL_OPENSSL_H
|
||||
#define XYSSL_OPENSSL_H
|
||||
#ifndef POLARSSL_OPENSSL_H
|
||||
#define POLARSSL_OPENSSL_H
|
||||
|
||||
#include "polarssl/aes.h"
|
||||
#include "polarssl/md5.h"
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
/**
|
||||
* \file padlock.h
|
||||
*/
|
||||
#ifndef XYSSL_PADLOCK_H
|
||||
#define XYSSL_PADLOCK_H
|
||||
#ifndef POLARSSL_PADLOCK_H
|
||||
#define POLARSSL_PADLOCK_H
|
||||
|
||||
#include "polarssl/aes.h"
|
||||
|
||||
#if (defined(__GNUC__) && defined(__i386__))
|
||||
|
||||
#ifndef XYSSL_HAVE_X86
|
||||
#define XYSSL_HAVE_X86
|
||||
#ifndef POLARSSL_HAVE_X86
|
||||
#define POLARSSL_HAVE_X86
|
||||
#endif
|
||||
|
||||
#define PADLOCK_RNG 0x000C
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
/**
|
||||
* \file rsa.h
|
||||
*/
|
||||
#ifndef XYSSL_RSA_H
|
||||
#define XYSSL_RSA_H
|
||||
#ifndef POLARSSL_RSA_H
|
||||
#define POLARSSL_RSA_H
|
||||
|
||||
#include "polarssl/bignum.h"
|
||||
|
||||
#define XYSSL_ERR_RSA_BAD_INPUT_DATA -0x0400
|
||||
#define XYSSL_ERR_RSA_INVALID_PADDING -0x0410
|
||||
#define XYSSL_ERR_RSA_KEY_GEN_FAILED -0x0420
|
||||
#define XYSSL_ERR_RSA_KEY_CHECK_FAILED -0x0430
|
||||
#define XYSSL_ERR_RSA_PUBLIC_FAILED -0x0440
|
||||
#define XYSSL_ERR_RSA_PRIVATE_FAILED -0x0450
|
||||
#define XYSSL_ERR_RSA_VERIFY_FAILED -0x0460
|
||||
#define POLARSSL_ERR_RSA_BAD_INPUT_DATA -0x0400
|
||||
#define POLARSSL_ERR_RSA_INVALID_PADDING -0x0410
|
||||
#define POLARSSL_ERR_RSA_KEY_GEN_FAILED -0x0420
|
||||
#define POLARSSL_ERR_RSA_KEY_CHECK_FAILED -0x0430
|
||||
#define POLARSSL_ERR_RSA_PUBLIC_FAILED -0x0440
|
||||
#define POLARSSL_ERR_RSA_PRIVATE_FAILED -0x0450
|
||||
#define POLARSSL_ERR_RSA_VERIFY_FAILED -0x0460
|
||||
|
||||
/*
|
||||
* PKCS#1 constants
|
||||
|
@ -114,7 +114,7 @@ void rsa_init( rsa_context *ctx,
|
|||
* \note rsa_init() must be called beforehand to setup
|
||||
* the RSA context (especially f_rng and p_rng).
|
||||
*
|
||||
* \return 0 if successful, or an XYSSL_ERR_RSA_XXX error code
|
||||
* \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code
|
||||
*/
|
||||
int rsa_gen_key( rsa_context *ctx, int nbits, int exponent );
|
||||
|
||||
|
@ -123,7 +123,7 @@ int rsa_gen_key( rsa_context *ctx, int nbits, int exponent );
|
|||
*
|
||||
* \param ctx RSA context to be checked
|
||||
*
|
||||
* \return 0 if successful, or an XYSSL_ERR_RSA_XXX error code
|
||||
* \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code
|
||||
*/
|
||||
int rsa_check_pubkey( rsa_context *ctx );
|
||||
|
||||
|
@ -132,7 +132,7 @@ int rsa_check_pubkey( rsa_context *ctx );
|
|||
*
|
||||
* \param ctx RSA context to be checked
|
||||
*
|
||||
* \return 0 if successful, or an XYSSL_ERR_RSA_XXX error code
|
||||
* \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code
|
||||
*/
|
||||
int rsa_check_privkey( rsa_context *ctx );
|
||||
|
||||
|
@ -143,7 +143,7 @@ int rsa_check_privkey( rsa_context *ctx );
|
|||
* \param input input buffer
|
||||
* \param output output buffer
|
||||
*
|
||||
* \return 0 if successful, or an XYSSL_ERR_RSA_XXX error code
|
||||
* \return 0 if successful, or an POLARSSL_ERR_RSA_XXX error code
|
||||
*
|
||||
* \note This function does NOT take care of message
|
||||
* padding. Also, be sure to set input[0] = 0.
|
||||
|
@ -162,7 +162,7 @@ int rsa_public( rsa_context *ctx,
|
|||
* \param input input buffer
|
||||
* \param output output buffer
|
||||
*
|
||||
* \return 0 if successful, or an XYSSL_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
|
||||
* enough (eg. 128 bytes if RSA-1024 is used).
|
||||
|
@ -180,7 +180,7 @@ int rsa_private( rsa_context *ctx,
|
|||
* \param input buffer holding the data to be encrypted
|
||||
* \param output buffer that will hold the ciphertext
|
||||
*
|
||||
* \return 0 if successful, or an XYSSL_ERR_RSA_XXX error code
|
||||
* \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).
|
||||
|
@ -199,7 +199,7 @@ int rsa_pkcs1_encrypt( rsa_context *ctx,
|
|||
* \param output buffer that will hold the plaintext
|
||||
* \param olen will contain the plaintext length
|
||||
*
|
||||
* \return 0 if successful, or an XYSSL_ERR_RSA_XXX error code
|
||||
* \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).
|
||||
|
@ -220,7 +220,7 @@ int rsa_pkcs1_decrypt( rsa_context *ctx,
|
|||
* \param sig buffer that will hold the ciphertext
|
||||
*
|
||||
* \return 0 if the signing operation was successful,
|
||||
* or an XYSSL_ERR_RSA_XXX error code
|
||||
* 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).
|
||||
|
@ -243,7 +243,7 @@ int rsa_pkcs1_sign( rsa_context *ctx,
|
|||
* \param sig buffer holding the ciphertext
|
||||
*
|
||||
* \return 0 if the verify operation was successful,
|
||||
* or an XYSSL_ERR_RSA_XXX error code
|
||||
* 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).
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* \file sha1.h
|
||||
*/
|
||||
#ifndef XYSSL_SHA1_H
|
||||
#define XYSSL_SHA1_H
|
||||
#ifndef POLARSSL_SHA1_H
|
||||
#define POLARSSL_SHA1_H
|
||||
|
||||
/**
|
||||
* \brief SHA-1 context structure
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* \file sha2.h
|
||||
*/
|
||||
#ifndef XYSSL_SHA2_H
|
||||
#define XYSSL_SHA2_H
|
||||
#ifndef POLARSSL_SHA2_H
|
||||
#define POLARSSL_SHA2_H
|
||||
|
||||
/**
|
||||
* \brief SHA-256 context structure
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* \file sha4.h
|
||||
*/
|
||||
#ifndef XYSSL_SHA4_H
|
||||
#define XYSSL_SHA4_H
|
||||
#ifndef POLARSSL_SHA4_H
|
||||
#define POLARSSL_SHA4_H
|
||||
|
||||
#if defined(_MSC_VER) || defined(__WATCOMC__)
|
||||
#define UL64(x) x##ui64
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* \file ssl.h
|
||||
*/
|
||||
#ifndef XYSSL_SSL_H
|
||||
#define XYSSL_SSL_H
|
||||
#ifndef POLARSSL_SSL_H
|
||||
#define POLARSSL_SSL_H
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
@ -13,33 +13,33 @@
|
|||
#include "polarssl/sha1.h"
|
||||
#include "polarssl/x509.h"
|
||||
|
||||
#define XYSSL_ERR_SSL_FEATURE_UNAVAILABLE -0x1000
|
||||
#define XYSSL_ERR_SSL_BAD_INPUT_DATA -0x1800
|
||||
#define XYSSL_ERR_SSL_INVALID_MAC -0x2000
|
||||
#define XYSSL_ERR_SSL_INVALID_RECORD -0x2800
|
||||
#define XYSSL_ERR_SSL_INVALID_MODULUS_SIZE -0x3000
|
||||
#define XYSSL_ERR_SSL_UNKNOWN_CIPHER -0x3800
|
||||
#define XYSSL_ERR_SSL_NO_CIPHER_CHOSEN -0x4000
|
||||
#define XYSSL_ERR_SSL_NO_SESSION_FOUND -0x4800
|
||||
#define XYSSL_ERR_SSL_NO_CLIENT_CERTIFICATE -0x5000
|
||||
#define XYSSL_ERR_SSL_CERTIFICATE_TOO_LARGE -0x5800
|
||||
#define XYSSL_ERR_SSL_CERTIFICATE_REQUIRED -0x6000
|
||||
#define XYSSL_ERR_SSL_PRIVATE_KEY_REQUIRED -0x6800
|
||||
#define XYSSL_ERR_SSL_CA_CHAIN_REQUIRED -0x7000
|
||||
#define XYSSL_ERR_SSL_UNEXPECTED_MESSAGE -0x7800
|
||||
#define XYSSL_ERR_SSL_FATAL_ALERT_MESSAGE -0x8000
|
||||
#define XYSSL_ERR_SSL_PEER_VERIFY_FAILED -0x8800
|
||||
#define XYSSL_ERR_SSL_PEER_CLOSE_NOTIFY -0x9000
|
||||
#define XYSSL_ERR_SSL_BAD_HS_CLIENT_HELLO -0x9800
|
||||
#define XYSSL_ERR_SSL_BAD_HS_SERVER_HELLO -0xA000
|
||||
#define XYSSL_ERR_SSL_BAD_HS_CERTIFICATE -0xA800
|
||||
#define XYSSL_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST -0xB000
|
||||
#define XYSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE -0xB800
|
||||
#define XYSSL_ERR_SSL_BAD_HS_SERVER_HELLO_DONE -0xC000
|
||||
#define XYSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE -0xC800
|
||||
#define XYSSL_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY -0xD000
|
||||
#define XYSSL_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC -0xD800
|
||||
#define XYSSL_ERR_SSL_BAD_HS_FINISHED -0xE000
|
||||
#define POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE -0x1000
|
||||
#define POLARSSL_ERR_SSL_BAD_INPUT_DATA -0x1800
|
||||
#define POLARSSL_ERR_SSL_INVALID_MAC -0x2000
|
||||
#define POLARSSL_ERR_SSL_INVALID_RECORD -0x2800
|
||||
#define POLARSSL_ERR_SSL_INVALID_MODULUS_SIZE -0x3000
|
||||
#define POLARSSL_ERR_SSL_UNKNOWN_CIPHER -0x3800
|
||||
#define POLARSSL_ERR_SSL_NO_CIPHER_CHOSEN -0x4000
|
||||
#define POLARSSL_ERR_SSL_NO_SESSION_FOUND -0x4800
|
||||
#define POLARSSL_ERR_SSL_NO_CLIENT_CERTIFICATE -0x5000
|
||||
#define POLARSSL_ERR_SSL_CERTIFICATE_TOO_LARGE -0x5800
|
||||
#define POLARSSL_ERR_SSL_CERTIFICATE_REQUIRED -0x6000
|
||||
#define POLARSSL_ERR_SSL_PRIVATE_KEY_REQUIRED -0x6800
|
||||
#define POLARSSL_ERR_SSL_CA_CHAIN_REQUIRED -0x7000
|
||||
#define POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE -0x7800
|
||||
#define POLARSSL_ERR_SSL_FATAL_ALERT_MESSAGE -0x8000
|
||||
#define POLARSSL_ERR_SSL_PEER_VERIFY_FAILED -0x8800
|
||||
#define POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY -0x9000
|
||||
#define POLARSSL_ERR_SSL_BAD_HS_CLIENT_HELLO -0x9800
|
||||
#define POLARSSL_ERR_SSL_BAD_HS_SERVER_HELLO -0xA000
|
||||
#define POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE -0xA800
|
||||
#define POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST -0xB000
|
||||
#define POLARSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE -0xB800
|
||||
#define POLARSSL_ERR_SSL_BAD_HS_SERVER_HELLO_DONE -0xC000
|
||||
#define POLARSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE -0xC800
|
||||
#define POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY -0xD000
|
||||
#define POLARSSL_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC -0xD800
|
||||
#define POLARSSL_ERR_SSL_BAD_HS_FINISHED -0xE000
|
||||
|
||||
/*
|
||||
* Various constants
|
||||
|
@ -443,7 +443,7 @@ char *ssl_get_cipher( ssl_context *ssl );
|
|||
*
|
||||
* \param ssl SSL context
|
||||
*
|
||||
* \return 0 if successful, XYSSL_ERR_NET_TRY_AGAIN,
|
||||
* \return 0 if successful, POLARSSL_ERR_NET_TRY_AGAIN,
|
||||
* or a specific SSL error code.
|
||||
*/
|
||||
int ssl_handshake( ssl_context *ssl );
|
||||
|
@ -470,7 +470,7 @@ int ssl_read( ssl_context *ssl, unsigned char *buf, int len );
|
|||
* \return This function returns the number of bytes written,
|
||||
* or a negative error code.
|
||||
*
|
||||
* \note When this function returns XYSSL_ERR_NET_TRY_AGAIN,
|
||||
* \note When this function returns POLARSSL_ERR_NET_TRY_AGAIN,
|
||||
* it must be called later with the *same* arguments,
|
||||
* until it returns a positive value.
|
||||
*/
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* \file timing.h
|
||||
*/
|
||||
#ifndef XYSSL_TIMING_H
|
||||
#define XYSSL_TIMING_H
|
||||
#ifndef POLARSSL_TIMING_H
|
||||
#define POLARSSL_TIMING_H
|
||||
|
||||
/**
|
||||
* \brief timer structure
|
||||
|
|
|
@ -1,42 +1,42 @@
|
|||
/**
|
||||
* \file x509.h
|
||||
*/
|
||||
#ifndef XYSSL_X509_H
|
||||
#define XYSSL_X509_H
|
||||
#ifndef POLARSSL_X509_H
|
||||
#define POLARSSL_X509_H
|
||||
|
||||
#include "polarssl/rsa.h"
|
||||
|
||||
#define XYSSL_ERR_ASN1_OUT_OF_DATA -0x0014
|
||||
#define XYSSL_ERR_ASN1_UNEXPECTED_TAG -0x0016
|
||||
#define XYSSL_ERR_ASN1_INVALID_LENGTH -0x0018
|
||||
#define XYSSL_ERR_ASN1_LENGTH_MISMATCH -0x001A
|
||||
#define XYSSL_ERR_ASN1_INVALID_DATA -0x001C
|
||||
#define POLARSSL_ERR_ASN1_OUT_OF_DATA -0x0014
|
||||
#define POLARSSL_ERR_ASN1_UNEXPECTED_TAG -0x0016
|
||||
#define POLARSSL_ERR_ASN1_INVALID_LENGTH -0x0018
|
||||
#define POLARSSL_ERR_ASN1_LENGTH_MISMATCH -0x001A
|
||||
#define POLARSSL_ERR_ASN1_INVALID_DATA -0x001C
|
||||
|
||||
#define XYSSL_ERR_X509_FEATURE_UNAVAILABLE -0x0020
|
||||
#define XYSSL_ERR_X509_CERT_INVALID_PEM -0x0040
|
||||
#define XYSSL_ERR_X509_CERT_INVALID_FORMAT -0x0060
|
||||
#define XYSSL_ERR_X509_CERT_INVALID_VERSION -0x0080
|
||||
#define XYSSL_ERR_X509_CERT_INVALID_SERIAL -0x00A0
|
||||
#define XYSSL_ERR_X509_CERT_INVALID_ALG -0x00C0
|
||||
#define XYSSL_ERR_X509_CERT_INVALID_NAME -0x00E0
|
||||
#define XYSSL_ERR_X509_CERT_INVALID_DATE -0x0100
|
||||
#define XYSSL_ERR_X509_CERT_INVALID_PUBKEY -0x0120
|
||||
#define XYSSL_ERR_X509_CERT_INVALID_SIGNATURE -0x0140
|
||||
#define XYSSL_ERR_X509_CERT_INVALID_EXTENSIONS -0x0160
|
||||
#define XYSSL_ERR_X509_CERT_UNKNOWN_VERSION -0x0180
|
||||
#define XYSSL_ERR_X509_CERT_UNKNOWN_SIG_ALG -0x01A0
|
||||
#define XYSSL_ERR_X509_CERT_UNKNOWN_PK_ALG -0x01C0
|
||||
#define XYSSL_ERR_X509_CERT_SIG_MISMATCH -0x01E0
|
||||
#define XYSSL_ERR_X509_CERT_VERIFY_FAILED -0x0200
|
||||
#define XYSSL_ERR_X509_KEY_INVALID_PEM -0x0220
|
||||
#define XYSSL_ERR_X509_KEY_INVALID_VERSION -0x0240
|
||||
#define XYSSL_ERR_X509_KEY_INVALID_FORMAT -0x0260
|
||||
#define XYSSL_ERR_X509_KEY_INVALID_ENC_IV -0x0280
|
||||
#define XYSSL_ERR_X509_KEY_UNKNOWN_ENC_ALG -0x02A0
|
||||
#define XYSSL_ERR_X509_KEY_PASSWORD_REQUIRED -0x02C0
|
||||
#define XYSSL_ERR_X509_KEY_PASSWORD_MISMATCH -0x02E0
|
||||
#define XYSSL_ERR_X509_POINT_ERROR -0x0300
|
||||
#define XYSSL_ERR_X509_VALUE_TO_LENGTH -0x0320
|
||||
#define POLARSSL_ERR_X509_FEATURE_UNAVAILABLE -0x0020
|
||||
#define POLARSSL_ERR_X509_CERT_INVALID_PEM -0x0040
|
||||
#define POLARSSL_ERR_X509_CERT_INVALID_FORMAT -0x0060
|
||||
#define POLARSSL_ERR_X509_CERT_INVALID_VERSION -0x0080
|
||||
#define POLARSSL_ERR_X509_CERT_INVALID_SERIAL -0x00A0
|
||||
#define POLARSSL_ERR_X509_CERT_INVALID_ALG -0x00C0
|
||||
#define POLARSSL_ERR_X509_CERT_INVALID_NAME -0x00E0
|
||||
#define POLARSSL_ERR_X509_CERT_INVALID_DATE -0x0100
|
||||
#define POLARSSL_ERR_X509_CERT_INVALID_PUBKEY -0x0120
|
||||
#define POLARSSL_ERR_X509_CERT_INVALID_SIGNATURE -0x0140
|
||||
#define POLARSSL_ERR_X509_CERT_INVALID_EXTENSIONS -0x0160
|
||||
#define POLARSSL_ERR_X509_CERT_UNKNOWN_VERSION -0x0180
|
||||
#define POLARSSL_ERR_X509_CERT_UNKNOWN_SIG_ALG -0x01A0
|
||||
#define POLARSSL_ERR_X509_CERT_UNKNOWN_PK_ALG -0x01C0
|
||||
#define POLARSSL_ERR_X509_CERT_SIG_MISMATCH -0x01E0
|
||||
#define POLARSSL_ERR_X509_CERT_VERIFY_FAILED -0x0200
|
||||
#define POLARSSL_ERR_X509_KEY_INVALID_PEM -0x0220
|
||||
#define POLARSSL_ERR_X509_KEY_INVALID_VERSION -0x0240
|
||||
#define POLARSSL_ERR_X509_KEY_INVALID_FORMAT -0x0260
|
||||
#define POLARSSL_ERR_X509_KEY_INVALID_ENC_IV -0x0280
|
||||
#define POLARSSL_ERR_X509_KEY_UNKNOWN_ENC_ALG -0x02A0
|
||||
#define POLARSSL_ERR_X509_KEY_PASSWORD_REQUIRED -0x02C0
|
||||
#define POLARSSL_ERR_X509_KEY_PASSWORD_MISMATCH -0x02E0
|
||||
#define POLARSSL_ERR_X509_POINT_ERROR -0x0300
|
||||
#define POLARSSL_ERR_X509_VALUE_TO_LENGTH -0x0320
|
||||
|
||||
#define BADCERT_EXPIRED 1
|
||||
#define BADCERT_REVOKED 2
|
||||
|
@ -262,7 +262,7 @@ int x509parse_expired( x509_cert *crt );
|
|||
* NULL if the CN must not be verified)
|
||||
* \param flags result of the verification
|
||||
*
|
||||
* \return 0 if successful or XYSSL_ERR_X509_SIG_VERIFY_FAILED,
|
||||
* \return 0 if successful or POLARSSL_ERR_X509_SIG_VERIFY_FAILED,
|
||||
* in which case *flags will have one or more of
|
||||
* the following values set:
|
||||
* BADCERT_EXPIRED --
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue