Skip to content

Commit

Permalink
Merge pull request #7806 from SparkiDev/dilithium_der_fix
Browse files Browse the repository at this point in the history
Dilithium: DER encoding fix
  • Loading branch information
douzzer authored Jul 30, 2024
2 parents 7da6149 + 1681cb2 commit f4c16d2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -33388,7 +33388,7 @@ static int test_wc_dilithium_der(void)
ExpectIntEQ(wc_Dilithium_PublicKeyToDer(NULL, der , DILITHIUM_MAX_DER_SIZE,
0), BAD_FUNC_ARG);
ExpectIntEQ(wc_Dilithium_PublicKeyToDer(key , der , 0 ,
0), BUFFER_E);
0), BUFFER_E );
/* Get length only. */
ExpectIntEQ(wc_Dilithium_PublicKeyToDer(key , NULL, 0 ,
0), pubLen);
Expand All @@ -33401,32 +33401,32 @@ static int test_wc_dilithium_der(void)

ExpectIntEQ(wc_Dilithium_PrivateKeyToDer(NULL, NULL,
0 ), BAD_FUNC_ARG);
ExpectIntEQ(wc_Dilithium_PrivateKeyToDer(key , NULL,
0 ), BAD_FUNC_ARG);
ExpectIntGT(wc_Dilithium_PrivateKeyToDer(key , NULL,
0 ), 0);
ExpectIntEQ(wc_Dilithium_PrivateKeyToDer(NULL, der ,
0 ), BAD_FUNC_ARG);
ExpectIntEQ(wc_Dilithium_PrivateKeyToDer(NULL, NULL,
DILITHIUM_MAX_DER_SIZE), BAD_FUNC_ARG);
ExpectIntEQ(wc_Dilithium_PrivateKeyToDer(NULL, der ,
DILITHIUM_MAX_DER_SIZE), BAD_FUNC_ARG);
ExpectIntEQ(wc_Dilithium_PrivateKeyToDer(key , der ,
0 ), BAD_FUNC_ARG);
0 ), BUFFER_E);
/* Get length only. */
ExpectIntEQ(wc_Dilithium_PrivateKeyToDer(key , NULL,
DILITHIUM_MAX_DER_SIZE), privDerLen);

ExpectIntEQ(wc_Dilithium_KeyToDer(NULL, NULL, 0 ),
BAD_FUNC_ARG);
ExpectIntEQ(wc_Dilithium_KeyToDer(key , NULL, 0 ),
BAD_FUNC_ARG);
ExpectIntGT(wc_Dilithium_KeyToDer(key , NULL, 0 ),
0 );
ExpectIntEQ(wc_Dilithium_KeyToDer(NULL, der , 0 ),
BAD_FUNC_ARG);
ExpectIntEQ(wc_Dilithium_KeyToDer(NULL, NULL, DILITHIUM_MAX_DER_SIZE),
BAD_FUNC_ARG);
ExpectIntEQ(wc_Dilithium_KeyToDer(NULL, der , DILITHIUM_MAX_DER_SIZE),
BAD_FUNC_ARG);
ExpectIntEQ(wc_Dilithium_KeyToDer(key , der , 0 ),
BAD_FUNC_ARG);
BUFFER_E );
/* Get length only. */
ExpectIntEQ(wc_Dilithium_KeyToDer(key , NULL, DILITHIUM_MAX_DER_SIZE),
keyDerLen);
Expand Down

0 comments on commit f4c16d2

Please sign in to comment.