Remove deprecated ipconfigRAND32 (#1108)

* Remove deprecated ipconfigRAND32

* Uncrustify: triggered by comment.

* Update

* Check for return value

* Uncrustify: triggered by comment.

* Update

---------

Co-authored-by: GitHub Action <action@github.com>
pull/1111/head
Monika Singh 1 year ago committed by GitHub
parent b1cadcc6fc
commit f60dd88609
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -124,14 +124,6 @@ extern void vLoggingPrintf( const char * pcFormatString,
* http://www.freertos.org/Stacks-and-stack-overflow-checking.html */ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html */
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 )
/* ipconfigRAND32() is called by the IP stack to generate random numbers for
* things such as a DHCP transaction number or initial sequence number. Random
* number generation is performed via this macro to allow applications to use their
* own random number generation method. For example, it might be possible to
* generate a random number by sampling noise on an analogue input. */
extern UBaseType_t uxRand();
#define ipconfigRAND32() uxRand()
/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the
* network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK
* is not set to 1 then the network event hook will never be called. See * is not set to 1 then the network event hook will never be called. See

@ -288,6 +288,7 @@ static void prvMiscInitialisation( void )
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 1 ] ); ( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 1 ] );
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 2 ] ); ( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 2 ] );
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 3 ] ); ( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 3 ] );
FreeRTOS_debug_printf( ( "Random numbers: %08X %08X %08X %08X\n", FreeRTOS_debug_printf( ( "Random numbers: %08X %08X %08X %08X\n",
ulRandomNumbers[ 0 ], ulRandomNumbers[ 0 ],
ulRandomNumbers[ 1 ], ulRandomNumbers[ 1 ],

@ -129,14 +129,6 @@ extern void vLoggingPrintf( const char * pcFormatString,
* http://www.freertos.org/Stacks-and-stack-overflow-checking.html */ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html */
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 )
/* ipconfigRAND32() is called by the IP stack to generate random numbers for
* things such as a DHCP transaction number or initial sequence number. Random
* number generation is performed via this macro to allow applications to use their
* own random number generation method. For example, it might be possible to
* generate a random number by sampling noise on an analogue input. */
extern UBaseType_t uxRand();
#define ipconfigRAND32() uxRand()
/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the
* network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK
* is not set to 1 then the network event hook will never be called. See * is not set to 1 then the network event hook will never be called. See

@ -113,14 +113,6 @@ extern void vLoggingPrintf( const char * pcFormatString,
* http://www.freertos.org/Stacks-and-stack-overflow-checking.html */ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html */
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 )
/* ipconfigRAND32() is called by the IP stack to generate random numbers for
* things such as a DHCP transaction number or initial sequence number. Random
* number generation is performed via this macro to allow applications to use their
* own random number generation method. For example, it might be possible to
* generate a random number by sampling noise on an analogue input. */
extern UBaseType_t uxRand();
#define ipconfigRAND32() uxRand()
/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the
* network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK
* is not set to 1 then the network event hook will never be called. See * is not set to 1 then the network event hook will never be called. See

@ -464,15 +464,6 @@ UBaseType_t uxRand( void )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
uint32_t uxRand32( void )
{
/* uxRand only returns 15 random bits. Call it 3 times. */
uint32_t ul[ 3 ] = { uxRand(), uxRand(), uxRand() };
uint32_t uxReturn = ul[ 0 ] | ( ul[ 1 ] << 15 ) | ( ul[ 2 ] << 30 );
return uxReturn;
}
static void prvSRand( UBaseType_t ulSeed ) static void prvSRand( UBaseType_t ulSeed )
{ {
/* Utility function to seed the pseudo random number generator. */ /* Utility function to seed the pseudo random number generator. */
@ -483,6 +474,7 @@ static void prvSRand( UBaseType_t ulSeed )
static void prvMiscInitialisation( void ) static void prvMiscInitialisation( void )
{ {
time_t xTimeNow; time_t xTimeNow;
uint32_t ulRandomNumbers[ 4 ];
uint32_t ulLoggingIPAddress; uint32_t ulLoggingIPAddress;
ulLoggingIPAddress = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0, configECHO_SERVER_ADDR1, configECHO_SERVER_ADDR2, configECHO_SERVER_ADDR3 ); ulLoggingIPAddress = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0, configECHO_SERVER_ADDR1, configECHO_SERVER_ADDR2, configECHO_SERVER_ADDR3 );
@ -492,7 +484,16 @@ static void prvMiscInitialisation( void )
time( &xTimeNow ); time( &xTimeNow );
FreeRTOS_debug_printf( ( "Seed for randomiser: %lu\r\n", xTimeNow ) ); FreeRTOS_debug_printf( ( "Seed for randomiser: %lu\r\n", xTimeNow ) );
prvSRand( ( uint32_t ) xTimeNow ); prvSRand( ( uint32_t ) xTimeNow );
FreeRTOS_debug_printf( ( "Random numbers: %08X %08X %08X %08X\r\n", ipconfigRAND32(), ipconfigRAND32(), ipconfigRAND32(), ipconfigRAND32() ) );
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 0 ] );
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 1 ] );
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 2 ] );
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 3 ] );
FreeRTOS_debug_printf( ( "Random numbers: %08X %08X %08X %08X\n",
ulRandomNumbers[ 0 ],
ulRandomNumbers[ 1 ],
ulRandomNumbers[ 2 ],
ulRandomNumbers[ 3 ] ) );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -637,12 +638,16 @@ extern uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
uint32_t ulDestinationAddress, uint32_t ulDestinationAddress,
uint16_t usDestinationPort ) uint16_t usDestinationPort )
{ {
uint32_t ulRandomNumber;
( void ) ulSourceAddress; ( void ) ulSourceAddress;
( void ) usSourcePort; ( void ) usSourcePort;
( void ) ulDestinationAddress; ( void ) ulDestinationAddress;
( void ) usDestinationPort; ( void ) usDestinationPort;
return uxRand32(); ( void ) xApplicationGetRandomNumber( &ulRandomNumber );
return ulRandomNumber;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -930,9 +935,11 @@ static void vDNSEvent( const char * pcName,
static void dns_test( const char * pcHostName ) static void dns_test( const char * pcHostName )
{ {
uint32_t ulID = uxRand32(); uint32_t ulID;
BaseType_t rc; BaseType_t rc;
if( xApplicationGetRandomNumber( &( ulID ) ) != pdFALSE )
{
FreeRTOS_dnsclear(); FreeRTOS_dnsclear();
struct freertos_addrinfo xHints; struct freertos_addrinfo xHints;
@ -959,6 +966,11 @@ static void dns_test( const char * pcHostName )
FreeRTOS_printf( ( "Lookup '%s': %d\n", pcHostName, rc ) ); FreeRTOS_printf( ( "Lookup '%s': %d\n", pcHostName, rc ) );
/* FreeRTOS_gethostbyname( pcHostName ); */ /* FreeRTOS_gethostbyname( pcHostName ); */
} }
else
{
FreeRTOS_printf( ( "dns_test: Failed to generate a random SearchID\n" ) );
}
}
void showAddressInfo( struct freertos_addrinfo * pxAddrInfo ) void showAddressInfo( struct freertos_addrinfo * pxAddrInfo )
{ {

@ -110,14 +110,6 @@ extern void vLoggingPrintf( const char * pcFormatString,
* https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html */ * https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html */
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 )
/* ipconfigRAND32() is called by the IP stack to generate random numbers for
* things such as a DHCP transaction number or initial sequence number. Random
* number generation is performed via this macro to allow applications to use their
* own random number generation method. For example, it might be possible to
* generate a random number by sampling noise on an analogue input. */
extern UBaseType_t uxRand();
#define ipconfigRAND32() uxRand()
/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the
* network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK
* is not set to 1 then the network event hook will never be called. See * is not set to 1 then the network event hook will never be called. See

@ -113,14 +113,6 @@ extern void vLoggingPrintf( const char * pcFormatString,
* http://www.freertos.org/Stacks-and-stack-overflow-checking.html */ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html */
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 )
/* ipconfigRAND32() is called by the IP stack to generate random numbers for
* things such as a DHCP transaction number or initial sequence number. Random
* number generation is performed via this macro to allow applications to use their
* own random number generation method. For example, it might be possible to
* generate a random number by sampling noise on an analogue input. */
/*extern UBaseType_t rand(); */
#define ipconfigRAND32() rand()
/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the
* network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK
* is not set to 1 then the network event hook will never be called. See * is not set to 1 then the network event hook will never be called. See

@ -97,14 +97,6 @@
* https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html. */ * https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html. */
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 )
/* ipconfigRAND32() is called by the IP stack to generate random numbers for
* things such as a DHCP transaction number or initial sequence number. Random
* number generation is performed via this macro to allow applications to use their
* own random number generation method. For example, it might be possible to
* generate a random number by sampling noise on an analogue input. */
extern uint32_t ulRand();
#define ipconfigRAND32() ulRand()
/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the
* network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK
* is not set to 1 then the network event hook will never be called. See: * is not set to 1 then the network event hook will never be called. See:

@ -113,14 +113,6 @@ extern void vLoggingPrintf( const char * pcFormatString,
* https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html */ * https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html */
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5U ) #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5U )
/* ipconfigRAND32() is called by the IP stack to generate random numbers for
* things such as a DHCP transaction number or initial sequence number. Random
* number generation is performed via this macro to allow applications to use their
* own random number generation method. For example, it might be possible to
* generate a random number by sampling noise on an analogue input. */
extern UBaseType_t uxRand();
#define ipconfigRAND32() uxRand()
/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the
* network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK
* is not set to 1 then the network event hook will never be called. See * is not set to 1 then the network event hook will never be called. See

@ -93,14 +93,6 @@
* https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html. */ * https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html. */
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 )
/* ipconfigRAND32() is called by the IP stack to generate random numbers for
* things such as a DHCP transaction number or initial sequence number. Random
* number generation is performed via this macro to allow applications to use their
* own random number generation method. For example, it might be possible to
* generate a random number by sampling noise on an analogue input. */
extern uint32_t ulRand();
#define ipconfigRAND32() ulRand()
/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the
* network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK
* is not set to 1 then the network event hook will never be called. See: * is not set to 1 then the network event hook will never be called. See:

Loading…
Cancel
Save