mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-22 19:55:43 +00:00
- Fixes for MSVC6
This commit is contained in:
parent
c9c5df98de
commit
7a2538ee38
|
@ -1,5 +1,9 @@
|
|||
PolarSSL ChangeLog
|
||||
|
||||
= Version Trunk
|
||||
Bugfixes
|
||||
* Fixes for MSVC6
|
||||
|
||||
= Version 1.2.0 released 2012-10-31
|
||||
Features
|
||||
* Added support for NULL cipher (POLARSSL_CIPHER_NULL_CIPHER) and weak
|
||||
|
|
|
@ -34,8 +34,13 @@
|
|||
|
||||
#ifdef _MSC_VER
|
||||
#include <basetsd.h>
|
||||
#if (_MSC_VER <= 1200)
|
||||
typedef signed short int16_t;
|
||||
typedef unsigned short uint16_t;
|
||||
#else
|
||||
typedef INT16 int16_t;
|
||||
typedef UINT16 uint16_t;
|
||||
#endif
|
||||
typedef INT32 int32_t;
|
||||
typedef UINT32 uint32_t;
|
||||
typedef UINT64 uint64_t;
|
||||
|
|
|
@ -29,7 +29,12 @@
|
|||
|
||||
#include "aes.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <basetsd.h>
|
||||
typedef UINT64 uint64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#define GCM_ENCRYPT 1
|
||||
#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
|
||||
* terminated. It is recommended to add metadata to determine 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 f_get_cache session get callback
|
||||
|
|
|
@ -40,10 +40,10 @@
|
|||
#if !defined(POLARSSL_NO_PLATFORM_ENTROPY)
|
||||
#if defined(_WIN32)
|
||||
|
||||
#include <windows.h>
|
||||
#if !defined(_WIN32_WINNT)
|
||||
#define _WIN32_WINNT 0x0400
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
|
||||
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 )
|
||||
{
|
||||
rem = zl & 0xf;
|
||||
rem = (unsigned char) zl & 0xf;
|
||||
zl = ( zh << 60 ) | ( zl >> 4 );
|
||||
zh = ( zh >> 4 );
|
||||
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 );
|
||||
zh = ( zh >> 4 );
|
||||
zh ^= (uint64_t) last4[rem] << 48;
|
||||
|
|
|
@ -60,9 +60,7 @@
|
|||
|
||||
#if defined(POLARSSL_FS_IO)
|
||||
#include <stdio.h>
|
||||
#if defined(_WIN32)
|
||||
#include <strsafe.h>
|
||||
#else
|
||||
#if !defined(_WIN32)
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
@ -1878,50 +1876,55 @@ int x509parse_crtpath( x509_cert *chain, const char *path )
|
|||
WCHAR szDir[MAX_PATH];
|
||||
char filename[MAX_PATH];
|
||||
char *p;
|
||||
int len = strlen( path );
|
||||
|
||||
WIN32_FIND_DATA file_data;
|
||||
HANDLE hFind;
|
||||
DWORD dwError = 0;
|
||||
|
||||
if( len > MAX_PATH - 3 )
|
||||
return( POLARSSL_ERR_X509_INVALID_INPUT );
|
||||
|
||||
memset( szDir, 0, sizeof(szDir) );
|
||||
memset( filename, 0, MAX_PATH );
|
||||
memcpy( filename, path, strlen( path ) );
|
||||
filename[strlen( path )] = '\\';
|
||||
p = filename + strlen( path ) + 1;
|
||||
memcpy( filename, path, len );
|
||||
filename[len++] = '\\';
|
||||
p = filename + len;
|
||||
filename[len++] = '*';
|
||||
|
||||
w_ret = MultiByteToWideChar( CP_ACP, 0, path, strlen(path), szDir, MAX_PATH - 3 );
|
||||
|
||||
StringCchCopyW(szDir, MAX_PATH, szDir);
|
||||
StringCchCatW(szDir, MAX_PATH, TEXT("\\*"));
|
||||
w_ret = MultiByteToWideChar( CP_ACP, 0, path, len, szDir, MAX_PATH - 3 );
|
||||
|
||||
hFind = FindFirstFile( szDir, &file_data );
|
||||
if (hFind == INVALID_HANDLE_VALUE)
|
||||
return( POLARSSL_ERR_X509_FILE_IO_ERROR );
|
||||
|
||||
len = MAX_PATH - len;
|
||||
do
|
||||
{
|
||||
memset( p, 0, filename + MAX_PATH - p - 1 );
|
||||
memset( p, 0, len );
|
||||
|
||||
if( file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
|
||||
continue;
|
||||
|
||||
w_ret = WideCharToMultiByte( CP_ACP, 0, file_data.cFileName,
|
||||
lstrlenW(file_data.cFileName),
|
||||
p,
|
||||
filename + MAX_PATH - p - 2, NULL, NULL );
|
||||
p, len - 1,
|
||||
NULL, NULL );
|
||||
|
||||
w_ret = x509parse_crtfile( chain, filename );
|
||||
if( w_ret < 0 )
|
||||
return( w_ret );
|
||||
{
|
||||
ret = w_ret;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret += w_ret;
|
||||
}
|
||||
while( FindNextFile( hFind, &file_data ) != 0 );
|
||||
|
||||
dwError = GetLastError();
|
||||
if (dwError != ERROR_NO_MORE_FILES)
|
||||
return( POLARSSL_ERR_X509_FILE_IO_ERROR );
|
||||
if (GetLastError() != ERROR_NO_MORE_FILES)
|
||||
ret = POLARSSL_ERR_X509_FILE_IO_ERROR;
|
||||
|
||||
cleanup:
|
||||
FindClose( hFind );
|
||||
#else
|
||||
int t_ret;
|
||||
|
|
Loading…
Reference in a new issue