forked from wolfSSL/wolfssl
Remove trailing spaces
This commit is contained in:
@@ -946,7 +946,7 @@ static int ProcessBufferTryDecodeDilithium(WOLFSSL_CTX* ctx, WOLFSSL* ssl,
|
|||||||
int ret;
|
int ret;
|
||||||
word32 idx;
|
word32 idx;
|
||||||
dilithium_key* key;
|
dilithium_key* key;
|
||||||
int keyFormatTemp = 0;
|
int keyFormatTemp = 0;
|
||||||
int keyTypeTemp;
|
int keyTypeTemp;
|
||||||
int keySizeTemp;
|
int keySizeTemp;
|
||||||
|
|
||||||
@@ -958,7 +958,7 @@ static int ProcessBufferTryDecodeDilithium(WOLFSSL_CTX* ctx, WOLFSSL* ssl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize Dilithium key. */
|
/* Initialize Dilithium key. */
|
||||||
ret = wc_dilithium_init(key);
|
ret = wc_dilithium_init(key);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
/* Decode as a Dilithium private key. */
|
/* Decode as a Dilithium private key. */
|
||||||
idx = 0;
|
idx = 0;
|
||||||
@@ -1023,7 +1023,7 @@ static int ProcessBufferTryDecodeDilithium(WOLFSSL_CTX* ctx, WOLFSSL* ssl,
|
|||||||
/* Unknown format wasn't dilithium, so keep trying other formats. */
|
/* Unknown format wasn't dilithium, so keep trying other formats. */
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free dynamically allocated data in key. */
|
/* Free dynamically allocated data in key. */
|
||||||
wc_dilithium_free(key);
|
wc_dilithium_free(key);
|
||||||
}
|
}
|
||||||
|
10
tests/api.c
10
tests/api.c
@@ -13944,7 +13944,7 @@ static int test_wolfSSL_PKCS8_MLDSA(void)
|
|||||||
size_t i;
|
size_t i;
|
||||||
const int derMaxSz = 8192; /* Largest size will be 7520 of separated format, WC_ML_DSA_87, DER */
|
const int derMaxSz = 8192; /* Largest size will be 7520 of separated format, WC_ML_DSA_87, DER */
|
||||||
const int tempMaxSz = 10240; /* Largest size will be 10239 of separated format, WC_MLS_DSA_87, PEM */
|
const int tempMaxSz = 10240; /* Largest size will be 10239 of separated format, WC_MLS_DSA_87, PEM */
|
||||||
byte* der = NULL;
|
byte* der = NULL;
|
||||||
byte* temp = NULL; /* Store PEM or intermediate key */
|
byte* temp = NULL; /* Store PEM or intermediate key */
|
||||||
word32 derSz = 0;
|
word32 derSz = 0;
|
||||||
word32 pemSz = 0;
|
word32 pemSz = 0;
|
||||||
@@ -13964,7 +13964,7 @@ static int test_wolfSSL_PKCS8_MLDSA(void)
|
|||||||
(void) pemSz;
|
(void) pemSz;
|
||||||
|
|
||||||
ExpectNotNull(der = (byte*) XMALLOC(derMaxSz, NULL, DYNAMIC_TYPE_TMP_BUFFER));
|
ExpectNotNull(der = (byte*) XMALLOC(derMaxSz, NULL, DYNAMIC_TYPE_TMP_BUFFER));
|
||||||
ExpectNotNull(temp = (byte*) XMALLOC(tempMaxSz, NULL, DYNAMIC_TYPE_TMP_BUFFER));
|
ExpectNotNull(temp = (byte*) XMALLOC(tempMaxSz, NULL, DYNAMIC_TYPE_TMP_BUFFER));
|
||||||
|
|
||||||
#ifndef NO_WOLFSSL_SERVER
|
#ifndef NO_WOLFSSL_SERVER
|
||||||
ExpectNotNull(ctx = wolfSSL_CTX_new(wolfSSLv23_server_method()));
|
ExpectNotNull(ctx = wolfSSL_CTX_new(wolfSSLv23_server_method()));
|
||||||
@@ -13980,7 +13980,7 @@ static int test_wolfSSL_PKCS8_MLDSA(void)
|
|||||||
ExpectIntEQ(wc_dilithium_set_level(&mldsa_key, test_variant[i].wcId), 0);
|
ExpectIntEQ(wc_dilithium_set_level(&mldsa_key, test_variant[i].wcId), 0);
|
||||||
ExpectIntEQ(wc_dilithium_make_key(&mldsa_key, &rng), 0);
|
ExpectIntEQ(wc_dilithium_make_key(&mldsa_key, &rng), 0);
|
||||||
|
|
||||||
ExpectIntGT(derSz = wc_Dilithium_KeyToDer(&mldsa_key, der, derMaxSz), 0);
|
ExpectIntGT(derSz = wc_Dilithium_KeyToDer(&mldsa_key, der, derMaxSz), 0);
|
||||||
ExpectIntEQ(wolfSSL_CTX_use_PrivateKey_buffer(ctx, der, derSz,
|
ExpectIntEQ(wolfSSL_CTX_use_PrivateKey_buffer(ctx, der, derSz,
|
||||||
WOLFSSL_FILETYPE_ASN1), WOLFSSL_SUCCESS);
|
WOLFSSL_FILETYPE_ASN1), WOLFSSL_SUCCESS);
|
||||||
|
|
||||||
@@ -13996,7 +13996,7 @@ static int test_wolfSSL_PKCS8_MLDSA(void)
|
|||||||
ExpectIntEQ(wc_dilithium_set_level(&mldsa_key, test_variant[i].wcId), 0);
|
ExpectIntEQ(wc_dilithium_set_level(&mldsa_key, test_variant[i].wcId), 0);
|
||||||
ExpectIntEQ(wc_dilithium_make_key(&mldsa_key, &rng), 0);
|
ExpectIntEQ(wc_dilithium_make_key(&mldsa_key, &rng), 0);
|
||||||
|
|
||||||
ExpectIntGT(derSz = wc_Dilithium_PrivateKeyToDer(&mldsa_key, der, derMaxSz), 0);
|
ExpectIntGT(derSz = wc_Dilithium_PrivateKeyToDer(&mldsa_key, der, derMaxSz), 0);
|
||||||
ExpectIntEQ(wolfSSL_CTX_use_PrivateKey_buffer(ctx, der, derSz,
|
ExpectIntEQ(wolfSSL_CTX_use_PrivateKey_buffer(ctx, der, derSz,
|
||||||
WOLFSSL_FILETYPE_ASN1), WOLFSSL_SUCCESS);
|
WOLFSSL_FILETYPE_ASN1), WOLFSSL_SUCCESS);
|
||||||
|
|
||||||
@@ -14006,7 +14006,7 @@ static int test_wolfSSL_PKCS8_MLDSA(void)
|
|||||||
WOLFSSL_FILETYPE_PEM), WOLFSSL_SUCCESS);
|
WOLFSSL_FILETYPE_PEM), WOLFSSL_SUCCESS);
|
||||||
#endif /* WOLFSSL_DER_TO_PEM */
|
#endif /* WOLFSSL_DER_TO_PEM */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test private + public key (integrated format) */
|
/* Test private + public key (integrated format) */
|
||||||
for(i = 0; i < sizeof(test_variant) / sizeof(test_variant[0]); ++i) {
|
for(i = 0; i < sizeof(test_variant) / sizeof(test_variant[0]); ++i) {
|
||||||
ExpectIntEQ(wc_dilithium_set_level(&mldsa_key, test_variant[i].wcId), 0);
|
ExpectIntEQ(wc_dilithium_set_level(&mldsa_key, test_variant[i].wcId), 0);
|
||||||
|
@@ -9663,7 +9663,7 @@ int wc_Dilithium_PrivateKeyDecode(const byte* input, word32* inOutIdx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
/* Get OID sum for level. */
|
/* Get OID sum for level. */
|
||||||
if(key->level == 0) { /* Check first, because key->params will be NULL
|
if(key->level == 0) { /* Check first, because key->params will be NULL
|
||||||
* when key->level = 0 */
|
* when key->level = 0 */
|
||||||
/* Level not set by caller, decode from DER */
|
/* Level not set by caller, decode from DER */
|
||||||
|
Reference in New Issue
Block a user