CSSM_RETURN ffutil_CopyDataToApp( CSSM_DL_HANDLE DLHandle, CSSM_DATA_PTR pDestination, DAL_CONST_DATA_PTR pSource) { VERIFY_PTR(pDestination); VERIFY_PTR(pSource); pDestination->Data = NULL; pDestination->Length = pSource->Length; if (!pDestination->Length) return CSSM_OK; pDestination->Data = (uint8 *)App_Calloc(DLHandle, pDestination->Length, 1); if (!pDestination->Data) { pDestination->Length = 0; return CSSMERR_DL_MEMORY_ERROR; } memcpy(pDestination->Data, pSource->Data, pDestination->Length); return CSSM_OK; }
/*----------------------------------------------------------------------------------- * Name: dlbe_CreateUniqueRecordId * * Description: * This function allocates and initializes a Unique Record Id * * Parameters: * pRecordset (input) * Attributes (output) * Data (output) * * RETURN: * A pointer to the unique record id of the current record * * ERROR CODES * CSSMERR_DL_MEMORY_ERROR *-----------------------------------------------------------------------------------*/ CSSM_RETURN dlbe_CreateUniqueRecordId(CSSM_HANDLE DLHandle, CSSM_DB_UNIQUE_RECORD_PTR *UR) { *UR = (CSSM_DB_UNIQUE_RECORD_PTR)App_Calloc(DLHandle, sizeof(CSSM_DB_UNIQUE_RECORD), 1); if (!(*UR)) return CSSMERR_DL_MEMORY_ERROR; /* Create & fill in the RecordIdentifer Structure */ (*UR)->RecordIdentifier.Data = (uint8 *)App_Calloc(DLHandle, 8, 1); if (!(*UR)->RecordIdentifier.Data) { App_Free(DLHandle, (*UR)); return CSSMERR_DL_MEMORY_ERROR; } (*UR)->RecordIdentifier.Length = 8; ((uint32 *)(*UR)->RecordIdentifier.Data)[0] = uint32(DAL_RECORDTYPE_OOB); /* Recordtype */ ((uint32 *)(*UR)->RecordIdentifier.Data)[1] = DAL_OOB; /* Id */ return CSSM_OK; }