This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHCC3235MOD: Multi thread Crypto Question

Part Number: LAUNCHCC3235MOD
Other Parts Discussed in Thread: SYSCONFIG

I have a multiclient server where each worker thread handles a client like in tcpecho. I am trying to use the CryptoCC32XX. Question is whether I should use a CryptoCC32XX_Handle per thread or one global one for all threads?Buffer size and keys the same for all threads.

In docs at CryptoCC32XX.h File Reference (ti.com) "The APIs in this driver serve as an interface to a typical TI-RTOS application. The specific peripheral implementations are responsible to create all the OSAL specific primitives to allow for thread-safe operation." What is OSAL?

g_aCryptoH[CLIMX]={0};
// iclient for use by thread 
int get_buffer_id() {
    if (g_Crypt_Init=0) CryptoCC32XX_init();
    int iret = -1;
    for (int i = 0; i < CLIMX; i++) {
        if (aibuffer_id[i] == 0) {
            aibuffer_id[i] = 1;
            iret = i;
            // do I get a thread crypto here? or is it not threadsafe and since
            // all keys are the same for all clients, one CryptoCC32XX_Handle and block until 
            // done with buffer on thread and release? 
            // 
            g_aCryptoH[i] = CryptoCC32XX_open( i,CryptoCC32XX_AES_CBC);
            break;
        }
    }
    return iret;
}
void unget_buffer_id(int id) {
    id = id % CLIMX;
    msgini(id, MSGS); // zeros memory and sets all buffers available
    aibuffer_id[id] = 0;
    CryptoCC32XX_close(g_aCryptoH[id];
    g_aCryptoH[id] = 0;
}