6969#if defined(NO_PKCS11_MLDSA ) && defined(HAVE_DILITHIUM )
7070 #undef HAVE_DILITHIUM
7171#endif
72- #if defined(WOLFSSL_HAVE_MLKEM )
73- #define HAVE_PKCS11_MLKEM
74- #endif
75- #if defined(NO_PKCS11_MLKEM ) && defined(HAVE_PKCS11_MLKEM )
76- #undef HAVE_PKCS11_MLKEM
72+ #if defined(NO_PKCS11_MLKEM ) && defined(WOLFSSL_HAVE_MLKEM )
73+ #undef WOLFSSL_HAVE_MLKEM
7774#endif
7875
7976
8077#if (defined(HAVE_ECC ) && !defined(NO_PKCS11_ECDH )) || \
81- defined(HAVE_PKCS11_MLKEM )
78+ defined(WOLFSSL_HAVE_MLKEM )
8279/* Pointer to false required for templates. */
8380static CK_BBOOL ckFalse = CK_FALSE ;
8481#endif
8582#if !defined(NO_RSA ) || defined(HAVE_ECC ) || (!defined(NO_AES ) && \
8683 (defined(HAVE_AESGCM ) || defined(HAVE_AES_CBC ))) || \
8784 !defined(NO_HMAC ) || defined(HAVE_DILITHIUM ) || \
88- defined(HAVE_PKCS11_MLKEM )
85+ defined(WOLFSSL_HAVE_MLKEM )
8986/* Pointer to true required for templates. */
9087static CK_BBOOL ckTrue = CK_TRUE ;
9188#endif
@@ -98,7 +95,7 @@ static CK_KEY_TYPE rsaKeyType = CKK_RSA;
9895/* Pointer to EC key type required for templates. */
9996static CK_KEY_TYPE ecKeyType = CKK_EC ;
10097#endif
101- #if defined(HAVE_PKCS11_MLKEM )
98+ #if defined(WOLFSSL_HAVE_MLKEM )
10299/* Pointer to ML-KEM key type required for templates. */
103100static CK_KEY_TYPE mlkemKeyType = CKK_ML_KEM ;
104101#endif
@@ -107,15 +104,15 @@ static CK_KEY_TYPE mlkemKeyType = CKK_ML_KEM;
107104static CK_KEY_TYPE mldsaKeyType = CKK_ML_DSA ;
108105#endif
109106#if !defined(NO_RSA ) || defined(HAVE_ECC ) || defined(HAVE_DILITHIUM ) || \
110- defined(HAVE_PKCS11_MLKEM )
107+ defined(WOLFSSL_HAVE_MLKEM )
111108/* Pointer to public key class required for templates. */
112109static CK_OBJECT_CLASS pubKeyClass = CKO_PUBLIC_KEY ;
113110/* Pointer to private key class required for templates. */
114111static CK_OBJECT_CLASS privKeyClass = CKO_PRIVATE_KEY ;
115112#endif
116113#if (!defined(NO_AES ) && (defined(HAVE_AESGCM ) || defined(HAVE_AES_CBC ))) || \
117114 !defined(NO_HMAC ) || (defined(HAVE_ECC ) && !defined(NO_PKCS11_ECDH )) || \
118- defined(HAVE_PKCS11_MLKEM )
115+ defined(WOLFSSL_HAVE_MLKEM )
119116/* Pointer to secret key class required for templates. */
120117static CK_OBJECT_CLASS secretKeyClass = CKO_SECRET_KEY ;
121118#endif
@@ -1572,7 +1569,7 @@ static int Pkcs11CreateEccPrivateKey(CK_OBJECT_HANDLE* privateKey,
15721569}
15731570#endif
15741571
1575- #ifdef HAVE_PKCS11_MLKEM
1572+ #ifdef WOLFSSL_HAVE_MLKEM
15761573/**
15771574 * Create a PKCS#11 object containing the ML-KEM public key data.
15781575 */
@@ -1772,7 +1769,7 @@ static int Pkcs11CreateMlKemPrivateKey(CK_OBJECT_HANDLE* privateKey,
17721769
17731770 return ret ;
17741771}
1775- #endif /* HAVE_PKCS11_MLKEM */
1772+ #endif /* WOLFSSL_HAVE_MLKEM */
17761773
17771774#ifdef HAVE_DILITHIUM
17781775/**
@@ -1949,7 +1946,7 @@ static int Pkcs11CreateMldsaPrivateKey(CK_OBJECT_HANDLE* privateKey,
19491946#if !defined(NO_RSA ) || defined(HAVE_ECC ) || (!defined(NO_AES ) && \
19501947 (defined(HAVE_AESGCM ) || defined(HAVE_AES_CBC ))) || \
19511948 !defined(NO_HMAC ) || defined(HAVE_DILITHIUM ) || \
1952- defined(HAVE_PKCS11_MLKEM )
1949+ defined(WOLFSSL_HAVE_MLKEM )
19531950/**
19541951 * Check if mechanism is available in session on token.
19551952 *
@@ -2191,7 +2188,7 @@ int wc_Pkcs11StoreKey(Pkcs11Token* token, int type, int clear, void* key)
21912188 break ;
21922189 }
21932190 #endif
2194- #ifdef HAVE_PKCS11_MLKEM
2191+ #ifdef WOLFSSL_HAVE_MLKEM
21952192 case PKCS11_KEY_TYPE_MLKEM : {
21962193 MlKemKey * mlkemKey = (MlKemKey * )key ;
21972194 CK_MECHANISM_INFO mechInfo ;
@@ -2220,7 +2217,7 @@ int wc_Pkcs11StoreKey(Pkcs11Token* token, int type, int clear, void* key)
22202217 }
22212218 break ;
22222219 }
2223- #endif /* HAVE_PKCS11_MLKEM */
2220+ #endif /* WOLFSSL_HAVE_MLKEM */
22242221 #if defined(HAVE_DILITHIUM )
22252222 case PKCS11_KEY_TYPE_MLDSA : {
22262223 MlDsaKey * mldsaKey = (MlDsaKey * ) key ;
@@ -4243,7 +4240,7 @@ static int Pkcs11EccDeletePrivKey(Pkcs11Session* session, ecc_key* key)
42434240}
42444241#endif
42454242
4246- #ifdef HAVE_PKCS11_MLKEM
4243+ #ifdef WOLFSSL_HAVE_MLKEM
42474244/* Finds the first ML-KEM key matching the key type. */
42484245static int Pkcs11FindMlKemKey (CK_OBJECT_HANDLE * handle ,
42494246 CK_OBJECT_CLASS keyClass ,
@@ -4747,7 +4744,7 @@ static int Pkcs11PqcKemDecapsulate(Pkcs11Session* session, wc_CryptoInfo* info)
47474744
47484745 return ret ;
47494746}
4750- #endif /* HAVE_PKCS11_MLKEM */
4747+ #endif /* WOLFSSL_HAVE_MLKEM */
47514748
47524749#if defined(HAVE_DILITHIUM )
47534750/**
@@ -6330,7 +6327,7 @@ int wc_Pkcs11_CryptoDevCb(int devId, wc_CryptoInfo* info, void* ctx)
63306327 if (ret == 0 ) {
63316328 if (info -> algo_type == WC_ALGO_TYPE_PK ) {
63326329#if !defined(NO_RSA ) || defined(HAVE_ECC ) || defined(HAVE_DILITHIUM ) || \
6333- defined(HAVE_PKCS11_MLKEM )
6330+ defined(WOLFSSL_HAVE_MLKEM )
63346331 switch (info -> pk .type ) {
63356332 #ifndef NO_RSA
63366333 case WC_PK_TYPE_RSA :
@@ -6410,7 +6407,7 @@ int wc_Pkcs11_CryptoDevCb(int devId, wc_CryptoInfo* info, void* ctx)
64106407 }
64116408 break ;
64126409 #endif
6413- #ifdef HAVE_PKCS11_MLKEM
6410+ #ifdef WOLFSSL_HAVE_MLKEM
64146411 case WC_PK_TYPE_PQC_KEM_KEYGEN :
64156412 ret = Pkcs11OpenSession (token , & session , readWrite );
64166413 if (ret == 0 ) {
@@ -6469,7 +6466,7 @@ int wc_Pkcs11_CryptoDevCb(int devId, wc_CryptoInfo* info, void* ctx)
64696466 }
64706467#else
64716468 ret = NOT_COMPILED_IN ;
6472- #endif /* !NO_RSA || HAVE_ECC || HAVE_DILITHIUM || HAVE_PKCS11_MLKEM */
6469+ #endif /* !NO_RSA || HAVE_ECC || HAVE_DILITHIUM || WOLFSSL_HAVE_MLKEM */
64736470 }
64746471 else if (info -> algo_type == WC_ALGO_TYPE_CIPHER ) {
64756472 #ifndef NO_AES
@@ -6603,7 +6600,7 @@ int wc_Pkcs11_CryptoDevCb(int devId, wc_CryptoInfo* info, void* ctx)
66036600 }
66046601 else
66056602 #endif
6606- #ifdef HAVE_PKCS11_MLKEM
6603+ #ifdef WOLFSSL_HAVE_MLKEM
66076604 if (info -> free .algo == WC_ALGO_TYPE_PK &&
66086605 info -> free .type == WC_PK_TYPE_PQC_KEM_KEYGEN &&
66096606 info -> free .subType == WC_PQC_KEM_TYPE_KYBER ) {
0 commit comments