Reference Guide
8 Chapter 1: Library and Header File Changes
RSA BSAFE Crypto-C Micro Edition 3.x to 4.1.4 Migration Guide
Memory Management
Crypto-C ME 4.0 introduced improvements to the memory model to give applications
full memory management control within the Crypto-C ME libraries. All memory is
now managed using
R_MEM memory allocator objects, which must be supplied from
the application.
With this memory model, newly created objects get their memory allocator object in
one of three ways:
• The application supplies the memory allocator object to the object creation
function. For example,
R_LIB_CTX_new_ef() creates a library context and
accepts an
R_MEM parameter.
• An object inherits its memory allocator object from its parent object. For example,
when creating a cryptographic context using
R_CR_CTX_new_ef(), if a memory
allocator object is not specified, the one from the library context is used.
• If an object has no parent object, and a memory allocator object is not specified,
the default memory allocator object from the library state is used.
The default memory allocator is specified when the library state is initialized
using
R_STATE_init(), and is the memory allocator object used to create all
objects unless a different memory allocator object is specified.
Applications that do not require custom memory allocation functionality can use
R_MEM_new_default() to create a memory allocator object that uses standard
platform memory management routines.
Applications that implemented custom memory functionality by setting memory
functions with
R_set_mem_functions(), can implement a custom memory
allocator object using
R_MEM_new_callback().
For more information about memory management functionality in Crypto-C ME
4.1.4, see Memory Management in the RSA BSAFE Crypto-C Micro Edition
Developers Guide.