mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-30 05:11:10 +00:00
- First replacement of xyssl by polarssl where needed
This commit is contained in:
parent
8e831edc24
commit
40e46940df
|
@ -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 --
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
# Also see "include/xyssl/config.h"
|
||||
# Also see "include/polarssl/config.h"
|
||||
|
||||
CFLAGS = -I../include -D_FILE_OFFSET_BITS=64
|
||||
OFLAGS = -O
|
||||
|
@ -30,21 +30,21 @@ OBJS= aes.o arc4.o base64.o \
|
|||
|
||||
all: static
|
||||
|
||||
static: libxyssl.a
|
||||
static: libpolarssl.a
|
||||
|
||||
shared: libxyssl.$(DLEXT)
|
||||
shared: libpolarssl.$(DLEXT)
|
||||
|
||||
libxyssl.a: $(OBJS)
|
||||
libpolarssl.a: $(OBJS)
|
||||
echo " AR $@"
|
||||
ar r $@ $(OBJS)
|
||||
echo " RL $@"
|
||||
ranlib $@
|
||||
|
||||
libxyssl.so: libxyssl.a
|
||||
libpolarssl.so: libpolarssl.a
|
||||
echo " LD $@"
|
||||
$(CC) -shared -Wl,-soname,$@ -o $@ $(OBJS)
|
||||
|
||||
libxyssl.dylib: libxyssl.a
|
||||
libpolarssl.dylib: libpolarssl.a
|
||||
echo " LD $@"
|
||||
$(CC) -dynamiclib -o $@ $(OBJS)
|
||||
|
||||
|
@ -53,5 +53,5 @@ libxyssl.dylib: libxyssl.a
|
|||
$(CC) $(CFLAGS) $(OFLAGS) -c $<
|
||||
|
||||
clean:
|
||||
rm -f *.o libxyssl.*
|
||||
rm -f *.o libpolarssl.*
|
||||
|
||||
|
|
|
@ -24,12 +24,12 @@
|
|||
* http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_AES_C)
|
||||
#if defined(POLARSSL_AES_C)
|
||||
|
||||
#include "xyssl/aes.h"
|
||||
#include "xyssl/padlock.h"
|
||||
#include "polarssl/aes.h"
|
||||
#include "polarssl/padlock.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_AES_ROM_TABLES)
|
||||
#if defined(POLARSSL_AES_ROM_TABLES)
|
||||
/*
|
||||
* Forward S-box
|
||||
*/
|
||||
|
@ -441,7 +441,7 @@ void aes_setkey_enc( aes_context *ctx, unsigned char *key, int keysize )
|
|||
int i;
|
||||
unsigned long *RK;
|
||||
|
||||
#if !defined(XYSSL_AES_ROM_TABLES)
|
||||
#if !defined(POLARSSL_AES_ROM_TABLES)
|
||||
if( aes_init_done == 0 )
|
||||
{
|
||||
aes_gen_tables();
|
||||
|
@ -644,7 +644,7 @@ void aes_crypt_ecb( aes_context *ctx,
|
|||
int i;
|
||||
unsigned long *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3;
|
||||
|
||||
#if defined(XYSSL_PADLOCK_C) && defined(XYSSL_HAVE_X86)
|
||||
#if defined(POLARSSL_PADLOCK_C) && defined(POLARSSL_HAVE_X86)
|
||||
if( padlock_supports( PADLOCK_ACE ) )
|
||||
{
|
||||
if( padlock_xcryptecb( ctx, mode, input, output ) == 0 )
|
||||
|
@ -747,7 +747,7 @@ void aes_crypt_cbc( aes_context *ctx,
|
|||
int i;
|
||||
unsigned char temp[16];
|
||||
|
||||
#if defined(XYSSL_PADLOCK_C) && defined(XYSSL_HAVE_X86)
|
||||
#if defined(POLARSSL_PADLOCK_C) && defined(POLARSSL_HAVE_X86)
|
||||
if( padlock_supports( PADLOCK_ACE ) )
|
||||
{
|
||||
if( padlock_xcryptcbc( ctx, mode, length, iv, input, output ) == 0 )
|
||||
|
@ -832,7 +832,7 @@ void aes_crypt_cfb128( aes_context *ctx,
|
|||
*iv_off = n;
|
||||
}
|
||||
|
||||
#if defined(XYSSL_SELF_TEST)
|
||||
#if defined(POLARSSL_SELF_TEST)
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
* http://groups.google.com/group/sci.crypt/msg/10a300c9d21afca0
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_ARC4_C)
|
||||
#if defined(POLARSSL_ARC4_C)
|
||||
|
||||
#include "xyssl/arc4.h"
|
||||
#include "polarssl/arc4.h"
|
||||
|
||||
/*
|
||||
* ARC4 key schedule
|
||||
|
@ -85,7 +85,7 @@ void arc4_crypt( arc4_context *ctx, unsigned char *buf, int buflen )
|
|||
ctx->y = y;
|
||||
}
|
||||
|
||||
#if defined(XYSSL_SELF_TEST)
|
||||
#if defined(POLARSSL_SELF_TEST)
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_BASE64_C)
|
||||
#if defined(POLARSSL_BASE64_C)
|
||||
|
||||
#include "xyssl/base64.h"
|
||||
#include "polarssl/base64.h"
|
||||
|
||||
static const unsigned char base64_enc_map[64] =
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ int base64_encode( unsigned char *dst, int *dlen,
|
|||
if( *dlen < n + 1 )
|
||||
{
|
||||
*dlen = n + 1;
|
||||
return( XYSSL_ERR_BASE64_BUFFER_TOO_SMALL );
|
||||
return( POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL );
|
||||
}
|
||||
|
||||
n = (slen / 3) * 3;
|
||||
|
@ -135,13 +135,13 @@ int base64_decode( unsigned char *dst, int *dlen,
|
|||
continue;
|
||||
|
||||
if( src[i] == '=' && ++j > 2 )
|
||||
return( XYSSL_ERR_BASE64_INVALID_CHARACTER );
|
||||
return( POLARSSL_ERR_BASE64_INVALID_CHARACTER );
|
||||
|
||||
if( src[i] > 127 || base64_dec_map[src[i]] == 127 )
|
||||
return( XYSSL_ERR_BASE64_INVALID_CHARACTER );
|
||||
return( POLARSSL_ERR_BASE64_INVALID_CHARACTER );
|
||||
|
||||
if( base64_dec_map[src[i]] < 64 && j != 0 )
|
||||
return( XYSSL_ERR_BASE64_INVALID_CHARACTER );
|
||||
return( POLARSSL_ERR_BASE64_INVALID_CHARACTER );
|
||||
|
||||
n++;
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ int base64_decode( unsigned char *dst, int *dlen,
|
|||
if( *dlen < n )
|
||||
{
|
||||
*dlen = n;
|
||||
return( XYSSL_ERR_BASE64_BUFFER_TOO_SMALL );
|
||||
return( POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL );
|
||||
}
|
||||
|
||||
for( j = 3, n = x = 0, p = dst; i > 0; i--, src++ )
|
||||
|
@ -179,7 +179,7 @@ int base64_decode( unsigned char *dst, int *dlen,
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
#if defined(XYSSL_SELF_TEST)
|
||||
#if defined(POLARSSL_SELF_TEST)
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
* http://math.libtomcrypt.com/files/tommath.pdf
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_BIGNUM_C)
|
||||
#if defined(POLARSSL_BIGNUM_C)
|
||||
|
||||
#include "xyssl/bignum.h"
|
||||
#include "xyssl/bn_mul.h"
|
||||
#include "polarssl/bignum.h"
|
||||
#include "polarssl/bn_mul.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -232,7 +232,7 @@ static int mpi_get_digit( t_int *d, int radix, char c )
|
|||
if( c >= 0x61 && c <= 0x66 ) *d = c - 0x57;
|
||||
|
||||
if( *d >= (t_int) radix )
|
||||
return( XYSSL_ERR_MPI_INVALID_CHARACTER );
|
||||
return( POLARSSL_ERR_MPI_INVALID_CHARACTER );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ int mpi_read_string( mpi *X, int radix, char *s )
|
|||
mpi T;
|
||||
|
||||
if( radix < 2 || radix > 16 )
|
||||
return( XYSSL_ERR_MPI_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_MPI_BAD_INPUT_DATA );
|
||||
|
||||
mpi_init( &T, NULL );
|
||||
|
||||
|
@ -304,7 +304,7 @@ static int mpi_write_hlp( mpi *X, int radix, char **p )
|
|||
t_int r;
|
||||
|
||||
if( radix < 2 || radix > 16 )
|
||||
return( XYSSL_ERR_MPI_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_MPI_BAD_INPUT_DATA );
|
||||
|
||||
MPI_CHK( mpi_mod_int( &r, X, radix ) );
|
||||
MPI_CHK( mpi_div_int( X, NULL, X, radix ) );
|
||||
|
@ -332,7 +332,7 @@ int mpi_write_string( mpi *X, int radix, char *s, int *slen )
|
|||
mpi T;
|
||||
|
||||
if( radix < 2 || radix > 16 )
|
||||
return( XYSSL_ERR_MPI_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_MPI_BAD_INPUT_DATA );
|
||||
|
||||
n = mpi_msb( X );
|
||||
if( radix >= 4 ) n >>= 1;
|
||||
|
@ -342,7 +342,7 @@ int mpi_write_string( mpi *X, int radix, char *s, int *slen )
|
|||
if( *slen < n )
|
||||
{
|
||||
*slen = n;
|
||||
return( XYSSL_ERR_MPI_BUFFER_TOO_SMALL );
|
||||
return( POLARSSL_ERR_MPI_BUFFER_TOO_SMALL );
|
||||
}
|
||||
|
||||
p = s;
|
||||
|
@ -397,7 +397,7 @@ int mpi_read_file( mpi *X, int radix, FILE *fin )
|
|||
|
||||
memset( s, 0, sizeof( s ) );
|
||||
if( fgets( s, sizeof( s ) - 1, fin ) == NULL )
|
||||
return( XYSSL_ERR_MPI_FILE_IO_ERROR );
|
||||
return( POLARSSL_ERR_MPI_FILE_IO_ERROR );
|
||||
|
||||
slen = strlen( s );
|
||||
if( s[slen - 1] == '\n' ) { slen--; s[slen] = '\0'; }
|
||||
|
@ -438,7 +438,7 @@ int mpi_write_file( char *p, mpi *X, int radix, FILE *fout )
|
|||
{
|
||||
if( fwrite( p, 1, plen, fout ) != plen ||
|
||||
fwrite( s, 1, slen, fout ) != slen )
|
||||
return( XYSSL_ERR_MPI_FILE_IO_ERROR );
|
||||
return( POLARSSL_ERR_MPI_FILE_IO_ERROR );
|
||||
}
|
||||
else
|
||||
printf( "%s%s", p, s );
|
||||
|
@ -480,7 +480,7 @@ int mpi_write_binary( mpi *X, unsigned char *buf, int buflen )
|
|||
n = mpi_size( X );
|
||||
|
||||
if( buflen < n )
|
||||
return( XYSSL_ERR_MPI_BUFFER_TOO_SMALL );
|
||||
return( POLARSSL_ERR_MPI_BUFFER_TOO_SMALL );
|
||||
|
||||
memset( buf, 0, buflen );
|
||||
|
||||
|
@ -734,7 +734,7 @@ int mpi_sub_abs( mpi *X, mpi *A, mpi *B )
|
|||
int ret, n;
|
||||
|
||||
if( mpi_cmp_abs( A, B ) < 0 )
|
||||
return( XYSSL_ERR_MPI_NEGATIVE_VALUE );
|
||||
return( POLARSSL_ERR_MPI_NEGATIVE_VALUE );
|
||||
|
||||
mpi_init( &TB, NULL );
|
||||
|
||||
|
@ -981,7 +981,7 @@ int mpi_div_mpi( mpi *Q, mpi *R, mpi *A, mpi *B )
|
|||
mpi X, Y, Z, T1, T2;
|
||||
|
||||
if( mpi_cmp_int( B, 0 ) == 0 )
|
||||
return( XYSSL_ERR_MPI_DIVISION_BY_ZERO );
|
||||
return( POLARSSL_ERR_MPI_DIVISION_BY_ZERO );
|
||||
|
||||
mpi_init( &X, &Y, &Z, &T1, &T2, NULL );
|
||||
|
||||
|
@ -1027,7 +1027,7 @@ int mpi_div_mpi( mpi *Q, mpi *R, mpi *A, mpi *B )
|
|||
Z.p[i - t - 1] = ~0;
|
||||
else
|
||||
{
|
||||
#if defined(XYSSL_HAVE_LONGLONG)
|
||||
#if defined(POLARSSL_HAVE_LONGLONG)
|
||||
t_dbl r;
|
||||
|
||||
r = (t_dbl) X.p[i] << biL;
|
||||
|
@ -1138,7 +1138,7 @@ cleanup:
|
|||
*
|
||||
* Returns 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_div_int( mpi *Q, mpi *R, mpi *A, int b )
|
||||
{
|
||||
|
@ -1182,7 +1182,7 @@ int mpi_mod_int( t_int *r, mpi *A, int b )
|
|||
t_int x, y, z;
|
||||
|
||||
if( b == 0 )
|
||||
return( XYSSL_ERR_MPI_DIVISION_BY_ZERO );
|
||||
return( POLARSSL_ERR_MPI_DIVISION_BY_ZERO );
|
||||
|
||||
if( b < 0 )
|
||||
b = -b;
|
||||
|
@ -1303,7 +1303,7 @@ int mpi_exp_mod( mpi *X, mpi *A, mpi *E, mpi *N, mpi *_RR )
|
|||
mpi RR, T, W[64];
|
||||
|
||||
if( mpi_cmp_int( N, 0 ) < 0 || ( N->p[0] & 1 ) == 0 )
|
||||
return( XYSSL_ERR_MPI_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_MPI_BAD_INPUT_DATA );
|
||||
|
||||
/*
|
||||
* Init temps and window size
|
||||
|
@ -1469,7 +1469,7 @@ cleanup:
|
|||
return( ret );
|
||||
}
|
||||
|
||||
#if defined(XYSSL_GENPRIME)
|
||||
#if defined(POLARSSL_GENPRIME)
|
||||
|
||||
/*
|
||||
* Greatest common divisor: G = gcd(A, B) (HAC 14.54)
|
||||
|
@ -1522,7 +1522,7 @@ int mpi_inv_mod( mpi *X, mpi *A, mpi *N )
|
|||
mpi G, TA, TU, U1, U2, TB, TV, V1, V2;
|
||||
|
||||
if( mpi_cmp_int( N, 0 ) <= 0 )
|
||||
return( XYSSL_ERR_MPI_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_MPI_BAD_INPUT_DATA );
|
||||
|
||||
mpi_init( &TA, &TU, &U1, &U2, &G,
|
||||
&TB, &TV, &V1, &V2, NULL );
|
||||
|
@ -1531,7 +1531,7 @@ int mpi_inv_mod( mpi *X, mpi *A, mpi *N )
|
|||
|
||||
if( mpi_cmp_int( &G, 1 ) != 0 )
|
||||
{
|
||||
ret = XYSSL_ERR_MPI_NOT_ACCEPTABLE;
|
||||
ret = POLARSSL_ERR_MPI_NOT_ACCEPTABLE;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1651,7 +1651,7 @@ int mpi_is_prime( mpi *X, int (*f_rng)(void *), void *p_rng )
|
|||
* test trivial factors first
|
||||
*/
|
||||
if( ( X->p[0] & 1 ) == 0 )
|
||||
return( XYSSL_ERR_MPI_NOT_ACCEPTABLE );
|
||||
return( POLARSSL_ERR_MPI_NOT_ACCEPTABLE );
|
||||
|
||||
for( i = 0; small_prime[i] > 0; i++ )
|
||||
{
|
||||
|
@ -1663,7 +1663,7 @@ int mpi_is_prime( mpi *X, int (*f_rng)(void *), void *p_rng )
|
|||
MPI_CHK( mpi_mod_int( &r, X, small_prime[i] ) );
|
||||
|
||||
if( r == 0 )
|
||||
return( XYSSL_ERR_MPI_NOT_ACCEPTABLE );
|
||||
return( POLARSSL_ERR_MPI_NOT_ACCEPTABLE );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1728,7 +1728,7 @@ int mpi_is_prime( mpi *X, int (*f_rng)(void *), void *p_rng )
|
|||
if( mpi_cmp_mpi( &A, &W ) != 0 ||
|
||||
mpi_cmp_int( &A, 1 ) == 0 )
|
||||
{
|
||||
ret = XYSSL_ERR_MPI_NOT_ACCEPTABLE;
|
||||
ret = POLARSSL_ERR_MPI_NOT_ACCEPTABLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1753,7 +1753,7 @@ int mpi_gen_prime( mpi *X, int nbits, int dh_flag,
|
|||
mpi Y;
|
||||
|
||||
if( nbits < 3 )
|
||||
return( XYSSL_ERR_MPI_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_MPI_BAD_INPUT_DATA );
|
||||
|
||||
mpi_init( &Y, NULL );
|
||||
|
||||
|
@ -1776,7 +1776,7 @@ int mpi_gen_prime( mpi *X, int nbits, int dh_flag,
|
|||
{
|
||||
while( ( ret = mpi_is_prime( X, f_rng, p_rng ) ) != 0 )
|
||||
{
|
||||
if( ret != XYSSL_ERR_MPI_NOT_ACCEPTABLE )
|
||||
if( ret != POLARSSL_ERR_MPI_NOT_ACCEPTABLE )
|
||||
goto cleanup;
|
||||
|
||||
MPI_CHK( mpi_add_int( X, X, 2 ) );
|
||||
|
@ -1794,11 +1794,11 @@ int mpi_gen_prime( mpi *X, int nbits, int dh_flag,
|
|||
if( ( ret = mpi_is_prime( &Y, f_rng, p_rng ) ) == 0 )
|
||||
break;
|
||||
|
||||
if( ret != XYSSL_ERR_MPI_NOT_ACCEPTABLE )
|
||||
if( ret != POLARSSL_ERR_MPI_NOT_ACCEPTABLE )
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if( ret != XYSSL_ERR_MPI_NOT_ACCEPTABLE )
|
||||
if( ret != POLARSSL_ERR_MPI_NOT_ACCEPTABLE )
|
||||
goto cleanup;
|
||||
|
||||
MPI_CHK( mpi_add_int( &Y, X, 1 ) );
|
||||
|
@ -1816,7 +1816,7 @@ cleanup:
|
|||
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_SELF_TEST)
|
||||
#if defined(POLARSSL_SELF_TEST)
|
||||
|
||||
/*
|
||||
* Checkup routine
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_CERTS_C)
|
||||
#if defined(POLARSSL_CERTS_C)
|
||||
|
||||
char test_ca_crt[] =
|
||||
"-----BEGIN CERTIFICATE-----\r\n"
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_DEBUG_C)
|
||||
#if defined(POLARSSL_DEBUG_C)
|
||||
|
||||
#include "xyssl/debug.h"
|
||||
#include "polarssl/debug.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
* http://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_DES_C)
|
||||
#if defined(POLARSSL_DES_C)
|
||||
|
||||
#include "xyssl/des.h"
|
||||
#include "polarssl/des.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -634,7 +634,7 @@ void des3_crypt_cbc( des3_context *ctx,
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(XYSSL_SELF_TEST)
|
||||
#if defined(POLARSSL_SELF_TEST)
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
* http://www.cacr.math.uwaterloo.ca/hac/ (chapter 12)
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_DHM_C)
|
||||
#if defined(POLARSSL_DHM_C)
|
||||
|
||||
#include "xyssl/dhm.h"
|
||||
#include "polarssl/dhm.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -41,16 +41,16 @@ static int dhm_read_bignum( mpi *X,
|
|||
int ret, n;
|
||||
|
||||
if( end - *p < 2 )
|
||||
return( XYSSL_ERR_DHM_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_DHM_BAD_INPUT_DATA );
|
||||
|
||||
n = ( (*p)[0] << 8 ) | (*p)[1];
|
||||
(*p) += 2;
|
||||
|
||||
if( (int)( end - *p ) < n )
|
||||
return( XYSSL_ERR_DHM_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_DHM_BAD_INPUT_DATA );
|
||||
|
||||
if( ( ret = mpi_read_binary( X, *p, n ) ) != 0 )
|
||||
return( XYSSL_ERR_DHM_READ_PARAMS_FAILED | ret );
|
||||
return( POLARSSL_ERR_DHM_READ_PARAMS_FAILED | ret );
|
||||
|
||||
(*p) += n;
|
||||
|
||||
|
@ -76,13 +76,13 @@ int dhm_read_params( dhm_context *ctx,
|
|||
ctx->len = mpi_size( &ctx->P );
|
||||
|
||||
if( end - *p < 2 )
|
||||
return( XYSSL_ERR_DHM_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_DHM_BAD_INPUT_DATA );
|
||||
|
||||
n = ( (*p)[0] << 8 ) | (*p)[1];
|
||||
(*p) += 2;
|
||||
|
||||
if( end != *p + n )
|
||||
return( XYSSL_ERR_DHM_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_DHM_BAD_INPUT_DATA );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ int dhm_make_params( dhm_context *ctx, int x_size,
|
|||
cleanup:
|
||||
|
||||
if( ret != 0 )
|
||||
return( ret | XYSSL_ERR_DHM_MAKE_PARAMS_FAILED );
|
||||
return( ret | POLARSSL_ERR_DHM_MAKE_PARAMS_FAILED );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -153,10 +153,10 @@ int dhm_read_public( dhm_context *ctx,
|
|||
int ret;
|
||||
|
||||
if( ctx == NULL || ilen < 1 || ilen > ctx->len )
|
||||
return( XYSSL_ERR_DHM_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_DHM_BAD_INPUT_DATA );
|
||||
|
||||
if( ( ret = mpi_read_binary( &ctx->GY, input, ilen ) ) != 0 )
|
||||
return( XYSSL_ERR_DHM_READ_PUBLIC_FAILED | ret );
|
||||
return( POLARSSL_ERR_DHM_READ_PUBLIC_FAILED | ret );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ int dhm_make_public( dhm_context *ctx, int x_size,
|
|||
unsigned char *p;
|
||||
|
||||
if( ctx == NULL || olen < 1 || olen > ctx->len )
|
||||
return( XYSSL_ERR_DHM_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_DHM_BAD_INPUT_DATA );
|
||||
|
||||
/*
|
||||
* generate X and calculate GX = G^X mod P
|
||||
|
@ -197,7 +197,7 @@ int dhm_make_public( dhm_context *ctx, int x_size,
|
|||
cleanup:
|
||||
|
||||
if( ret != 0 )
|
||||
return( XYSSL_ERR_DHM_MAKE_PUBLIC_FAILED | ret );
|
||||
return( POLARSSL_ERR_DHM_MAKE_PUBLIC_FAILED | ret );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ int dhm_calc_secret( dhm_context *ctx,
|
|||
int ret;
|
||||
|
||||
if( ctx == NULL || *olen < ctx->len )
|
||||
return( XYSSL_ERR_DHM_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_DHM_BAD_INPUT_DATA );
|
||||
|
||||
MPI_CHK( mpi_exp_mod( &ctx->K, &ctx->GY, &ctx->X,
|
||||
&ctx->P, &ctx->RP ) );
|
||||
|
@ -223,7 +223,7 @@ int dhm_calc_secret( dhm_context *ctx,
|
|||
cleanup:
|
||||
|
||||
if( ret != 0 )
|
||||
return( XYSSL_ERR_DHM_CALC_SECRET_FAILED | ret );
|
||||
return( POLARSSL_ERR_DHM_CALC_SECRET_FAILED | ret );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ void dhm_free( dhm_context *ctx )
|
|||
&ctx->P, NULL );
|
||||
}
|
||||
|
||||
#if defined(XYSSL_SELF_TEST)
|
||||
#if defined(POLARSSL_SELF_TEST)
|
||||
|
||||
/*
|
||||
* Checkup routine
|
||||
|
|
|
@ -28,12 +28,12 @@
|
|||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_HAVEGE_C)
|
||||
#if defined(POLARSSL_HAVEGE_C)
|
||||
|
||||
#include "xyssl/havege.h"
|
||||
#include "xyssl/timing.h"
|
||||
#include "polarssl/havege.h"
|
||||
#include "polarssl/timing.h"
|
||||
|
||||
/* ------------------------------------------------------------------------
|
||||
* On average, one iteration accesses two 8-word blocks in the havege WALK
|
||||
|
@ -209,7 +209,7 @@ int havege_rand( void *p_rng )
|
|||
return( ret );
|
||||
}
|
||||
|
||||
#if defined(XYSSL_RAND_TEST)
|
||||
#if defined(POLARSSL_RAND_TEST)
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
* http://www.ietf.org/rfc/rfc1319.txt
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_MD2_C)
|
||||
#if defined(POLARSSL_MD2_C)
|
||||
|
||||
#include "xyssl/md2.h"
|
||||
#include "polarssl/md2.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -269,7 +269,7 @@ void md2_hmac( unsigned char *key, int keylen, unsigned char *input, int ilen,
|
|||
memset( &ctx, 0, sizeof( md2_context ) );
|
||||
}
|
||||
|
||||
#if defined(XYSSL_SELF_TEST)
|
||||
#if defined(POLARSSL_SELF_TEST)
|
||||
|
||||
/*
|
||||
* RFC 1319 test vectors
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
* http://www.ietf.org/rfc/rfc1320.txt
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_MD4_C)
|
||||
#if defined(POLARSSL_MD4_C)
|
||||
|
||||
#include "xyssl/md4.h"
|
||||
#include "polarssl/md4.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -368,7 +368,7 @@ void md4_hmac( unsigned char *key, int keylen, unsigned char *input, int ilen,
|
|||
memset( &ctx, 0, sizeof( md4_context ) );
|
||||
}
|
||||
|
||||
#if defined(XYSSL_SELF_TEST)
|
||||
#if defined(POLARSSL_SELF_TEST)
|
||||
|
||||
/*
|
||||
* RFC 1320 test vectors
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
* http://www.ietf.org/rfc/rfc1321.txt
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_MD5_C)
|
||||
#if defined(POLARSSL_MD5_C)
|
||||
|
||||
#include "xyssl/md5.h"
|
||||
#include "polarssl/md5.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -387,7 +387,7 @@ void md5_hmac( unsigned char *key, int keylen, unsigned char *input, int ilen,
|
|||
memset( &ctx, 0, sizeof( md5_context ) );
|
||||
}
|
||||
|
||||
#if defined(XYSSL_SELF_TEST)
|
||||
#if defined(POLARSSL_SELF_TEST)
|
||||
/*
|
||||
* RFC 1321 test vectors
|
||||
*/
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_NET_C)
|
||||
#if defined(POLARSSL_NET_C)
|
||||
|
||||
#include "xyssl/net.h"
|
||||
#include "polarssl/net.h"
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32_WCE)
|
||||
|
||||
|
@ -89,7 +89,7 @@ int net_connect( int *fd, char *host, int port )
|
|||
if( wsa_init_done == 0 )
|
||||
{
|
||||
if( WSAStartup( MAKEWORD(2,0), &wsaData ) == SOCKET_ERROR )
|
||||
return( XYSSL_ERR_NET_SOCKET_FAILED );
|
||||
return( POLARSSL_ERR_NET_SOCKET_FAILED );
|
||||
|
||||
wsa_init_done = 1;
|
||||
}
|
||||
|
@ -98,10 +98,10 @@ int net_connect( int *fd, char *host, int port )
|
|||
#endif
|
||||
|
||||
if( ( server_host = gethostbyname( host ) ) == NULL )
|
||||
return( XYSSL_ERR_NET_UNKNOWN_HOST );
|
||||
return( POLARSSL_ERR_NET_UNKNOWN_HOST );
|
||||
|
||||
if( ( *fd = socket( AF_INET, SOCK_STREAM, IPPROTO_IP ) ) < 0 )
|
||||
return( XYSSL_ERR_NET_SOCKET_FAILED );
|
||||
return( POLARSSL_ERR_NET_SOCKET_FAILED );
|
||||
|
||||
memcpy( (void *) &server_addr.sin_addr,
|
||||
(void *) server_host->h_addr,
|
||||
|
@ -114,7 +114,7 @@ int net_connect( int *fd, char *host, int port )
|
|||
sizeof( server_addr ) ) < 0 )
|
||||
{
|
||||
close( *fd );
|
||||
return( XYSSL_ERR_NET_CONNECT_FAILED );
|
||||
return( POLARSSL_ERR_NET_CONNECT_FAILED );
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
|
@ -134,7 +134,7 @@ int net_bind( int *fd, char *bind_ip, int port )
|
|||
if( wsa_init_done == 0 )
|
||||
{
|
||||
if( WSAStartup( MAKEWORD(2,0), &wsaData ) == SOCKET_ERROR )
|
||||
return( XYSSL_ERR_NET_SOCKET_FAILED );
|
||||
return( POLARSSL_ERR_NET_SOCKET_FAILED );
|
||||
|
||||
wsa_init_done = 1;
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ int net_bind( int *fd, char *bind_ip, int port )
|
|||
#endif
|
||||
|
||||
if( ( *fd = socket( AF_INET, SOCK_STREAM, IPPROTO_IP ) ) < 0 )
|
||||
return( XYSSL_ERR_NET_SOCKET_FAILED );
|
||||
return( POLARSSL_ERR_NET_SOCKET_FAILED );
|
||||
|
||||
n = 1;
|
||||
setsockopt( *fd, SOL_SOCKET, SO_REUSEADDR,
|
||||
|
@ -174,13 +174,13 @@ int net_bind( int *fd, char *bind_ip, int port )
|
|||
sizeof( server_addr ) ) < 0 )
|
||||
{
|
||||
close( *fd );
|
||||
return( XYSSL_ERR_NET_BIND_FAILED );
|
||||
return( POLARSSL_ERR_NET_BIND_FAILED );
|
||||
}
|
||||
|
||||
if( listen( *fd, 10 ) != 0 )
|
||||
{
|
||||
close( *fd );
|
||||
return( XYSSL_ERR_NET_LISTEN_FAILED );
|
||||
return( POLARSSL_ERR_NET_LISTEN_FAILED );
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
|
@ -227,9 +227,9 @@ int net_accept( int bind_fd, int *client_fd, void *client_ip )
|
|||
if( *client_fd < 0 )
|
||||
{
|
||||
if( net_is_blocking() != 0 )
|
||||
return( XYSSL_ERR_NET_TRY_AGAIN );
|
||||
return( POLARSSL_ERR_NET_TRY_AGAIN );
|
||||
|
||||
return( XYSSL_ERR_NET_ACCEPT_FAILED );
|
||||
return( POLARSSL_ERR_NET_ACCEPT_FAILED );
|
||||
}
|
||||
|
||||
if( client_ip != NULL )
|
||||
|
@ -281,25 +281,25 @@ int net_recv( void *ctx, unsigned char *buf, int len )
|
|||
int ret = read( *((int *) ctx), buf, len );
|
||||
|
||||
if( len > 0 && ret == 0 )
|
||||
return( XYSSL_ERR_NET_CONN_RESET );
|
||||
return( POLARSSL_ERR_NET_CONN_RESET );
|
||||
|
||||
if( ret < 0 )
|
||||
{
|
||||
if( net_is_blocking() != 0 )
|
||||
return( XYSSL_ERR_NET_TRY_AGAIN );
|
||||
return( POLARSSL_ERR_NET_TRY_AGAIN );
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32_WCE)
|
||||
if( WSAGetLastError() == WSAECONNRESET )
|
||||
return( XYSSL_ERR_NET_CONN_RESET );
|
||||
return( POLARSSL_ERR_NET_CONN_RESET );
|
||||
#else
|
||||
if( errno == EPIPE || errno == ECONNRESET )
|
||||
return( XYSSL_ERR_NET_CONN_RESET );
|
||||
return( POLARSSL_ERR_NET_CONN_RESET );
|
||||
|
||||
if( errno == EINTR )
|
||||
return( XYSSL_ERR_NET_TRY_AGAIN );
|
||||
return( POLARSSL_ERR_NET_TRY_AGAIN );
|
||||
#endif
|
||||
|
||||
return( XYSSL_ERR_NET_RECV_FAILED );
|
||||
return( POLARSSL_ERR_NET_RECV_FAILED );
|
||||
}
|
||||
|
||||
return( ret );
|
||||
|
@ -315,20 +315,20 @@ int net_send( void *ctx, unsigned char *buf, int len )
|
|||
if( ret < 0 )
|
||||
{
|
||||
if( net_is_blocking() != 0 )
|
||||
return( XYSSL_ERR_NET_TRY_AGAIN );
|
||||
return( POLARSSL_ERR_NET_TRY_AGAIN );
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32_WCE)
|
||||
if( WSAGetLastError() == WSAECONNRESET )
|
||||
return( XYSSL_ERR_NET_CONN_RESET );
|
||||
return( POLARSSL_ERR_NET_CONN_RESET );
|
||||
#else
|
||||
if( errno == EPIPE || errno == ECONNRESET )
|
||||
return( XYSSL_ERR_NET_CONN_RESET );
|
||||
return( POLARSSL_ERR_NET_CONN_RESET );
|
||||
|
||||
if( errno == EINTR )
|
||||
return( XYSSL_ERR_NET_TRY_AGAIN );
|
||||
return( POLARSSL_ERR_NET_TRY_AGAIN );
|
||||
#endif
|
||||
|
||||
return( XYSSL_ERR_NET_SEND_FAILED );
|
||||
return( POLARSSL_ERR_NET_SEND_FAILED );
|
||||
}
|
||||
|
||||
return( ret );
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
* programming_guide.pdf
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_PADLOCK_C)
|
||||
#if defined(POLARSSL_PADLOCK_C)
|
||||
|
||||
#include "xyssl/aes.h"
|
||||
#include "xyssl/padlock.h"
|
||||
#include "polarssl/aes.h"
|
||||
#include "polarssl/padlock.h"
|
||||
|
||||
#if defined(XYSSL_HAVE_X86)
|
||||
#if defined(POLARSSL_HAVE_X86)
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
* http://www.cacr.math.uwaterloo.ca/hac/about/chap8.pdf
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_RSA_C)
|
||||
#if defined(POLARSSL_RSA_C)
|
||||
|
||||
#include "xyssl/rsa.h"
|
||||
#include "polarssl/rsa.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -52,7 +52,7 @@ void rsa_init( rsa_context *ctx,
|
|||
ctx->p_rng = p_rng;
|
||||
}
|
||||
|
||||
#if defined(XYSSL_GENPRIME)
|
||||
#if defined(POLARSSL_GENPRIME)
|
||||
|
||||
/*
|
||||
* Generate an RSA keypair
|
||||
|
@ -63,7 +63,7 @@ int rsa_gen_key( rsa_context *ctx, int nbits, int exponent )
|
|||
mpi P1, Q1, H, G;
|
||||
|
||||
if( ctx->f_rng == NULL || nbits < 128 || exponent < 3 )
|
||||
return( XYSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
|
||||
mpi_init( &P1, &Q1, &H, &G, NULL );
|
||||
|
||||
|
@ -118,7 +118,7 @@ cleanup:
|
|||
if( ret != 0 )
|
||||
{
|
||||
rsa_free( ctx );
|
||||
return( XYSSL_ERR_RSA_KEY_GEN_FAILED | ret );
|
||||
return( POLARSSL_ERR_RSA_KEY_GEN_FAILED | ret );
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
|
@ -133,15 +133,15 @@ int rsa_check_pubkey( rsa_context *ctx )
|
|||
{
|
||||
if( ( ctx->N.p[0] & 1 ) == 0 ||
|
||||
( ctx->E.p[0] & 1 ) == 0 )
|
||||
return( XYSSL_ERR_RSA_KEY_CHECK_FAILED );
|
||||
return( POLARSSL_ERR_RSA_KEY_CHECK_FAILED );
|
||||
|
||||
if( mpi_msb( &ctx->N ) < 128 ||
|
||||
mpi_msb( &ctx->N ) > 4096 )
|
||||
return( XYSSL_ERR_RSA_KEY_CHECK_FAILED );
|
||||
return( POLARSSL_ERR_RSA_KEY_CHECK_FAILED );
|
||||
|
||||
if( mpi_msb( &ctx->E ) < 2 ||
|
||||
mpi_msb( &ctx->E ) > 64 )
|
||||
return( XYSSL_ERR_RSA_KEY_CHECK_FAILED );
|
||||
return( POLARSSL_ERR_RSA_KEY_CHECK_FAILED );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ int rsa_check_privkey( rsa_context *ctx )
|
|||
cleanup:
|
||||
|
||||
mpi_free( &G, &I, &H, &Q1, &P1, &DE, &PQ, NULL );
|
||||
return( XYSSL_ERR_RSA_KEY_CHECK_FAILED | ret );
|
||||
return( POLARSSL_ERR_RSA_KEY_CHECK_FAILED | ret );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -198,7 +198,7 @@ int rsa_public( rsa_context *ctx,
|
|||
if( mpi_cmp_mpi( &T, &ctx->N ) >= 0 )
|
||||
{
|
||||
mpi_free( &T, NULL );
|
||||
return( XYSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
}
|
||||
|
||||
olen = ctx->len;
|
||||
|
@ -210,7 +210,7 @@ cleanup:
|
|||
mpi_free( &T, NULL );
|
||||
|
||||
if( ret != 0 )
|
||||
return( XYSSL_ERR_RSA_PUBLIC_FAILED | ret );
|
||||
return( POLARSSL_ERR_RSA_PUBLIC_FAILED | ret );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ int rsa_private( rsa_context *ctx,
|
|||
if( mpi_cmp_mpi( &T, &ctx->N ) >= 0 )
|
||||
{
|
||||
mpi_free( &T, NULL );
|
||||
return( XYSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -269,7 +269,7 @@ cleanup:
|
|||
mpi_free( &T, &T1, &T2, NULL );
|
||||
|
||||
if( ret != 0 )
|
||||
return( XYSSL_ERR_RSA_PRIVATE_FAILED | ret );
|
||||
return( POLARSSL_ERR_RSA_PRIVATE_FAILED | ret );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ int rsa_pkcs1_encrypt( rsa_context *ctx,
|
|||
case RSA_PKCS_V15:
|
||||
|
||||
if( ilen < 0 || olen < ilen + 11 )
|
||||
return( XYSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
|
||||
nb_pad = olen - 3 - ilen;
|
||||
|
||||
|
@ -312,7 +312,7 @@ int rsa_pkcs1_encrypt( rsa_context *ctx,
|
|||
|
||||
default:
|
||||
|
||||
return( XYSSL_ERR_RSA_INVALID_PADDING );
|
||||
return( POLARSSL_ERR_RSA_INVALID_PADDING );
|
||||
}
|
||||
|
||||
return( ( mode == RSA_PUBLIC )
|
||||
|
@ -335,7 +335,7 @@ int rsa_pkcs1_decrypt( rsa_context *ctx,
|
|||
ilen = ctx->len;
|
||||
|
||||
if( ilen < 16 || ilen > (int) sizeof( buf ) )
|
||||
return( XYSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
|
||||
ret = ( mode == RSA_PUBLIC )
|
||||
? rsa_public( ctx, input, buf )
|
||||
|
@ -351,12 +351,12 @@ int rsa_pkcs1_decrypt( rsa_context *ctx,
|
|||
case RSA_PKCS_V15:
|
||||
|
||||
if( *p++ != 0 || *p++ != RSA_CRYPT )
|
||||
return( XYSSL_ERR_RSA_INVALID_PADDING );
|
||||
return( POLARSSL_ERR_RSA_INVALID_PADDING );
|
||||
|
||||
while( *p != 0 )
|
||||
{
|
||||
if( p >= buf + ilen - 1 )
|
||||
return( XYSSL_ERR_RSA_INVALID_PADDING );
|
||||
return( POLARSSL_ERR_RSA_INVALID_PADDING );
|
||||
p++;
|
||||
}
|
||||
p++;
|
||||
|
@ -364,7 +364,7 @@ int rsa_pkcs1_decrypt( rsa_context *ctx,
|
|||
|
||||
default:
|
||||
|
||||
return( XYSSL_ERR_RSA_INVALID_PADDING );
|
||||
return( POLARSSL_ERR_RSA_INVALID_PADDING );
|
||||
}
|
||||
|
||||
*olen = ilen - (int)(p - buf);
|
||||
|
@ -409,11 +409,11 @@ int rsa_pkcs1_sign( rsa_context *ctx,
|
|||
break;
|
||||
|
||||
default:
|
||||
return( XYSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
}
|
||||
|
||||
if( nb_pad < 8 )
|
||||
return( XYSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
|
||||
*p++ = 0;
|
||||
*p++ = RSA_SIGN;
|
||||
|
@ -424,7 +424,7 @@ int rsa_pkcs1_sign( rsa_context *ctx,
|
|||
|
||||
default:
|
||||
|
||||
return( XYSSL_ERR_RSA_INVALID_PADDING );
|
||||
return( POLARSSL_ERR_RSA_INVALID_PADDING );
|
||||
}
|
||||
|
||||
switch( hash_id )
|
||||
|
@ -454,7 +454,7 @@ int rsa_pkcs1_sign( rsa_context *ctx,
|
|||
break;
|
||||
|
||||
default:
|
||||
return( XYSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
}
|
||||
|
||||
return( ( mode == RSA_PUBLIC )
|
||||
|
@ -479,7 +479,7 @@ int rsa_pkcs1_verify( rsa_context *ctx,
|
|||
siglen = ctx->len;
|
||||
|
||||
if( siglen < 16 || siglen > (int) sizeof( buf ) )
|
||||
return( XYSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
|
||||
ret = ( mode == RSA_PUBLIC )
|
||||
? rsa_public( ctx, sig, buf )
|
||||
|
@ -495,12 +495,12 @@ int rsa_pkcs1_verify( rsa_context *ctx,
|
|||
case RSA_PKCS_V15:
|
||||
|
||||
if( *p++ != 0 || *p++ != RSA_SIGN )
|
||||
return( XYSSL_ERR_RSA_INVALID_PADDING );
|
||||
return( POLARSSL_ERR_RSA_INVALID_PADDING );
|
||||
|
||||
while( *p != 0 )
|
||||
{
|
||||
if( p >= buf + siglen - 1 || *p != 0xFF )
|
||||
return( XYSSL_ERR_RSA_INVALID_PADDING );
|
||||
return( POLARSSL_ERR_RSA_INVALID_PADDING );
|
||||
p++;
|
||||
}
|
||||
p++;
|
||||
|
@ -508,7 +508,7 @@ int rsa_pkcs1_verify( rsa_context *ctx,
|
|||
|
||||
default:
|
||||
|
||||
return( XYSSL_ERR_RSA_INVALID_PADDING );
|
||||
return( POLARSSL_ERR_RSA_INVALID_PADDING );
|
||||
}
|
||||
|
||||
len = siglen - (int)( p - buf );
|
||||
|
@ -519,7 +519,7 @@ int rsa_pkcs1_verify( rsa_context *ctx,
|
|||
p[13] = 0;
|
||||
|
||||
if( memcmp( p, ASN1_HASH_MDX, 18 ) != 0 )
|
||||
return( XYSSL_ERR_RSA_VERIFY_FAILED );
|
||||
return( POLARSSL_ERR_RSA_VERIFY_FAILED );
|
||||
|
||||
if( ( c == 2 && hash_id == RSA_MD2 ) ||
|
||||
( c == 4 && hash_id == RSA_MD4 ) ||
|
||||
|
@ -528,7 +528,7 @@ int rsa_pkcs1_verify( rsa_context *ctx,
|
|||
if( memcmp( p + 18, hash, 16 ) == 0 )
|
||||
return( 0 );
|
||||
else
|
||||
return( XYSSL_ERR_RSA_VERIFY_FAILED );
|
||||
return( POLARSSL_ERR_RSA_VERIFY_FAILED );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -538,7 +538,7 @@ int rsa_pkcs1_verify( rsa_context *ctx,
|
|||
memcmp( p + 15, hash, 20 ) == 0 )
|
||||
return( 0 );
|
||||
else
|
||||
return( XYSSL_ERR_RSA_VERIFY_FAILED );
|
||||
return( POLARSSL_ERR_RSA_VERIFY_FAILED );
|
||||
}
|
||||
|
||||
if( len == hashlen && hash_id == RSA_RAW )
|
||||
|
@ -546,10 +546,10 @@ int rsa_pkcs1_verify( rsa_context *ctx,
|
|||
if( memcmp( p, hash, hashlen ) == 0 )
|
||||
return( 0 );
|
||||
else
|
||||
return( XYSSL_ERR_RSA_VERIFY_FAILED );
|
||||
return( POLARSSL_ERR_RSA_VERIFY_FAILED );
|
||||
}
|
||||
|
||||
return( XYSSL_ERR_RSA_INVALID_PADDING );
|
||||
return( POLARSSL_ERR_RSA_INVALID_PADDING );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -563,9 +563,9 @@ void rsa_free( rsa_context *ctx )
|
|||
&ctx->E, &ctx->N, NULL );
|
||||
}
|
||||
|
||||
#if defined(XYSSL_SELF_TEST)
|
||||
#if defined(POLARSSL_SELF_TEST)
|
||||
|
||||
#include "xyssl/sha1.h"
|
||||
#include "polarssl/sha1.h"
|
||||
|
||||
/*
|
||||
* Example RSA-1024 keypair, for test purposes
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
* http://www.itl.nist.gov/fipspubs/fip180-1.htm
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_SHA1_C)
|
||||
#if defined(POLARSSL_SHA1_C)
|
||||
|
||||
#include "xyssl/sha1.h"
|
||||
#include "polarssl/sha1.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -423,7 +423,7 @@ void sha1_hmac( unsigned char *key, int keylen,
|
|||
memset( &ctx, 0, sizeof( sha1_context ) );
|
||||
}
|
||||
|
||||
#if defined(XYSSL_SELF_TEST)
|
||||
#if defined(POLARSSL_SELF_TEST)
|
||||
/*
|
||||
* FIPS-180-1 test vectors
|
||||
*/
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
* http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_SHA2_C)
|
||||
#if defined(POLARSSL_SHA2_C)
|
||||
|
||||
#include "xyssl/sha2.h"
|
||||
#include "polarssl/sha2.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -430,7 +430,7 @@ void sha2_hmac( unsigned char *key, int keylen,
|
|||
memset( &ctx, 0, sizeof( sha2_context ) );
|
||||
}
|
||||
|
||||
#if defined(XYSSL_SELF_TEST)
|
||||
#if defined(POLARSSL_SELF_TEST)
|
||||
/*
|
||||
* FIPS-180-2 test vectors
|
||||
*/
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
* http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_SHA4_C)
|
||||
#if defined(POLARSSL_SHA4_C)
|
||||
|
||||
#include "xyssl/sha4.h"
|
||||
#include "polarssl/sha4.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -429,7 +429,7 @@ void sha4_hmac( unsigned char *key, int keylen,
|
|||
memset( &ctx, 0, sizeof( sha4_context ) );
|
||||
}
|
||||
|
||||
#if defined(XYSSL_SELF_TEST)
|
||||
#if defined(POLARSSL_SELF_TEST)
|
||||
|
||||
/*
|
||||
* FIPS-180-2 test vectors
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_SSL_CLI_C)
|
||||
#if defined(POLARSSL_SSL_CLI_C)
|
||||
|
||||
#include "xyssl/debug.h"
|
||||
#include "xyssl/ssl.h"
|
||||
#include "polarssl/debug.h"
|
||||
#include "polarssl/ssl.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -189,7 +189,7 @@ static int ssl_parse_server_hello( ssl_context *ssl )
|
|||
if( ssl->in_msgtype != SSL_MSG_HANDSHAKE )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
|
||||
return( XYSSL_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||
return( POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||
}
|
||||
|
||||
SSL_DEBUG_MSG( 3, ( "server hello, chosen version: [%d:%d]",
|
||||
|
@ -200,14 +200,14 @@ static int ssl_parse_server_hello( ssl_context *ssl )
|
|||
buf[4] != SSL_MAJOR_VERSION_3 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||
}
|
||||
|
||||
if( buf[5] != SSL_MINOR_VERSION_0 &&
|
||||
buf[5] != SSL_MINOR_VERSION_1 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||
}
|
||||
|
||||
ssl->minor_ver = buf[5];
|
||||
|
@ -245,7 +245,7 @@ static int ssl_parse_server_hello( ssl_context *ssl )
|
|||
if( n < 0 || n > 32 || ssl->in_hslen != 42 + n + ext_len )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||
}
|
||||
|
||||
i = ( buf[39 + n] << 8 ) | buf[40 + n];
|
||||
|
@ -286,7 +286,7 @@ static int ssl_parse_server_hello( ssl_context *ssl )
|
|||
if( ssl->ciphers[i] == 0 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||
}
|
||||
|
||||
if( ssl->ciphers[i++] == ssl->session->cipher )
|
||||
|
@ -296,7 +296,7 @@ static int ssl_parse_server_hello( ssl_context *ssl )
|
|||
if( buf[41 + n] != SSL_COMPRESS_NULL )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad server hello message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_SERVER_HELLO );
|
||||
}
|
||||
|
||||
/* TODO: Process extensions */
|
||||
|
@ -324,9 +324,9 @@ static int ssl_parse_server_key_exchange( ssl_context *ssl )
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
#if !defined(XYSSL_DHM_C)
|
||||
#if !defined(POLARSSL_DHM_C)
|
||||
SSL_DEBUG_MSG( 1, ( "support for dhm in not available" ) );
|
||||
return( XYSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
#else
|
||||
if( ( ret = ssl_read_record( ssl ) ) != 0 )
|
||||
{
|
||||
|
@ -337,13 +337,13 @@ static int ssl_parse_server_key_exchange( ssl_context *ssl )
|
|||
if( ssl->in_msgtype != SSL_MSG_HANDSHAKE )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
|
||||
return( XYSSL_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||
return( POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||
}
|
||||
|
||||
if( ssl->in_msg[0] != SSL_HS_SERVER_KEY_EXCHANGE )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -361,19 +361,19 @@ static int ssl_parse_server_key_exchange( ssl_context *ssl )
|
|||
if( ( ret = dhm_read_params( &ssl->dhm_ctx, &p, end ) ) != 0 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||
}
|
||||
|
||||
if( (int)( end - p ) != ssl->peer_cert->rsa.len )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||
}
|
||||
|
||||
if( ssl->dhm_ctx.len < 64 || ssl->dhm_ctx.len > 256 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||
}
|
||||
|
||||
SSL_DEBUG_MPI( 3, "DHM: P ", &ssl->dhm_ctx.P );
|
||||
|
@ -448,7 +448,7 @@ static int ssl_parse_certificate_request( ssl_context *ssl )
|
|||
if( ssl->in_msgtype != SSL_MSG_HANDSHAKE )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad certificate request message" ) );
|
||||
return( XYSSL_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||
return( POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||
}
|
||||
|
||||
ssl->client_auth = 0;
|
||||
|
@ -482,7 +482,7 @@ static int ssl_parse_server_hello_done( ssl_context *ssl )
|
|||
if( ssl->in_msgtype != SSL_MSG_HANDSHAKE )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad server hello done message" ) );
|
||||
return( XYSSL_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||
return( POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -490,7 +490,7 @@ static int ssl_parse_server_hello_done( ssl_context *ssl )
|
|||
ssl->in_msg[0] != SSL_HS_SERVER_HELLO_DONE )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad server hello done message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_SERVER_HELLO_DONE );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_SERVER_HELLO_DONE );
|
||||
}
|
||||
|
||||
ssl->state++;
|
||||
|
@ -509,9 +509,9 @@ static int ssl_write_client_key_exchange( ssl_context *ssl )
|
|||
if( ssl->session->cipher == SSL_EDH_RSA_DES_168_SHA ||
|
||||
ssl->session->cipher == SSL_EDH_RSA_AES_256_SHA )
|
||||
{
|
||||
#if !defined(XYSSL_DHM_C)
|
||||
#if !defined(POLARSSL_DHM_C)
|
||||
SSL_DEBUG_MSG( 1, ( "support for dhm in not available" ) );
|
||||
return( XYSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
#else
|
||||
/*
|
||||
* DHM key exchange -- send G^X mod P
|
||||
|
@ -615,7 +615,7 @@ static int ssl_write_certificate_verify( ssl_context *ssl )
|
|||
if( ssl->rsa_key == NULL )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "got no private key" ) );
|
||||
return( XYSSL_ERR_SSL_PRIVATE_KEY_REQUIRED );
|
||||
return( POLARSSL_ERR_SSL_PRIVATE_KEY_REQUIRED );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -753,7 +753,7 @@ int ssl_handshake_client( ssl_context *ssl )
|
|||
|
||||
default:
|
||||
SSL_DEBUG_MSG( 1, ( "invalid state %d", ssl->state ) );
|
||||
return( XYSSL_ERR_SSL_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_SSL_BAD_INPUT_DATA );
|
||||
}
|
||||
|
||||
if( ret != 0 )
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_SSL_SRV_C)
|
||||
#if defined(POLARSSL_SSL_SRV_C)
|
||||
|
||||
#include "xyssl/debug.h"
|
||||
#include "xyssl/ssl.h"
|
||||
#include "polarssl/debug.h"
|
||||
#include "polarssl/ssl.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -72,7 +72,7 @@ static int ssl_parse_client_hello( ssl_context *ssl )
|
|||
buf[3] != SSL_MAJOR_VERSION_3 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad client hello message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
}
|
||||
|
||||
n = ( ( buf[0] << 8 ) | buf[1] ) & 0x7FFF;
|
||||
|
@ -80,7 +80,7 @@ static int ssl_parse_client_hello( ssl_context *ssl )
|
|||
if( n < 17 || n > 512 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad client hello message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
}
|
||||
|
||||
ssl->max_major_ver = buf[3];
|
||||
|
@ -125,25 +125,25 @@ static int ssl_parse_client_hello( ssl_context *ssl )
|
|||
if( ciph_len < 3 || ( ciph_len % 3 ) != 0 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad client hello message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
}
|
||||
|
||||
if( sess_len < 0 || sess_len > 32 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad client hello message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
}
|
||||
|
||||
if( chal_len < 8 || chal_len > 32 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad client hello message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
}
|
||||
|
||||
if( n != 6 + ciph_len + sess_len + chal_len )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad client hello message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
}
|
||||
|
||||
SSL_DEBUG_BUF( 3, "client hello, cipherlist",
|
||||
|
@ -196,7 +196,7 @@ static int ssl_parse_client_hello( ssl_context *ssl )
|
|||
buf[1] != SSL_MAJOR_VERSION_3 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad client hello message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
}
|
||||
|
||||
n = ( buf[3] << 8 ) | buf[4];
|
||||
|
@ -204,7 +204,7 @@ static int ssl_parse_client_hello( ssl_context *ssl )
|
|||
if( n < 45 || n > 512 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad client hello message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
}
|
||||
|
||||
if( ( ret = ssl_fetch_input( ssl, 5 + n ) ) != 0 )
|
||||
|
@ -249,7 +249,7 @@ static int ssl_parse_client_hello( ssl_context *ssl )
|
|||
buf[4] != SSL_MAJOR_VERSION_3 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad client hello message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
}
|
||||
|
||||
ssl->major_ver = SSL_MAJOR_VERSION_3;
|
||||
|
@ -267,7 +267,7 @@ static int ssl_parse_client_hello( ssl_context *ssl )
|
|||
if( buf[1] != 0 || n != 4 + ( ( buf[2] << 8 ) | buf[3] ) )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad client hello message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -278,7 +278,7 @@ static int ssl_parse_client_hello( ssl_context *ssl )
|
|||
if( sess_len < 0 || sess_len > 32 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad client hello message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
}
|
||||
|
||||
ssl->session->length = sess_len;
|
||||
|
@ -294,7 +294,7 @@ static int ssl_parse_client_hello( ssl_context *ssl )
|
|||
if( ciph_len < 2 || ciph_len > 256 || ( ciph_len % 2 ) != 0 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad client hello message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -305,7 +305,7 @@ static int ssl_parse_client_hello( ssl_context *ssl )
|
|||
if( comp_len < 1 || comp_len > 16 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad client hello message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_HELLO );
|
||||
}
|
||||
|
||||
SSL_DEBUG_BUF( 3, "client hello, random bytes",
|
||||
|
@ -333,7 +333,7 @@ static int ssl_parse_client_hello( ssl_context *ssl )
|
|||
|
||||
SSL_DEBUG_MSG( 1, ( "got no ciphers in common" ) );
|
||||
|
||||
return( XYSSL_ERR_SSL_NO_CIPHER_CHOSEN );
|
||||
return( POLARSSL_ERR_SSL_NO_CIPHER_CHOSEN );
|
||||
|
||||
have_cipher:
|
||||
|
||||
|
@ -526,9 +526,9 @@ static int ssl_write_server_key_exchange( ssl_context *ssl )
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
#if !defined(XYSSL_DHM_C)
|
||||
#if !defined(POLARSSL_DHM_C)
|
||||
SSL_DEBUG_MSG( 1, ( "support for dhm is not available" ) );
|
||||
return( XYSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
#else
|
||||
/*
|
||||
* Ephemeral DH parameters:
|
||||
|
@ -646,21 +646,21 @@ static int ssl_parse_client_key_exchange( ssl_context *ssl )
|
|||
if( ssl->in_msgtype != SSL_MSG_HANDSHAKE )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad client key exchange message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE );
|
||||
}
|
||||
|
||||
if( ssl->in_msg[0] != SSL_HS_CLIENT_KEY_EXCHANGE )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad client key exchange message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE );
|
||||
}
|
||||
|
||||
if( ssl->session->cipher == SSL_EDH_RSA_DES_168_SHA ||
|
||||
ssl->session->cipher == SSL_EDH_RSA_AES_256_SHA )
|
||||
{
|
||||
#if !defined(XYSSL_DHM_C)
|
||||
#if !defined(POLARSSL_DHM_C)
|
||||
SSL_DEBUG_MSG( 1, ( "support for dhm is not available" ) );
|
||||
return( XYSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
#else
|
||||
/*
|
||||
* Receive G^Y mod P, premaster = (G^Y)^X mod P
|
||||
|
@ -671,14 +671,14 @@ static int ssl_parse_client_key_exchange( ssl_context *ssl )
|
|||
n + 6 != ssl->in_hslen )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad client key exchange message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE );
|
||||
}
|
||||
|
||||
if( ( ret = dhm_read_public( &ssl->dhm_ctx,
|
||||
ssl->in_msg + 6, n ) ) != 0 )
|
||||
{
|
||||
SSL_DEBUG_RET( 1, "dhm_read_public", ret );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE | ret );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE | ret );
|
||||
}
|
||||
|
||||
SSL_DEBUG_MPI( 3, "DHM: GY", &ssl->dhm_ctx.GY );
|
||||
|
@ -689,7 +689,7 @@ static int ssl_parse_client_key_exchange( ssl_context *ssl )
|
|||
ssl->premaster, &ssl->pmslen ) ) != 0 )
|
||||
{
|
||||
SSL_DEBUG_RET( 1, "dhm_calc_secret", ret );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE | ret );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE | ret );
|
||||
}
|
||||
|
||||
SSL_DEBUG_MPI( 3, "DHM: K ", &ssl->dhm_ctx.K );
|
||||
|
@ -711,14 +711,14 @@ static int ssl_parse_client_key_exchange( ssl_context *ssl )
|
|||
ssl->in_msg[5] != ( ( n ) & 0xFF ) )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad client key exchange message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE );
|
||||
}
|
||||
}
|
||||
|
||||
if( ssl->in_hslen != i + n )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad client key exchange message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE );
|
||||
}
|
||||
|
||||
ret = rsa_pkcs1_decrypt( ssl->rsa_key, RSA_PRIVATE, &ssl->pmslen,
|
||||
|
@ -782,13 +782,13 @@ static int ssl_parse_certificate_verify( ssl_context *ssl )
|
|||
if( ssl->in_msgtype != SSL_MSG_HANDSHAKE )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad certificate verify message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY );
|
||||
}
|
||||
|
||||
if( ssl->in_msg[0] != SSL_HS_CERTIFICATE_VERIFY )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad certificate verify message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY );
|
||||
}
|
||||
|
||||
n1 = ssl->peer_cert->rsa.len;
|
||||
|
@ -797,7 +797,7 @@ static int ssl_parse_certificate_verify( ssl_context *ssl )
|
|||
if( n1 + 6 != ssl->in_hslen || n1 != n2 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad certificate verify message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY );
|
||||
}
|
||||
|
||||
ret = rsa_pkcs1_verify( &ssl->peer_cert->rsa, RSA_PUBLIC,
|
||||
|
@ -915,7 +915,7 @@ int ssl_handshake_server( ssl_context *ssl )
|
|||
|
||||
default:
|
||||
SSL_DEBUG_MSG( 1, ( "invalid state %d", ssl->state ) );
|
||||
return( XYSSL_ERR_SSL_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_SSL_BAD_INPUT_DATA );
|
||||
}
|
||||
|
||||
if( ret != 0 )
|
||||
|
|
|
@ -26,15 +26,15 @@
|
|||
* http://www.ietf.org/rfc/rfc4346.txt
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_SSL_TLS_C)
|
||||
#if defined(POLARSSL_SSL_TLS_C)
|
||||
|
||||
#include "xyssl/aes.h"
|
||||
#include "xyssl/arc4.h"
|
||||
#include "xyssl/des.h"
|
||||
#include "xyssl/debug.h"
|
||||
#include "xyssl/ssl.h"
|
||||
#include "polarssl/aes.h"
|
||||
#include "polarssl/arc4.h"
|
||||
#include "polarssl/des.h"
|
||||
#include "polarssl/debug.h"
|
||||
#include "polarssl/ssl.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -54,7 +54,7 @@ static int tls1_prf( unsigned char *secret, int slen, char *label,
|
|||
unsigned char h_i[20];
|
||||
|
||||
if( sizeof( tmp ) < 20 + strlen( label ) + rlen )
|
||||
return( XYSSL_ERR_SSL_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_SSL_BAD_INPUT_DATA );
|
||||
|
||||
hs = ( slen + 1 ) / 2;
|
||||
S1 = secret;
|
||||
|
@ -220,7 +220,7 @@ int ssl_derive_keys( ssl_context *ssl )
|
|||
*/
|
||||
switch( ssl->session->cipher )
|
||||
{
|
||||
#if defined(XYSSL_ARC4_C)
|
||||
#if defined(POLARSSL_ARC4_C)
|
||||
case SSL_RSA_RC4_128_MD5:
|
||||
ssl->keylen = 16; ssl->minlen = 16;
|
||||
ssl->ivlen = 0; ssl->maclen = 16;
|
||||
|
@ -232,7 +232,7 @@ int ssl_derive_keys( ssl_context *ssl )
|
|||
break;
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_DES_C)
|
||||
#if defined(POLARSSL_DES_C)
|
||||
case SSL_RSA_DES_168_SHA:
|
||||
case SSL_EDH_RSA_DES_168_SHA:
|
||||
ssl->keylen = 24; ssl->minlen = 24;
|
||||
|
@ -240,7 +240,7 @@ int ssl_derive_keys( ssl_context *ssl )
|
|||
break;
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_AES_C)
|
||||
#if defined(POLARSSL_AES_C)
|
||||
case SSL_RSA_AES_128_SHA:
|
||||
ssl->keylen = 16; ssl->minlen = 32;
|
||||
ssl->ivlen = 16; ssl->maclen = 20;
|
||||
|
@ -256,7 +256,7 @@ int ssl_derive_keys( ssl_context *ssl )
|
|||
default:
|
||||
SSL_DEBUG_MSG( 1, ( "cipher %s is not available",
|
||||
ssl_get_cipher( ssl ) ) );
|
||||
return( XYSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
}
|
||||
|
||||
SSL_DEBUG_MSG( 3, ( "keylen: %d, minlen: %d, ivlen: %d, maclen: %d",
|
||||
|
@ -292,7 +292,7 @@ int ssl_derive_keys( ssl_context *ssl )
|
|||
|
||||
switch( ssl->session->cipher )
|
||||
{
|
||||
#if defined(XYSSL_ARC4_C)
|
||||
#if defined(POLARSSL_ARC4_C)
|
||||
case SSL_RSA_RC4_128_MD5:
|
||||
case SSL_RSA_RC4_128_SHA:
|
||||
arc4_setup( (arc4_context *) ssl->ctx_enc, key1, ssl->keylen );
|
||||
|
@ -300,7 +300,7 @@ int ssl_derive_keys( ssl_context *ssl )
|
|||
break;
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_DES_C)
|
||||
#if defined(POLARSSL_DES_C)
|
||||
case SSL_RSA_DES_168_SHA:
|
||||
case SSL_EDH_RSA_DES_168_SHA:
|
||||
des3_set3key_enc( (des3_context *) ssl->ctx_enc, key1 );
|
||||
|
@ -308,7 +308,7 @@ int ssl_derive_keys( ssl_context *ssl )
|
|||
break;
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_AES_C)
|
||||
#if defined(POLARSSL_AES_C)
|
||||
case SSL_RSA_AES_128_SHA:
|
||||
aes_setkey_enc( (aes_context *) ssl->ctx_enc, key1, 128 );
|
||||
aes_setkey_dec( (aes_context *) ssl->ctx_dec, key2, 128 );
|
||||
|
@ -322,7 +322,7 @@ int ssl_derive_keys( ssl_context *ssl )
|
|||
#endif
|
||||
|
||||
default:
|
||||
return( XYSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
}
|
||||
|
||||
memset( keyblk, 0, sizeof( keyblk ) );
|
||||
|
@ -490,7 +490,7 @@ static int ssl_encrypt_buf( ssl_context *ssl )
|
|||
|
||||
if( ssl->ivlen == 0 )
|
||||
{
|
||||
#if defined(XYSSL_ARC4_C)
|
||||
#if defined(POLARSSL_ARC4_C)
|
||||
padlen = 0;
|
||||
|
||||
SSL_DEBUG_MSG( 3, ( "before encrypt: msglen = %d, "
|
||||
|
@ -503,7 +503,7 @@ static int ssl_encrypt_buf( ssl_context *ssl )
|
|||
arc4_crypt( (arc4_context *) ssl->ctx_enc,
|
||||
ssl->out_msg, ssl->out_msglen );
|
||||
#else
|
||||
return( XYSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@ -527,7 +527,7 @@ static int ssl_encrypt_buf( ssl_context *ssl )
|
|||
switch( ssl->ivlen )
|
||||
{
|
||||
case 8:
|
||||
#if defined(XYSSL_DES_C)
|
||||
#if defined(POLARSSL_DES_C)
|
||||
des3_crypt_cbc( (des3_context *) ssl->ctx_enc,
|
||||
DES_ENCRYPT, ssl->out_msglen,
|
||||
ssl->iv_enc, ssl->out_msg, ssl->out_msg );
|
||||
|
@ -535,7 +535,7 @@ static int ssl_encrypt_buf( ssl_context *ssl )
|
|||
#endif
|
||||
|
||||
case 16:
|
||||
#if defined(XYSSL_AES_C)
|
||||
#if defined(POLARSSL_AES_C)
|
||||
aes_crypt_cbc( (aes_context *) ssl->ctx_enc,
|
||||
AES_ENCRYPT, ssl->out_msglen,
|
||||
ssl->iv_enc, ssl->out_msg, ssl->out_msg );
|
||||
|
@ -543,7 +543,7 @@ static int ssl_encrypt_buf( ssl_context *ssl )
|
|||
#endif
|
||||
|
||||
default:
|
||||
return( XYSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -563,17 +563,17 @@ static int ssl_decrypt_buf( ssl_context *ssl )
|
|||
{
|
||||
SSL_DEBUG_MSG( 1, ( "in_msglen (%d) < minlen (%d)",
|
||||
ssl->in_msglen, ssl->minlen ) );
|
||||
return( XYSSL_ERR_SSL_INVALID_MAC );
|
||||
return( POLARSSL_ERR_SSL_INVALID_MAC );
|
||||
}
|
||||
|
||||
if( ssl->ivlen == 0 )
|
||||
{
|
||||
#if defined(XYSSL_ARC4_C)
|
||||
#if defined(POLARSSL_ARC4_C)
|
||||
padlen = 0;
|
||||
arc4_crypt( (arc4_context *) ssl->ctx_dec,
|
||||
ssl->in_msg, ssl->in_msglen );
|
||||
#else
|
||||
return( XYSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@ -585,12 +585,12 @@ static int ssl_decrypt_buf( ssl_context *ssl )
|
|||
{
|
||||
SSL_DEBUG_MSG( 1, ( "msglen (%d) %% ivlen (%d) != 0",
|
||||
ssl->in_msglen, ssl->ivlen ) );
|
||||
return( XYSSL_ERR_SSL_INVALID_MAC );
|
||||
return( POLARSSL_ERR_SSL_INVALID_MAC );
|
||||
}
|
||||
|
||||
switch( ssl->ivlen )
|
||||
{
|
||||
#if defined(XYSSL_DES_C)
|
||||
#if defined(POLARSSL_DES_C)
|
||||
case 8:
|
||||
des3_crypt_cbc( (des3_context *) ssl->ctx_dec,
|
||||
DES_DECRYPT, ssl->in_msglen,
|
||||
|
@ -598,7 +598,7 @@ static int ssl_decrypt_buf( ssl_context *ssl )
|
|||
break;
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_AES_C)
|
||||
#if defined(POLARSSL_AES_C)
|
||||
case 16:
|
||||
aes_crypt_cbc( (aes_context *) ssl->ctx_dec,
|
||||
AES_DECRYPT, ssl->in_msglen,
|
||||
|
@ -607,7 +607,7 @@ static int ssl_decrypt_buf( ssl_context *ssl )
|
|||
#endif
|
||||
|
||||
default:
|
||||
return( XYSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||
}
|
||||
|
||||
padlen = 1 + ssl->in_msg[ssl->in_msglen - 1];
|
||||
|
@ -684,7 +684,7 @@ static int ssl_decrypt_buf( ssl_context *ssl )
|
|||
ssl->maclen ) != 0 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "message mac does not match" ) );
|
||||
return( XYSSL_ERR_SSL_INVALID_MAC );
|
||||
return( POLARSSL_ERR_SSL_INVALID_MAC );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -692,7 +692,7 @@ static int ssl_decrypt_buf( ssl_context *ssl )
|
|||
* will produce the same error as an invalid MAC.
|
||||
*/
|
||||
if( ssl->ivlen != 0 && padlen == 0 )
|
||||
return( XYSSL_ERR_SSL_INVALID_MAC );
|
||||
return( POLARSSL_ERR_SSL_INVALID_MAC );
|
||||
|
||||
if( ssl->in_msglen == 0 )
|
||||
{
|
||||
|
@ -706,7 +706,7 @@ static int ssl_decrypt_buf( ssl_context *ssl )
|
|||
{
|
||||
SSL_DEBUG_MSG( 1, ( "received four consecutive empty "
|
||||
"messages, possible DoS attack" ) );
|
||||
return( XYSSL_ERR_SSL_INVALID_MAC );
|
||||
return( POLARSSL_ERR_SSL_INVALID_MAC );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -866,13 +866,13 @@ int ssl_read_record( ssl_context *ssl )
|
|||
if( ssl->in_msglen < 4 || ssl->in_msg[1] != 0 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad handshake length" ) );
|
||||
return( XYSSL_ERR_SSL_INVALID_RECORD );
|
||||
return( POLARSSL_ERR_SSL_INVALID_RECORD );
|
||||
}
|
||||
|
||||
if( ssl->in_msglen < ssl->in_hslen )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad handshake length" ) );
|
||||
return( XYSSL_ERR_SSL_INVALID_RECORD );
|
||||
return( POLARSSL_ERR_SSL_INVALID_RECORD );
|
||||
}
|
||||
|
||||
md5_update( &ssl->fin_md5 , ssl->in_msg, ssl->in_hslen );
|
||||
|
@ -903,14 +903,14 @@ int ssl_read_record( ssl_context *ssl )
|
|||
if( ssl->in_hdr[1] != ssl->major_ver )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "major version mismatch" ) );
|
||||
return( XYSSL_ERR_SSL_INVALID_RECORD );
|
||||
return( POLARSSL_ERR_SSL_INVALID_RECORD );
|
||||
}
|
||||
|
||||
if( ssl->in_hdr[2] != SSL_MINOR_VERSION_0 &&
|
||||
ssl->in_hdr[2] != SSL_MINOR_VERSION_1 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "minor version mismatch" ) );
|
||||
return( XYSSL_ERR_SSL_INVALID_RECORD );
|
||||
return( POLARSSL_ERR_SSL_INVALID_RECORD );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -922,7 +922,7 @@ int ssl_read_record( ssl_context *ssl )
|
|||
ssl->in_msglen > SSL_MAX_CONTENT_LEN )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad message length" ) );
|
||||
return( XYSSL_ERR_SSL_INVALID_RECORD );
|
||||
return( POLARSSL_ERR_SSL_INVALID_RECORD );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -930,14 +930,14 @@ int ssl_read_record( ssl_context *ssl )
|
|||
if( ssl->in_msglen < ssl->minlen )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad message length" ) );
|
||||
return( XYSSL_ERR_SSL_INVALID_RECORD );
|
||||
return( POLARSSL_ERR_SSL_INVALID_RECORD );
|
||||
}
|
||||
|
||||
if( ssl->minor_ver == SSL_MINOR_VERSION_0 &&
|
||||
ssl->in_msglen > ssl->minlen + SSL_MAX_CONTENT_LEN )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad message length" ) );
|
||||
return( XYSSL_ERR_SSL_INVALID_RECORD );
|
||||
return( POLARSSL_ERR_SSL_INVALID_RECORD );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -947,7 +947,7 @@ int ssl_read_record( ssl_context *ssl )
|
|||
ssl->in_msglen > ssl->minlen + SSL_MAX_CONTENT_LEN + 256 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad message length" ) );
|
||||
return( XYSSL_ERR_SSL_INVALID_RECORD );
|
||||
return( POLARSSL_ERR_SSL_INVALID_RECORD );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -977,7 +977,7 @@ int ssl_read_record( ssl_context *ssl )
|
|||
if( ssl->in_msglen > SSL_MAX_CONTENT_LEN )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad message length" ) );
|
||||
return( XYSSL_ERR_SSL_INVALID_RECORD );
|
||||
return( POLARSSL_ERR_SSL_INVALID_RECORD );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -996,13 +996,13 @@ int ssl_read_record( ssl_context *ssl )
|
|||
if( ssl->in_msglen < 4 || ssl->in_msg[1] != 0 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad handshake length" ) );
|
||||
return( XYSSL_ERR_SSL_INVALID_RECORD );
|
||||
return( POLARSSL_ERR_SSL_INVALID_RECORD );
|
||||
}
|
||||
|
||||
if( ssl->in_msglen < ssl->in_hslen )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad handshake length" ) );
|
||||
return( XYSSL_ERR_SSL_INVALID_RECORD );
|
||||
return( POLARSSL_ERR_SSL_INVALID_RECORD );
|
||||
}
|
||||
|
||||
md5_update( &ssl->fin_md5 , ssl->in_msg, ssl->in_hslen );
|
||||
|
@ -1020,14 +1020,14 @@ int ssl_read_record( ssl_context *ssl )
|
|||
if( ssl->in_msg[0] == SSL_ALERT_FATAL )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "is a fatal alert message" ) );
|
||||
return( XYSSL_ERR_SSL_FATAL_ALERT_MESSAGE | ssl->in_msg[1] );
|
||||
return( POLARSSL_ERR_SSL_FATAL_ALERT_MESSAGE | ssl->in_msg[1] );
|
||||
}
|
||||
|
||||
if( ssl->in_msg[0] == SSL_ALERT_WARNING &&
|
||||
ssl->in_msg[1] == SSL_ALERT_CLOSE_NOTIFY )
|
||||
{
|
||||
SSL_DEBUG_MSG( 2, ( "is a close notify message" ) );
|
||||
return( XYSSL_ERR_SSL_PEER_CLOSE_NOTIFY );
|
||||
return( POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1078,7 +1078,7 @@ int ssl_write_certificate( ssl_context *ssl )
|
|||
if( ssl->own_cert == NULL )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "got no certificate to send" ) );
|
||||
return( XYSSL_ERR_SSL_CERTIFICATE_REQUIRED );
|
||||
return( POLARSSL_ERR_SSL_CERTIFICATE_REQUIRED );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1103,7 +1103,7 @@ int ssl_write_certificate( ssl_context *ssl )
|
|||
{
|
||||
SSL_DEBUG_MSG( 1, ( "certificate too large, %d > %d",
|
||||
i + 3 + n, SSL_MAX_CONTENT_LEN ) );
|
||||
return( XYSSL_ERR_SSL_CERTIFICATE_TOO_LARGE );
|
||||
return( POLARSSL_ERR_SSL_CERTIFICATE_TOO_LARGE );
|
||||
}
|
||||
|
||||
ssl->out_msg[i ] = (unsigned char)( n >> 16 );
|
||||
|
@ -1175,7 +1175,7 @@ int ssl_parse_certificate( ssl_context *ssl )
|
|||
if( ssl->authmode == SSL_VERIFY_OPTIONAL )
|
||||
return( 0 );
|
||||
else
|
||||
return( XYSSL_ERR_SSL_NO_CLIENT_CERTIFICATE );
|
||||
return( POLARSSL_ERR_SSL_NO_CLIENT_CERTIFICATE );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1190,7 +1190,7 @@ int ssl_parse_certificate( ssl_context *ssl )
|
|||
SSL_DEBUG_MSG( 1, ( "TLSv1 client has no certificate" ) );
|
||||
|
||||
if( ssl->authmode == SSL_VERIFY_REQUIRED )
|
||||
return( XYSSL_ERR_SSL_NO_CLIENT_CERTIFICATE );
|
||||
return( POLARSSL_ERR_SSL_NO_CLIENT_CERTIFICATE );
|
||||
else
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -1199,13 +1199,13 @@ int ssl_parse_certificate( ssl_context *ssl )
|
|||
if( ssl->in_msgtype != SSL_MSG_HANDSHAKE )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad certificate message" ) );
|
||||
return( XYSSL_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||
return( POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||
}
|
||||
|
||||
if( ssl->in_msg[0] != SSL_HS_CERTIFICATE || ssl->in_hslen < 10 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad certificate message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CERTIFICATE );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1216,7 +1216,7 @@ int ssl_parse_certificate( ssl_context *ssl )
|
|||
if( ssl->in_msg[4] != 0 || ssl->in_hslen != 7 + n )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad certificate message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CERTIFICATE );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE );
|
||||
}
|
||||
|
||||
if( ( ssl->peer_cert = (x509_cert *) malloc(
|
||||
|
@ -1236,7 +1236,7 @@ int ssl_parse_certificate( ssl_context *ssl )
|
|||
if( ssl->in_msg[i] != 0 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad certificate message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CERTIFICATE );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE );
|
||||
}
|
||||
|
||||
n = ( (unsigned int) ssl->in_msg[i + 1] << 8 )
|
||||
|
@ -1246,7 +1246,7 @@ int ssl_parse_certificate( ssl_context *ssl )
|
|||
if( n < 128 || i + n > ssl->in_hslen )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad certificate message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CERTIFICATE );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE );
|
||||
}
|
||||
|
||||
ret = x509parse_crt( ssl->peer_cert, ssl->in_msg + i, n );
|
||||
|
@ -1266,7 +1266,7 @@ int ssl_parse_certificate( ssl_context *ssl )
|
|||
if( ssl->ca_chain == NULL )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "got no CA chain" ) );
|
||||
return( XYSSL_ERR_SSL_CA_CHAIN_REQUIRED );
|
||||
return( POLARSSL_ERR_SSL_CA_CHAIN_REQUIRED );
|
||||
}
|
||||
|
||||
ret = x509parse_verify( ssl->peer_cert, ssl->ca_chain,
|
||||
|
@ -1325,13 +1325,13 @@ int ssl_parse_change_cipher_spec( ssl_context *ssl )
|
|||
if( ssl->in_msgtype != SSL_MSG_CHANGE_CIPHER_SPEC )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad change cipher spec message" ) );
|
||||
return( XYSSL_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||
return( POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||
}
|
||||
|
||||
if( ssl->in_msglen != 1 || ssl->in_msg[0] != 1 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad change cipher spec message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC );
|
||||
}
|
||||
|
||||
ssl->state++;
|
||||
|
@ -1500,7 +1500,7 @@ int ssl_parse_finished( ssl_context *ssl )
|
|||
if( ssl->in_msgtype != SSL_MSG_HANDSHAKE )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad finished message" ) );
|
||||
return( XYSSL_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||
return( POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||
}
|
||||
|
||||
hash_len = ( ssl->minor_ver == SSL_MINOR_VERSION_0 ) ? 36 : 12;
|
||||
|
@ -1509,7 +1509,7 @@ int ssl_parse_finished( ssl_context *ssl )
|
|||
ssl->in_hslen != 4 + hash_len )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad finished message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_FINISHED );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_FINISHED );
|
||||
}
|
||||
|
||||
ssl_calc_finished( ssl, buf, ssl->endpoint ^ 1, &md5, &sha1 );
|
||||
|
@ -1517,7 +1517,7 @@ int ssl_parse_finished( ssl_context *ssl )
|
|||
if( memcmp( ssl->in_msg + 4, buf, hash_len ) != 0 )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad finished message" ) );
|
||||
return( XYSSL_ERR_SSL_BAD_HS_FINISHED );
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_FINISHED );
|
||||
}
|
||||
|
||||
if( ssl->resume != 0 )
|
||||
|
@ -1674,7 +1674,7 @@ int ssl_set_dh_param( ssl_context *ssl, char *dhm_P, char *dhm_G )
|
|||
int ssl_set_hostname( ssl_context *ssl, char *hostname )
|
||||
{
|
||||
if( hostname == NULL )
|
||||
return( XYSSL_ERR_SSL_BAD_INPUT_DATA );
|
||||
return( POLARSSL_ERR_SSL_BAD_INPUT_DATA );
|
||||
|
||||
ssl->hostname_len = strlen( hostname );
|
||||
ssl->hostname = (unsigned char *) malloc( ssl->hostname_len );
|
||||
|
@ -1702,7 +1702,7 @@ char *ssl_get_cipher( ssl_context *ssl )
|
|||
{
|
||||
switch( ssl->session->cipher )
|
||||
{
|
||||
#if defined(XYSSL_ARC4_C)
|
||||
#if defined(POLARSSL_ARC4_C)
|
||||
case SSL_RSA_RC4_128_MD5:
|
||||
return( "SSL_RSA_RC4_128_MD5" );
|
||||
|
||||
|
@ -1710,7 +1710,7 @@ char *ssl_get_cipher( ssl_context *ssl )
|
|||
return( "SSL_RSA_RC4_128_SHA" );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_DES_C)
|
||||
#if defined(POLARSSL_DES_C)
|
||||
case SSL_RSA_DES_168_SHA:
|
||||
return( "SSL_RSA_DES_168_SHA" );
|
||||
|
||||
|
@ -1718,7 +1718,7 @@ char *ssl_get_cipher( ssl_context *ssl )
|
|||
return( "SSL_EDH_RSA_DES_168_SHA" );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_AES_C)
|
||||
#if defined(POLARSSL_AES_C)
|
||||
case SSL_RSA_AES_128_SHA:
|
||||
return( "SSL_RSA_AES_128_SHA" );
|
||||
|
||||
|
@ -1738,23 +1738,23 @@ char *ssl_get_cipher( ssl_context *ssl )
|
|||
|
||||
int ssl_default_ciphers[] =
|
||||
{
|
||||
#if defined(XYSSL_DHM_C)
|
||||
#if defined(XYSSL_AES_C)
|
||||
#if defined(POLARSSL_DHM_C)
|
||||
#if defined(POLARSSL_AES_C)
|
||||
SSL_EDH_RSA_AES_256_SHA,
|
||||
#endif
|
||||
#if defined(XYSSL_DES_C)
|
||||
#if defined(POLARSSL_DES_C)
|
||||
SSL_EDH_RSA_DES_168_SHA,
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_AES_C)
|
||||
#if defined(POLARSSL_AES_C)
|
||||
SSL_RSA_AES_128_SHA,
|
||||
SSL_RSA_AES_256_SHA,
|
||||
#endif
|
||||
#if defined(XYSSL_DES_C)
|
||||
#if defined(POLARSSL_DES_C)
|
||||
SSL_RSA_DES_168_SHA,
|
||||
#endif
|
||||
#if defined(XYSSL_ARC4_C)
|
||||
#if defined(POLARSSL_ARC4_C)
|
||||
SSL_RSA_RC4_128_SHA,
|
||||
SSL_RSA_RC4_128_MD5,
|
||||
#endif
|
||||
|
@ -1766,16 +1766,16 @@ int ssl_default_ciphers[] =
|
|||
*/
|
||||
int ssl_handshake( ssl_context *ssl )
|
||||
{
|
||||
int ret = XYSSL_ERR_SSL_FEATURE_UNAVAILABLE;
|
||||
int ret = POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE;
|
||||
|
||||
SSL_DEBUG_MSG( 2, ( "=> handshake" ) );
|
||||
|
||||
#if defined(XYSSL_SSL_CLI_C)
|
||||
#if defined(POLARSSL_SSL_CLI_C)
|
||||
if( ssl->endpoint == SSL_IS_CLIENT )
|
||||
ret = ssl_handshake_client( ssl );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_SSL_SRV_C)
|
||||
#if defined(POLARSSL_SSL_SRV_C)
|
||||
if( ssl->endpoint == SSL_IS_SERVER )
|
||||
ret = ssl_handshake_server( ssl );
|
||||
#endif
|
||||
|
@ -1827,7 +1827,7 @@ int ssl_read( ssl_context *ssl, unsigned char *buf, int len )
|
|||
if( ssl->in_msgtype != SSL_MSG_APPLICATION_DATA )
|
||||
{
|
||||
SSL_DEBUG_MSG( 1, ( "bad application data message" ) );
|
||||
return( XYSSL_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||
return( POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE );
|
||||
}
|
||||
|
||||
ssl->in_offt = ssl->in_msg;
|
||||
|
@ -1958,7 +1958,7 @@ void ssl_free( ssl_context *ssl )
|
|||
free( ssl->in_ctr );
|
||||
}
|
||||
|
||||
#if defined(XYSSL_DHM_C)
|
||||
#if defined(POLARSSL_DHM_C)
|
||||
dhm_free( &ssl->dhm_ctx );
|
||||
#endif
|
||||
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_TIMING_C)
|
||||
#if defined(POLARSSL_TIMING_C)
|
||||
|
||||
#include "xyssl/timing.h"
|
||||
#include "polarssl/timing.h"
|
||||
|
||||
#if defined(WIN32)
|
||||
|
||||
|
|
|
@ -29,17 +29,17 @@
|
|||
* http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf
|
||||
*/
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#if defined(XYSSL_X509_PARSE_C)
|
||||
#if defined(POLARSSL_X509_PARSE_C)
|
||||
|
||||
#include "xyssl/x509.h"
|
||||
#include "xyssl/base64.h"
|
||||
#include "xyssl/des.h"
|
||||
#include "xyssl/md2.h"
|
||||
#include "xyssl/md4.h"
|
||||
#include "xyssl/md5.h"
|
||||
#include "xyssl/sha1.h"
|
||||
#include "polarssl/x509.h"
|
||||
#include "polarssl/base64.h"
|
||||
#include "polarssl/des.h"
|
||||
#include "polarssl/md2.h"
|
||||
#include "polarssl/md4.h"
|
||||
#include "polarssl/md5.h"
|
||||
#include "polarssl/sha1.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -54,7 +54,7 @@ static int asn1_get_len( unsigned char **p,
|
|||
int *len )
|
||||
{
|
||||
if( ( end - *p ) < 1 )
|
||||
return( XYSSL_ERR_ASN1_OUT_OF_DATA );
|
||||
return( POLARSSL_ERR_ASN1_OUT_OF_DATA );
|
||||
|
||||
if( ( **p & 0x80 ) == 0 )
|
||||
*len = *(*p)++;
|
||||
|
@ -64,7 +64,7 @@ static int asn1_get_len( unsigned char **p,
|
|||
{
|
||||
case 1:
|
||||
if( ( end - *p ) < 2 )
|
||||
return( XYSSL_ERR_ASN1_OUT_OF_DATA );
|
||||
return( POLARSSL_ERR_ASN1_OUT_OF_DATA );
|
||||
|
||||
*len = (*p)[1];
|
||||
(*p) += 2;
|
||||
|
@ -72,20 +72,20 @@ static int asn1_get_len( unsigned char **p,
|
|||
|
||||
case 2:
|
||||
if( ( end - *p ) < 3 )
|
||||
return( XYSSL_ERR_ASN1_OUT_OF_DATA );
|
||||
return( POLARSSL_ERR_ASN1_OUT_OF_DATA );
|
||||
|
||||
*len = ( (*p)[1] << 8 ) | (*p)[2];
|
||||
(*p) += 3;
|
||||
break;
|
||||
|
||||
default:
|
||||
return( XYSSL_ERR_ASN1_INVALID_LENGTH );
|
||||
return( POLARSSL_ERR_ASN1_INVALID_LENGTH );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( *len > (int) ( end - *p ) )
|
||||
return( XYSSL_ERR_ASN1_OUT_OF_DATA );
|
||||
return( POLARSSL_ERR_ASN1_OUT_OF_DATA );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -95,10 +95,10 @@ static int asn1_get_tag( unsigned char **p,
|
|||
int *len, int tag )
|
||||
{
|
||||
if( ( end - *p ) < 1 )
|
||||
return( XYSSL_ERR_ASN1_OUT_OF_DATA );
|
||||
return( POLARSSL_ERR_ASN1_OUT_OF_DATA );
|
||||
|
||||
if( **p != tag )
|
||||
return( XYSSL_ERR_ASN1_UNEXPECTED_TAG );
|
||||
return( POLARSSL_ERR_ASN1_UNEXPECTED_TAG );
|
||||
|
||||
(*p)++;
|
||||
|
||||
|
@ -115,7 +115,7 @@ static int asn1_get_bool( unsigned char **p,
|
|||
return( ret );
|
||||
|
||||
if( len != 1 )
|
||||
return( XYSSL_ERR_ASN1_INVALID_LENGTH );
|
||||
return( POLARSSL_ERR_ASN1_INVALID_LENGTH );
|
||||
|
||||
*val = ( **p != 0 ) ? 1 : 0;
|
||||
(*p)++;
|
||||
|
@ -133,7 +133,7 @@ static int asn1_get_int( unsigned char **p,
|
|||
return( ret );
|
||||
|
||||
if( len > (int) sizeof( int ) || ( **p & 0x80 ) != 0 )
|
||||
return( XYSSL_ERR_ASN1_INVALID_LENGTH );
|
||||
return( POLARSSL_ERR_ASN1_INVALID_LENGTH );
|
||||
|
||||
*val = 0;
|
||||
|
||||
|
@ -174,7 +174,7 @@ static int x509_get_version( unsigned char **p,
|
|||
if( ( ret = asn1_get_tag( p, end, &len,
|
||||
ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTED | 0 ) ) != 0 )
|
||||
{
|
||||
if( ret == XYSSL_ERR_ASN1_UNEXPECTED_TAG )
|
||||
if( ret == POLARSSL_ERR_ASN1_UNEXPECTED_TAG )
|
||||
return( *ver = 0 );
|
||||
|
||||
return( ret );
|
||||
|
@ -183,11 +183,11 @@ static int x509_get_version( unsigned char **p,
|
|||
end = *p + len;
|
||||
|
||||
if( ( ret = asn1_get_int( p, end, ver ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_VERSION | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_VERSION | ret );
|
||||
|
||||
if( *p != end )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_VERSION |
|
||||
XYSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_VERSION |
|
||||
POLARSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -202,18 +202,18 @@ static int x509_get_serial( unsigned char **p,
|
|||
int ret;
|
||||
|
||||
if( ( end - *p ) < 1 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_SERIAL |
|
||||
XYSSL_ERR_ASN1_OUT_OF_DATA );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_SERIAL |
|
||||
POLARSSL_ERR_ASN1_OUT_OF_DATA );
|
||||
|
||||
if( **p != ( ASN1_CONTEXT_SPECIFIC | ASN1_PRIMITIVE | 2 ) &&
|
||||
**p != ASN1_INTEGER )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_SERIAL |
|
||||
XYSSL_ERR_ASN1_UNEXPECTED_TAG );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_SERIAL |
|
||||
POLARSSL_ERR_ASN1_UNEXPECTED_TAG );
|
||||
|
||||
serial->tag = *(*p)++;
|
||||
|
||||
if( ( ret = asn1_get_len( p, end, &serial->len ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_SERIAL | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_SERIAL | ret );
|
||||
|
||||
serial->p = *p;
|
||||
*p += serial->len;
|
||||
|
@ -234,13 +234,13 @@ static int x509_get_alg( unsigned char **p,
|
|||
|
||||
if( ( ret = asn1_get_tag( p, end, &len,
|
||||
ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_ALG | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_ALG | ret );
|
||||
|
||||
end = *p + len;
|
||||
alg->tag = **p;
|
||||
|
||||
if( ( ret = asn1_get_tag( p, end, &alg->len, ASN1_OID ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_ALG | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_ALG | ret );
|
||||
|
||||
alg->p = *p;
|
||||
*p += alg->len;
|
||||
|
@ -252,11 +252,11 @@ static int x509_get_alg( unsigned char **p,
|
|||
* assume the algorithm parameters must be NULL
|
||||
*/
|
||||
if( ( ret = asn1_get_tag( p, end, &len, ASN1_NULL ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_ALG | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_ALG | ret );
|
||||
|
||||
if( *p != end )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_ALG |
|
||||
XYSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_ALG |
|
||||
POLARSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -284,43 +284,43 @@ static int x509_get_name( unsigned char **p,
|
|||
|
||||
if( ( ret = asn1_get_tag( p, end, &len,
|
||||
ASN1_CONSTRUCTED | ASN1_SET ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_NAME | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_NAME | ret );
|
||||
|
||||
end2 = end;
|
||||
end = *p + len;
|
||||
|
||||
if( ( ret = asn1_get_tag( p, end, &len,
|
||||
ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_NAME | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_NAME | ret );
|
||||
|
||||
if( *p + len != end )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_NAME |
|
||||
XYSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_NAME |
|
||||
POLARSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
|
||||
oid = &cur->oid;
|
||||
oid->tag = **p;
|
||||
|
||||
if( ( ret = asn1_get_tag( p, end, &oid->len, ASN1_OID ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_NAME | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_NAME | ret );
|
||||
|
||||
oid->p = *p;
|
||||
*p += oid->len;
|
||||
|
||||
if( ( end - *p ) < 1 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_NAME |
|
||||
XYSSL_ERR_ASN1_OUT_OF_DATA );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_NAME |
|
||||
POLARSSL_ERR_ASN1_OUT_OF_DATA );
|
||||
|
||||
if( **p != ASN1_BMP_STRING && **p != ASN1_UTF8_STRING &&
|
||||
**p != ASN1_T61_STRING && **p != ASN1_PRINTABLE_STRING &&
|
||||
**p != ASN1_IA5_STRING && **p != ASN1_UNIVERSAL_STRING )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_NAME |
|
||||
XYSSL_ERR_ASN1_UNEXPECTED_TAG );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_NAME |
|
||||
POLARSSL_ERR_ASN1_UNEXPECTED_TAG );
|
||||
|
||||
val = &cur->val;
|
||||
val->tag = *(*p)++;
|
||||
|
||||
if( ( ret = asn1_get_len( p, end, &val->len ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_NAME | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_NAME | ret );
|
||||
|
||||
val->p = *p;
|
||||
*p += val->len;
|
||||
|
@ -328,8 +328,8 @@ static int x509_get_name( unsigned char **p,
|
|||
cur->next = NULL;
|
||||
|
||||
if( *p != end )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_NAME |
|
||||
XYSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_NAME |
|
||||
POLARSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
|
||||
/*
|
||||
* recurse until end of SEQUENCE is reached
|
||||
|
@ -365,7 +365,7 @@ static int x509_get_dates( unsigned char **p,
|
|||
|
||||
if( ( ret = asn1_get_tag( p, end, &len,
|
||||
ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_DATE | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_DATE | ret );
|
||||
|
||||
end = *p + len;
|
||||
|
||||
|
@ -373,7 +373,7 @@ static int x509_get_dates( unsigned char **p,
|
|||
* TODO: also handle GeneralizedTime
|
||||
*/
|
||||
if( ( ret = asn1_get_tag( p, end, &len, ASN1_UTC_TIME ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_DATE | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_DATE | ret );
|
||||
|
||||
memset( date, 0, sizeof( date ) );
|
||||
memcpy( date, *p, ( len < (int) sizeof( date ) - 1 ) ?
|
||||
|
@ -382,7 +382,7 @@ static int x509_get_dates( unsigned char **p,
|
|||
if( sscanf( date, "%2d%2d%2d%2d%2d%2d",
|
||||
&from->year, &from->mon, &from->day,
|
||||
&from->hour, &from->min, &from->sec ) < 5 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_DATE );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_DATE );
|
||||
|
||||
from->year += 100 * ( from->year < 90 );
|
||||
from->year += 1900;
|
||||
|
@ -390,7 +390,7 @@ static int x509_get_dates( unsigned char **p,
|
|||
*p += len;
|
||||
|
||||
if( ( ret = asn1_get_tag( p, end, &len, ASN1_UTC_TIME ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_DATE | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_DATE | ret );
|
||||
|
||||
memset( date, 0, sizeof( date ) );
|
||||
memcpy( date, *p, ( len < (int) sizeof( date ) - 1 ) ?
|
||||
|
@ -399,7 +399,7 @@ static int x509_get_dates( unsigned char **p,
|
|||
if( sscanf( date, "%2d%2d%2d%2d%2d%2d",
|
||||
&to->year, &to->mon, &to->day,
|
||||
&to->hour, &to->min, &to->sec ) < 5 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_DATE );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_DATE );
|
||||
|
||||
to->year += 100 * ( to->year < 90 );
|
||||
to->year += 1900;
|
||||
|
@ -407,8 +407,8 @@ static int x509_get_dates( unsigned char **p,
|
|||
*p += len;
|
||||
|
||||
if( *p != end )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_DATE |
|
||||
XYSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_DATE |
|
||||
POLARSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -434,19 +434,19 @@ static int x509_get_pubkey( unsigned char **p,
|
|||
*/
|
||||
if( pk_alg_oid->len != 9 ||
|
||||
memcmp( pk_alg_oid->p, OID_PKCS1_RSA, 9 ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_UNKNOWN_PK_ALG );
|
||||
return( POLARSSL_ERR_X509_CERT_UNKNOWN_PK_ALG );
|
||||
|
||||
if( ( ret = asn1_get_tag( p, end, &len, ASN1_BIT_STRING ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_PUBKEY | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_PUBKEY | ret );
|
||||
|
||||
if( ( end - *p ) < 1 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_PUBKEY |
|
||||
XYSSL_ERR_ASN1_OUT_OF_DATA );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_PUBKEY |
|
||||
POLARSSL_ERR_ASN1_OUT_OF_DATA );
|
||||
|
||||
end2 = *p + len;
|
||||
|
||||
if( *(*p)++ != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_PUBKEY );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_PUBKEY );
|
||||
|
||||
/*
|
||||
* RSAPublicKey ::= SEQUENCE {
|
||||
|
@ -456,19 +456,19 @@ static int x509_get_pubkey( unsigned char **p,
|
|||
*/
|
||||
if( ( ret = asn1_get_tag( p, end2, &len,
|
||||
ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_PUBKEY | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_PUBKEY | ret );
|
||||
|
||||
if( *p + len != end2 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_PUBKEY |
|
||||
XYSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_PUBKEY |
|
||||
POLARSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
|
||||
if( ( ret = asn1_get_mpi( p, end2, N ) ) != 0 ||
|
||||
( ret = asn1_get_mpi( p, end2, E ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_PUBKEY | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_PUBKEY | ret );
|
||||
|
||||
if( *p != end )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_PUBKEY |
|
||||
XYSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_PUBKEY |
|
||||
POLARSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -482,10 +482,10 @@ static int x509_get_sig( unsigned char **p,
|
|||
sig->tag = **p;
|
||||
|
||||
if( ( ret = asn1_get_tag( p, end, &len, ASN1_BIT_STRING ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_SIGNATURE | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_SIGNATURE | ret );
|
||||
|
||||
if( --len < 1 || *(*p)++ != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_SIGNATURE );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_SIGNATURE );
|
||||
|
||||
sig->len = len;
|
||||
sig->p = *p;
|
||||
|
@ -512,7 +512,7 @@ static int x509_get_uid( unsigned char **p,
|
|||
if( ( ret = asn1_get_tag( p, end, &uid->len,
|
||||
ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTED | n ) ) != 0 )
|
||||
{
|
||||
if( ret == XYSSL_ERR_ASN1_UNEXPECTED_TAG )
|
||||
if( ret == POLARSSL_ERR_ASN1_UNEXPECTED_TAG )
|
||||
return( 0 );
|
||||
|
||||
return( ret );
|
||||
|
@ -546,7 +546,7 @@ static int x509_get_ext( unsigned char **p,
|
|||
if( ( ret = asn1_get_tag( p, end, &ext->len,
|
||||
ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTED | 3 ) ) != 0 )
|
||||
{
|
||||
if( ret == XYSSL_ERR_ASN1_UNEXPECTED_TAG )
|
||||
if( ret == POLARSSL_ERR_ASN1_UNEXPECTED_TAG )
|
||||
return( 0 );
|
||||
|
||||
return( ret );
|
||||
|
@ -565,17 +565,17 @@ static int x509_get_ext( unsigned char **p,
|
|||
*/
|
||||
if( ( ret = asn1_get_tag( p, end, &len,
|
||||
ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_EXTENSIONS | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_EXTENSIONS | ret );
|
||||
|
||||
if( end != *p + len )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_EXTENSIONS |
|
||||
XYSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_EXTENSIONS |
|
||||
POLARSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
|
||||
while( *p < end )
|
||||
{
|
||||
if( ( ret = asn1_get_tag( p, end, &len,
|
||||
ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_EXTENSIONS | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_EXTENSIONS | ret );
|
||||
|
||||
if( memcmp( *p, "\x06\x03\x55\x1D\x13", 5 ) != 0 )
|
||||
{
|
||||
|
@ -586,12 +586,12 @@ static int x509_get_ext( unsigned char **p,
|
|||
*p += 5;
|
||||
|
||||
if( ( ret = asn1_get_bool( p, end, &is_critical ) ) != 0 &&
|
||||
( ret != XYSSL_ERR_ASN1_UNEXPECTED_TAG ) )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_EXTENSIONS | ret );
|
||||
( ret != POLARSSL_ERR_ASN1_UNEXPECTED_TAG ) )
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_EXTENSIONS | ret );
|
||||
|
||||
if( ( ret = asn1_get_tag( p, end, &len,
|
||||
ASN1_OCTET_STRING ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_EXTENSIONS | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_EXTENSIONS | ret );
|
||||
|
||||
/*
|
||||
* BasicConstraints ::= SEQUENCE {
|
||||
|
@ -602,18 +602,18 @@ static int x509_get_ext( unsigned char **p,
|
|||
|
||||
if( ( ret = asn1_get_tag( p, end2, &len,
|
||||
ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_EXTENSIONS | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_EXTENSIONS | ret );
|
||||
|
||||
if( *p == end2 )
|
||||
continue;
|
||||
|
||||
if( ( ret = asn1_get_bool( p, end2, &is_cacert ) ) != 0 )
|
||||
{
|
||||
if( ret == XYSSL_ERR_ASN1_UNEXPECTED_TAG )
|
||||
if( ret == POLARSSL_ERR_ASN1_UNEXPECTED_TAG )
|
||||
ret = asn1_get_int( p, end2, &is_cacert );
|
||||
|
||||
if( ret != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_EXTENSIONS | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_EXTENSIONS | ret );
|
||||
|
||||
if( is_cacert != 0 )
|
||||
is_cacert = 1;
|
||||
|
@ -623,18 +623,18 @@ static int x509_get_ext( unsigned char **p,
|
|||
continue;
|
||||
|
||||
if( ( ret = asn1_get_int( p, end2, max_pathlen ) ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_EXTENSIONS | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_EXTENSIONS | ret );
|
||||
|
||||
if( *p != end2 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_EXTENSIONS |
|
||||
XYSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_EXTENSIONS |
|
||||
POLARSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
|
||||
max_pathlen++;
|
||||
}
|
||||
|
||||
if( *p != end )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_EXTENSIONS |
|
||||
XYSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_EXTENSIONS |
|
||||
POLARSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
|
||||
*ca_istrue = is_critical & is_cacert;
|
||||
|
||||
|
@ -668,12 +668,12 @@ int x509parse_crt( x509_cert *chain, unsigned char *buf, int buflen )
|
|||
"-----END CERTIFICATE-----" );
|
||||
|
||||
if( s2 == NULL || s2 <= s1 )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_PEM );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_PEM );
|
||||
|
||||
s1 += 27;
|
||||
if( *s1 == '\r' ) s1++;
|
||||
if( *s1 == '\n' ) s1++;
|
||||
else return( XYSSL_ERR_X509_CERT_INVALID_PEM );
|
||||
else return( POLARSSL_ERR_X509_CERT_INVALID_PEM );
|
||||
|
||||
/*
|
||||
* get the DER data length and decode the buffer
|
||||
|
@ -681,8 +681,8 @@ int x509parse_crt( x509_cert *chain, unsigned char *buf, int buflen )
|
|||
len = 0;
|
||||
ret = base64_decode( NULL, &len, s1, s2 - s1 );
|
||||
|
||||
if( ret == XYSSL_ERR_BASE64_INVALID_CHARACTER )
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_PEM | ret );
|
||||
if( ret == POLARSSL_ERR_BASE64_INVALID_CHARACTER )
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_PEM | ret );
|
||||
|
||||
if( ( p = (unsigned char *) malloc( len ) ) == NULL )
|
||||
return( 1 );
|
||||
|
@ -690,7 +690,7 @@ int x509parse_crt( x509_cert *chain, unsigned char *buf, int buflen )
|
|||
if( ( ret = base64_decode( p, &len, s1, s2 - s1 ) ) != 0 )
|
||||
{
|
||||
free( p );
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_PEM | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_PEM | ret );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -702,7 +702,7 @@ int x509parse_crt( x509_cert *chain, unsigned char *buf, int buflen )
|
|||
else
|
||||
{
|
||||
free( p );
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_PEM );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_PEM );
|
||||
}
|
||||
|
||||
buflen -= s2 - buf;
|
||||
|
@ -737,14 +737,14 @@ int x509parse_crt( x509_cert *chain, unsigned char *buf, int buflen )
|
|||
ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ) != 0 )
|
||||
{
|
||||
x509_free( crt );
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_FORMAT );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_FORMAT );
|
||||
}
|
||||
|
||||
if( len != (int) ( end - p ) )
|
||||
{
|
||||
x509_free( crt );
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_FORMAT |
|
||||
XYSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_FORMAT |
|
||||
POLARSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -756,7 +756,7 @@ int x509parse_crt( x509_cert *chain, unsigned char *buf, int buflen )
|
|||
ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ) != 0 )
|
||||
{
|
||||
x509_free( crt );
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_FORMAT | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_FORMAT | ret );
|
||||
}
|
||||
|
||||
end = p + len;
|
||||
|
@ -782,21 +782,21 @@ int x509parse_crt( x509_cert *chain, unsigned char *buf, int buflen )
|
|||
if( crt->version > 3 )
|
||||
{
|
||||
x509_free( crt );
|
||||
return( XYSSL_ERR_X509_CERT_UNKNOWN_VERSION );
|
||||
return( POLARSSL_ERR_X509_CERT_UNKNOWN_VERSION );
|
||||
}
|
||||
|
||||
if( crt->sig_oid1.len != 9 ||
|
||||
memcmp( crt->sig_oid1.p, OID_PKCS1, 8 ) != 0 )
|
||||
{
|
||||
x509_free( crt );
|
||||
return( XYSSL_ERR_X509_CERT_UNKNOWN_SIG_ALG );
|
||||
return( POLARSSL_ERR_X509_CERT_UNKNOWN_SIG_ALG );
|
||||
}
|
||||
|
||||
if( crt->sig_oid1.p[8] < 2 ||
|
||||
crt->sig_oid1.p[8] > 5 )
|
||||
{
|
||||
x509_free( crt );
|
||||
return( XYSSL_ERR_X509_CERT_UNKNOWN_SIG_ALG );
|
||||
return( POLARSSL_ERR_X509_CERT_UNKNOWN_SIG_ALG );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -808,7 +808,7 @@ int x509parse_crt( x509_cert *chain, unsigned char *buf, int buflen )
|
|||
ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ) != 0 )
|
||||
{
|
||||
x509_free( crt );
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_FORMAT | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_FORMAT | ret );
|
||||
}
|
||||
|
||||
if( ( ret = x509_get_name( &p, p + len, &crt->issuer ) ) != 0 )
|
||||
|
@ -841,7 +841,7 @@ int x509parse_crt( x509_cert *chain, unsigned char *buf, int buflen )
|
|||
ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ) != 0 )
|
||||
{
|
||||
x509_free( crt );
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_FORMAT | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_FORMAT | ret );
|
||||
}
|
||||
|
||||
if( ( ret = x509_get_name( &p, p + len, &crt->subject ) ) != 0 )
|
||||
|
@ -861,7 +861,7 @@ int x509parse_crt( x509_cert *chain, unsigned char *buf, int buflen )
|
|||
ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ) != 0 )
|
||||
{
|
||||
x509_free( crt );
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_FORMAT | ret );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_FORMAT | ret );
|
||||
}
|
||||
|
||||
if( ( ret = x509_get_pubkey( &p, p + len, &crt->pk_oid,
|
||||
|
@ -921,8 +921,8 @@ int x509parse_crt( x509_cert *chain, unsigned char *buf, int buflen )
|
|||
if( p != end )
|
||||
{
|
||||
x509_free( crt );
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_FORMAT |
|
||||
XYSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_FORMAT |
|
||||
POLARSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
}
|
||||
|
||||
end = crt->raw.p + crt->raw.len;
|
||||
|
@ -940,7 +940,7 @@ int x509parse_crt( x509_cert *chain, unsigned char *buf, int buflen )
|
|||
if( memcmp( crt->sig_oid1.p, crt->sig_oid2.p, 9 ) != 0 )
|
||||
{
|
||||
x509_free( crt );
|
||||
return( XYSSL_ERR_X509_CERT_SIG_MISMATCH );
|
||||
return( POLARSSL_ERR_X509_CERT_SIG_MISMATCH );
|
||||
}
|
||||
|
||||
if( ( ret = x509_get_sig( &p, end, &crt->sig ) ) != 0 )
|
||||
|
@ -952,8 +952,8 @@ int x509parse_crt( x509_cert *chain, unsigned char *buf, int buflen )
|
|||
if( p != end )
|
||||
{
|
||||
x509_free( crt );
|
||||
return( XYSSL_ERR_X509_CERT_INVALID_FORMAT |
|
||||
XYSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
return( POLARSSL_ERR_X509_CERT_INVALID_FORMAT |
|
||||
POLARSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
}
|
||||
|
||||
crt->next = (x509_cert *) malloc( sizeof( x509_cert ) );
|
||||
|
@ -1011,7 +1011,7 @@ int x509parse_crtfile( x509_cert *chain, char *path )
|
|||
return( ret );
|
||||
}
|
||||
|
||||
#if defined(XYSSL_DES_C)
|
||||
#if defined(POLARSSL_DES_C)
|
||||
/*
|
||||
* Read a 16-byte hex string and convert it to binary
|
||||
*/
|
||||
|
@ -1026,7 +1026,7 @@ static int x509_get_iv( unsigned char *s, unsigned char iv[8] )
|
|||
if( *s >= '0' && *s <= '9' ) j = *s - '0'; else
|
||||
if( *s >= 'A' && *s <= 'F' ) j = *s - '7'; else
|
||||
if( *s >= 'a' && *s <= 'f' ) j = *s - 'W'; else
|
||||
return( XYSSL_ERR_X509_KEY_INVALID_ENC_IV );
|
||||
return( POLARSSL_ERR_X509_KEY_INVALID_ENC_IV );
|
||||
|
||||
k = ( ( i & 1 ) != 0 ) ? j : j << 4;
|
||||
|
||||
|
@ -1096,46 +1096,46 @@ int x509parse_key( rsa_context *rsa, unsigned char *buf, int buflen,
|
|||
"-----END RSA PRIVATE KEY-----" );
|
||||
|
||||
if( s2 == NULL || s2 <= s1 )
|
||||
return( XYSSL_ERR_X509_KEY_INVALID_PEM );
|
||||
return( POLARSSL_ERR_X509_KEY_INVALID_PEM );
|
||||
|
||||
s1 += 31;
|
||||
if( *s1 == '\r' ) s1++;
|
||||
if( *s1 == '\n' ) s1++;
|
||||
else return( XYSSL_ERR_X509_KEY_INVALID_PEM );
|
||||
else return( POLARSSL_ERR_X509_KEY_INVALID_PEM );
|
||||
|
||||
enc = 0;
|
||||
|
||||
if( memcmp( s1, "Proc-Type: 4,ENCRYPTED", 22 ) == 0 )
|
||||
{
|
||||
#if defined(XYSSL_DES_C)
|
||||
#if defined(POLARSSL_DES_C)
|
||||
enc++;
|
||||
|
||||
s1 += 22;
|
||||
if( *s1 == '\r' ) s1++;
|
||||
if( *s1 == '\n' ) s1++;
|
||||
else return( XYSSL_ERR_X509_KEY_INVALID_PEM );
|
||||
else return( POLARSSL_ERR_X509_KEY_INVALID_PEM );
|
||||
|
||||
if( memcmp( s1, "DEK-Info: DES-EDE3-CBC,", 23 ) != 0 )
|
||||
return( XYSSL_ERR_X509_KEY_UNKNOWN_ENC_ALG );
|
||||
return( POLARSSL_ERR_X509_KEY_UNKNOWN_ENC_ALG );
|
||||
|
||||
s1 += 23;
|
||||
if( x509_get_iv( s1, des3_iv ) != 0 )
|
||||
return( XYSSL_ERR_X509_KEY_INVALID_ENC_IV );
|
||||
return( POLARSSL_ERR_X509_KEY_INVALID_ENC_IV );
|
||||
|
||||
s1 += 16;
|
||||
if( *s1 == '\r' ) s1++;
|
||||
if( *s1 == '\n' ) s1++;
|
||||
else return( XYSSL_ERR_X509_KEY_INVALID_PEM );
|
||||
else return( POLARSSL_ERR_X509_KEY_INVALID_PEM );
|
||||
#else
|
||||
return( XYSSL_ERR_X509_FEATURE_UNAVAILABLE );
|
||||
return( POLARSSL_ERR_X509_FEATURE_UNAVAILABLE );
|
||||
#endif
|
||||
}
|
||||
|
||||
len = 0;
|
||||
ret = base64_decode( NULL, &len, s1, s2 - s1 );
|
||||
|
||||
if( ret == XYSSL_ERR_BASE64_INVALID_CHARACTER )
|
||||
return( ret | XYSSL_ERR_X509_KEY_INVALID_PEM );
|
||||
if( ret == POLARSSL_ERR_BASE64_INVALID_CHARACTER )
|
||||
return( ret | POLARSSL_ERR_X509_KEY_INVALID_PEM );
|
||||
|
||||
if( ( buf = (unsigned char *) malloc( len ) ) == NULL )
|
||||
return( 1 );
|
||||
|
@ -1143,18 +1143,18 @@ int x509parse_key( rsa_context *rsa, unsigned char *buf, int buflen,
|
|||
if( ( ret = base64_decode( buf, &len, s1, s2 - s1 ) ) != 0 )
|
||||
{
|
||||
free( buf );
|
||||
return( ret | XYSSL_ERR_X509_KEY_INVALID_PEM );
|
||||
return( ret | POLARSSL_ERR_X509_KEY_INVALID_PEM );
|
||||
}
|
||||
|
||||
buflen = len;
|
||||
|
||||
if( enc != 0 )
|
||||
{
|
||||
#if defined(XYSSL_DES_C)
|
||||
#if defined(POLARSSL_DES_C)
|
||||
if( pwd == NULL )
|
||||
{
|
||||
free( buf );
|
||||
return( XYSSL_ERR_X509_KEY_PASSWORD_REQUIRED );
|
||||
return( POLARSSL_ERR_X509_KEY_PASSWORD_REQUIRED );
|
||||
}
|
||||
|
||||
x509_des3_decrypt( des3_iv, buf, buflen, pwd, pwdlen );
|
||||
|
@ -1163,10 +1163,10 @@ int x509parse_key( rsa_context *rsa, unsigned char *buf, int buflen,
|
|||
buf[4] != 0x02 || buf[5] != 0x01 )
|
||||
{
|
||||
free( buf );
|
||||
return( XYSSL_ERR_X509_KEY_PASSWORD_MISMATCH );
|
||||
return( POLARSSL_ERR_X509_KEY_PASSWORD_MISMATCH );
|
||||
}
|
||||
#else
|
||||
return( XYSSL_ERR_X509_FEATURE_UNAVAILABLE );
|
||||
return( POLARSSL_ERR_X509_FEATURE_UNAVAILABLE );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -1197,7 +1197,7 @@ int x509parse_key( rsa_context *rsa, unsigned char *buf, int buflen,
|
|||
free( buf );
|
||||
|
||||
rsa_free( rsa );
|
||||
return( XYSSL_ERR_X509_KEY_INVALID_FORMAT | ret );
|
||||
return( POLARSSL_ERR_X509_KEY_INVALID_FORMAT | ret );
|
||||
}
|
||||
|
||||
end = p + len;
|
||||
|
@ -1208,7 +1208,7 @@ int x509parse_key( rsa_context *rsa, unsigned char *buf, int buflen,
|
|||
free( buf );
|
||||
|
||||
rsa_free( rsa );
|
||||
return( XYSSL_ERR_X509_KEY_INVALID_FORMAT | ret );
|
||||
return( POLARSSL_ERR_X509_KEY_INVALID_FORMAT | ret );
|
||||
}
|
||||
|
||||
if( rsa->ver != 0 )
|
||||
|
@ -1217,7 +1217,7 @@ int x509parse_key( rsa_context *rsa, unsigned char *buf, int buflen,
|
|||
free( buf );
|
||||
|
||||
rsa_free( rsa );
|
||||
return( ret | XYSSL_ERR_X509_KEY_INVALID_VERSION );
|
||||
return( ret | POLARSSL_ERR_X509_KEY_INVALID_VERSION );
|
||||
}
|
||||
|
||||
if( ( ret = asn1_get_mpi( &p, end, &rsa->N ) ) != 0 ||
|
||||
|
@ -1233,7 +1233,7 @@ int x509parse_key( rsa_context *rsa, unsigned char *buf, int buflen,
|
|||
free( buf );
|
||||
|
||||
rsa_free( rsa );
|
||||
return( ret | XYSSL_ERR_X509_KEY_INVALID_FORMAT );
|
||||
return( ret | POLARSSL_ERR_X509_KEY_INVALID_FORMAT );
|
||||
}
|
||||
|
||||
rsa->len = mpi_size( &rsa->N );
|
||||
|
@ -1244,8 +1244,8 @@ int x509parse_key( rsa_context *rsa, unsigned char *buf, int buflen,
|
|||
free( buf );
|
||||
|
||||
rsa_free( rsa );
|
||||
return( XYSSL_ERR_X509_KEY_INVALID_FORMAT |
|
||||
XYSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
return( POLARSSL_ERR_X509_KEY_INVALID_FORMAT |
|
||||
POLARSSL_ERR_ASN1_LENGTH_MISMATCH );
|
||||
}
|
||||
|
||||
if( ( ret = rsa_check_privkey( rsa ) ) != 0 )
|
||||
|
@ -1483,10 +1483,10 @@ static void x509_hash( unsigned char *in, int len, int alg,
|
|||
{
|
||||
switch( alg )
|
||||
{
|
||||
#if defined(XYSSL_MD2_C)
|
||||
#if defined(POLARSSL_MD2_C)
|
||||
case RSA_MD2 : md2( in, len, out ); break;
|
||||
#endif
|
||||
#if defined(XYSSL_MD4_C)
|
||||
#if defined(POLARSSL_MD4_C)
|
||||
case RSA_MD4 : md4( in, len, out ); break;
|
||||
#endif
|
||||
case RSA_MD5 : md5( in, len, out ); break;
|
||||
|
@ -1559,7 +1559,7 @@ int x509parse_verify( x509_cert *crt,
|
|||
|
||||
if( rsa_pkcs1_verify( &cur->rsa, RSA_PUBLIC, hash_id,
|
||||
0, hash, crt->sig.p ) != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_VERIFY_FAILED );
|
||||
return( POLARSSL_ERR_X509_CERT_VERIFY_FAILED );
|
||||
|
||||
pathlen++;
|
||||
|
||||
|
@ -1602,7 +1602,7 @@ int x509parse_verify( x509_cert *crt,
|
|||
}
|
||||
|
||||
if( *flags != 0 )
|
||||
return( XYSSL_ERR_X509_CERT_VERIFY_FAILED );
|
||||
return( POLARSSL_ERR_X509_CERT_VERIFY_FAILED );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -1665,9 +1665,9 @@ void x509_free( x509_cert *crt )
|
|||
while( cert_cur != NULL );
|
||||
}
|
||||
|
||||
#if defined(XYSSL_SELF_TEST)
|
||||
#if defined(POLARSSL_SELF_TEST)
|
||||
|
||||
#include "xyssl/certs.h"
|
||||
#include "polarssl/certs.h"
|
||||
|
||||
/*
|
||||
* Checkup routine
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
CFLAGS = -I../include -D_FILE_OFFSET_BITS=64
|
||||
OFLAGS = -O
|
||||
LDFLAGS = -L../library -lxyssl
|
||||
LDFLAGS = -L../library -lpolarssl
|
||||
|
||||
APPS = aes/aescrypt2 hash/hello \
|
||||
hash/md5sum hash/sha1sum \
|
||||
|
@ -20,75 +20,75 @@ APPS = aes/aescrypt2 hash/hello \
|
|||
|
||||
all: $(APPS)
|
||||
|
||||
aes/aescrypt2: aes/aescrypt2.c ../library/libxyssl.a
|
||||
aes/aescrypt2: aes/aescrypt2.c ../library/libpolarssl.a
|
||||
echo " CC aes/aescrypt2.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) aes/aescrypt2.c $(LDFLAGS) -o $@
|
||||
|
||||
hash/hello: hash/hello.c ../library/libxyssl.a
|
||||
hash/hello: hash/hello.c ../library/libpolarssl.a
|
||||
echo " CC hash/hello.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) hash/hello.c $(LDFLAGS) -o $@
|
||||
|
||||
hash/md5sum: hash/md5sum.c ../library/libxyssl.a
|
||||
hash/md5sum: hash/md5sum.c ../library/libpolarssl.a
|
||||
echo " CC hash/md5sum.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) hash/md5sum.c $(LDFLAGS) -o $@
|
||||
|
||||
hash/sha1sum: hash/sha1sum.c ../library/libxyssl.a
|
||||
hash/sha1sum: hash/sha1sum.c ../library/libpolarssl.a
|
||||
echo " CC hash/sha1sum.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) hash/sha1sum.c $(LDFLAGS) -o $@
|
||||
|
||||
hash/sha2sum: hash/sha2sum.c ../library/libxyssl.a
|
||||
hash/sha2sum: hash/sha2sum.c ../library/libpolarssl.a
|
||||
echo " CC hash/sha2sum.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) hash/sha2sum.c $(LDFLAGS) -o $@
|
||||
|
||||
pkey/dh_client: pkey/dh_client.c ../library/libxyssl.a
|
||||
pkey/dh_client: pkey/dh_client.c ../library/libpolarssl.a
|
||||
echo " CC pkey/dh_client.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) pkey/dh_client.c $(LDFLAGS) -o $@
|
||||
|
||||
pkey/dh_genprime: pkey/dh_genprime.c ../library/libxyssl.a
|
||||
pkey/dh_genprime: pkey/dh_genprime.c ../library/libpolarssl.a
|
||||
echo " CC pkey/dh_genprime.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) pkey/dh_genprime.c $(LDFLAGS) -o $@
|
||||
|
||||
pkey/dh_server: pkey/dh_server.c ../library/libxyssl.a
|
||||
pkey/dh_server: pkey/dh_server.c ../library/libpolarssl.a
|
||||
echo " CC pkey/dh_server.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) pkey/dh_server.c $(LDFLAGS) -o $@
|
||||
|
||||
pkey/mpi_demo: pkey/mpi_demo.c ../library/libxyssl.a
|
||||
pkey/mpi_demo: pkey/mpi_demo.c ../library/libpolarssl.a
|
||||
echo " CC pkey/mpi_demo.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) pkey/mpi_demo.c $(LDFLAGS) -o $@
|
||||
|
||||
pkey/rsa_genkey: pkey/rsa_genkey.c ../library/libxyssl.a
|
||||
pkey/rsa_genkey: pkey/rsa_genkey.c ../library/libpolarssl.a
|
||||
echo " CC pkey/rsa_genkey.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_genkey.c $(LDFLAGS) -o $@
|
||||
|
||||
pkey/rsa_sign: pkey/rsa_sign.c ../library/libxyssl.a
|
||||
pkey/rsa_sign: pkey/rsa_sign.c ../library/libpolarssl.a
|
||||
echo " CC pkey/rsa_sign.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_sign.c $(LDFLAGS) -o $@
|
||||
|
||||
pkey/rsa_verify: pkey/rsa_verify.c ../library/libxyssl.a
|
||||
pkey/rsa_verify: pkey/rsa_verify.c ../library/libpolarssl.a
|
||||
echo " CC pkey/rsa_verify.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) pkey/rsa_verify.c $(LDFLAGS) -o $@
|
||||
|
||||
ssl/ssl_client1: ssl/ssl_client1.c ../library/libxyssl.a
|
||||
ssl/ssl_client1: ssl/ssl_client1.c ../library/libpolarssl.a
|
||||
echo " CC ssl/ssl_client1.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_client1.c $(LDFLAGS) -o $@
|
||||
|
||||
ssl/ssl_client2: ssl/ssl_client2.c ../library/libxyssl.a
|
||||
ssl/ssl_client2: ssl/ssl_client2.c ../library/libpolarssl.a
|
||||
echo " CC ssl/ssl_client2.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_client2.c $(LDFLAGS) -o $@
|
||||
|
||||
ssl/ssl_server: ssl/ssl_server.c ../library/libxyssl.a
|
||||
ssl/ssl_server: ssl/ssl_server.c ../library/libpolarssl.a
|
||||
echo " CC ssl/ssl_server.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) ssl/ssl_server.c $(LDFLAGS) -o $@
|
||||
|
||||
test/benchmark: test/benchmark.c ../library/libxyssl.a
|
||||
test/benchmark: test/benchmark.c ../library/libpolarssl.a
|
||||
echo " CC test/benchmark.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) test/benchmark.c $(LDFLAGS) -o $@
|
||||
|
||||
test/selftest: test/selftest.c ../library/libxyssl.a
|
||||
test/selftest: test/selftest.c ../library/libpolarssl.a
|
||||
echo " CC test/selftest.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) test/selftest.c $(LDFLAGS) -o $@
|
||||
|
||||
test/ssl_test: test/ssl_test.c ../library/libxyssl.a
|
||||
test/ssl_test: test/ssl_test.c ../library/libpolarssl.a
|
||||
echo " CC test/ssl_test.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) test/ssl_test.c $(LDFLAGS) -o $@
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "xyssl/aes.h"
|
||||
#include "xyssl/sha2.h"
|
||||
#include "polarssl/aes.h"
|
||||
#include "polarssl/sha2.h"
|
||||
|
||||
#define MODE_ENCRYPT 0
|
||||
#define MODE_DECRYPT 1
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xyssl/md5.h"
|
||||
#include "polarssl/md5.h"
|
||||
|
||||
int main( void )
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xyssl/md5.h"
|
||||
#include "polarssl/md5.h"
|
||||
|
||||
static int md5_wrapper( char *filename, unsigned char *sum )
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xyssl/sha1.h"
|
||||
#include "polarssl/sha1.h"
|
||||
|
||||
static int sha1_wrapper( char *filename, unsigned char *sum )
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xyssl/sha2.h"
|
||||
#include "polarssl/sha2.h"
|
||||
|
||||
static int sha2_wrapper( char *filename, unsigned char *sum )
|
||||
{
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xyssl/net.h"
|
||||
#include "xyssl/aes.h"
|
||||
#include "xyssl/dhm.h"
|
||||
#include "xyssl/rsa.h"
|
||||
#include "xyssl/sha1.h"
|
||||
#include "xyssl/havege.h"
|
||||
#include "polarssl/net.h"
|
||||
#include "polarssl/aes.h"
|
||||
#include "polarssl/dhm.h"
|
||||
#include "polarssl/rsa.h"
|
||||
#include "polarssl/sha1.h"
|
||||
#include "polarssl/havege.h"
|
||||
|
||||
#define SERVER_NAME "localhost"
|
||||
#define SERVER_PORT 11999
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xyssl/bignum.h"
|
||||
#include "xyssl/config.h"
|
||||
#include "xyssl/havege.h"
|
||||
#include "polarssl/bignum.h"
|
||||
#include "polarssl/config.h"
|
||||
#include "polarssl/havege.h"
|
||||
|
||||
/*
|
||||
* Note: G = 4 is always a quadratic residue mod P,
|
||||
|
@ -39,7 +39,7 @@ int main( void )
|
|||
{
|
||||
int ret = 1;
|
||||
|
||||
#if defined(XYSSL_GENPRIME)
|
||||
#if defined(POLARSSL_GENPRIME)
|
||||
mpi G, P, Q;
|
||||
havege_state hs;
|
||||
FILE *fout;
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xyssl/net.h"
|
||||
#include "xyssl/aes.h"
|
||||
#include "xyssl/dhm.h"
|
||||
#include "xyssl/rsa.h"
|
||||
#include "xyssl/sha1.h"
|
||||
#include "xyssl/havege.h"
|
||||
#include "polarssl/net.h"
|
||||
#include "polarssl/aes.h"
|
||||
#include "polarssl/dhm.h"
|
||||
#include "polarssl/rsa.h"
|
||||
#include "polarssl/sha1.h"
|
||||
#include "polarssl/havege.h"
|
||||
|
||||
#define SERVER_PORT 11999
|
||||
#define PLAINTEXT "==Hello there!=="
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xyssl/bignum.h"
|
||||
#include "polarssl/bignum.h"
|
||||
|
||||
int main( void )
|
||||
{
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xyssl/havege.h"
|
||||
#include "xyssl/bignum.h"
|
||||
#include "xyssl/x509.h"
|
||||
#include "xyssl/rsa.h"
|
||||
#include "polarssl/havege.h"
|
||||
#include "polarssl/bignum.h"
|
||||
#include "polarssl/x509.h"
|
||||
#include "polarssl/rsa.h"
|
||||
|
||||
#define KEY_SIZE 1024
|
||||
#define EXPONENT 65537
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xyssl/rsa.h"
|
||||
#include "xyssl/sha1.h"
|
||||
#include "polarssl/rsa.h"
|
||||
#include "polarssl/sha1.h"
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xyssl/rsa.h"
|
||||
#include "xyssl/sha1.h"
|
||||
#include "polarssl/rsa.h"
|
||||
#include "polarssl/sha1.h"
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xyssl/net.h"
|
||||
#include "xyssl/ssl.h"
|
||||
#include "xyssl/havege.h"
|
||||
#include "polarssl/net.h"
|
||||
#include "polarssl/ssl.h"
|
||||
#include "polarssl/havege.h"
|
||||
|
||||
#define SERVER_PORT 443
|
||||
/*
|
||||
|
@ -115,7 +115,7 @@ int main( void )
|
|||
|
||||
while( ( ret = ssl_write( &ssl, buf, len ) ) <= 0 )
|
||||
{
|
||||
if( ret != XYSSL_ERR_NET_TRY_AGAIN )
|
||||
if( ret != POLARSSL_ERR_NET_TRY_AGAIN )
|
||||
{
|
||||
printf( " failed\n ! ssl_write returned %d\n\n", ret );
|
||||
goto exit;
|
||||
|
@ -137,10 +137,10 @@ int main( void )
|
|||
memset( buf, 0, sizeof( buf ) );
|
||||
ret = ssl_read( &ssl, buf, len );
|
||||
|
||||
if( ret == XYSSL_ERR_NET_TRY_AGAIN )
|
||||
if( ret == POLARSSL_ERR_NET_TRY_AGAIN )
|
||||
continue;
|
||||
|
||||
if( ret == XYSSL_ERR_SSL_PEER_CLOSE_NOTIFY )
|
||||
if( ret == POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY )
|
||||
break;
|
||||
|
||||
if( ret <= 0 )
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xyssl/net.h"
|
||||
#include "xyssl/ssl.h"
|
||||
#include "xyssl/havege.h"
|
||||
#include "xyssl/certs.h"
|
||||
#include "xyssl/x509.h"
|
||||
#include "polarssl/net.h"
|
||||
#include "polarssl/ssl.h"
|
||||
#include "polarssl/havege.h"
|
||||
#include "polarssl/certs.h"
|
||||
#include "polarssl/x509.h"
|
||||
|
||||
#define SERVER_PORT 443
|
||||
/*
|
||||
|
@ -174,7 +174,7 @@ int main( void )
|
|||
|
||||
while( ( ret = ssl_handshake( &ssl ) ) != 0 )
|
||||
{
|
||||
if( ret != XYSSL_ERR_NET_TRY_AGAIN )
|
||||
if( ret != POLARSSL_ERR_NET_TRY_AGAIN )
|
||||
{
|
||||
printf( " failed\n ! ssl_handshake returned %d\n\n", ret );
|
||||
goto exit;
|
||||
|
@ -223,7 +223,7 @@ int main( void )
|
|||
|
||||
while( ( ret = ssl_write( &ssl, buf, len ) ) <= 0 )
|
||||
{
|
||||
if( ret != XYSSL_ERR_NET_TRY_AGAIN )
|
||||
if( ret != POLARSSL_ERR_NET_TRY_AGAIN )
|
||||
{
|
||||
printf( " failed\n ! ssl_write returned %d\n\n", ret );
|
||||
goto exit;
|
||||
|
@ -245,10 +245,10 @@ int main( void )
|
|||
memset( buf, 0, sizeof( buf ) );
|
||||
ret = ssl_read( &ssl, buf, len );
|
||||
|
||||
if( ret == XYSSL_ERR_NET_TRY_AGAIN )
|
||||
if( ret == POLARSSL_ERR_NET_TRY_AGAIN )
|
||||
continue;
|
||||
|
||||
if( ret == XYSSL_ERR_SSL_PEER_CLOSE_NOTIFY )
|
||||
if( ret == POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY )
|
||||
break;
|
||||
|
||||
if( ret <= 0 )
|
||||
|
|
|
@ -30,11 +30,11 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xyssl/havege.h"
|
||||
#include "xyssl/certs.h"
|
||||
#include "xyssl/x509.h"
|
||||
#include "xyssl/ssl.h"
|
||||
#include "xyssl/net.h"
|
||||
#include "polarssl/havege.h"
|
||||
#include "polarssl/certs.h"
|
||||
#include "polarssl/x509.h"
|
||||
#include "polarssl/ssl.h"
|
||||
#include "polarssl/net.h"
|
||||
|
||||
#define HTTP_RESPONSE \
|
||||
"HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n" \
|
||||
|
@ -293,7 +293,7 @@ accept:
|
|||
|
||||
while( ( ret = ssl_handshake( &ssl ) ) != 0 )
|
||||
{
|
||||
if( ret != XYSSL_ERR_NET_TRY_AGAIN )
|
||||
if( ret != POLARSSL_ERR_NET_TRY_AGAIN )
|
||||
{
|
||||
printf( " failed\n ! ssl_handshake returned %d\n\n", ret );
|
||||
goto accept;
|
||||
|
@ -314,18 +314,18 @@ accept:
|
|||
memset( buf, 0, sizeof( buf ) );
|
||||
ret = ssl_read( &ssl, buf, len );
|
||||
|
||||
if( ret == XYSSL_ERR_NET_TRY_AGAIN )
|
||||
if( ret == POLARSSL_ERR_NET_TRY_AGAIN )
|
||||
continue;
|
||||
|
||||
if( ret <= 0 )
|
||||
{
|
||||
switch( ret )
|
||||
{
|
||||
case XYSSL_ERR_SSL_PEER_CLOSE_NOTIFY:
|
||||
case POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY:
|
||||
printf( " connection was closed gracefully\n" );
|
||||
break;
|
||||
|
||||
case XYSSL_ERR_NET_CONN_RESET:
|
||||
case POLARSSL_ERR_NET_CONN_RESET:
|
||||
printf( " connection was reset by peer\n" );
|
||||
break;
|
||||
|
||||
|
@ -353,13 +353,13 @@ accept:
|
|||
|
||||
while( ( ret = ssl_write( &ssl, buf, len ) ) <= 0 )
|
||||
{
|
||||
if( ret == XYSSL_ERR_NET_CONN_RESET )
|
||||
if( ret == POLARSSL_ERR_NET_CONN_RESET )
|
||||
{
|
||||
printf( " failed\n ! peer closed the connection\n\n" );
|
||||
goto accept;
|
||||
}
|
||||
|
||||
if( ret != XYSSL_ERR_NET_TRY_AGAIN )
|
||||
if( ret != POLARSSL_ERR_NET_TRY_AGAIN )
|
||||
{
|
||||
printf( " failed\n ! ssl_write returned %d\n\n", ret );
|
||||
goto exit;
|
||||
|
|
|
@ -26,17 +26,17 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "xyssl/md4.h"
|
||||
#include "xyssl/md5.h"
|
||||
#include "xyssl/sha1.h"
|
||||
#include "xyssl/sha2.h"
|
||||
#include "xyssl/arc4.h"
|
||||
#include "xyssl/des.h"
|
||||
#include "xyssl/aes.h"
|
||||
#include "xyssl/rsa.h"
|
||||
#include "xyssl/timing.h"
|
||||
#include "polarssl/md4.h"
|
||||
#include "polarssl/md5.h"
|
||||
#include "polarssl/sha1.h"
|
||||
#include "polarssl/sha2.h"
|
||||
#include "polarssl/arc4.h"
|
||||
#include "polarssl/des.h"
|
||||
#include "polarssl/aes.h"
|
||||
#include "polarssl/rsa.h"
|
||||
#include "polarssl/timing.h"
|
||||
|
||||
#define BUFSIZE 1024
|
||||
|
||||
|
@ -55,17 +55,17 @@ int main( void )
|
|||
int keysize;
|
||||
unsigned long i, j, tsc;
|
||||
unsigned char tmp[32];
|
||||
#if defined(XYSSL_ARC4_C)
|
||||
#if defined(POLARSSL_ARC4_C)
|
||||
arc4_context arc4;
|
||||
#endif
|
||||
#if defined(XYSSL_DES_C)
|
||||
#if defined(POLARSSL_DES_C)
|
||||
des3_context des3;
|
||||
des_context des;
|
||||
#endif
|
||||
#if defined(XYSSL_AES_C)
|
||||
#if defined(POLARSSL_AES_C)
|
||||
aes_context aes;
|
||||
#endif
|
||||
#if defined(XYSSL_RSA_C)
|
||||
#if defined(POLARSSL_RSA_C)
|
||||
rsa_context rsa;
|
||||
#endif
|
||||
|
||||
|
@ -73,7 +73,7 @@ int main( void )
|
|||
|
||||
printf( "\n" );
|
||||
|
||||
#if defined(XYSSL_MD4_C)
|
||||
#if defined(POLARSSL_MD4_C)
|
||||
printf( " MD4 : " );
|
||||
fflush( stdout );
|
||||
|
||||
|
@ -89,7 +89,7 @@ int main( void )
|
|||
( hardclock() - tsc ) / ( j * BUFSIZE ) );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_MD5_C)
|
||||
#if defined(POLARSSL_MD5_C)
|
||||
printf( " MD5 : " );
|
||||
fflush( stdout );
|
||||
|
||||
|
@ -105,7 +105,7 @@ int main( void )
|
|||
( hardclock() - tsc ) / ( j * BUFSIZE ) );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_SHA1_C)
|
||||
#if defined(POLARSSL_SHA1_C)
|
||||
printf( " SHA-1 : " );
|
||||
fflush( stdout );
|
||||
|
||||
|
@ -121,7 +121,7 @@ int main( void )
|
|||
( hardclock() - tsc ) / ( j * BUFSIZE ) );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_SHA2_C)
|
||||
#if defined(POLARSSL_SHA2_C)
|
||||
printf( " SHA-256 : " );
|
||||
fflush( stdout );
|
||||
|
||||
|
@ -137,7 +137,7 @@ int main( void )
|
|||
( hardclock() - tsc ) / ( j * BUFSIZE ) );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_ARC4_C)
|
||||
#if defined(POLARSSL_ARC4_C)
|
||||
printf( " ARC4 : " );
|
||||
fflush( stdout );
|
||||
|
||||
|
@ -155,7 +155,7 @@ int main( void )
|
|||
( hardclock() - tsc ) / ( j * BUFSIZE ) );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_DES_C)
|
||||
#if defined(POLARSSL_DES_C)
|
||||
printf( " 3DES : " );
|
||||
fflush( stdout );
|
||||
|
||||
|
@ -189,7 +189,7 @@ int main( void )
|
|||
( hardclock() - tsc ) / ( j * BUFSIZE ) );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_AES_C)
|
||||
#if defined(POLARSSL_AES_C)
|
||||
for( keysize = 128; keysize <= 256; keysize += 64 )
|
||||
{
|
||||
printf( " AES-%d : ", keysize );
|
||||
|
@ -213,7 +213,7 @@ int main( void )
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_RSA_C)
|
||||
#if defined(POLARSSL_RSA_C)
|
||||
rsa_init( &rsa, RSA_PKCS_V15, 0, myrand, NULL );
|
||||
rsa_gen_key( &rsa, 1024, 65537 );
|
||||
|
||||
|
|
|
@ -25,21 +25,21 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xyssl/config.h"
|
||||
#include "polarssl/config.h"
|
||||
|
||||
#include "xyssl/md2.h"
|
||||
#include "xyssl/md4.h"
|
||||
#include "xyssl/md5.h"
|
||||
#include "xyssl/sha1.h"
|
||||
#include "xyssl/sha2.h"
|
||||
#include "xyssl/sha4.h"
|
||||
#include "xyssl/arc4.h"
|
||||
#include "xyssl/des.h"
|
||||
#include "xyssl/aes.h"
|
||||
#include "xyssl/base64.h"
|
||||
#include "xyssl/bignum.h"
|
||||
#include "xyssl/rsa.h"
|
||||
#include "xyssl/x509.h"
|
||||
#include "polarssl/md2.h"
|
||||
#include "polarssl/md4.h"
|
||||
#include "polarssl/md5.h"
|
||||
#include "polarssl/sha1.h"
|
||||
#include "polarssl/sha2.h"
|
||||
#include "polarssl/sha4.h"
|
||||
#include "polarssl/arc4.h"
|
||||
#include "polarssl/des.h"
|
||||
#include "polarssl/aes.h"
|
||||
#include "polarssl/base64.h"
|
||||
#include "polarssl/bignum.h"
|
||||
#include "polarssl/rsa.h"
|
||||
#include "polarssl/x509.h"
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
|
@ -53,67 +53,67 @@ int main( int argc, char *argv[] )
|
|||
printf( "\n" );
|
||||
}
|
||||
|
||||
#if defined(XYSSL_MD2_C)
|
||||
#if defined(POLARSSL_MD2_C)
|
||||
if( ( ret = md2_self_test( v ) ) != 0 )
|
||||
return( ret );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_MD4_C)
|
||||
#if defined(POLARSSL_MD4_C)
|
||||
if( ( ret = md4_self_test( v ) ) != 0 )
|
||||
return( ret );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_MD5_C)
|
||||
#if defined(POLARSSL_MD5_C)
|
||||
if( ( ret = md5_self_test( v ) ) != 0 )
|
||||
return( ret );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_SHA1_C)
|
||||
#if defined(POLARSSL_SHA1_C)
|
||||
if( ( ret = sha1_self_test( v ) ) != 0 )
|
||||
return( ret );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_SHA2_C)
|
||||
#if defined(POLARSSL_SHA2_C)
|
||||
if( ( ret = sha2_self_test( v ) ) != 0 )
|
||||
return( ret );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_SHA4_C)
|
||||
#if defined(POLARSSL_SHA4_C)
|
||||
if( ( ret = sha4_self_test( v ) ) != 0 )
|
||||
return( ret );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_ARC4_C)
|
||||
#if defined(POLARSSL_ARC4_C)
|
||||
if( ( ret = arc4_self_test( v ) ) != 0 )
|
||||
return( ret );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_DES_C)
|
||||
#if defined(POLARSSL_DES_C)
|
||||
if( ( ret = des_self_test( v ) ) != 0 )
|
||||
return( ret );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_AES_C)
|
||||
#if defined(POLARSSL_AES_C)
|
||||
if( ( ret = aes_self_test( v ) ) != 0 )
|
||||
return( ret );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_BASE64_C)
|
||||
#if defined(POLARSSL_BASE64_C)
|
||||
if( ( ret = base64_self_test( v ) ) != 0 )
|
||||
return( ret );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_BIGNUM_C)
|
||||
#if defined(POLARSSL_BIGNUM_C)
|
||||
if( ( ret = mpi_self_test( v ) ) != 0 )
|
||||
return( ret );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_RSA_C)
|
||||
#if defined(POLARSSL_RSA_C)
|
||||
if( ( ret = rsa_self_test( v ) ) != 0 )
|
||||
return( ret );
|
||||
#endif
|
||||
|
||||
#if defined(XYSSL_X509_C)
|
||||
#if defined(POLARSSL_X509_C)
|
||||
if( ( ret = x509_self_test( v ) ) != 0 )
|
||||
return( ret );
|
||||
#endif
|
||||
|
|
|
@ -26,11 +26,11 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xyssl/net.h"
|
||||
#include "xyssl/ssl.h"
|
||||
#include "xyssl/havege.h"
|
||||
#include "xyssl/timing.h"
|
||||
#include "xyssl/certs.h"
|
||||
#include "polarssl/net.h"
|
||||
#include "polarssl/ssl.h"
|
||||
#include "polarssl/havege.h"
|
||||
#include "polarssl/timing.h"
|
||||
#include "polarssl/certs.h"
|
||||
|
||||
#define OPMODE_NONE 0
|
||||
#define OPMODE_CLIENT 1
|
||||
|
@ -281,14 +281,14 @@ static int ssl_test( struct options *opt )
|
|||
offset_to_write += ret;
|
||||
}
|
||||
|
||||
if( ret == XYSSL_ERR_SSL_PEER_CLOSE_NOTIFY ||
|
||||
ret == XYSSL_ERR_NET_CONN_RESET )
|
||||
if( ret == POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY ||
|
||||
ret == POLARSSL_ERR_NET_CONN_RESET )
|
||||
{
|
||||
ret = 0;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if( ret < 0 && ret != XYSSL_ERR_NET_TRY_AGAIN )
|
||||
if( ret < 0 && ret != POLARSSL_ERR_NET_TRY_AGAIN )
|
||||
{
|
||||
printf( " ! ssl_write returned %d\n\n", ret );
|
||||
break;
|
||||
|
@ -324,14 +324,14 @@ static int ssl_test( struct options *opt )
|
|||
offset_to_read += ret;
|
||||
}
|
||||
|
||||
if( ret == XYSSL_ERR_SSL_PEER_CLOSE_NOTIFY ||
|
||||
ret == XYSSL_ERR_NET_CONN_RESET )
|
||||
if( ret == POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY ||
|
||||
ret == POLARSSL_ERR_NET_CONN_RESET )
|
||||
{
|
||||
ret = 0;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if( ret < 0 && ret != XYSSL_ERR_NET_TRY_AGAIN )
|
||||
if( ret < 0 && ret != POLARSSL_ERR_NET_TRY_AGAIN )
|
||||
{
|
||||
printf( " ! ssl_read returned %d\n\n", ret );
|
||||
break;
|
||||
|
|
|
@ -1,368 +0,0 @@
|
|||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "_build_all"=".\_build_all.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name xyssl
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name aescrypt2
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name hello
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name md5sum
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name sha1sum
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name sha2sum
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name benchmark
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name dh_client
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name dh_genprime
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name dh_server
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name mpi_demo
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name rsa_genkey
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name rsa_sign
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name rsa_verify
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name selftest
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name ssl_client1
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name ssl_client2
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name ssl_server
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name ssl_test
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "aescrypt2"=".\aescrypt2.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name xyssl
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "benchmark"=".\benchmark.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name xyssl
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "dh_client"=".\dh_client.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name xyssl
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "dh_genprime"=".\dh_genprime.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name xyssl
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "dh_server"=".\dh_server.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name xyssl
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "hello"=".\hello.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name xyssl
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "md5sum"=".\md5sum.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name xyssl
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "mpi_demo"=".\mpi_demo.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name xyssl
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "rsa_genkey"=".\rsa_genkey.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name xyssl
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "rsa_sign"=".\rsa_sign.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name xyssl
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "rsa_verify"=".\rsa_verify.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name xyssl
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "selftest"=".\selftest.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name xyssl
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "sha1sum"=".\sha1sum.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name xyssl
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "sha2sum"=".\sha2sum.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name xyssl
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "ssl_client1"=".\ssl_client1.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name xyssl
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "ssl_client2"=".\ssl_client2.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name xyssl
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "ssl_server"=".\ssl_server.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name xyssl
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "ssl_test"=".\ssl_test.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name xyssl
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "xyssl"=".\xyssl.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
|
@ -1,24 +1,24 @@
|
|||
# Microsoft Developer Studio Project File - Name="xyssl" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Project File - Name="polarssl" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=xyssl - Win32 Debug
|
||||
CFG=polarssl - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "xyssl.mak".
|
||||
!MESSAGE NMAKE /f "polarssl.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "xyssl.mak" CFG="xyssl - Win32 Debug"
|
||||
!MESSAGE NMAKE /f "polarssl.mak" CFG="polarssl - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "xyssl - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "xyssl - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "polarssl - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "polarssl - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
|
@ -28,7 +28,7 @@ CFG=xyssl - Win32 Debug
|
|||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "xyssl - Win32 Release"
|
||||
!IF "$(CFG)" == "polarssl - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
|
@ -51,7 +51,7 @@ LIB32=link.exe -lib
|
|||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "xyssl - Win32 Debug"
|
||||
!ELSEIF "$(CFG)" == "polarssl - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
|
@ -78,8 +78,8 @@ LIB32=link.exe -lib
|
|||
|
||||
# Begin Target
|
||||
|
||||
# Name "xyssl - Win32 Release"
|
||||
# Name "xyssl - Win32 Debug"
|
||||
# Name "polarssl - Win32 Release"
|
||||
# Name "polarssl - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
|
@ -181,95 +181,95 @@ SOURCE=..\library\x509parse.c
|
|||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\aes.h
|
||||
SOURCE=..\include\polarssl\aes.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\arc4.h
|
||||
SOURCE=..\include\polarssl\arc4.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\base64.h
|
||||
SOURCE=..\include\polarssl\base64.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\bignum.h
|
||||
SOURCE=..\include\polarssl\bignum.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\bn_mul.h
|
||||
SOURCE=..\include\polarssl\bn_mul.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\certs.h
|
||||
SOURCE=..\include\polarssl\certs.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\config.h
|
||||
SOURCE=..\include\polarssl\config.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\debug.h
|
||||
SOURCE=..\include\polarssl\debug.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\des.h
|
||||
SOURCE=..\include\polarssl\des.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\dhm.h
|
||||
SOURCE=..\include\polarssl\dhm.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\havege.h
|
||||
SOURCE=..\include\polarssl\havege.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\md2.h
|
||||
SOURCE=..\include\polarssl\md2.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\md4.h
|
||||
SOURCE=..\include\polarssl\md4.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\md5.h
|
||||
SOURCE=..\include\polarssl\md5.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\net.h
|
||||
SOURCE=..\include\polarssl\net.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\padlock.h
|
||||
SOURCE=..\include\polarssl\padlock.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\rsa.h
|
||||
SOURCE=..\include\polarssl\rsa.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\sha1.h
|
||||
SOURCE=..\include\polarssl\sha1.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\sha2.h
|
||||
SOURCE=..\include\polarssl\sha2.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\sha4.h
|
||||
SOURCE=..\include\polarssl\sha4.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\ssl.h
|
||||
SOURCE=..\include\polarssl\ssl.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\timing.h
|
||||
SOURCE=..\include\polarssl\timing.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\xyssl\x509.h
|
||||
SOURCE=..\include\polarssl\x509.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
Loading…
Reference in a new issue