Page 1 of 1

v3.5.0 Build errors

Posted: Mon May 20, 2024 10:27 am
by SeeCwriter
I installed v3.5.0, and in predef.h I uncommented ENABLE_AUTOCERT_REGEN and tried to rebuild the system. I get the following compiler errors:

Code: Select all

C:/nburn/libraries/crypto/NetBurner/NbCertGen.cpp:126:111: error: request for member 'm_certExpTime' in 'pGenData', which is of pointer type 'CertGenData*' (maybe you meant to use '->' ?)
         else if (SSL_GetTimeToExpire(HalGetDeviceCert(), HalGetDeviceCertLen(), HalGetDeviceFormat(),pGenData.m_certExpTime))
                                                                                                               ^~~~~~~~~~~~~
C:/nburn/libraries/crypto/NetBurner/NbCertGen.cpp:128:13: error: 'gCertGenData' was not declared in this scope
             gCertGenData.m_certExpTimeSet = true;
             ^~~~~~~~~~~~
C:/nburn/libraries/crypto/NetBurner/NbCertGen.cpp:473:90: error: 'gCertGenData' was not declared in this scope
     SSL_GetTimeToExpire(HalGetDeviceCert(), HalGetDeviceCertLen(), HalGetDeviceFormat(), gCertGenData.m_certExpTime);
                                                                                          ^~~~~~~~~~~~

Re: v3.5.0 Build errors

Posted: Mon May 20, 2024 2:32 pm
by Forrest
Hello,
I looked through this and it looks like we failed to change the name of the global variable under the ENABLE_AUTOCERT_REGEN ifdefs. This internal variable name had been changed between the 3.5.0 and previous release. I fixed this for the upcoming release. You can fix it locally by renaming all instances of gCertGenData in the file libraries/crypto/NetBurner/NbCertGen.cpp. They should be pGenData. Thanks for the report...

See patch below:

Code: Select all

diff --git a/libraries/crypto/NetBurner/NbCertGen.cpp b/libraries/crypto/NetBurner/NbCertGen.cpp
index 45542dad4..909b58f11 100644
--- a/libraries/crypto/NetBurner/NbCertGen.cpp
+++ b/libraries/crypto/NetBurner/NbCertGen.cpp
@@ -103,7 +103,7 @@ CertGenReturnCode CheckAndCreateHalCertAndKey()
         if (ShouldReplaceNbHalCert()) { createCert = true; }
         else if (SSL_GetTimeToExpire(HalGetDeviceCert(), HalGetDeviceCertLen(), HalGetDeviceFormat(),pGenData.m_certExpTime))
         {
-            gCertGenData.m_certExpTimeSet = true;
+            pGenData.m_certExpTimeSet = true;
         }
 #endif
     }
@@ -448,8 +448,8 @@ extern "C" CertGenReturnCode SSL_CreateNewSelfSignedCert(CertGenData & GenData)
 
 #ifdef ENABLE_AUTOCERT_REGEN
     // Set the new expriation time so we can check it and re-generate the cert if needed
-    SSL_GetTimeToExpire(HalGetDeviceCert(), HalGetDeviceCertLen(), HalGetDeviceFormat(), gCertGenData.m_certExpTime);
-    gCertGenData.m_certExpTimeSet = true;
+    SSL_GetTimeToExpire(HalGetDeviceCert(), HalGetDeviceCertLen(), HalGetDeviceFormat(), pGenData.m_certExpTime);
+    pGenData.m_certExpTimeSet = true;
 #endif
 
     return CERT_GEN_RETURN_SUCCESS;


Re: v3.5.0 Build errors

Posted: Tue May 21, 2024 7:12 am
by SeeCwriter
I made the changes, and additional errors were revealed in file NbCertGen.cpp.

Line 128: "CertGenData has no member named m_certExpTimeSet."
Line 473: "pGenData was not declared in this scope."

It looks like line 474 will have the same error as line 128.