lib/sw_services/xilnvm/src/server/xnvm_bbram_ipihandler.c
static int XNvm_BbramKeyWrite(u32 Size, u32 KeyAddrLow, u32 KeyAddrHigh)
{
	int Status = XST_FAILURE;
	int StatusTmp = XST_FAILURE;
	u64 Addr = ((u64)KeyAddrHigh << 32U) | (u64)KeyAddrLow;
	u8 Key[XNVM_BBRAM_AES_KEY_SIZE];

	Status = XPlmi_MemSet((u64)(UINTPTR)&Key, 0U,
			(XNVM_BBRAM_AES_KEY_SIZE / XNVM_WORD_LEN));
	if (Status != XST_SUCCESS) {
		goto END;
	}

	Status = XPlmi_DmaXfr(Addr, (UINTPTR)Key, Size / XNVM_WORD_LEN,
			XPLMI_PMCDMA_0);
	if (Status != XST_SUCCESS) {
		goto END;
	}

	Status = XNvm_BbramWriteAesKey(Key, Size);

END:
	StatusTmp = XNvm_ZeroizeAndVerify((u8 *)Key, Size);
	if (Status == XST_SUCCESS) {
		Status = StatusTmp;
	}

	return Status;
}
/*****************************************************************************/
/**
 * @brief       This function programs BBRAM AES key.
 *
 * @param 	Size		Size of the input data in bytes to be
 *				updated
 * 		KeyAddrLow	Lower 32 bit address of the key
 *		KeyAddrHigh	Higher 32 bit address of the key
 *
 * @return	- XST_SUCCESS - If the programming is successful
 * 		- ErrorCode - If there is a failure
 *
 ******************************************************************************/
@brief       This function programs BBRAM AES key.
@param       Size            Size of the input data in bytes to be
updated
KeyAddrLow      Lower 32 bit address of the key
KeyAddrHigh     Higher 32 bit address of the key

@return      - XST_SUCCESS - If the programming is successful
- ErrorCode - If there is a failure
@brief This function programs BBRAM AES key . @param Size Size of the input data in bytes to be updated KeyAddrLow Lower 32 bit address of the key KeyAddrHigh Higher 32 bit address of the key @return - XST_SUCCESS - If the programming is successful - ErrorCode - If there is a failure
static int XNvm_BbramKeyWrite(u32 Size, u32 KeyAddrLow, u32 KeyAddrHigh)
{
	int Status = XST_FAILURE;
	int StatusTmp = XST_FAILURE;
	u64 Addr = ((u64)KeyAddrHigh << 32U) | (u64)KeyAddrLow;
	u8 Key[XNVM_BBRAM_AES_KEY_SIZE];
	Status = XPlmi_MemSet((u64)(UINTPTR)&Key, 0U,
			(XNVM_BBRAM_AES_KEY_SIZE / XNVM_WORD_LEN));
	if (Status != XST_SUCCESS) {
		goto END;
	}
	Status = XPlmi_DmaXfr(Addr, (UINTPTR)Key, Size / XNVM_WORD_LEN,
			XPLMI_PMCDMA_0);
	if (Status != XST_SUCCESS) {
		goto END;
	}
	Status = XNvm_BbramWriteAesKey(Key, Size);
END:
	StatusTmp = XNvm_ZeroizeAndVerify((u8 *)Key, Size);
	if (Status == XST_SUCCESS) {
		Status = StatusTmp;
	}
	return Status;
}
static int XNvm_BbramKeyWrite ( u32 Size , u32 KeyAddrLow , u32 KeyAddrHigh ) { int Status = XST_FAILURE ; int StatusTmp = XST_FAILURE ; u64 Addr = ( ( u64 ) KeyAddrHigh << 32U ) | ( u64 ) KeyAddrLow ; u8 Key [ XNVM_BBRAM_AES_KEY_SIZE ] ; Status = XPlmi_MemSet ( ( u64 ) ( UINTPTR ) & Key , 0U , ( XNVM_BBRAM_AES_KEY_SIZE / XNVM_WORD_LEN ) ) ; if ( Status != XST_SUCCESS ) { goto END ; } Status = XPlmi_DmaXfr ( Addr , ( UINTPTR ) Key , Size / XNVM_WORD_LEN , XPLMI_PMCDMA_0 ) ; if ( Status != XST_SUCCESS ) { goto END ; } Status = XNvm_BbramWriteAesKey ( Key , Size ) ; END : StatusTmp = XNvm_ZeroizeAndVerify ( ( u8 * ) Key , Size ) ; if ( Status == XST_SUCCESS ) { Status = StatusTmp ; } return Status ; }
@brief       This function programs BBRAM AES key.
@brief This function programs BBRAM AES key .