From 40e46940df33ecf9dfb3507affb25a5f10301b3c Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Sat, 3 Jan 2009 21:51:57 +0000 Subject: [PATCH] - First replacement of xyssl by polarssl where needed --- XySSL.png | Bin 27745 -> 0 bytes include/polarssl/aes.h | 4 +- include/polarssl/arc4.h | 4 +- include/polarssl/base64.h | 14 +- include/polarssl/bignum.h | 52 ++-- include/polarssl/bn_mul.h | 14 +- include/polarssl/certs.h | 4 +- include/polarssl/config.h | 70 +++--- include/polarssl/debug.h | 2 +- include/polarssl/des.h | 4 +- include/polarssl/dhm.h | 26 +- include/polarssl/havege.h | 4 +- include/polarssl/md2.h | 4 +- include/polarssl/md4.h | 4 +- include/polarssl/md5.h | 4 +- include/polarssl/net.h | 44 ++-- include/polarssl/openssl.h | 4 +- include/polarssl/padlock.h | 8 +- include/polarssl/rsa.h | 36 +-- include/polarssl/sha1.h | 4 +- include/polarssl/sha2.h | 4 +- include/polarssl/sha4.h | 4 +- include/polarssl/ssl.h | 62 ++--- include/polarssl/timing.h | 4 +- include/polarssl/x509.h | 66 ++--- library/Makefile | 14 +- library/aes.c | 18 +- library/arc4.c | 8 +- library/base64.c | 18 +- library/bignum.c | 58 ++--- library/certs.c | 4 +- library/debug.c | 6 +- library/des.c | 8 +- library/dhm.c | 32 +-- library/havege.c | 10 +- library/md2.c | 8 +- library/md4.c | 8 +- library/md5.c | 8 +- library/net.c | 48 ++-- library/padlock.c | 10 +- library/rsa.c | 70 +++--- library/sha1.c | 8 +- library/sha2.c | 8 +- library/sha4.c | 8 +- library/ssl_cli.c | 48 ++-- library/ssl_srv.c | 66 ++--- library/ssl_tls.c | 148 +++++------ library/timing.c | 6 +- library/x509parse.c | 262 ++++++++++---------- programs/Makefile | 38 +-- programs/aes/aescrypt2.c | 4 +- programs/hash/hello.c | 2 +- programs/hash/md5sum.c | 2 +- programs/hash/sha1sum.c | 2 +- programs/hash/sha2sum.c | 2 +- programs/pkey/dh_client.c | 12 +- programs/pkey/dh_genprime.c | 8 +- programs/pkey/dh_server.c | 12 +- programs/pkey/mpi_demo.c | 2 +- programs/pkey/rsa_genkey.c | 8 +- programs/pkey/rsa_sign.c | 4 +- programs/pkey/rsa_verify.c | 4 +- programs/ssl/ssl_client1.c | 12 +- programs/ssl/ssl_client2.c | 18 +- programs/ssl/ssl_server.c | 22 +- programs/test/benchmark.c | 44 ++-- programs/test/selftest.c | 54 ++-- programs/test/ssl_test.c | 22 +- visualc/_build.dsw | 368 ---------------------------- visualc/{xyssl.dsp => polarssl.dsp} | 66 ++--- 70 files changed, 833 insertions(+), 1201 deletions(-) delete mode 100644 XySSL.png rename visualc/{xyssl.dsp => polarssl.dsp} (74%) diff --git a/XySSL.png b/XySSL.png deleted file mode 100644 index f631a3b0f5612e6eac7578b2ae2e12d7ba8befbc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 27745 zcma%jcRZDU_`ba|j**pdj3mj*$~;C^LXsqLNSq|udvlCrC!uU1SxHv*4%sUS*_-VB zyM4Z|@9*#L^Xj9|t8<+5Jn!dy-}iN2*L6RkI$Ej}WXxnZI5-sQYRbAeIJlYc|EVN+ z@UycmvJUUVAt4-wUVV3%`e;F;2?3-l@;_{f2~xzc-(tXDaW6; z_b2T7LxFPN@I?d(Hwy1YLhQ}?3m+mKemTua-QXZpM3W%uK9)cF;=W$ZaJ1KY^5u_g z%=hb;lxS3zBaI@W%XWWx0S4jRc8-NOG{X#)4NYtMG`v4$HzZ> zV5JXhwkSFBi{$b=t^I5C$Lo6awEL;0LHqiJl}dK6s&O0fB-f9u%cRr`TkwWb!+qRq7xw}pqoteJ?Il^3R#&SI&)kG4Uox?ejF0E*=Z#u_ z>&1K>d+|?Anh53BY!=-rEh^eHy*XoFp~KrG2$wW!E$)pLNnjn>T+1mNj@jRExY?w; z?zYusK`S|S60uR<_HWKs@{Bubucj`d@+_&#qQXckyFW`eS2tIbIUKIz%cHg{n}3_l zgo7KWwhlxRG?56~ir*3On*v3B)%=N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D_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 ); diff --git a/include/polarssl/bn_mul.h b/include/polarssl/bn_mul.h index 4848c8285..b85bede9b 100644 --- a/include/polarssl/bn_mul.h +++ b/include/polarssl/bn_mul.h @@ -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 \ { \ diff --git a/include/polarssl/certs.h b/include/polarssl/certs.h index 7b91bafbe..6bc74bfc8 100644 --- a/include/polarssl/certs.h +++ b/include/polarssl/certs.h @@ -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" { diff --git a/include/polarssl/config.h b/include/polarssl/config.h index f0c760960..6fcbc26cf 100644 --- a/include/polarssl/config.h +++ b/include/polarssl/config.h @@ -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 */ diff --git a/include/polarssl/debug.h b/include/polarssl/debug.h index 4b1a164c4..5997d0c0d 100644 --- a/include/polarssl/debug.h +++ b/include/polarssl/debug.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 ); diff --git a/include/polarssl/des.h b/include/polarssl/des.h index f118eac4e..938e2a8b0 100644 --- a/include/polarssl/des.h +++ b/include/polarssl/des.h @@ -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 diff --git a/include/polarssl/dhm.h b/include/polarssl/dhm.h index ebed106eb..0995867f2 100644 --- a/include/polarssl/dhm.h +++ b/include/polarssl/dhm.h @@ -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 ); diff --git a/include/polarssl/havege.h b/include/polarssl/havege.h index 3ad84b4a7..1ae334292 100644 --- a/include/polarssl/havege.h +++ b/include/polarssl/havege.h @@ -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 diff --git a/include/polarssl/md2.h b/include/polarssl/md2.h index c3034835f..3952940ed 100644 --- a/include/polarssl/md2.h +++ b/include/polarssl/md2.h @@ -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 diff --git a/include/polarssl/md4.h b/include/polarssl/md4.h index f0a7c33ca..1262e01be 100644 --- a/include/polarssl/md4.h +++ b/include/polarssl/md4.h @@ -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 diff --git a/include/polarssl/md5.h b/include/polarssl/md5.h index a772542b4..bc1aafc1a 100644 --- a/include/polarssl/md5.h +++ b/include/polarssl/md5.h @@ -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 diff --git a/include/polarssl/net.h b/include/polarssl/net.h index 1860b3d58..a8fcdca15 100644 --- a/include/polarssl/net.h +++ b/include/polarssl/net.h @@ -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 ); diff --git a/include/polarssl/openssl.h b/include/polarssl/openssl.h index f34db57a4..a9bd3b847 100644 --- a/include/polarssl/openssl.h +++ b/include/polarssl/openssl.h @@ -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" diff --git a/include/polarssl/padlock.h b/include/polarssl/padlock.h index 713b15523..e154214a1 100644 --- a/include/polarssl/padlock.h +++ b/include/polarssl/padlock.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 diff --git a/include/polarssl/rsa.h b/include/polarssl/rsa.h index 482dc0114..e6302c661 100644 --- a/include/polarssl/rsa.h +++ b/include/polarssl/rsa.h @@ -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). diff --git a/include/polarssl/sha1.h b/include/polarssl/sha1.h index 7d44c6721..5748fa499 100644 --- a/include/polarssl/sha1.h +++ b/include/polarssl/sha1.h @@ -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 diff --git a/include/polarssl/sha2.h b/include/polarssl/sha2.h index ad2d37b7c..0304039ba 100644 --- a/include/polarssl/sha2.h +++ b/include/polarssl/sha2.h @@ -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 diff --git a/include/polarssl/sha4.h b/include/polarssl/sha4.h index 6c80085ae..e4cebf2f5 100644 --- a/include/polarssl/sha4.h +++ b/include/polarssl/sha4.h @@ -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 diff --git a/include/polarssl/ssl.h b/include/polarssl/ssl.h index e8dbf89eb..673783d17 100644 --- a/include/polarssl/ssl.h +++ b/include/polarssl/ssl.h @@ -1,8 +1,8 @@ /** * \file ssl.h */ -#ifndef XYSSL_SSL_H -#define XYSSL_SSL_H +#ifndef POLARSSL_SSL_H +#define POLARSSL_SSL_H #include @@ -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. */ diff --git a/include/polarssl/timing.h b/include/polarssl/timing.h index 32e53e8c0..630c8ba42 100644 --- a/include/polarssl/timing.h +++ b/include/polarssl/timing.h @@ -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 diff --git a/include/polarssl/x509.h b/include/polarssl/x509.h index 9d9ef99a5..a70e3e930 100644 --- a/include/polarssl/x509.h +++ b/include/polarssl/x509.h @@ -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 -- diff --git a/library/Makefile b/library/Makefile index aef615d47..b28c858a0 100644 --- a/library/Makefile +++ b/library/Makefile @@ -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.* diff --git a/library/aes.c b/library/aes.c index 84fb037c3..039f3dc6b 100644 --- a/library/aes.c +++ b/library/aes.c @@ -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 @@ -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 diff --git a/library/arc4.c b/library/arc4.c index d226c07c4..d15136a12 100644 --- a/library/arc4.c +++ b/library/arc4.c @@ -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 #include diff --git a/library/base64.c b/library/base64.c index be6c02414..39e9e96b9 100644 --- a/library/base64.c +++ b/library/base64.c @@ -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 #include diff --git a/library/bignum.c b/library/bignum.c index f25fc4d12..38d161033 100644 --- a/library/bignum.c +++ b/library/bignum.c @@ -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 #include @@ -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 diff --git a/library/certs.c b/library/certs.c index 8d0abb60c..d696cde19 100644 --- a/library/certs.c +++ b/library/certs.c @@ -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" diff --git a/library/debug.c b/library/debug.c index 4862fc46e..b2ae54820 100644 --- a/library/debug.c +++ b/library/debug.c @@ -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 #include diff --git a/library/des.c b/library/des.c index aec027da9..df60e0040 100644 --- a/library/des.c +++ b/library/des.c @@ -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 @@ -634,7 +634,7 @@ void des3_crypt_cbc( des3_context *ctx, } } -#if defined(XYSSL_SELF_TEST) +#if defined(POLARSSL_SELF_TEST) #include diff --git a/library/dhm.c b/library/dhm.c index 4fff26488..0c247afc2 100644 --- a/library/dhm.c +++ b/library/dhm.c @@ -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 @@ -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 diff --git a/library/havege.c b/library/havege.c index 48ae7e6a3..f191bd7cd 100644 --- a/library/havege.c +++ b/library/havege.c @@ -28,12 +28,12 @@ #include #include -#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 diff --git a/library/md2.c b/library/md2.c index 9cfce4ab0..6bb46b532 100644 --- a/library/md2.c +++ b/library/md2.c @@ -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 #include @@ -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 diff --git a/library/md4.c b/library/md4.c index 67fcd9995..672520e33 100644 --- a/library/md4.c +++ b/library/md4.c @@ -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 #include @@ -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 diff --git a/library/md5.c b/library/md5.c index b52941d2f..a9d853156 100644 --- a/library/md5.c +++ b/library/md5.c @@ -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 #include @@ -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 */ diff --git a/library/net.c b/library/net.c index 78525c31e..df79bf3a7 100644 --- a/library/net.c +++ b/library/net.c @@ -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 ); diff --git a/library/padlock.c b/library/padlock.c index 8d761b2fd..e060838f8 100644 --- a/library/padlock.c +++ b/library/padlock.c @@ -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 diff --git a/library/rsa.c b/library/rsa.c index 9d54032ca..3e2d4c62f 100644 --- a/library/rsa.c +++ b/library/rsa.c @@ -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 #include @@ -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 diff --git a/library/sha1.c b/library/sha1.c index b15a5bfce..ceb776b3d 100644 --- a/library/sha1.c +++ b/library/sha1.c @@ -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 #include @@ -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 */ diff --git a/library/sha2.c b/library/sha2.c index 03e5b7072..81812292a 100644 --- a/library/sha2.c +++ b/library/sha2.c @@ -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 #include @@ -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 */ diff --git a/library/sha4.c b/library/sha4.c index 52422a07f..2634fba54 100644 --- a/library/sha4.c +++ b/library/sha4.c @@ -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 #include @@ -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 diff --git a/library/ssl_cli.c b/library/ssl_cli.c index ad91b5f35..c2832be71 100644 --- a/library/ssl_cli.c +++ b/library/ssl_cli.c @@ -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 #include @@ -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 ) diff --git a/library/ssl_srv.c b/library/ssl_srv.c index b8dd6618e..ead2b2091 100644 --- a/library/ssl_srv.c +++ b/library/ssl_srv.c @@ -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 #include @@ -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 ) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 72d98b8fe..a59122786 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -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 #include @@ -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 diff --git a/library/timing.c b/library/timing.c index 49fe7f3c3..2b52af0bd 100644 --- a/library/timing.c +++ b/library/timing.c @@ -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) diff --git a/library/x509parse.c b/library/x509parse.c index 5bac80fc6..02adfa55b 100644 --- a/library/x509parse.c +++ b/library/x509parse.c @@ -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 #include @@ -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 diff --git a/programs/Makefile b/programs/Makefile index 5771a57fb..a29f358cd 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -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 $@ diff --git a/programs/aes/aescrypt2.c b/programs/aes/aescrypt2.c index 3d9c06da8..8e632f082 100644 --- a/programs/aes/aescrypt2.c +++ b/programs/aes/aescrypt2.c @@ -35,8 +35,8 @@ #include #include -#include "xyssl/aes.h" -#include "xyssl/sha2.h" +#include "polarssl/aes.h" +#include "polarssl/sha2.h" #define MODE_ENCRYPT 0 #define MODE_DECRYPT 1 diff --git a/programs/hash/hello.c b/programs/hash/hello.c index 12e016734..f1e93ab3c 100644 --- a/programs/hash/hello.c +++ b/programs/hash/hello.c @@ -24,7 +24,7 @@ #include -#include "xyssl/md5.h" +#include "polarssl/md5.h" int main( void ) { diff --git a/programs/hash/md5sum.c b/programs/hash/md5sum.c index 10e9a7101..d246900b4 100644 --- a/programs/hash/md5sum.c +++ b/programs/hash/md5sum.c @@ -25,7 +25,7 @@ #include #include -#include "xyssl/md5.h" +#include "polarssl/md5.h" static int md5_wrapper( char *filename, unsigned char *sum ) { diff --git a/programs/hash/sha1sum.c b/programs/hash/sha1sum.c index 33c3142d6..53a97d045 100644 --- a/programs/hash/sha1sum.c +++ b/programs/hash/sha1sum.c @@ -25,7 +25,7 @@ #include #include -#include "xyssl/sha1.h" +#include "polarssl/sha1.h" static int sha1_wrapper( char *filename, unsigned char *sum ) { diff --git a/programs/hash/sha2sum.c b/programs/hash/sha2sum.c index c0d42a844..beb21cb64 100644 --- a/programs/hash/sha2sum.c +++ b/programs/hash/sha2sum.c @@ -25,7 +25,7 @@ #include #include -#include "xyssl/sha2.h" +#include "polarssl/sha2.h" static int sha2_wrapper( char *filename, unsigned char *sum ) { diff --git a/programs/pkey/dh_client.c b/programs/pkey/dh_client.c index 212207882..8bf6b5f2e 100644 --- a/programs/pkey/dh_client.c +++ b/programs/pkey/dh_client.c @@ -25,12 +25,12 @@ #include #include -#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 diff --git a/programs/pkey/dh_genprime.c b/programs/pkey/dh_genprime.c index 09d9b1d70..45605e380 100644 --- a/programs/pkey/dh_genprime.c +++ b/programs/pkey/dh_genprime.c @@ -24,9 +24,9 @@ #include -#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; diff --git a/programs/pkey/dh_server.c b/programs/pkey/dh_server.c index 4990dcf4f..f4b7b44d1 100644 --- a/programs/pkey/dh_server.c +++ b/programs/pkey/dh_server.c @@ -25,12 +25,12 @@ #include #include -#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!==" diff --git a/programs/pkey/mpi_demo.c b/programs/pkey/mpi_demo.c index 699fa5aee..87737c8e7 100644 --- a/programs/pkey/mpi_demo.c +++ b/programs/pkey/mpi_demo.c @@ -24,7 +24,7 @@ #include -#include "xyssl/bignum.h" +#include "polarssl/bignum.h" int main( void ) { diff --git a/programs/pkey/rsa_genkey.c b/programs/pkey/rsa_genkey.c index 0619f1547..cd8016d3e 100644 --- a/programs/pkey/rsa_genkey.c +++ b/programs/pkey/rsa_genkey.c @@ -24,10 +24,10 @@ #include -#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 diff --git a/programs/pkey/rsa_sign.c b/programs/pkey/rsa_sign.c index 0e7077e1c..85016b9ca 100644 --- a/programs/pkey/rsa_sign.c +++ b/programs/pkey/rsa_sign.c @@ -25,8 +25,8 @@ #include #include -#include "xyssl/rsa.h" -#include "xyssl/sha1.h" +#include "polarssl/rsa.h" +#include "polarssl/sha1.h" int main( int argc, char *argv[] ) { diff --git a/programs/pkey/rsa_verify.c b/programs/pkey/rsa_verify.c index aacc664f5..a8096f37f 100644 --- a/programs/pkey/rsa_verify.c +++ b/programs/pkey/rsa_verify.c @@ -25,8 +25,8 @@ #include #include -#include "xyssl/rsa.h" -#include "xyssl/sha1.h" +#include "polarssl/rsa.h" +#include "polarssl/sha1.h" int main( int argc, char *argv[] ) { diff --git a/programs/ssl/ssl_client1.c b/programs/ssl/ssl_client1.c index e752d87c8..f32c2283a 100644 --- a/programs/ssl/ssl_client1.c +++ b/programs/ssl/ssl_client1.c @@ -25,9 +25,9 @@ #include #include -#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 ) diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c index a19c37b66..e814931b2 100644 --- a/programs/ssl/ssl_client2.c +++ b/programs/ssl/ssl_client2.c @@ -25,11 +25,11 @@ #include #include -#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 ) diff --git a/programs/ssl/ssl_server.c b/programs/ssl/ssl_server.c index 565fed292..4b07ef67f 100644 --- a/programs/ssl/ssl_server.c +++ b/programs/ssl/ssl_server.c @@ -30,11 +30,11 @@ #include #include -#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; diff --git a/programs/test/benchmark.c b/programs/test/benchmark.c index 9869cc438..5058cffec 100644 --- a/programs/test/benchmark.c +++ b/programs/test/benchmark.c @@ -26,17 +26,17 @@ #include #include -#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 ); diff --git a/programs/test/selftest.c b/programs/test/selftest.c index 6fc0e1f3e..cf77939bd 100644 --- a/programs/test/selftest.c +++ b/programs/test/selftest.c @@ -25,21 +25,21 @@ #include #include -#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 diff --git a/programs/test/ssl_test.c b/programs/test/ssl_test.c index 44ff7d8eb..ebf2be9c1 100644 --- a/programs/test/ssl_test.c +++ b/programs/test/ssl_test.c @@ -26,11 +26,11 @@ #include #include -#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; diff --git a/visualc/_build.dsw b/visualc/_build.dsw index 2d568c22d..e69de29bb 100644 --- a/visualc/_build.dsw +++ b/visualc/_build.dsw @@ -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> -{{{ -}}} - -############################################################################### - diff --git a/visualc/xyssl.dsp b/visualc/polarssl.dsp similarity index 74% rename from visualc/xyssl.dsp rename to visualc/polarssl.dsp index 1c69355ab..6e7bd0931 100644 --- a/visualc/xyssl.dsp +++ b/visualc/polarssl.dsp @@ -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