- Fixes for MSVC6
This commit is contained in:
parent
c9c5df98de
commit
7a2538ee38
7 changed files with 39 additions and 22 deletions
|
@ -1,5 +1,9 @@
|
||||||
PolarSSL ChangeLog
|
PolarSSL ChangeLog
|
||||||
|
|
||||||
|
= Version Trunk
|
||||||
|
Bugfixes
|
||||||
|
* Fixes for MSVC6
|
||||||
|
|
||||||
= Version 1.2.0 released 2012-10-31
|
= Version 1.2.0 released 2012-10-31
|
||||||
Features
|
Features
|
||||||
* Added support for NULL cipher (POLARSSL_CIPHER_NULL_CIPHER) and weak
|
* Added support for NULL cipher (POLARSSL_CIPHER_NULL_CIPHER) and weak
|
||||||
|
|
|
@ -34,8 +34,13 @@
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#include <basetsd.h>
|
#include <basetsd.h>
|
||||||
|
#if (_MSC_VER <= 1200)
|
||||||
|
typedef signed short int16_t;
|
||||||
|
typedef unsigned short uint16_t;
|
||||||
|
#else
|
||||||
typedef INT16 int16_t;
|
typedef INT16 int16_t;
|
||||||
typedef UINT16 uint16_t;
|
typedef UINT16 uint16_t;
|
||||||
|
#endif
|
||||||
typedef INT32 int32_t;
|
typedef INT32 int32_t;
|
||||||
typedef UINT32 uint32_t;
|
typedef UINT32 uint32_t;
|
||||||
typedef UINT64 uint64_t;
|
typedef UINT64 uint64_t;
|
||||||
|
|
|
@ -29,7 +29,12 @@
|
||||||
|
|
||||||
#include "aes.h"
|
#include "aes.h"
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#include <basetsd.h>
|
||||||
|
typedef UINT64 uint64_t;
|
||||||
|
#else
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define GCM_ENCRYPT 1
|
#define GCM_ENCRYPT 1
|
||||||
#define GCM_DECRYPT 0
|
#define GCM_DECRYPT 0
|
||||||
|
|
|
@ -682,7 +682,7 @@ void ssl_set_bio( ssl_context *ssl,
|
||||||
* data) is cleared by the SSL/TLS layer when the connection is
|
* data) is cleared by the SSL/TLS layer when the connection is
|
||||||
* terminated. It is recommended to add metadata to determine if
|
* terminated. It is recommended to add metadata to determine if
|
||||||
* an entry is still valid in the future. Return 0 if
|
* an entry is still valid in the future. Return 0 if
|
||||||
* successfully cached, return 0 otherwise.
|
* successfully cached, return 1 otherwise.
|
||||||
*
|
*
|
||||||
* \param ssl SSL context
|
* \param ssl SSL context
|
||||||
* \param f_get_cache session get callback
|
* \param f_get_cache session get callback
|
||||||
|
|
|
@ -40,10 +40,10 @@
|
||||||
#if !defined(POLARSSL_NO_PLATFORM_ENTROPY)
|
#if !defined(POLARSSL_NO_PLATFORM_ENTROPY)
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
#if !defined(_WIN32_WINNT)
|
#if !defined(_WIN32_WINNT)
|
||||||
#define _WIN32_WINNT 0x0400
|
#define _WIN32_WINNT 0x0400
|
||||||
#endif
|
#endif
|
||||||
|
#include <windows.h>
|
||||||
#include <wincrypt.h>
|
#include <wincrypt.h>
|
||||||
|
|
||||||
int platform_entropy_poll( void *data, unsigned char *output, size_t len,
|
int platform_entropy_poll( void *data, unsigned char *output, size_t len,
|
||||||
|
|
|
@ -148,7 +148,7 @@ void gcm_mult( gcm_context *ctx, const unsigned char x[16], unsigned char output
|
||||||
|
|
||||||
if( i != 15 )
|
if( i != 15 )
|
||||||
{
|
{
|
||||||
rem = zl & 0xf;
|
rem = (unsigned char) zl & 0xf;
|
||||||
zl = ( zh << 60 ) | ( zl >> 4 );
|
zl = ( zh << 60 ) | ( zl >> 4 );
|
||||||
zh = ( zh >> 4 );
|
zh = ( zh >> 4 );
|
||||||
zh ^= (uint64_t) last4[rem] << 48;
|
zh ^= (uint64_t) last4[rem] << 48;
|
||||||
|
@ -157,7 +157,7 @@ void gcm_mult( gcm_context *ctx, const unsigned char x[16], unsigned char output
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rem = zl & 0xf;
|
rem = (unsigned char) zl & 0xf;
|
||||||
zl = ( zh << 60 ) | ( zl >> 4 );
|
zl = ( zh << 60 ) | ( zl >> 4 );
|
||||||
zh = ( zh >> 4 );
|
zh = ( zh >> 4 );
|
||||||
zh ^= (uint64_t) last4[rem] << 48;
|
zh ^= (uint64_t) last4[rem] << 48;
|
||||||
|
|
|
@ -60,9 +60,7 @@
|
||||||
|
|
||||||
#if defined(POLARSSL_FS_IO)
|
#if defined(POLARSSL_FS_IO)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#if defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
#include <strsafe.h>
|
|
||||||
#else
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -1878,50 +1876,55 @@ int x509parse_crtpath( x509_cert *chain, const char *path )
|
||||||
WCHAR szDir[MAX_PATH];
|
WCHAR szDir[MAX_PATH];
|
||||||
char filename[MAX_PATH];
|
char filename[MAX_PATH];
|
||||||
char *p;
|
char *p;
|
||||||
|
int len = strlen( path );
|
||||||
|
|
||||||
WIN32_FIND_DATA file_data;
|
WIN32_FIND_DATA file_data;
|
||||||
HANDLE hFind;
|
HANDLE hFind;
|
||||||
DWORD dwError = 0;
|
|
||||||
|
if( len > MAX_PATH - 3 )
|
||||||
|
return( POLARSSL_ERR_X509_INVALID_INPUT );
|
||||||
|
|
||||||
memset( szDir, 0, sizeof(szDir) );
|
memset( szDir, 0, sizeof(szDir) );
|
||||||
memset( filename, 0, MAX_PATH );
|
memset( filename, 0, MAX_PATH );
|
||||||
memcpy( filename, path, strlen( path ) );
|
memcpy( filename, path, len );
|
||||||
filename[strlen( path )] = '\\';
|
filename[len++] = '\\';
|
||||||
p = filename + strlen( path ) + 1;
|
p = filename + len;
|
||||||
|
filename[len++] = '*';
|
||||||
|
|
||||||
w_ret = MultiByteToWideChar( CP_ACP, 0, path, strlen(path), szDir, MAX_PATH - 3 );
|
w_ret = MultiByteToWideChar( CP_ACP, 0, path, len, szDir, MAX_PATH - 3 );
|
||||||
|
|
||||||
StringCchCopyW(szDir, MAX_PATH, szDir);
|
|
||||||
StringCchCatW(szDir, MAX_PATH, TEXT("\\*"));
|
|
||||||
|
|
||||||
hFind = FindFirstFile( szDir, &file_data );
|
hFind = FindFirstFile( szDir, &file_data );
|
||||||
if (hFind == INVALID_HANDLE_VALUE)
|
if (hFind == INVALID_HANDLE_VALUE)
|
||||||
return( POLARSSL_ERR_X509_FILE_IO_ERROR );
|
return( POLARSSL_ERR_X509_FILE_IO_ERROR );
|
||||||
|
|
||||||
|
len = MAX_PATH - len;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
memset( p, 0, filename + MAX_PATH - p - 1 );
|
memset( p, 0, len );
|
||||||
|
|
||||||
if( file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
|
if( file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
w_ret = WideCharToMultiByte( CP_ACP, 0, file_data.cFileName,
|
w_ret = WideCharToMultiByte( CP_ACP, 0, file_data.cFileName,
|
||||||
lstrlenW(file_data.cFileName),
|
lstrlenW(file_data.cFileName),
|
||||||
p,
|
p, len - 1,
|
||||||
filename + MAX_PATH - p - 2, NULL, NULL );
|
NULL, NULL );
|
||||||
|
|
||||||
w_ret = x509parse_crtfile( chain, filename );
|
w_ret = x509parse_crtfile( chain, filename );
|
||||||
if( w_ret < 0 )
|
if( w_ret < 0 )
|
||||||
return( w_ret );
|
{
|
||||||
|
ret = w_ret;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
ret += w_ret;
|
ret += w_ret;
|
||||||
}
|
}
|
||||||
while( FindNextFile( hFind, &file_data ) != 0 );
|
while( FindNextFile( hFind, &file_data ) != 0 );
|
||||||
|
|
||||||
dwError = GetLastError();
|
if (GetLastError() != ERROR_NO_MORE_FILES)
|
||||||
if (dwError != ERROR_NO_MORE_FILES)
|
ret = POLARSSL_ERR_X509_FILE_IO_ERROR;
|
||||||
return( POLARSSL_ERR_X509_FILE_IO_ERROR );
|
|
||||||
|
|
||||||
|
cleanup:
|
||||||
FindClose( hFind );
|
FindClose( hFind );
|
||||||
#else
|
#else
|
||||||
int t_ret;
|
int t_ret;
|
||||||
|
|
Loading…
Reference in a new issue