38 #define TLS_CERT_TIMEOUT (24 * 60 * 60 * 1000) 39 #define MAX_TLS_CERT_NAME (22) 40 #define MAX_CALLBACKS (5) 44 #ifdef TLS_DEBUG_PRINT 45 #define PRINT(x) DBG_PRINTF x 63 static U16BIT callbackCount = 0;
64 static U32BIT lastCertStoreUpdate = 0;
65 static MHEG5Int lastRequestNumber = 0;
72 static void ClearTlsCertStore(
void);
73 static void TlsCertRetrieved(
void *userData,
S_CONTENT *content );
74 static void AddCertificates(
U8BIT *certData,
U32BIT certLen );
75 static void TlsCertRetrievalFailed(
void *userData );
76 static void NotifyTlsReady(
void);
135 if (lastRequestFailed)
143 if (IsTimeToUpdate())
148 if (!lastRequestFailed)
152 currentRequestNumber = lastRequestNumber;
153 sprintf(name,
"DSM://auth.tls.%ld", lastRequestNumber + 1);
155 requestName.
len = strlen(name);
157 TlsCertRetrieved, TlsCertRetrievalFailed);
161 if (currentRequestNumber == lastRequestNumber)
193 tlsCallback[callbackCount] = loadCallback;
210 timeToUpdate =
FALSE;
214 if (lastCertStoreUpdate == 0)
218 else if ((currentTime > lastCertStoreUpdate) &&
223 else if (currentTime < lastCertStoreUpdate)
236 static void ClearTlsCertStore(
void)
239 lastCertStoreUpdate = 0;
240 lastRequestNumber = 0;
254 static void TlsCertRetrieved(
void *userData,
S_CONTENT *content )
269 AddCertificates( content->
data, content->
size );
290 static void AddCertificates(
U8BIT *certData,
U32BIT certLen)
298 count = certData[0] << 8 | certData[1];
306 size = (certData[2] << 16 | certData[3] << 8 | certData[4]);
307 if (size + 5 == certLen)
323 DBG_PRINTF(
"Invalid certificate file length\n");
328 if (lastRequestNumber == 0)
342 void TlsCertRetrievalFailed(
void *userData)
357 if (lastCertStoreUpdate == 0)
377 static void NotifyTlsReady(
void)
381 for (i = 0; i < callbackCount; i++)
383 if (tlsCallback[i] != NULL)
U32BIT STB_OSGetClockMilliseconds(void)
Get Current Computer Clock Time.
#define MAX_TLS_CERT_NAME
MHEG5TlsCertRequestStatus
Manages the interface between MHEG5 Engine and the HTTP component.
MHEG5TlsCertRequestStatus MHEG5GetNextTlsCertificate(void)
Issues a request to load the next TLS certificate from the DSM-CC object carousel.
void MHEG5InvalidateTlsCertStore(void)
Invalidate the TLS certificate store.
void MHEG5AddTlsCertificateCallback(void(*loadCallback)(void))
Add a callback function to be called when pending requests are resolved.
void * MHEG5FileOrmGet(MHEG5String name, U16BIT priority, void *userData, F_CB_Good cbGood, F_CB_Fail cbFail)
Get a file. The file will be loaded and one of the callback functions called when request is resolved...
#define FRP_CACHE_DEFAULT
void MHEG5ClearTlsCertStore(void)
Clear the TLS certificate store.
This file defines the profile for the MHEG engine.
void httpClearTlsCertStore(void)
Clear TLS certificate store.
File interface functions to DSMCC component.
Functions relating to TLS certificate store.
#define USE_UNWANTED_PARAM(param)
void httpAddTlsCertToStore(U8BIT *certData, U32BIT certLen)
Add TLS certificate to store.
U32BIT MHEG5GetTlsCertStoreCount(void)
Return number of TLS certificates in the TLS certificate store.
U32BIT httpGetTlsCertStoreCount(void)
Return number of TLS certificate in the certificate store.
Header file - Function prototypes for operating system.