[经验] 【STM32H5开发板】第四帖 stm32h563 真随机数测试

29447945   2023-6-15 09:46 楼主

STM32H563芯片的TRNG模块是一种真随机数生成器,它可以在芯片内部生成高质量的随机数。这个模块基于物理随机过程,如热噪声、电压噪声和电流噪声等,来生成随机数。这些物理随机过程的不可预测性和不可重复性,使得生成的随机数具有高度的随机性和安全性。TRNG模块可以用于各种应用,如加密、认证、密钥生成等。此外,STM32H563芯片的TRNG模块还具有高速性能和低功耗的特点,可以满足各种应用的需求。

具体模块的系统框图如下:

微信截图_20230615093123.png

我们这里按照官方文档,使用TRNG测试工具:NIST SP800-22b

首先使用cubemx代码生成工具开启RNG,编写代码生成随机数,具体生成数据比特为:5120,000 ,官网文档也有说明,如下图:

微信截图_20230615093408.png

具体代码如下:

/* USER CODE BEGIN 0 */
#define     FILE_ASCII_FORMAT   1
#define     NUMBER_OF_RANDOM_BITS_TO_GENERATE 512000
#define     BLOCK_NUMBER 10
/* USER CODE END 0 */

/**
  * [url=home.php?mod=space&uid=159083]@brief[/url] The application entry point.
  * @retval int
  */
int main(void)
{
  /* USER CODE BEGIN 1 */
    uint32_t *temp_data = NULL;
    uint8_t *rng_data = NULL;
    uint32_t i,j,len = 0;
    uint8_t code_tabel[2] = {'0','1'};
  /* USER CODE END 1 */

  /* MCU Configuration--------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* USER CODE BEGIN Init */

  /* USER CODE END Init */

  /* Configure the system clock */
  SystemClock_Config();

  /* USER CODE BEGIN SysInit */

  /* USER CODE END SysInit */

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_ADC1_Init();
  MX_ETH_Init();
  MX_ICACHE_Init();
  MX_LPUART1_UART_Init();
  MX_USART3_UART_Init();
  MX_RNG_Init();
  MX_UCPD1_Init();
  MX_USB_PCD_Init();
  /* USER CODE BEGIN 2 */
  printf("start\r\n");
  
  rng_data = (uint8_t *)malloc(NUMBER_OF_RANDOM_BITS_TO_GENERATE*BLOCK_NUMBER/8);
  if(rng_data == NULL)
  {
      printf("malloc error!\n");
  }
    memset(rng_data,0,NUMBER_OF_RANDOM_BITS_TO_GENERATE*BLOCK_NUMBER/8);
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
      temp_data = (uint32_t *)rng_data;
      while(1)
      {
          HAL_RNG_GenerateRandomNumber(&hrng,temp_data);
          temp_data ++;
          len += 32;
          if( len >= NUMBER_OF_RANDOM_BITS_TO_GENERATE*BLOCK_NUMBER )
              break;
      }
      for(i = 0; i < (NUMBER_OF_RANDOM_BITS_TO_GENERATE*BLOCK_NUMBER / 8); i ++)
      {
          for(j = 0; j < 8; j ++ )
          {
              if( ( rng_data[i] >> j ) & 0x01 )
              {
                  HAL_UART_Transmit(&huart3, (uint8_t *)&code_tabel[1], 1, 0xFFFF);
              }
              else
                  HAL_UART_Transmit(&huart3, (uint8_t *)&code_tabel[0], 1, 0xFFFF);
              
          }
            
      }
      printf("finishn\n");
      HAL_Delay(5000);
      break;
  }
  free(rng_data);
  /* USER CODE END 3 */
}

这里数据量比较大640K数据,输出的0,1比特大概5M左右,所以串口输出需要一点时间;

串口接收数据保存文件如下图:

QQ截图20230615093659.png

接下来就是使用工具集测试,官网下载测试工具集:
sts-2_1_2.zip (41.88 MB)
(下载次数: 2, 2023-6-15 09:38 上传)

在ubuntu系统中直接make编译就可以生成二进制执行文件:

xxxx@xxxx:/mnt/c/Users/29447/Desktop/sts-2.1.2$ cd sts-2.1.2/
xxxx@xxxx:/mnt/c/Users/29447/Desktop/sts-2.1.2/sts-2.1.2$ ls
data  experiments  include  makefile  obj  src  templates
xxxx@xxxx:/mnt/c/Users/29447/Desktop/sts-2.1.2/sts-2.1.2$ make
/usr/bin/gcc -o obj/assess.o -c ./src/assess.c
/usr/bin/gcc -o obj/frequency.o -c -Wall ./src/frequency.c
/usr/bin/gcc -o obj/blockFrequency.o -c -Wall ./src/blockFrequency.c
/usr/bin/gcc -o obj/cusum.o -c -Wall ./src/cusum.c
/usr/bin/gcc -o obj/runs.o -c -Wall ./src/runs.c
/usr/bin/gcc -o obj/longestRunOfOnes.o -c -Wall ./src/longestRunOfOnes.c
/usr/bin/gcc -o obj/serial.o -c -Wall ./src/serial.c
/usr/bin/gcc -o obj/rank.o -c -Wall ./src/rank.c
/usr/bin/gcc -o obj/discreteFourierTransform.o -c -Wall ./src/discreteFourierTransform.c
/usr/bin/gcc -o obj/nonOverlappingTemplateMatchings.o -c -Wall ./src/nonOverlappingTemplateMatchings.c
./src/nonOverlappingTemplateMatchings.c: In function ‘NonOverlappingTemplateMatchings’:
./src/nonOverlappingTemplateMatchings.c:24:27: warning: variable ‘nu’ set but not used [-Wunused-but-set-variable]
   24 |  unsigned int bit, W_obs, nu[6], *Wj = NULL;
      |                           ^~
/usr/bin/gcc -o obj/overlappingTemplateMatchings.o -c -Wall ./src/overlappingTemplateMatchings.c
/usr/bin/gcc -o obj/universal.o -c -Wall ./src/universal.c
/usr/bin/gcc -o obj/approximateEntropy.o -c -Wall ./src/approximateEntropy.c
/usr/bin/gcc -o obj/randomExcursions.o -c -Wall ./src/randomExcursions.c
/usr/bin/gcc -o obj/randomExcursionsVariant.o -c -Wall ./src/randomExcursionsVariant.c
/usr/bin/gcc -o obj/linearComplexity.o -c -Wall ./src/linearComplexity.c
/usr/bin/gcc -o obj/dfft.o -c -Wall ./src/dfft.c
/usr/bin/gcc -o obj/cephes.o -c -Wall ./src/cephes.c
/usr/bin/gcc -o obj/matrix.o -c -Wall ./src/matrix.c
./src/matrix.c: In function ‘find_unit_element_and_swap’:
./src/matrix.c:69:3: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation]
   69 |   while ( (index < M) && (A[index][i] == 0) )
      |   ^~~~~
./src/matrix.c:71:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’
   71 |    if ( index < M )
      |    ^~
./src/matrix.c:76:3: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation]
   76 |   while ( (index >= 0) && (A[index][i] == 0) )
      |   ^~~~~
./src/matrix.c:78:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’
   78 |    if ( index >= 0 )
      |    ^~
/usr/bin/gcc -o obj/utilities.o -c -Wall ./src/utilities.c
/usr/bin/gcc -o obj/generators.o -c -Wall ./src/generators.c
./src/generators.c: In function ‘lcg’:
./src/generators.c:48:10: warning: variable ‘counter’ set but not used [-Wunused-but-set-variable]
   48 |  int  i, counter;
      |          ^~~~~~~
/usr/bin/gcc -o obj/genutils.o -c -Wall ./src/genutils.c
./src/genutils.c: In function ‘Mult’:
./src/genutils.c:175:16: warning: variable ‘LA’ set but not used [-Wunused-but-set-variable]
  175 |  int  i, j, k, LA;
      |                ^~
/usr/bin/gcc -o assess ./obj/assess.o ./obj/frequency.o ./obj/blockFrequency.o ./obj/cusum.o ./obj/runs.o ./obj/longestRunOfOnes.o ./obj/serial.o ./obj/rank.o ./obj/discreteFourierTransform.o ./obj/nonOverlappingTemplateMatchings.o ./obj/overlappingTemplateMatchings.o ./obj/universal.o ./obj/approximateEntropy.o ./obj/randomExcursions.o ./obj/randomExcursionsVariant.o ./obj/linearComplexity.o ./obj/dfft.o ./obj/cephes.o ./obj/matrix.o ./obj/utilities.o ./obj/generators.o ./obj/genutils.o -lm
xxxx@xxxx:/mnt/c/Users/29447/Desktop/sts-2.1.2/sts-2.1.2$ ls
assess  data  experiments  include  makefile  obj  src  templates

接下来就是按照步骤配置测试选项:

xxxx@xxxx:/mnt/c/Users/29447/Desktop/sts-2.1.2/sts-2.1.2$ ./assess 512000
           G E N E R A T O R    S E L E C T I O N
           ______________________________________

    [0] Input File                 [1] Linear Congruential
    [2] Quadratic Congruential I   [3] Quadratic Congruential II
    [4] Cubic Congruential         [5] XOR
    [6] Modular Exponentiation     [7] Blum-Blum-Shub
    [8] Micali-Schnorr             [9] G Using SHA-1

   Enter Choice: 0


                User Prescribed Input File: /mn ^H^H^H^H^H

File Error:  file /mn could not be opened.
xxxx@xxxx:/mnt/c/Users/29447/Desktop/sts-2.1.2/sts-2.1.2$ ./assess 512000
           G E N E R A T O R    S E L E C T I O N
           ______________________________________

    [0] Input File                 [1] Linear Congruential
    [2] Quadratic Congruential I   [3] Quadratic Congruential II
    [4] Cubic Congruential         [5] XOR
    [6] Modular Exponentiation     [7] Blum-Blum-Shub
    [8] Micali-Schnorr             [9] G Using SHA-1

   Enter Choice: 0


                User Prescribed Input File: data/stm32_rng.txt

                S T A T I S T I C A L   T E S T S
                _________________________________

    [01] Frequency                       [02] Block Frequency
    [03] Cumulative Sums                 [04] Runs
    [05] Longest Run of Ones             [06] Rank
    [07] Discrete Fourier Transform      [08] Nonperiodic Template Matchings
    [09] Overlapping Template Matchings  [10] Universal Statistical
    [11] Approximate Entropy             [12] Random Excursions
    [13] Random Excursions Variant       [14] Serial
    [15] Linear Complexity

         INSTRUCTIONS
            Enter 0 if you DO NOT want to apply all of the
            statistical tests to each sequence and 1 if you DO.

   Enter Choice: 0

         INSTRUCTIONS
            Enter a 0 or 1 to indicate whether or not the numbered statistical
            test should be applied to each sequence.

      123456789111111
               012345
      111111111111111


        P a r a m e t e r   A d j u s t m e n t s
        -----------------------------------------
    [1] Block Frequency Test - block length(M):         128
    [2] NonOverlapping Template Test - block length(m): 9
    [3] Overlapping Template Test - block length(m):    9
    [4] Approximate Entropy Test - block length(m):     10
    [5] Serial Test - block length(m):                  16
    [6] Linear Complexity Test - block length(M):       500

   Select Test (0 to continue): 0

   How many bitstreams? 10

   Input File Format:
    [0] ASCII - A sequence of ASCII 0's and 1's
    [1] Binary - Each byte in data file contains 8 bits of data

   Select input mode:  0

     Statistical Testing In Progress.........

     Statistical Testing Complete!!!!!!!!!!!!

xxxx@xxxx:/mnt/c/Users/29447/Desktop/sts-2.1.2/sts-2.1.2$
上面的参数具体文档里面也有说明:
dm00073853-stm32-microcontroller-random-number-generation-validation-using-the-n.pdf (607.02 KB)
(下载次数: 4, 2023-6-15 09:41 上传)

微信截图_20230615094229.png

测试完自动生成一个文件夹AlgorithmTesting存放结果:

测试项比较多,所以结果内容也较多,最终结果如下:

------------------------------------------------------------------------------
RESULTS FOR THE UNIFORMITY OF P-VALUES AND THE PROPORTION OF PASSING SEQUENCES
------------------------------------------------------------------------------
   generator is <data/stm32_rng.txt>
------------------------------------------------------------------------------
 C1  C2  C3  C4  C5  C6  C7  C8  C9 C10  P-VALUE  PROPORTION  STATISTICAL TEST
------------------------------------------------------------------------------
  1   1   2   0   1   2   0   0   1   2  0.739918     10/10      Frequency
  2   2   1   1   2   0   0   1   0   1  0.739918     10/10      BlockFrequency
  1   1   1   0   1   2   0   0   2   2  0.739918     10/10      CumulativeSums
  0   1   1   3   2   0   0   1   2   0  0.350485     10/10      CumulativeSums
  0   0   2   1   0   1   2   1   1   2  0.739918     10/10      Runs
  0   1   1   1   1   2   1   2   1   0  0.911413     10/10      LongestRun
  2   1   1   0   1   0   3   0   2   0  0.350485     10/10      Rank
  0   1   2   0   1   1   1   1   2   1  0.911413     10/10      FFT
  3   0   1   0   2   0   0   0   2   2  0.213309     10/10      NonOverlappingTemplate
  0   3   0   2   2   0   0   0   1   2  0.213309     10/10      NonOverlappingTemplate
  1   1   2   1   0   1   0   0   2   2  0.739918     10/10      NonOverlappingTemplate
  1   0   1   1   1   1   1   1   2   1  0.991468      9/10      NonOverlappingTemplate
  2   0   0   0   2   2   3   1   0   0  0.213309      9/10      NonOverlappingTemplate
  1   4   1   0   0   1   1   2   0   0  0.122325     10/10      NonOverlappingTemplate
  1   0   4   0   1   3   1   0   0   0  0.035174     10/10      NonOverlappingTemplate
  2   0   0   0   0   1   2   1   3   1  0.350485     10/10      NonOverlappingTemplate
  0   0   2   0   1   3   0   2   1   1  0.350485     10/10      NonOverlappingTemplate
  1   0   2   0   1   4   0   0   0   2  0.066882     10/10      NonOverlappingTemplate
  0   0   1   1   1   1   4   0   1   1  0.213309     10/10      NonOverlappingTemplate
  0   0   2   1   6   0   1   0   0   0  0.000199     10/10      NonOverlappingTemplate
  1   1   2   1   0   0   2   0   2   1  0.739918     10/10      NonOverlappingTemplate
  1   1   2   1   3   0   0   1   1   0  0.534146     10/10      NonOverlappingTemplate
  1   2   1   1   0   1   1   0   2   1  0.911413     10/10      NonOverlappingTemplate
  0   0   0   0   0   4   1   2   3   0  0.017912     10/10      NonOverlappingTemplate
  2   0   0   0   1   2   1   1   1   2  0.739918      9/10      NonOverlappingTemplate
  1   1   1   1   1   0   0   2   1   2  0.911413      9/10      NonOverlappingTemplate
  1   1   1   2   0   1   3   0   1   0  0.534146     10/10      NonOverlappingTemplate
  1   1   2   2   1   1   0   0   2   0  0.739918     10/10      NonOverlappingTemplate
  2   1   0   1   0   1   0   3   0   2  0.350485      9/10      NonOverlappingTemplate
  3   0   2   1   1   0   2   0   0   1  0.350485      9/10      NonOverlappingTemplate
  0   1   1   2   1   1   1   0   2   1  0.911413     10/10      NonOverlappingTemplate
  0   2   1   1   2   0   1   1   1   1  0.911413     10/10      NonOverlappingTemplate
  2   0   0   0   2   0   0   2   3   1  0.213309     10/10      NonOverlappingTemplate
  2   1   0   0   1   2   1   2   0   1  0.739918     10/10      NonOverlappingTemplate
  2   2   0   0   2   1   1   1   1   0  0.739918     10/10      NonOverlappingTemplate
  1   1   1   0   2   1   1   0   1   2  0.911413     10/10      NonOverlappingTemplate
  0   3   0   1   2   2   0   1   1   0  0.350485     10/10      NonOverlappingTemplate
  2   1   1   2   0   0   0   1   3   0  0.350485      9/10      NonOverlappingTemplate
  1   0   1   3   1   1   0   2   0   1  0.534146     10/10      NonOverlappingTemplate
  1   1   0   4   0   1   1   0   0   2  0.122325      9/10      NonOverlappingTemplate
  1   0   2   1   1   0   2   1   1   1  0.911413     10/10      NonOverlappingTemplate
  2   0   0   1   2   1   2   1   0   1  0.739918     10/10      NonOverlappingTemplate
  0   1   0   2   1   4   0   0   2   0  0.066882     10/10      NonOverlappingTemplate
  1   0   0   0   0   2   2   1   0   4  0.066882     10/10      NonOverlappingTemplate
  1   1   1   2   1   1   1   1   0   1  0.991468     10/10      NonOverlappingTemplate
  1   2   1   0   0   1   1   0   1   3  0.534146     10/10      NonOverlappingTemplate
  1   0   1   1   1   3   0   0   1   2  0.534146     10/10      NonOverlappingTemplate
  0   1   0   1   1   2   3   0   1   1  0.534146     10/10      NonOverlappingTemplate
  2   0   0   3   1   1   0   0   1   2  0.350485     10/10      NonOverlappingTemplate
  0   1   1   0   0   1   0   4   2   1  0.122325     10/10      NonOverlappingTemplate
  1   2   2   0   0   2   0   0   2   1  0.534146     10/10      NonOverlappingTemplate
  3   1   0   0   2   0   2   0   0   2  0.213309      9/10      NonOverlappingTemplate
  3   0   0   0   1   1   1   1   2   1  0.534146     10/10      NonOverlappingTemplate
  2   2   1   0   0   1   1   0   1   2  0.739918     10/10      NonOverlappingTemplate
  3   1   1   1   1   1   0   2   0   0  0.534146     10/10      NonOverlappingTemplate
  0   0   0   4   0   1   2   2   1   0  0.066882     10/10      NonOverlappingTemplate
  2   2   1   1   2   0   0   1   0   1  0.739918     10/10      NonOverlappingTemplate
  2   1   1   0   2   1   0   3   0   0  0.350485      9/10      NonOverlappingTemplate
  2   1   2   1   1   1   0   0   2   0  0.739918     10/10      NonOverlappingTemplate
  1   1   1   2   0   0   1   1   3   0  0.534146     10/10      NonOverlappingTemplate
  1   0   0   0   3   0   3   1   2   0  0.122325     10/10      NonOverlappingTemplate
  1   2   1   1   2   2   0   0   1   0  0.739918     10/10      NonOverlappingTemplate
  1   0   0   3   2   1   1   0   1   1  0.534146     10/10      NonOverlappingTemplate
  0   0   2   2   0   0   0   4   2   0  0.035174     10/10      NonOverlappingTemplate
  1   2   2   1   1   0   1   0   1   1  0.911413     10/10      NonOverlappingTemplate
  2   1   1   0   1   0   1   2   2   0  0.739918     10/10      NonOverlappingTemplate
  3   1   0   1   0   1   2   0   1   1  0.534146     10/10      NonOverlappingTemplate
  1   0   1   1   1   0   0   4   1   1  0.213309     10/10      NonOverlappingTemplate
  1   1   1   1   1   2   1   1   1   0  0.991468     10/10      NonOverlappingTemplate
  0   2   0   3   0   1   1   2   1   0  0.350485     10/10      NonOverlappingTemplate
  0   2   1   1   2   0   1   1   1   1  0.911413     10/10      NonOverlappingTemplate
  1   1   2   0   1   0   1   2   2   0  0.739918      9/10      NonOverlappingTemplate
  1   1   2   2   2   2   0   0   0   0  0.534146     10/10      NonOverlappingTemplate
  1   0   1   1   3   0   1   2   0   1  0.534146     10/10      NonOverlappingTemplate
  0   0   2   1   0   1   1   1   2   2  0.739918     10/10      NonOverlappingTemplate
  2   0   1   0   1   1   1   2   1   1  0.911413     10/10      NonOverlappingTemplate
  1   2   0   4   0   0   1   1   1   0  0.122325     10/10      NonOverlappingTemplate
  2   0   1   1   1   1   1   0   0   3  0.534146      9/10      NonOverlappingTemplate
  0   0   2   1   2   1   1   1   1   1  0.911413     10/10      NonOverlappingTemplate
  0   1   1   0   0   2   2   1   2   1  0.739918     10/10      NonOverlappingTemplate
  2   1   1   0   1   2   1   2   0   0  0.739918     10/10      NonOverlappingTemplate
  1   1   1   0   0   3   1   2   0   1  0.534146     10/10      NonOverlappingTemplate
  3   0   1   0   2   0   0   0   2   2  0.213309     10/10      NonOverlappingTemplate
  2   1   1   1   1   2   0   1   1   0  0.911413     10/10      NonOverlappingTemplate
  2   1   3   0   0   1   1   1   0   1  0.534146     10/10      NonOverlappingTemplate
  2   1   1   1   1   0   0   2   1   1  0.911413     10/10      NonOverlappingTemplate
  1   0   0   2   1   2   2   2   0   0  0.534146     10/10      NonOverlappingTemplate
  0   1   0   2   2   0   1   0   3   1  0.350485     10/10      NonOverlappingTemplate
  2   3   1   3   1   0   0   0   0   0  0.122325     10/10      NonOverlappingTemplate
  1   0   1   2   1   0   0   1   2   2  0.739918     10/10      NonOverlappingTemplate
  1   1   2   0   1   3   1   0   0   1  0.534146     10/10      NonOverlappingTemplate
  2   2   0   2   0   0   1   1   2   0  0.534146     10/10      NonOverlappingTemplate
  0   2   0   1   1   1   0   2   3   0  0.350485     10/10      NonOverlappingTemplate
  0   2   0   0   2   1   0   1   1   3  0.350485     10/10      NonOverlappingTemplate
  2   0   1   1   1   3   0   1   1   0  0.534146     10/10      NonOverlappingTemplate
  0   3   1   0   2   1   2   0   0   1  0.350485     10/10      NonOverlappingTemplate
  0   1   1   2   3   1   1   0   1   0  0.534146     10/10      NonOverlappingTemplate
  1   1   0   0   1   1   2   2   2   0  0.739918     10/10      NonOverlappingTemplate
  1   1   0   2   1   2   2   0   1   0  0.739918     10/10      NonOverlappingTemplate
  1   0   1   2   2   2   0   1   0   1  0.739918     10/10      NonOverlappingTemplate
  2   0   1   0   0   2   1   1   2   1  0.739918     10/10      NonOverlappingTemplate
  1   2   2   1   1   0   0   2   0   1  0.739918     10/10      NonOverlappingTemplate
  1   4   1   1   0   1   1   0   1   0  0.213309     10/10      NonOverlappingTemplate
  0   1   2   0   0   2   1   1   2   1  0.739918     10/10      NonOverlappingTemplate
  2   1   1   2   1   0   0   0   0   3  0.350485     10/10      NonOverlappingTemplate
  0   3   0   1   2   1   2   1   0   0  0.350485     10/10      NonOverlappingTemplate
  0   1   1   1   0   1   1   0   1   4  0.213309     10/10      NonOverlappingTemplate
  1   1   3   2   0   1   1   1   0   0  0.534146     10/10      NonOverlappingTemplate
  0   0   1   0   1   1   2   2   2   1  0.739918     10/10      NonOverlappingTemplate
  3   2   0   1   0   2   0   1   1   0  0.350485     10/10      NonOverlappingTemplate
  0   0   1   2   2   3   0   0   0   2  0.213309     10/10      NonOverlappingTemplate
  4   0   0   1   0   2   2   0   1   0  0.066882     10/10      NonOverlappingTemplate
  1   1   0   0   2   2   1   1   1   1  0.911413     10/10      NonOverlappingTemplate
  1   1   1   0   0   2   2   1   1   1  0.911413     10/10      NonOverlappingTemplate
  2   1   0   1   2   2   1   0   1   0  0.739918     10/10      NonOverlappingTemplate
  0   1   0   2   1   2   1   0   2   1  0.739918     10/10      NonOverlappingTemplate
  1   2   3   0   2   0   1   0   0   1  0.350485     10/10      NonOverlappingTemplate
  1   0   1   0   0   1   0   3   3   1  0.213309     10/10      NonOverlappingTemplate
  0   0   2   1   1   1   1   2   1   1  0.911413     10/10      NonOverlappingTemplate
  0   1   0   0   3   1   0   2   2   1  0.350485     10/10      NonOverlappingTemplate
  1   0   0   1   1   2   2   1   1   1  0.911413     10/10      NonOverlappingTemplate
  0   2   0   3   0   1   4   0   0   0  0.017912     10/10      NonOverlappingTemplate
  1   0   1   0   0   1   3   0   3   1  0.213309     10/10      NonOverlappingTemplate
  1   1   1   1   1   0   1   3   0   1  0.739918     10/10      NonOverlappingTemplate
  1   0   1   2   2   0   1   1   1   1  0.911413     10/10      NonOverlappingTemplate
  1   0   0   0   1   1   3   0   4   0  0.035174     10/10      NonOverlappingTemplate
  0   1   0   1   2   0   3   1   1   1  0.534146     10/10      NonOverlappingTemplate
  1   0   3   0   1   0   2   0   2   1  0.350485     10/10      NonOverlappingTemplate
  2   0   1   1   1   1   0   2   1   1  0.911413     10/10      NonOverlappingTemplate
  0   0   1   3   0   2   1   1   1   1  0.534146     10/10      NonOverlappingTemplate
  0   3   2   0   1   1   1   2   0   0  0.350485     10/10      NonOverlappingTemplate
  1   1   1   3   0   0   1   1   0   2  0.534146     10/10      NonOverlappingTemplate
  0   0   3   0   1   1   1   0   3   1  0.213309     10/10      NonOverlappingTemplate
  1   0   1   0   2   2   2   1   1   0  0.739918     10/10      NonOverlappingTemplate
  2   1   1   2   1   0   2   0   0   1  0.739918      9/10      NonOverlappingTemplate
  1   1   1   0   2   1   0   1   1   2  0.911413     10/10      NonOverlappingTemplate
  0   1   2   1   1   0   0   2   2   1  0.739918     10/10      NonOverlappingTemplate
  0   1   1   0   1   2   1   1   2   1  0.911413     10/10      NonOverlappingTemplate
  1   0   1   1   0   2   2   2   1   0  0.739918     10/10      NonOverlappingTemplate
  2   2   1   0   0   2   0   2   0   1  0.534146     10/10      NonOverlappingTemplate
  1   1   1   2   1   1   1   1   1   0  0.991468     10/10      NonOverlappingTemplate
  0   0   1   2   1   3   0   1   1   1  0.534146     10/10      NonOverlappingTemplate
  1   0   3   2   0   1   1   0   1   1  0.534146     10/10      NonOverlappingTemplate
  2   1   0   1   0   1   3   0   0   2  0.350485     10/10      NonOverlappingTemplate
  0   0   1   2   1   3   1   0   1   1  0.534146     10/10      NonOverlappingTemplate
  0   3   3   2   0   2   0   0   0   0  0.066882     10/10      NonOverlappingTemplate
  1   0   2   2   2   0   1   0   0   2  0.534146     10/10      NonOverlappingTemplate
  1   0   0   0   0   3   3   1   1   1  0.213309     10/10      NonOverlappingTemplate
  0   1   1   2   1   0   3   1   0   1  0.534146     10/10      NonOverlappingTemplate
  0   3   1   1   0   2   1   0   2   0  0.350485     10/10      NonOverlappingTemplate
  0   0   1   0   2   2   3   2   0   0  0.213309     10/10      NonOverlappingTemplate
  3   1   1   0   2   0   0   0   2   1  0.350485     10/10      NonOverlappingTemplate
  0   2   1   2   0   1   2   1   1   0  0.739918     10/10      NonOverlappingTemplate
  0   0   0   4   0   1   0   3   2   0  0.017912     10/10      NonOverlappingTemplate
  1   2   0   0   0   1   0   2   3   1  0.350485     10/10      NonOverlappingTemplate
  1   1   1   0   0   3   1   2   0   1  0.534146     10/10      NonOverlappingTemplate
  1   1   0   2   0   1   2   1   0   2  0.739918     10/10      OverlappingTemplate
  1   0   0   2   2   0   1   0   2   2  0.534146     10/10      Universal
  0   1   0   3   0   1   3   1   0   1  0.213309     10/10      ApproximateEntropy
  0   2   0   0   0   1   0   1   0   0     ----       4/4       RandomExcursions
  2   0   1   0   0   0   1   0   0   0     ----       3/4       RandomExcursions
  0   0   1   1   1   0   1   0   0   0     ----       4/4       RandomExcursions
  0   0   1   1   0   0   0   1   0   1     ----       4/4       RandomExcursions
  1   1   0   0   0   0   0   0   2   0     ----       3/4       RandomExcursions
  1   0   0   0   0   0   1   0   0   2     ----       3/4       RandomExcursions
  0   1   0   1   1   0   0   0   0   1     ----       4/4       RandomExcursions
  1   0   0   0   0   0   0   2   1   0     ----       4/4       RandomExcursions
  0   0   1   0   0   2   0   0   1   0     ----       4/4       RandomExcursionsVariant
  0   0   2   0   0   1   0   0   1   0     ----       4/4       RandomExcursionsVariant
  0   0   1   0   1   1   0   0   0   1     ----       4/4       RandomExcursionsVariant
  0   0   1   0   0   0   1   0   2   0     ----       4/4       RandomExcursionsVariant
  0   0   1   0   1   0   0   0   1   1     ----       4/4       RandomExcursionsVariant
  0   1   0   0   1   0   1   0   1   0     ----       4/4       RandomExcursionsVariant
  1   0   0   1   0   0   0   1   1   0     ----       4/4       RandomExcursionsVariant
  1   1   0   0   0   0   0   1   0   1     ----       4/4       RandomExcursionsVariant
  1   1   0   0   0   0   1   0   1   0     ----       4/4       RandomExcursionsVariant
  0   0   1   1   0   1   1   0   0   0     ----       4/4       RandomExcursionsVariant
  0   0   0   0   1   1   1   0   0   1     ----       4/4       RandomExcursionsVariant
  0   0   0   2   0   0   0   0   1   1     ----       4/4       RandomExcursionsVariant
  0   0   1   0   0   1   0   1   1   0     ----       4/4       RandomExcursionsVariant
  0   0   1   0   0   1   0   1   1   0     ----       4/4       RandomExcursionsVariant
  0   0   2   0   0   0   0   0   1   1     ----       4/4       RandomExcursionsVariant
  0   0   2   0   0   0   1   0   1   0     ----       4/4       RandomExcursionsVariant
  0   0   0   1   1   1   1   0   0   0     ----       4/4       RandomExcursionsVariant
  0   1   0   1   0   0   1   0   1   0     ----       4/4       RandomExcursionsVariant
  2   0   0   1   1   2   1   1   1   1  0.911413     10/10      Serial
  0   1   0   1   3   1   1   1   1   1  0.739918     10/10      Serial
  3   1   1   1   1   0   0   2   0   1  0.534146     10/10      LinearComplexity


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
The minimum pass rate for each statistical test with the exception of the
random excursion (variant) test is approximately = 8 for a
sample size = 10 binary sequences.

The minimum pass rate for the random excursion (variant) test
is approximately = 3 for a sample size = 4 binary sequences.

For further guidelines construct a probability table using the MAPLE program
provided in the addendum section of the documentation.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

如果测试有不通过项会有星号标注,上面结果全部通过,如果要关注具体每一项的测试结果则需要打开对应文件

比如FFT(离散傅里叶变换(光谱)测试)结果:

微信截图_20230615094537.png

回复评论 (2)

STM32H563芯片的TRNG模块能生成的随机数随机性和安全性很重要,说其他的都没有用

点赞  2023-6-17 14:27

谢谢分享,期待后续!

默认摸鱼,再摸鱼。2022、9、28
点赞  2023-6-20 17:51
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复