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 randomdata generator. When entropy input is not required by thealgorith this input can be NULL, which is the case when OpenSSLversion of the random data generator is used.
    entropyLen [in] Specifies entropy size in bytes that should be generated bythe entropy function when it is used.
    personalizationData [in] Pointer to a memory buffer that stores personalization datainput. This data input should be device specific and ithelps 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 shouldbe 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 asa memory pool for Weave Security Manager memory allocation.This input is optional (defaults to NULL) and shouldn't be usedif 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 andgenerates an error if buffer size is not big enough to supportWeave 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) therequested memory block is for long term use. A long termallocation is memory that should stay allocated until securesession/handshake is complete. Examples of a long termallocation include blocks allocated for CASE/PASE objectsand their context data. A short term allocation is a memoryneeded to perform specific operation and can be releasedimmediately after that. This input helps to optimize memoryutilization in a memory constrained system. Use of this parameteris 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.