Reference Guide

Chapter 2: Multithreading Support 13
RSA BSAFE Crypto-C Mcro Edition 3.x to 4.1.4 Migration Guide
/* Perform cryptographic operations */
R_LIB_CTX_free(lib_ctx);
for (i = 0; i < locks; ++i) {
/* free lock i */
}
free(locks);
return 0;
}
Default Locking Implementation - Crypto-C ME 4.1.4
int main(int argc, char **argv)
{
int ret;
ret = R_STATE_init_defaults_mt();
if (R_ERROR_NONE != ret)
return 1;
ret = R_LIB_CTX_new_ef(…);
/* Perform cryptographic operations */
R_LIB_CTX_free(lib_ctx);
R_STATE_cleanup();
return 0;
}
Custom Synchronization Method - Crypto-C ME 4.1.4
int main(int argc, char **argv)
{
int ret;
ret = R_STATE_init_defaults();
if (R_ERROR_NONE != ret)
return 1;
ret = R_SYNC_set_method(&custom_sync);
if (R_ERROR_NONE != ret)
goto end;
ret = R_LIB_CTX_new_ef(…);
/* Perform cryptographic operations */
R_LIB_CTX_free(lib_ctx);
end:
R_STATE_cleanup();
return 0;
}