mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-01 19:54:40 +02:00
Merge pull request #930 from dgarske/fix_win
Fixes for building AES key wrap and PKCS7 on Windows
This commit is contained in:
@@ -1190,7 +1190,7 @@ int wolfSSL_dtls_export_internal(WOLFSSL* ssl, byte* buf, word32 sz)
|
|||||||
#ifdef WOLFSSL_SESSION_EXPORT_DEBUG
|
#ifdef WOLFSSL_SESSION_EXPORT_DEBUG
|
||||||
{
|
{
|
||||||
char debug[256];
|
char debug[256];
|
||||||
snprintf(debug, sizeof(debug), "Exporting DTLS session\n"
|
XSNPRINTF(debug, sizeof(debug), "Exporting DTLS session\n"
|
||||||
"\tVersion : %d\n\tProtocol : %02X%01X\n\tLength of: %d\n\n"
|
"\tVersion : %d\n\tProtocol : %02X%01X\n\tLength of: %d\n\n"
|
||||||
, (int)DTLS_EXPORT_VERSION, buf[0], (buf[1] >> 4), idx - 2);
|
, (int)DTLS_EXPORT_VERSION, buf[0], (buf[1] >> 4), idx - 2);
|
||||||
WOLFSSL_MSG(debug);
|
WOLFSSL_MSG(debug);
|
||||||
@@ -1234,7 +1234,7 @@ int wolfSSL_dtls_import_internal(WOLFSSL* ssl, byte* buf, word32 sz)
|
|||||||
#ifdef WOLFSSL_SESSION_EXPORT_DEBUG
|
#ifdef WOLFSSL_SESSION_EXPORT_DEBUG
|
||||||
{
|
{
|
||||||
char debug[256];
|
char debug[256];
|
||||||
snprintf(debug, sizeof(debug), "Importing DTLS session\n"
|
XSNPRINTF(debug, sizeof(debug), "Importing DTLS session\n"
|
||||||
"\tVersion : %d\n\tProtocol : %02X%01X\n\tLength of: %d\n\n"
|
"\tVersion : %d\n\tProtocol : %02X%01X\n\tLength of: %d\n\n"
|
||||||
, (int)version, buf[0], (buf[1] >> 4), length);
|
, (int)version, buf[0], (buf[1] >> 4), length);
|
||||||
WOLFSSL_MSG(debug);
|
WOLFSSL_MSG(debug);
|
||||||
|
@@ -4963,8 +4963,6 @@ int wc_AesKeyWrap(const byte* key, word32 keySz, const byte* in, word32 inSz,
|
|||||||
int wc_AesKeyUnWrap(const byte* key, word32 keySz, const byte* in, word32 inSz,
|
int wc_AesKeyUnWrap(const byte* key, word32 keySz, const byte* in, word32 inSz,
|
||||||
byte* out, word32 outSz, const byte* iv)
|
byte* out, word32 outSz, const byte* iv)
|
||||||
{
|
{
|
||||||
(void)iv;
|
|
||||||
|
|
||||||
Aes aes;
|
Aes aes;
|
||||||
byte* r;
|
byte* r;
|
||||||
word32 i, n;
|
word32 i, n;
|
||||||
@@ -4978,6 +4976,8 @@ int wc_AesKeyUnWrap(const byte* key, word32 keySz, const byte* in, word32 inSz,
|
|||||||
0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6
|
0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6
|
||||||
};
|
};
|
||||||
|
|
||||||
|
(void)iv;
|
||||||
|
|
||||||
if (key == NULL || in == NULL || inSz < 3 ||
|
if (key == NULL || in == NULL || inSz < 3 ||
|
||||||
out == NULL || outSz < (inSz - KEYWRAP_BLOCK_SIZE))
|
out == NULL || outSz < (inSz - KEYWRAP_BLOCK_SIZE))
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
|
2
wolfcrypt/src/pkcs7.c
Normal file → Executable file
2
wolfcrypt/src/pkcs7.c
Normal file → Executable file
@@ -974,7 +974,7 @@ int wc_PKCS7_EncodeSignedData(PKCS7* pkcs7, byte* output, word32 outputSz)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
esd->contentDigest[0] = ASN_OCTET_STRING;
|
esd->contentDigest[0] = ASN_OCTET_STRING;
|
||||||
esd->contentDigest[1] = hashSz;
|
esd->contentDigest[1] = (byte)hashSz;
|
||||||
ret = wc_HashFinal(&esd->hash, esd->hashType,
|
ret = wc_HashFinal(&esd->hash, esd->hashType,
|
||||||
&esd->contentDigest[2]);
|
&esd->contentDigest[2]);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
@@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
#include <wolfssl/wolfcrypt/wc_port.h>
|
#include <wolfssl/wolfcrypt/wc_port.h>
|
||||||
#include <wolfssl/wolfcrypt/logging.h>
|
#include <wolfssl/wolfcrypt/logging.h>
|
||||||
|
#include <wolfssl/wolfcrypt/types.h>
|
||||||
|
|
||||||
#ifdef WOLFSSL_TEST_CERT
|
#ifdef WOLFSSL_TEST_CERT
|
||||||
#include <wolfssl/wolfcrypt/asn.h>
|
#include <wolfssl/wolfcrypt/asn.h>
|
||||||
@@ -12693,7 +12694,7 @@ static int pkcs7signed_run_vectors(byte* rsaCert, word32 rsaCertSz,
|
|||||||
wc_ShaFree(&sha);
|
wc_ShaFree(&sha);
|
||||||
|
|
||||||
for (j = 0, k = 2; j < SHA_DIGEST_SIZE; j++, k += 2) {
|
for (j = 0, k = 2; j < SHA_DIGEST_SIZE; j++, k += 2) {
|
||||||
snprintf((char*)&transId[k], 3, "%02x", digest[j]);
|
XSNPRINTF((char*)&transId[k], 3, "%02x", digest[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -302,13 +302,12 @@
|
|||||||
#define XSTRNCASECMP(s1,s2,n) _strnicmp((s1),(s2),(n))
|
#define XSTRNCASECMP(s1,s2,n) _strnicmp((s1),(s2),(n))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WOLFSSL_MYSQL_COMPATIBLE) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY)
|
/* snprintf is used in asn.c for GetTimeString and PKCS7 test */
|
||||||
#ifndef USE_WINDOWS_API
|
#ifndef USE_WINDOWS_API
|
||||||
#define XSNPRINTF snprintf
|
#define XSNPRINTF snprintf
|
||||||
#else
|
#else
|
||||||
#define XSNPRINTF _snprintf
|
#define XSNPRINTF _snprintf
|
||||||
#endif
|
#endif
|
||||||
#endif /* WOLFSSL_MYSQL_COMPATIBLE */
|
|
||||||
|
|
||||||
#if defined(WOLFSSL_CERT_EXT) || defined(HAVE_ALPN)
|
#if defined(WOLFSSL_CERT_EXT) || defined(HAVE_ALPN)
|
||||||
/* use only Thread Safe version of strtok */
|
/* use only Thread Safe version of strtok */
|
||||||
|
Reference in New Issue
Block a user