@@ -504,25 +504,25 @@ public class wolfcrypt
504504 */
505505#if WindowsCE
506506 [ DllImport ( wolfssl_dll ) ]
507- private static extern IntPtr wc_dilithium_new ( IntPtr heap , int devId ) ;
507+ private static extern IntPtr wc_MlDsaKey_New ( IntPtr heap , int devId ) ;
508508 [ DllImport ( wolfssl_dll ) ]
509- private static extern int wc_dilithium_delete ( IntPtr key , IntPtr key_p ) ;
509+ private static extern int wc_MlDsaKey_Delete ( IntPtr key , IntPtr key_p ) ;
510510 [ DllImport ( wolfssl_dll ) ]
511- private static extern int wc_dilithium_set_level ( IntPtr key , byte level ) ;
511+ private static extern int wc_MlDsaKey_SetParams ( IntPtr key , byte level ) ;
512512 [ DllImport ( wolfssl_dll ) ]
513- private static extern int wc_dilithium_make_key ( IntPtr key , IntPtr rng ) ;
513+ private static extern int wc_MlDsaKey_MakeKey ( IntPtr key , IntPtr rng ) ;
514514 [ DllImport ( wolfssl_dll ) ]
515- private static extern int wc_dilithium_export_private ( IntPtr key , byte [ ] output , ref uint outLen ) ;
515+ private static extern int wc_MlDsaKey_ExportPrivRaw ( IntPtr key , byte [ ] output , ref uint outLen ) ;
516516 [ DllImport ( wolfssl_dll ) ]
517- private static extern int wc_dilithium_import_private ( byte [ ] priv , uint privSz , IntPtr key ) ;
517+ private static extern int wc_MlDsaKey_ImportPrivRaw ( IntPtr key , byte [ ] priv , uint privSz ) ;
518518 [ DllImport ( wolfssl_dll ) ]
519- private static extern int wc_dilithium_export_public ( IntPtr key , byte [ ] output , ref uint outLen ) ;
519+ private static extern int wc_MlDsaKey_ExportPubRaw ( IntPtr key , byte [ ] output , ref uint outLen ) ;
520520 [ DllImport ( wolfssl_dll ) ]
521- private static extern int wc_dilithium_import_public ( byte [ ] input , uint inputLen , IntPtr key ) ;
521+ private static extern int wc_MlDsaKey_ImportPubRaw ( IntPtr key , byte [ ] input , uint inputLen ) ;
522522 [ DllImport ( wolfssl_dll ) ]
523- private static extern int wc_dilithium_sign_ctx_msg ( byte [ ] ctx , byte ctxLen , byte [ ] msg , uint msgLen , byte [ ] sig , ref uint sigLen , IntPtr key , IntPtr rng ) ;
523+ private static extern int wc_MlDsaKey_SignCtx ( IntPtr key , byte [ ] ctx , byte ctxLen , byte [ ] sig , ref uint sigLen , byte [ ] msg , uint msgLen , IntPtr rng ) ;
524524 [ DllImport ( wolfssl_dll ) ]
525- private static extern int wc_dilithium_verify_ctx_msg ( byte [ ] sig , uint sigLen , byte [ ] ctx , byte ctxLen , byte [ ] msg , uint msgLen , ref int res , IntPtr key ) ;
525+ private static extern int wc_MlDsaKey_VerifyCtx ( IntPtr key , byte [ ] sig , uint sigLen , byte [ ] ctx , byte ctxLen , byte [ ] msg , uint msgLen , ref int res ) ;
526526 [ DllImport ( wolfssl_dll ) ]
527527 private static extern int wc_MlDsaKey_GetPrivLen ( IntPtr key , ref int len ) ;
528528 [ DllImport ( wolfssl_dll ) ]
@@ -531,25 +531,25 @@ public class wolfcrypt
531531 private static extern int wc_MlDsaKey_GetSigLen ( IntPtr key , ref int len ) ;
532532#else
533533 [ DllImport ( wolfssl_dll , CallingConvention = CallingConvention . Cdecl ) ]
534- private static extern IntPtr wc_dilithium_new ( IntPtr heap , int devId ) ;
534+ private static extern IntPtr wc_MlDsaKey_New ( IntPtr heap , int devId ) ;
535535 [ DllImport ( wolfssl_dll , CallingConvention = CallingConvention . Cdecl ) ]
536- private static extern int wc_dilithium_delete ( IntPtr key , IntPtr key_p ) ;
536+ private static extern int wc_MlDsaKey_Delete ( IntPtr key , IntPtr key_p ) ;
537537 [ DllImport ( wolfssl_dll , CallingConvention = CallingConvention . Cdecl ) ]
538- private static extern int wc_dilithium_set_level ( IntPtr key , byte level ) ;
538+ private static extern int wc_MlDsaKey_SetParams ( IntPtr key , byte level ) ;
539539 [ DllImport ( wolfssl_dll , CallingConvention = CallingConvention . Cdecl ) ]
540- private static extern int wc_dilithium_make_key ( IntPtr key , IntPtr rng ) ;
540+ private static extern int wc_MlDsaKey_MakeKey ( IntPtr key , IntPtr rng ) ;
541541 [ DllImport ( wolfssl_dll , CallingConvention = CallingConvention . Cdecl ) ]
542- private static extern int wc_dilithium_export_private ( IntPtr key , byte [ ] output , ref uint outLen ) ;
542+ private static extern int wc_MlDsaKey_ExportPrivRaw ( IntPtr key , byte [ ] output , ref uint outLen ) ;
543543 [ DllImport ( wolfssl_dll , CallingConvention = CallingConvention . Cdecl ) ]
544- private static extern int wc_dilithium_import_private ( byte [ ] priv , uint privSz , IntPtr key ) ;
544+ private static extern int wc_MlDsaKey_ImportPrivRaw ( IntPtr key , byte [ ] priv , uint privSz ) ;
545545 [ DllImport ( wolfssl_dll , CallingConvention = CallingConvention . Cdecl ) ]
546- private static extern int wc_dilithium_export_public ( IntPtr key , byte [ ] output , ref uint outLen ) ;
546+ private static extern int wc_MlDsaKey_ExportPubRaw ( IntPtr key , byte [ ] output , ref uint outLen ) ;
547547 [ DllImport ( wolfssl_dll , CallingConvention = CallingConvention . Cdecl ) ]
548- private static extern int wc_dilithium_import_public ( byte [ ] input , uint inputLen , IntPtr key ) ;
548+ private static extern int wc_MlDsaKey_ImportPubRaw ( IntPtr key , byte [ ] input , uint inputLen ) ;
549549 [ DllImport ( wolfssl_dll , CallingConvention = CallingConvention . Cdecl ) ]
550- private static extern int wc_dilithium_sign_ctx_msg ( byte [ ] ctx , byte ctxLen , byte [ ] msg , uint msgLen , byte [ ] sig , ref uint sigLen , IntPtr key , IntPtr rng ) ;
550+ private static extern int wc_MlDsaKey_SignCtx ( IntPtr key , byte [ ] ctx , byte ctxLen , byte [ ] sig , ref uint sigLen , byte [ ] msg , uint msgLen , IntPtr rng ) ;
551551 [ DllImport ( wolfssl_dll , CallingConvention = CallingConvention . Cdecl ) ]
552- private static extern int wc_dilithium_verify_ctx_msg ( byte [ ] sig , uint sigLen , byte [ ] ctx , byte ctxLen , byte [ ] msg , uint msgLen , ref int res , IntPtr key ) ;
552+ private static extern int wc_MlDsaKey_VerifyCtx ( IntPtr key , byte [ ] sig , uint sigLen , byte [ ] ctx , byte ctxLen , byte [ ] msg , uint msgLen , ref int res ) ;
553553 [ DllImport ( wolfssl_dll , CallingConvention = CallingConvention . Cdecl ) ]
554554 private static extern int wc_MlDsaKey_GetPrivLen ( IntPtr key , ref int len ) ;
555555 [ DllImport ( wolfssl_dll , CallingConvention = CallingConvention . Cdecl ) ]
@@ -3370,14 +3370,14 @@ public static IntPtr MlDsaNew(IntPtr heap, int devId, MlDsaLevels level)
33703370
33713371 try
33723372 {
3373- key = wc_dilithium_new ( heap , devId ) ;
3373+ key = wc_MlDsaKey_New ( heap , devId ) ;
33743374 if ( key == IntPtr . Zero )
33753375 {
33763376 log ( ERROR_LOG , "Failed to allocate and initialize ML-DSA key." ) ;
33773377 return IntPtr . Zero ;
33783378 }
33793379
3380- int ret = wc_dilithium_set_level ( key , ( byte ) level ) ;
3380+ int ret = wc_MlDsaKey_SetParams ( key , ( byte ) level ) ;
33813381 if ( ret != 0 )
33823382 {
33833383 log ( ERROR_LOG , "Failed to set ML-DSA level. Error code: " + ret ) ;
@@ -3421,14 +3421,14 @@ public static IntPtr MlDsaMakeKey(IntPtr heap, int devId, MlDsaLevels level)
34213421
34223422 try
34233423 {
3424- key = wc_dilithium_new ( heap , devId ) ;
3424+ key = wc_MlDsaKey_New ( heap , devId ) ;
34253425 if ( key == IntPtr . Zero )
34263426 {
34273427 log ( ERROR_LOG , "Failed to allocate and initialize ML-DSA key." ) ;
34283428 return IntPtr . Zero ;
34293429 }
34303430
3431- ret = wc_dilithium_set_level ( key , ( byte ) level ) ;
3431+ ret = wc_MlDsaKey_SetParams ( key , ( byte ) level ) ;
34323432 if ( ret != 0 )
34333433 {
34343434 log ( ERROR_LOG , "Failed to set ML-DSA level. Error code: " + ret ) ;
@@ -3442,7 +3442,7 @@ public static IntPtr MlDsaMakeKey(IntPtr heap, int devId, MlDsaLevels level)
34423442 return IntPtr . Zero ;
34433443 }
34443444
3445- ret = wc_dilithium_make_key ( key , rng ) ;
3445+ ret = wc_MlDsaKey_MakeKey ( key , rng ) ;
34463446 if ( ret != 0 )
34473447 {
34483448 log ( ERROR_LOG , "Failed to make ML-DSA key. Error code: " + ret ) ;
@@ -3488,7 +3488,7 @@ public static int MlDsaFreeKey(ref IntPtr key)
34883488 return BAD_FUNC_ARG ;
34893489 }
34903490
3491- ret = wc_dilithium_delete ( key , IntPtr . Zero ) ;
3491+ ret = wc_MlDsaKey_Delete ( key , IntPtr . Zero ) ;
34923492 key = IntPtr . Zero ;
34933493 return ret ;
34943494 }
@@ -3508,7 +3508,7 @@ public static int MlDsaImportPublicKey(byte[] publicKey, IntPtr key)
35083508
35093509 try
35103510 {
3511- return wc_dilithium_import_public ( publicKey , ( uint ) publicKey . Length , key ) ;
3511+ return wc_MlDsaKey_ImportPubRaw ( key , publicKey , ( uint ) publicKey . Length ) ;
35123512 }
35133513 catch ( Exception e )
35143514 {
@@ -3532,7 +3532,7 @@ public static int MlDsaImportPrivateKey(byte[] privateKey, IntPtr key)
35323532
35333533 try
35343534 {
3535- return wc_dilithium_import_private ( privateKey , ( uint ) privateKey . Length , key ) ;
3535+ return wc_MlDsaKey_ImportPrivRaw ( key , privateKey , ( uint ) privateKey . Length ) ;
35363536 }
35373537 catch ( Exception e )
35383538 {
@@ -3570,7 +3570,7 @@ public static int MlDsaExportPrivateKey(IntPtr key, out byte[] privateKey)
35703570
35713571 privateKey = new byte [ privLen ] ;
35723572 outLen = ( uint ) privLen ;
3573- ret = wc_dilithium_export_private ( key , privateKey , ref outLen ) ;
3573+ ret = wc_MlDsaKey_ExportPrivRaw ( key , privateKey , ref outLen ) ;
35743574 if ( ret != 0 )
35753575 {
35763576 log ( ERROR_LOG , "Failed to export ML-DSA private key. Error code: " + ret ) ;
@@ -3620,7 +3620,7 @@ public static int MlDsaExportPublicKey(IntPtr key, out byte[] publicKey)
36203620
36213621 publicKey = new byte [ pubLen ] ;
36223622 outLen = ( uint ) pubLen ;
3623- ret = wc_dilithium_export_public ( key , publicKey , ref outLen ) ;
3623+ ret = wc_MlDsaKey_ExportPubRaw ( key , publicKey , ref outLen ) ;
36243624 if ( ret != 0 )
36253625 {
36263626 log ( ERROR_LOG , "Failed to export ML-DSA public key. Error code: " + ret ) ;
@@ -3679,7 +3679,7 @@ public static int MlDsaSignMsg(IntPtr key, byte[] msg, out byte[] sig)
36793679 return MEMORY_E ;
36803680 }
36813681 /* FIPS 204 sign with empty context (ctx=null, ctxLen=0). */
3682- ret = wc_dilithium_sign_ctx_msg ( null , 0 , msg , ( uint ) msg . Length , sig , ref outLen , key , rng ) ;
3682+ ret = wc_MlDsaKey_SignCtx ( key , null , 0 , sig , ref outLen , msg , ( uint ) msg . Length , rng ) ;
36833683 if ( ret != 0 )
36843684 {
36853685 log ( ERROR_LOG , "Failed to sign message with ML-DSA key. Error code: " + ret ) ;
@@ -3724,7 +3724,7 @@ public static int MlDsaVerifyMsg(IntPtr key, byte[] msg, byte[] sig)
37243724 try
37253725 {
37263726 /* FIPS 204 verify with empty context (ctx=null, ctxLen=0). */
3727- ret = wc_dilithium_verify_ctx_msg ( sig , ( uint ) sig . Length , null , 0 , msg , ( uint ) msg . Length , ref res , key ) ;
3727+ ret = wc_MlDsaKey_VerifyCtx ( key , sig , ( uint ) sig . Length , null , 0 , msg , ( uint ) msg . Length , ref res ) ;
37283728 if ( ret != 0 )
37293729 {
37303730 log ( ERROR_LOG , "Failed to verify message with ML-DSA key. Error code: " + ret ) ;
0 commit comments