Records

Functions

  • WEAVE_ERROR InitSecureRandomDataSource (nl::Weave::Crypto::EntropyFunct entropyFunct, uint16_t entropyLen, const uint8_t * personalizationData, uint16_t perDataLen)

    This function is called by the Weave layer to initialize random data source.

    This function is platform specific and might be empty when no initialization of

    random data source is required.

    Parameters

    entropyFunct [in] Pointer to a function that generates entropy to the random data generator. When entropy input is not required by the algorith this input can be NULL, which is the case when OpenSSL version of the random data generator is used.
    entropyLen [in] Specifies entropy size in bytes that should be generated by the entropy function when it is used.
    personalizationData [in] Pointer to a memory buffer that stores personalization data input. This data input should be device specific and it helps to improve statistical properties of the random data.
    perDataLen [in] Specifies personalization data size in bytes.
  • WEAVE_ERROR GetSecureRandomData (uint8_t * buf, uint16_t len)

    This function is called by the Weave layer to generate random data.

    Parameters

    buf [in] Pointer to a memory buffer, where requested random data should be stored.
    len [in] Specifies requested random data size in bytes.
  • WEAVE_ERROR MemoryInit (void * buf, size_t bufSize)

    This function is called by the Weave layer to initialize memory and resources

    required for proper functionality of the Weave Security Manager memory allocator.

    This function is platform specific and might be empty in certain cases.

    For example, this function is doing nothing when the C Standard Library malloc()

    and free() functions are used for memory allocation.

    Parameters

    buf [in] A pointer to a dedicated memory buffer, which should be used as a memory pool for Weave Security Manager memory allocation. This input is optional (defaults to NULL) and shouldn't be used if a dedicated memory buffer is not used.
    bufSize [in] Size of a dedicated memory buffer. This input is optional (defaults to 0) and shouldn't be used if dedicated memory buffer is not used. When a dedicated memory buffer is used the function checks and generates an error if buffer size is not big enough to support Weave Security Manager use cases.
  • int GetDRBGSeedDevRandom (uint8_t * buf, size_t bufSize)
  • void MemoryShutdown ()

    This function is called by the Weave layer to releases all resources that were allocated

    by MemoryInit() function.

    This function can be an empty call if there is no need to release resources. For example,

    this is the case when the C Standard Library malloc() and free() functions are used

    for memory allocation.

  • void * MemoryAlloc (size_t size, bool isLongTermAlloc)

    This function is called by the Weave layer to allocate a block of memory of "size" bytes.

    Parameters

    size [in] Specifies requested memory size in bytes.
    isLongTermAlloc [in] A Boolean indicating whether (true) or not (false) the requested memory block is for long term use. A long term allocation is memory that should stay allocated until secure session/handshake is complete. Examples of a long term allocation include blocks allocated for CASE/PASE objects and their context data. A short term allocation is a memory needed to perform specific operation and can be released immediately after that. This input helps to optimize memory utilization in a memory constrained system. Use of this parameter is arbitrary and depends on function implementer. For example, this parameter is ignored when the C Standard Library malloc() is used.
  • void * MemoryAlloc (size_t size)

    This function is called by the Weave layer to allocate a block of memory of "size" bytes.

    This function is equivalent to MemoryAlloc(size, false).

    Parameters

    size [in] Specifies requested memory size in bytes.
  • void MemoryFree (void * p)

    This function is called by the Weave layer to release a memory block allocated by

    the MemeoryAlloc() function.

    Parameters

    p [in] Pointer to a memory block that should be released.