4

mbedtls を使用して SSL サーバーを実行しています。関数mbedtls_ctr_drbg_seedが -34 を返しました。私のコードは以下の通りです:

const char *pers = "ssl_server2";
  mbedtls_havege_state hs;
  mbedtls_ssl_session ssn;
  mbedtls_entropy_context entropy;
  mbedtls_ctr_drbg_context ctr_drbg;
  // One HTTPS Request Handling
  memset( &ssn, 0, sizeof( mbedtls_ssl_session ) );
  /*
  * 4. Setup stuff
  */
  mbedtls_ssl_init( &ssl );
  mbedtls_ssl_config_init( &conf );
  mbedtls_ctr_drbg_init( &ctr_drbg );
  mbedtls_entropy_init( &entropy );
  printf( "  . Setting up the RNG and SSL data...." );
  if( ( ret = mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy, (const unsigned char *) pers, sizeof( pers ) ) ) != 0 )
  {
     printf( " failed\n  ! mbedtls_ctr_drbg_seed returned -0x%x\n", -ret );
     goto ExitFunction;
  }
  else
     printf( " mbedtls_ctr_drbg_seed returned 0x%x ok\n", ret );
4

1 に答える 1