GK SDK 源码库: XMIPCLinuxV100R005C00SPC030 (kernel/tools/open_source excluded)

This commit is contained in:
lai
2026-09-06 03:52:57 +08:00
commit b1928b41c0
21813 changed files with 4413081 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
/*
* Copyright (c) XMEDIA. All rights reserved.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include "xmedia_type.h"
#include "xmedia_cipher.h"
#include "sample_common.h"
int sample_rng(xmedia_void)
{
xmedia_s32 ret = XMEDIA_SUCCESS;
xmedia_s32 index = 0;
xmedia_u32 random_number = 0;
ret = xmedia_cipher_init();
if (XMEDIA_SUCCESS != ret) {
ERR_CODE_CIPHER("xmedia_cipher_init ERROR!\n");
return ret;
}
for (index = 0; index < 10; index++) {
ret = xmedia_cipher_get_random_number(&random_number);
if (XMEDIA_SUCCESS != ret) {
ERR_CODE_CIPHER("There is No ramdom number available now. Try again!\n");
index--;
continue;
}
printf("Random number: %08x\n", random_number);
}
ret = xmedia_cipher_exit();
if (XMEDIA_SUCCESS != ret) {
ERR_CODE_CIPHER("xmedia_cipher_exit error! return value = %d.\n", ret);
return ret;
}
return ret;
}