mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-25 00:02:42 +00:00
Code style fixes
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
This commit is contained in:
parent
b8d6b82df4
commit
a277b210ff
@ -57,12 +57,12 @@
|
|||||||
* These constants are guaranteed to be the same, though, so we suppress the
|
* These constants are guaranteed to be the same, though, so we suppress the
|
||||||
* warning when including intsafe.h.
|
* warning when including intsafe.h.
|
||||||
*/
|
*/
|
||||||
#pragma warning( push )
|
#pragma warning(push)
|
||||||
#pragma warning( disable : 4005 )
|
#pragma warning(disable : 4005)
|
||||||
#endif
|
#endif
|
||||||
#include <intsafe.h>
|
#include <intsafe.h>
|
||||||
#if defined(_MSC_VER) && _MSC_VER <= 1600
|
#if defined(_MSC_VER) && _MSC_VER <= 1600
|
||||||
#pragma warning( pop )
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int mbedtls_platform_entropy_poll(void *data, unsigned char *output, size_t len,
|
int mbedtls_platform_entropy_poll(void *data, unsigned char *output, size_t len,
|
||||||
@ -77,14 +77,13 @@ int mbedtls_platform_entropy_poll(void *data, unsigned char *output, size_t len,
|
|||||||
* 64-bit Windows platforms. Ensure len's value can be safely converted into
|
* 64-bit Windows platforms. Ensure len's value can be safely converted into
|
||||||
* a ULONG.
|
* a ULONG.
|
||||||
*/
|
*/
|
||||||
if ( FAILED( SizeTToULong( len, &len_as_ulong ) ) )
|
if (FAILED(SizeTToULong(len, &len_as_ulong))) {
|
||||||
{
|
return MBEDTLS_ERR_ENTROPY_SOURCE_FAILED;
|
||||||
return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !BCRYPT_SUCCESS( BCryptGenRandom( NULL, output, len_as_ulong, BCRYPT_USE_SYSTEM_PREFERRED_RNG ) ) )
|
if (!BCRYPT_SUCCESS(BCryptGenRandom(NULL, output, len_as_ulong,
|
||||||
{
|
BCRYPT_USE_SYSTEM_PREFERRED_RNG))) {
|
||||||
return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
|
return MBEDTLS_ERR_ENTROPY_SOURCE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
*olen = len;
|
*olen = len;
|
||||||
|
@ -67,12 +67,12 @@
|
|||||||
* These constants are guaranteed to be the same, though, so we suppress the
|
* These constants are guaranteed to be the same, though, so we suppress the
|
||||||
* warning when including intsafe.h.
|
* warning when including intsafe.h.
|
||||||
*/
|
*/
|
||||||
#pragma warning( push )
|
#pragma warning(push )
|
||||||
#pragma warning( disable : 4005 )
|
#pragma warning(disable : 4005)
|
||||||
#endif
|
#endif
|
||||||
#include <intsafe.h>
|
#include <intsafe.h>
|
||||||
#if defined(_MSC_VER) && _MSC_VER <= 1600
|
#if defined(_MSC_VER) && _MSC_VER <= 1600
|
||||||
#pragma warning( pop )
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -1570,8 +1570,9 @@ int mbedtls_x509_crt_parse_path(mbedtls_x509_crt *chain, const char *path)
|
|||||||
p = filename + len;
|
p = filename + len;
|
||||||
filename[len++] = '*';
|
filename[len++] = '*';
|
||||||
|
|
||||||
if (FAILED (SizeTToInt(len, &length_as_int)))
|
if (FAILED(SizeTToInt(len, &length_as_int))) {
|
||||||
return(MBEDTLS_ERR_X509_FILE_IO_ERROR);
|
return MBEDTLS_ERR_X509_FILE_IO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note this function uses the code page CP_ACP, and assumes the incoming
|
* Note this function uses the code page CP_ACP, and assumes the incoming
|
||||||
@ -1600,15 +1601,15 @@ int mbedtls_x509_crt_parse_path(mbedtls_x509_crt *chain, const char *path)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(SizeTToInt(wcslen(file_data.cFileName), &length_as_int)))
|
if (FAILED(SizeTToInt(wcslen(file_data.cFileName), &length_as_int))) {
|
||||||
return(MBEDTLS_ERR_X509_FILE_IO_ERROR);
|
return MBEDTLS_ERR_X509_FILE_IO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
w_ret = WideCharToMultiByte(CP_ACP, 0, file_data.cFileName,
|
w_ret = WideCharToMultiByte(CP_ACP, 0, file_data.cFileName,
|
||||||
length_as_int,
|
length_as_int,
|
||||||
p, (int) len - 1,
|
p, (int) len - 1,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
if(w_ret == 0)
|
if (w_ret == 0) {
|
||||||
{
|
|
||||||
ret = MBEDTLS_ERR_X509_FILE_IO_ERROR;
|
ret = MBEDTLS_ERR_X509_FILE_IO_ERROR;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user