Re: RSB vs. Python 2.7

2022-09-08 Thread Chris Johns
On 9/9/2022 3:50 pm, Sebastian Huber wrote:
> On 09.09.22 07:49, Chris Johns wrote:
>> On 9/9/2022 3:30 pm, Sebastian Huber wrote:
>>> Hello,
>>>
>>> it seems that the recent RSB no longer runs with Python 2.7:
>>>
>>> download:https://codeload.github.com/RTEMS/gnu-mirror-gcc/tar.gz/6678700:
>>> error: 
>> https should be ok with python2?
>>
> 
> My default "python" command is
> 
> Python 2.7.18

The doco says https is supported ...

https://docs.python.org/2.7/library/urllib.html

> With it, the RSB stops with the above error. With Python 3 it works fine.

Strange. I will take a look once the current run of tests finish. Some build
take a while even on fast hardware.

Chris


___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: RSB vs. Python 2.7

2022-09-08 Thread Sebastian Huber

On 09.09.22 07:49, Chris Johns wrote:

On 9/9/2022 3:30 pm, Sebastian Huber wrote:

Hello,

it seems that the recent RSB no longer runs with Python 2.7:

download:https://codeload.github.com/RTEMS/gnu-mirror-gcc/tar.gz/6678700:
error: 

https should be ok with python2?



My default "python" command is

Python 2.7.18

With it, the RSB stops with the above error. With Python 3 it works fine.

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] user: Document arm/fvp BSP

2022-09-08 Thread Chris Johns
Ok to push

Thanks
Chris

On 9/9/2022 3:49 pm, Sebastian Huber wrote:
> Close #4202.
> ---
>  user/bsps/arm/fvp.rst  | 39 +++
>  user/bsps/bsps-arm.rst |  1 +
>  2 files changed, 40 insertions(+)
>  create mode 100644 user/bsps/arm/fvp.rst
> 
> diff --git a/user/bsps/arm/fvp.rst b/user/bsps/arm/fvp.rst
> new file mode 100644
> index 000..a1e186a
> --- /dev/null
> +++ b/user/bsps/arm/fvp.rst
> @@ -0,0 +1,39 @@
> +.. SPDX-License-Identifier: CC-BY-SA-4.0
> +
> +.. Copyright (C) 2022 embedded brains GmbH
> +
> +fvp (Fixed Virtual Platform)
> +
> +
> +The BSP for the
> +`Arm Fixed Virtual Platforms 
> `_
> +offers one variant.  You need a license from Arm to run the simulator.  The
> +`fvp_cortex_r52` variant supports a simulation of the Cortex-R52 processor.
> +The BSP supports the SMP configuration.
> +
> +Run an Executable
> +-
> +
> +To run an executable on a single Cortex-R52 processor use:
> +
> +.. code-block:: none
> +
> +FVP_BaseR_Cortex-R52x1 -C bp.vis.disable_visualisation=1 -a 
> build/arm/fvp_cortex_r52/testsuites/samples/ticker.exe
> +
> +To run an executable on a four Cortex-R52 processors use:
> +
> +.. code-block:: none
> +
> +FVP_BaseR_Cortex-R52x4 -C bp.vis.disable_visualisation=1 -a 
> build/arm/fvp_cortex_r52/testsuites/samples/ticker.exe
> +
> +Clock Driver
> +
> +
> +The clock driver uses the `ARMv7-AR Generic Timer`.
> +
> +Console Driver
> +--
> +
> +The console driver uses the
> +`semihosting 
> `_
> +``SYS_READC`` and ``SYS_WRITEC`` system calls.
> diff --git a/user/bsps/bsps-arm.rst b/user/bsps/bsps-arm.rst
> index f1113e3..d9b5d01 100644
> --- a/user/bsps/bsps-arm.rst
> +++ b/user/bsps/bsps-arm.rst
> @@ -14,6 +14,7 @@ arm (ARM)
>arm/csb336.rst
>arm/csb337.rst
>arm/edb7312.rst
> +  arm/fvp.rst
>arm/gumstix.rst
>arm/imx.rst
>arm/imxrt.rst
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] user: Document arm/fvp BSP

2022-09-08 Thread Sebastian Huber
Close #4202.
---
 user/bsps/arm/fvp.rst  | 39 +++
 user/bsps/bsps-arm.rst |  1 +
 2 files changed, 40 insertions(+)
 create mode 100644 user/bsps/arm/fvp.rst

diff --git a/user/bsps/arm/fvp.rst b/user/bsps/arm/fvp.rst
new file mode 100644
index 000..a1e186a
--- /dev/null
+++ b/user/bsps/arm/fvp.rst
@@ -0,0 +1,39 @@
+.. SPDX-License-Identifier: CC-BY-SA-4.0
+
+.. Copyright (C) 2022 embedded brains GmbH
+
+fvp (Fixed Virtual Platform)
+
+
+The BSP for the
+`Arm Fixed Virtual Platforms 
`_
+offers one variant.  You need a license from Arm to run the simulator.  The
+`fvp_cortex_r52` variant supports a simulation of the Cortex-R52 processor.
+The BSP supports the SMP configuration.
+
+Run an Executable
+-
+
+To run an executable on a single Cortex-R52 processor use:
+
+.. code-block:: none
+
+FVP_BaseR_Cortex-R52x1 -C bp.vis.disable_visualisation=1 -a 
build/arm/fvp_cortex_r52/testsuites/samples/ticker.exe
+
+To run an executable on a four Cortex-R52 processors use:
+
+.. code-block:: none
+
+FVP_BaseR_Cortex-R52x4 -C bp.vis.disable_visualisation=1 -a 
build/arm/fvp_cortex_r52/testsuites/samples/ticker.exe
+
+Clock Driver
+
+
+The clock driver uses the `ARMv7-AR Generic Timer`.
+
+Console Driver
+--
+
+The console driver uses the
+`semihosting 
`_
+``SYS_READC`` and ``SYS_WRITEC`` system calls.
diff --git a/user/bsps/bsps-arm.rst b/user/bsps/bsps-arm.rst
index f1113e3..d9b5d01 100644
--- a/user/bsps/bsps-arm.rst
+++ b/user/bsps/bsps-arm.rst
@@ -14,6 +14,7 @@ arm (ARM)
   arm/csb336.rst
   arm/csb337.rst
   arm/edb7312.rst
+  arm/fvp.rst
   arm/gumstix.rst
   arm/imx.rst
   arm/imxrt.rst
-- 
2.35.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: RSB vs. Python 2.7

2022-09-08 Thread Chris Johns
On 9/9/2022 3:30 pm, Sebastian Huber wrote:
> Hello,
> 
> it seems that the recent RSB no longer runs with Python 2.7:
> 
> download: https://codeload.github.com/RTEMS/gnu-mirror-gcc/tar.gz/6678700:
> error: 

https should be ok with python2?

> Is it now time to drop the Python 2 support entirely?

After 6? I can take a look but it is a little confusing.

I have some other issues in the bsp buildssets I am fixing because I changed the
bsp define from just the bsp to arch/bsp to align it with how we define them.

Thanks for the report.

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


RSB vs. Python 2.7

2022-09-08 Thread Sebastian Huber

Hello,

it seems that the recent RSB no longer runs with Python 2.7:

download: 
https://codeload.github.com/RTEMS/gnu-mirror-gcc/tar.gz/6678700: error: 



Is it now time to drop the Python 2 support entirely?

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] user: Document RSB --with/without-newlib-tls

2022-09-08 Thread Chris Johns
Thanks for adding this. Please push.

Chris

On 9/9/2022 3:18 pm, Sebastian Huber wrote:
> Update #4560.
> ---
>  user/rsb/project-sets.rst | 9 +
>  1 file changed, 9 insertions(+)
> 
> diff --git a/user/rsb/project-sets.rst b/user/rsb/project-sets.rst
> index 54a3f8e..ce839c5 100644
> --- a/user/rsb/project-sets.rst
> +++ b/user/rsb/project-sets.rst
> @@ -116,6 +116,15 @@ build sets:
>  ``--with-objc``
>Attempt to build a C++ compiler.
>  
> +``--with-newlib-tls`` or ``--without-newlib-tls``
> +  Enable or disable the ``--enable-newlib-reent-thread-local`` Newlib
> +  configuration option.  This option is enabled by default on the aarch64, 
> arm,
> +  nios2, powerpc, riscv, and sparc targets.  If this option is enabled, then
> +  each member of the Newlib struct _reent is replaced by a dedicated
> +  thread-local object.  The thread-local objects are defined in translation
> +  units which use the corresponding object so that only objects used by the
> +  application are linked in.
> +
>  The RSB provides build sets for some BSPs. These build sets will build:
>  
>  - Compiler, linker, debugger and RTEMS Tools.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] user: Document RSB --with/without-newlib-tls

2022-09-08 Thread Sebastian Huber
Update #4560.
---
 user/rsb/project-sets.rst | 9 +
 1 file changed, 9 insertions(+)

diff --git a/user/rsb/project-sets.rst b/user/rsb/project-sets.rst
index 54a3f8e..ce839c5 100644
--- a/user/rsb/project-sets.rst
+++ b/user/rsb/project-sets.rst
@@ -116,6 +116,15 @@ build sets:
 ``--with-objc``
   Attempt to build a C++ compiler.
 
+``--with-newlib-tls`` or ``--without-newlib-tls``
+  Enable or disable the ``--enable-newlib-reent-thread-local`` Newlib
+  configuration option.  This option is enabled by default on the aarch64, arm,
+  nios2, powerpc, riscv, and sparc targets.  If this option is enabled, then
+  each member of the Newlib struct _reent is replaced by a dedicated
+  thread-local object.  The thread-local objects are defined in translation
+  units which use the corresponding object so that only objects used by the
+  application are linked in.
+
 The RSB provides build sets for some BSPs. These build sets will build:
 
 - Compiler, linker, debugger and RTEMS Tools.
-- 
2.35.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [rtems-source-builder commit] 7: Update Binutils, GDB, and GCC

2022-09-08 Thread Chris Johns
On 9/9/2022 12:28 am, Sebastian Huber wrote:
https://codeload.github.com/RTEMS/sourceware-mirror-binutils-gdb/tar.gz/%{binutils_version}
> -%hash sha512 %{binutils_expand_name}.tar.gz 
> 8e728147ea5d8c533f48129a0fdb0ab29ead768974b55f4a88249335f47e621ec51aaabe239fd3fa6f1db6bbf845749f7a83275295acda1a94f235dc419b3075
> +%hash sha512 %{binutils_expand_name}.tar.gz 
> f17828a61cd19853892cafd6990fa4c13b059afc17a5e7aad01d68da186f3088c65c305eb3bfb998687463e7b3b1f4358a1291a2c4715f82ae1eb3ae858e4017

FYI I am considering dropping the smaller checksums and only supporting base64
hashes after 6 is branched. The RSB has a command to create a base64 hash.

Thanks
Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 00/15] Synchronize libcrypt and libmd with FreeBSD

2022-09-08 Thread Chris Johns
On 9/9/2022 12:29 am, Sebastian Huber wrote:
> On 08/09/2022 16:27, Joel Sherrill wrote:
>>
>> On Thu, Sep 8, 2022 at 9:26 AM Sebastian Huber
>> > > wrote:
>>
>>     On 08/09/2022 16:21, Joel Sherrill wrote:
>>  > Were there no updates to md4/md5 code in libmd? git blame shows
>>     md4.c as
>>  > having mostly no updates in 15 years.
>>
>>     These hashes are obsolete for cryptographic purposes.
>>
>>
>> But they are good checksums. And we have the code. What's the upstream for 
>> it?
> 
> I don't have time to do this right now.

I cannot see any documentation in the classic API guide on what we provide, what
we maintain and what users should use. Should we have a crypto section to help
explain these things?

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH rtems-lwip] lwip: Provide h_errno

2022-09-08 Thread Kinsey Moore
Any application using gethostbyname requires h_errno. This restores the
ability to link applications that make use of h_errno by way of
gethostbyname.
---
 lwip/src/api/netdb.c  | 3 +++
 lwip/src/include/lwip/netdb.h | 6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lwip/src/api/netdb.c b/lwip/src/api/netdb.c
index ee78297..6592728 100644
--- a/lwip/src/api/netdb.c
+++ b/lwip/src/api/netdb.c
@@ -58,6 +58,9 @@ struct gethostbyname_r_helper {
 
 /** h_errno is exported in netdb.h for access by applications. */
 #if LWIP_DNS_API_DECLARE_H_ERRNO
+#ifdef __rtems__
+#undef h_errno
+#endif
 int h_errno;
 #endif /* LWIP_DNS_API_DECLARE_H_ERRNO */
 
diff --git a/lwip/src/include/lwip/netdb.h b/lwip/src/include/lwip/netdb.h
index eaae285..03186fe 100644
--- a/lwip/src/include/lwip/netdb.h
+++ b/lwip/src/include/lwip/netdb.h
@@ -46,14 +46,14 @@
 extern "C" {
 #endif
 
-#ifdef __rtems__
-#include 
-#else
 /* some rarely used options */
 #ifndef LWIP_DNS_API_DECLARE_H_ERRNO
 #define LWIP_DNS_API_DECLARE_H_ERRNO  1
 #endif
 
+#ifdef __rtems__
+#include 
+#else
 #ifndef LWIP_DNS_API_DEFINE_ERRORS
 #define LWIP_DNS_API_DEFINE_ERRORS1
 #endif
-- 
2.30.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH rtems-lwip v3 5/7] RTEMS port of lwIP for STM32 and STM32F4 BSP

2022-09-08 Thread Kinsey Moore
There are a few places noted below where the code import rules aren't 
being followed.


On 9/8/2022 11:34, Duc Doan wrote:

---
  rtemslwip/stm32f4/stm32f4_lwip.c |  14 
  rtemslwip/stm32f4/stm32f4_lwip.h |   9 +++
  stm32/ethernetif.c   | 110 ++-
  stm32/ethernetif.h   |   8 ++-
  stm32/lwip.h |   2 +
  5 files changed, 140 insertions(+), 3 deletions(-)
  create mode 100644 rtemslwip/stm32f4/stm32f4_lwip.c
  create mode 100644 rtemslwip/stm32f4/stm32f4_lwip.h

diff --git a/rtemslwip/stm32f4/stm32f4_lwip.c b/rtemslwip/stm32f4/stm32f4_lwip.c
new file mode 100644
index 000..1f4f07e
--- /dev/null
+++ b/rtemslwip/stm32f4/stm32f4_lwip.c
@@ -0,0 +1,14 @@
+#include "stm32f4_lwip.h"
+
+extern ETH_HandleTypeDef heth;
+
+__attribute__((weak)) void Error_Handler(void) {
+__disable_irq();
+while (1)
+{
+}
+}
+
+void ETH_IRQHandler(void) {
+HAL_ETH_IRQHandler();
+}
diff --git a/rtemslwip/stm32f4/stm32f4_lwip.h b/rtemslwip/stm32f4/stm32f4_lwip.h
new file mode 100644
index 000..8a2b03a
--- /dev/null
+++ b/rtemslwip/stm32f4/stm32f4_lwip.h
@@ -0,0 +1,9 @@
+#ifndef LIPLWIP_RTEMSLWIP_STM32F4_STM32F4_LWIP_H
+#define LIPLWIP_RTEMSLWIP_STM32F4_STM32F4_LWIP_H
+
+#include 
+
+void ErrorHandler(void);
+void ETH_IRQHandler(void);
+
+#endif /* LIPLWIP_RTEMSLWIP_STM32F4_STM32F4_LWIP_H */
diff --git a/stm32/ethernetif.c b/stm32/ethernetif.c
index 7a82c51..e71ac8f 100644
--- a/stm32/ethernetif.c
+++ b/stm32/ethernetif.c
@@ -19,7 +19,12 @@
  /* USER CODE END Header */
  
  /* Includes --*/

+#ifndef __rtems__
  #include "main.h"
+#else
+#include 
+#include 
+#endif /* __rtems__ */
  #include "lwip/opt.h"
  #include "lwip/timeouts.h"
  #include "netif/ethernet.h"
@@ -28,7 +33,9 @@
  #include "ethernetif.h"
  #include "dp83848.h"
  #include 
+#ifndef __rtems__
  #include "cmsis_os.h"
+#endif /* __rtems__ */
  #include "lwip/tcpip.h"
  
  /* Within 'USER CODE' section, code will be kept by default at each generation */

@@ -38,7 +45,12 @@
  
  /* Private define */

  /* The time to block waiting for input. */
+#ifndef __rtems__
  #define TIME_WAITING_FOR_INPUT ( portMAX_DELAY )
+#else
+#define TIME_WAITING_FOR_INPUT ( RTEMS_NO_TIMEOUT )
+#endif /* __rtems__ */
+
  /* USER CODE BEGIN OS_THREAD_STACK_SIZE_WITH_RTOS */
  /* Stack size of the interface thread */
  #define INTERFACE_THREAD_STACK_SIZE ( 350 )
@@ -109,12 +121,20 @@ ETH_DMADescTypeDef  DMATxDscrTab[ETH_TX_DESC_CNT]; /* 
Ethernet Tx DMA Descriptor
  
  /* USER CODE END 2 */
  
+#ifndef __rtems__

  osSemaphoreId RxPktSemaphore = NULL;   /* Semaphore to signal incoming 
packets */
  osSemaphoreId TxPktSemaphore = NULL;   /* Semaphore to signal transmit packet 
complete */
+#else
+rtems_id RxPktSemaphore;   /* Semaphore to signal incoming packets */
+rtems_id TxPktSemaphore;   /* Semaphore to signal transmit packet complete */
+#endif /* __rtems__ */
  
  /* Global Ethernet handle */

  ETH_HandleTypeDef heth;
  ETH_TxPacketConfig TxConfig;
+#ifdef __rtems__
+static uint8_t *MACAddr;
+#endif /* __rtems__ */
  
  /* Private function prototypes ---*/

  int32_t ETH_PHY_IO_Init(void);
@@ -144,7 +164,11 @@ void pbuf_free_custom(struct pbuf *p);
*/
  void HAL_ETH_RxCpltCallback(ETH_HandleTypeDef *handlerEth)
  {
+#ifndef __rtems__
osSemaphoreRelease(RxPktSemaphore);
+#else
+  rtems_semaphore_release(RxPktSemaphore);
+#endif /* __rtems__ */
  }
  /**
* @brief  Ethernet Tx Transfer completed callback
@@ -153,7 +177,11 @@ void HAL_ETH_RxCpltCallback(ETH_HandleTypeDef *handlerEth)
*/
  void HAL_ETH_TxCpltCallback(ETH_HandleTypeDef *handlerEth)
  {
+#ifndef __rtems__
osSemaphoreRelease(TxPktSemaphore);
+#else
+  rtems_semaphore_release(TxPktSemaphore);
+#endif /* __rtems__ */
  }
  /**
* @brief  Ethernet DMA transfer error callback
@@ -164,12 +192,21 @@ void HAL_ETH_ErrorCallback(ETH_HandleTypeDef *handlerEth)
  {
if((HAL_ETH_GetDMAError(handlerEth) & ETH_DMASR_RBUS) == ETH_DMASR_RBUS)
{
- osSemaphoreRelease(RxPktSemaphore);

It looks like this was just an accidental spacing issue.

+#ifndef __rtems__
+osSemaphoreRelease(RxPktSemaphore);
+#else
+rtems_semaphore_release(RxPktSemaphore);
+#endif /* __rtems__ */
}
  }
  
  /* USER CODE BEGIN 4 */

-

Removed newline.

+#ifdef __rtems__
+void set_mac_addr(uint8_t *mac_addr)
+{
+  MACAddr = mac_addr;
+}
+#endif /* __rtems__ */
  /* USER CODE END 4 */
  
  /***

@@ -186,15 +223,20 @@ static void low_level_init(struct netif *netif)
  {
HAL_StatusTypeDef hal_eth_init_status = HAL_OK;
  /* USER CODE BEGIN OS_THREAD_ATTR_CMSIS_RTOS_V2 */
+#ifndef __rtems__
osThreadAttr_t attributes;
+#endif /* __rtems__ */
  /* USER CODE END OS_THREAD_ATTR_CMSIS_RTOS_V2 

Re: [PATCH rtems-lwip v3 3/7] Add STM32 Ethernet source

2022-09-08 Thread Kinsey Moore
lwip.h should also be removed as I believe it is unused except where 
it's included in netstart.h which doesn't use anything declared there as 
far as I can tell. The only thing I can tell that lwip.h provides that's 
of any use is the extern declaration for heth and it isn't used for that.



Kinsey

On 9/8/2022 11:34, Duc Doan wrote:

This patch adds ST's Ethernet and lwIP port and DP83848 driver. The
files are generated using STM32CubeIDE with STM32F4 Cube FW v1.27.1,
under RTOS mode.
---
  COPYING.stm32  |  28 ++
  ORIGIN.stm32   |   2 +
  stm32/driver/dp83848.c | 664 +++
  stm32/driver/dp83848.h | 436 
  stm32/ethernetif.c | 879 +
  stm32/ethernetif.h |  47 +++
  stm32/lwip.h   |  76 
  7 files changed, 2132 insertions(+)
  create mode 100644 COPYING.stm32
  create mode 100644 ORIGIN.stm32
  create mode 100644 stm32/driver/dp83848.c
  create mode 100644 stm32/driver/dp83848.h
  create mode 100644 stm32/ethernetif.c
  create mode 100644 stm32/ethernetif.h
  create mode 100644 stm32/lwip.h

diff --git a/COPYING.stm32 b/COPYING.stm32
new file mode 100644
index 000..f42052b
--- /dev/null
+++ b/COPYING.stm32
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2022 STMicroelectronics.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without 
modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *this list of conditions and the following disclaimer in the documentation
+ *and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 
EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+
diff --git a/ORIGIN.stm32 b/ORIGIN.stm32
new file mode 100644
index 000..afc15ed
--- /dev/null
+++ b/ORIGIN.stm32
@@ -0,0 +1,2 @@
+The files under stm32/ directory are generated using STM32CubeIDE with
+STM32F4 Cube FW v1.27.1, under RTOS mode.
diff --git a/stm32/driver/dp83848.c b/stm32/driver/dp83848.c
new file mode 100644
index 000..2c5d59b
--- /dev/null
+++ b/stm32/driver/dp83848.c
@@ -0,0 +1,664 @@
+/**
+  
**
+  * @filedp83848.c
+  * @author  MCD Application Team
+  * @brief   This file provides a set of functions needed to manage the DP83848
+  *  PHY devices.
+  
**
+  * @attention
+  *
+  *  Copyright (c) 2021 STMicroelectronics.
+  * All rights reserved.
+  *
+  * This software component is licensed by ST under BSD 3-Clause license,
+  * the "License"; You may not use this file except in compliance with the
+  * License. You may obtain a copy of the License at:
+  *opensource.org/licenses/BSD-3-Clause
+  *
+  
**
+  */
+
+/* Includes 
--*/
+#include "dp83848.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup Component
+  * @{
+  */
+
+/** @defgroup DP83848 DP83848
+  * @{
+  */
+
+/* Private typedef 
---*/
+/* Private define 
*/
+/** @defgroup DP83848_Private_Defines DP83848 Private Defines
+  * @{
+  */
+#define DP83848_SW_RESET_TO((uint32_t)500U)
+#define DP83848_INIT_TO((uint32_t)2000U)
+#define DP83848_MAX_DEV_ADDR   ((uint32_t)31U)
+/**
+  * @}
+  */
+
+/* Private macro 
-*/
+/* Private variables 
-*/
+/* Private function prototypes 
---*/
+/* Private functions 
-*/
+/** @defgroup 

Re: [PATCH rtems-lwip v3 1/7] lwip.py: Change arch and bsp check method

2022-09-08 Thread Duc Doan
I realized that I am not using the latest rtems, so I did not see those BSPs. 
Should I create another patch to add the correct BSPs?

Thanks,

Duc

From: devel  on behalf of Kinsey Moore 

Sent: Thursday, September 8, 2022 12:52:15 PM
To: devel@rtems.org 
Subject: Re: [PATCH rtems-lwip v3 1/7] lwip.py: Change arch and bsp check method

On 9/8/2022 11:34, Duc Doan wrote:
> ---
>   lwip.py | 31 ++-
>   1 file changed, 18 insertions(+), 13 deletions(-)
>
> diff --git a/lwip.py b/lwip.py
> index 84eef2c..1f0b8e2 100644
> --- a/lwip.py
> +++ b/lwip.py
> @@ -99,6 +99,8 @@ def build(bld):
>   drv_incl = []
>   arch_lib_path = rtems.arch_bsp_lib_path(bld.env.RTEMS_VERSION,
>   bld.env.RTEMS_ARCH_BSP)
...
>   is_qemu = False
> -if bld.env.RTEMS_ARCH_BSP.startswith('aarch64-rtems6-xilinx_zynqmp'):
> +if arch == 'aarch64' and bsp in ['xilinx_zynqmp_ultra96']:
>   is_xilinx_bsp = True
>   is_aarch64_bsp = True
> -if bld.env.RTEMS_ARCH_BSP.endswith('_qemu'):
> +if bsp in ['xilinx_zynq_a9_qemu']:
>   is_qemu = True
>   if is_xilinx_bsp:
>   drv_incl.extend(xilinx_drv_incl)

The BSPs mentioned here for AArch64 are actually ARM BSPs. The proper
set of BSPs to be used here are:

xilinx_zynqmp_lp64_qemu

xilinx_zynqmp_lp64_zu3eg

xilinx_zynqmp_ilp32_qemu

xilinx_zynqmp_ilp32_zu3eg


At some point, the lwIP build needs to get better about managing which BSPs it 
supports, but that's not a task for you here and now.


Kinsey

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH rtems-lwip v3 1/7] lwip.py: Change arch and bsp check method

2022-09-08 Thread Kinsey Moore

On 9/8/2022 11:34, Duc Doan wrote:

---
  lwip.py | 31 ++-
  1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/lwip.py b/lwip.py
index 84eef2c..1f0b8e2 100644
--- a/lwip.py
+++ b/lwip.py
@@ -99,6 +99,8 @@ def build(bld):
  drv_incl = []
  arch_lib_path = rtems.arch_bsp_lib_path(bld.env.RTEMS_VERSION,
  bld.env.RTEMS_ARCH_BSP)

...

  is_qemu = False
-if bld.env.RTEMS_ARCH_BSP.startswith('aarch64-rtems6-xilinx_zynqmp'):
+if arch == 'aarch64' and bsp in ['xilinx_zynqmp_ultra96']:
  is_xilinx_bsp = True
  is_aarch64_bsp = True
-if bld.env.RTEMS_ARCH_BSP.endswith('_qemu'):
+if bsp in ['xilinx_zynq_a9_qemu']:
  is_qemu = True
  if is_xilinx_bsp:
  drv_incl.extend(xilinx_drv_incl)


The BSPs mentioned here for AArch64 are actually ARM BSPs. The proper 
set of BSPs to be used here are:


xilinx_zynqmp_lp64_qemu

xilinx_zynqmp_lp64_zu3eg

xilinx_zynqmp_ilp32_qemu

xilinx_zynqmp_ilp32_zu3eg


At some point, the lwIP build needs to get better about managing which BSPs it 
supports, but that's not a task for you here and now.


Kinsey

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH rtems-lwip v3 7/7] stm32: Convert to Unix line endings

2022-09-08 Thread Duc Doan
This patch converts all files imported from ST to Unix line endings
---
 rtemslwip/stm32f4/lwipopts.h |  294 ++---
 stm32/driver/dp83848.c   | 1328 +++
 stm32/driver/dp83848.h   |  872 +++
 stm32/ethernetif.c   | 1970 +-
 stm32/ethernetif.h   |  106 +-
 stm32/lwip.h |  156 +--
 6 files changed, 2363 insertions(+), 2363 deletions(-)

diff --git a/rtemslwip/stm32f4/lwipopts.h b/rtemslwip/stm32f4/lwipopts.h
index aa6b95b..eec98c7 100644
--- a/rtemslwip/stm32f4/lwipopts.h
+++ b/rtemslwip/stm32f4/lwipopts.h
@@ -1,147 +1,147 @@
-/* USER CODE BEGIN Header */
-/**
-  
**
-  * File Name  : Target/lwipopts.h
-  * Description: This file overrides LwIP stack default configuration
-  *  done in opt.h file.
-  
**
-  * @attention
-  *
-  * Copyright (c) 2022 STMicroelectronics.
-  * All rights reserved.
-  *
-  * This software is licensed under terms that can be found in the LICENSE file
-  * in the root directory of this software component.
-  * If no LICENSE file comes with this software, it is provided AS-IS.
-  *
-  
**
-  */
-/* USER CODE END Header */
-
-/* Define to prevent recursive inclusion 
--*/
-#ifndef __LWIPOPTS__H__
-#define __LWIPOPTS__H__
-
-/*-*/
-/* Current version of LwIP supported by CubeMx: 2.1.2 -*/
-/*-*/
-
-/* Within 'USER CODE' section, code will be kept by default at each generation 
*/
-/* USER CODE BEGIN 0 */
-#include 
-/* USER CODE END 0 */
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-/* STM32CubeMX Specific Parameters (not defined in opt.h) 
-*/
-/* Parameters set in STM32CubeMX LwIP Configuration GUI -*/
-/*- WITH_RTOS disabled (Since FREERTOS is not set) -*/
-#define WITH_RTOS 1
-/*- CHECKSUM_BY_HARDWARE disabled -*/
-#define CHECKSUM_BY_HARDWARE 0
-/*-*/
-
-/* LwIP Stack Parameters (modified compared to initialization value in opt.h) 
-*/
-/* Parameters set in STM32CubeMX LwIP Configuration GUI -*/
-/*- Default value in ETH configuration GUI in CubeMx: 1524 -*/
-#define ETH_RX_BUFFER_SIZE 1536
-/*- Value in opt.h for NO_SYS: 0 -*/
-#define NO_SYS 0
-/*- Value in opt.h for SYS_LIGHTWEIGHT_PROT: 1 -*/
-#define SYS_LIGHTWEIGHT_PROT 1
-/*- Value in opt.h for MEM_ALIGNMENT: 1 -*/
-#define MEM_ALIGNMENT 4
-/*- Default Value for H7 devices: 0x30044000 -*/
-//#define LWIP_RAM_HEAP_POINTER 0x20017f58
-/*- Value supported for H7 devices: 1 -*/
-#define LWIP_SUPPORT_CUSTOM_PBUF 1
-/*- Value in opt.h for LWIP_ETHERNET: LWIP_ARP || PPPOE_SUPPORT -*/
-#define LWIP_ETHERNET 1
-/*- Value in opt.h for LWIP_DNS_SECURE: (LWIP_DNS_SECURE_RAND_XID | 
LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING | LWIP_DNS_SECURE_RAND_SRC_PORT) -*/
-#define LWIP_DNS_SECURE 7
-/*- Value in opt.h for TCP_SND_QUEUELEN: (4*TCP_SND_BUF + (TCP_MSS - 
1))/TCP_MSS -*/
-#define TCP_SND_QUEUELEN 9
-/*- Value in opt.h for TCP_SNDLOWAT: LWIP_MIN(LWIP_MAX(((TCP_SND_BUF)/2), 
(2 * TCP_MSS) + 1), (TCP_SND_BUF) - 1) -*/
-#define TCP_SNDLOWAT 1071
-/*- Value in opt.h for TCP_SNDQUEUELOWAT: LWIP_MAX(TCP_SND_QUEUELEN)/2, 5) 
-*/
-#define TCP_SNDQUEUELOWAT 5
-/*- Value in opt.h for TCP_WND_UPDATE_THRESHOLD: LWIP_MIN(TCP_WND/4, 
TCP_MSS*4) -*/
-#define TCP_WND_UPDATE_THRESHOLD 536
-/*- Value in opt.h for LWIP_NETIF_LINK_CALLBACK: 0 -*/
-//#define LWIP_NETIF_LINK_CALLBACK 0
-/*- Value in opt.h for LWIP_NETCONN: 1 -*/
-#define LWIP_NETCONN 1
-/*- Value in opt.h for LWIP_SOCKET: 1 -*/
-#define LWIP_SOCKET 1
-/*- Value in opt.h for RECV_BUFSIZE_DEFAULT: INT_MAX -*/
-//#define RECV_BUFSIZE_DEFAULT 20
-/*- Value in opt.h for LWIP_STATS: 1 -*/
-#define LWIP_STATS 0
-/*- Value in opt.h for CHECKSUM_GEN_IP: 1 -*/
-#define CHECKSUM_GEN_IP 0
-/*- Value in opt.h for CHECKSUM_GEN_UDP: 1 -*/
-#define CHECKSUM_GEN_UDP 0
-/*- Value in opt.h for CHECKSUM_GEN_TCP: 1 -*/
-#define CHECKSUM_GEN_TCP 0
-/*- Value in opt.h for CHECKSUM_GEN_ICMP: 1 -*/
-#define CHECKSUM_GEN_ICMP 0
-/*- Value in opt.h for CHECKSUM_GEN_ICMP6: 1 -*/
-#define CHECKSUM_GEN_ICMP6 0
-/*- Value in opt.h for CHECKSUM_CHECK_IP: 1 -*/
-#define CHECKSUM_CHECK_IP 0
-/*- Value in opt.h for CHECKSUM_CHECK_UDP: 1 -*/
-#define CHECKSUM_CHECK_UDP 0
-/*- Value in opt.h for CHECKSUM_CHECK_TCP: 1 -*/
-#define CHECKSUM_CHECK_TCP 0
-/*- Value in opt.h for 

[PATCH rtems-lwip v3 6/7] lwip.py: Add STM32 lwIP port to build

2022-09-08 Thread Duc Doan
---
 lwip.py | 21 +
 1 file changed, 21 insertions(+)

diff --git a/lwip.py b/lwip.py
index 593f0e0..2d8769d 100644
--- a/lwip.py
+++ b/lwip.py
@@ -92,6 +92,20 @@ common_source_files = [
 'rtemslwip/bsd_compat/rtems-kernel-program.c'
 ]
 
+stm32_drv_incl = [
+'stm32',
+'stm32/driver'
+]
+
+stm32_drv_src = [
+'stm32/ethernetif.c',
+'stm32/driver/dp83848.c'
+]
+
+stm32_stm32f4_drv_incl = [
+'rtemslwip/stm32f4'
+]
+
 
 def build(bld):
 source_files = []
@@ -127,6 +141,13 @@ def build(bld):
 drv_incl.append('cpsw/src/include')
 driver_source.extend(walk_sources('cpsw/src'))
 
+# These files will only compile for STM32F4 BSPs
+if bsp == 'stm32f4':
+driver_source.extend(walk_sources('rtemslwip/stm32f4'))
+drv_incl.extend(stm32_drv_incl)
+driver_source.extend(stm32_drv_src)
+drv_incl.extend(stm32_stm32f4_drv_incl)
+
 
 # These files will only compile for BSPs on Xilinx hardware
 is_xilinx_bsp = False
-- 
2.37.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH rtems-lwip v3 5/7] RTEMS port of lwIP for STM32 and STM32F4 BSP

2022-09-08 Thread Duc Doan
---
 rtemslwip/stm32f4/stm32f4_lwip.c |  14 
 rtemslwip/stm32f4/stm32f4_lwip.h |   9 +++
 stm32/ethernetif.c   | 110 ++-
 stm32/ethernetif.h   |   8 ++-
 stm32/lwip.h |   2 +
 5 files changed, 140 insertions(+), 3 deletions(-)
 create mode 100644 rtemslwip/stm32f4/stm32f4_lwip.c
 create mode 100644 rtemslwip/stm32f4/stm32f4_lwip.h

diff --git a/rtemslwip/stm32f4/stm32f4_lwip.c b/rtemslwip/stm32f4/stm32f4_lwip.c
new file mode 100644
index 000..1f4f07e
--- /dev/null
+++ b/rtemslwip/stm32f4/stm32f4_lwip.c
@@ -0,0 +1,14 @@
+#include "stm32f4_lwip.h"
+
+extern ETH_HandleTypeDef heth;
+
+__attribute__((weak)) void Error_Handler(void) {
+__disable_irq();
+while (1)
+{
+}
+}
+
+void ETH_IRQHandler(void) {
+HAL_ETH_IRQHandler();
+}
diff --git a/rtemslwip/stm32f4/stm32f4_lwip.h b/rtemslwip/stm32f4/stm32f4_lwip.h
new file mode 100644
index 000..8a2b03a
--- /dev/null
+++ b/rtemslwip/stm32f4/stm32f4_lwip.h
@@ -0,0 +1,9 @@
+#ifndef LIPLWIP_RTEMSLWIP_STM32F4_STM32F4_LWIP_H
+#define LIPLWIP_RTEMSLWIP_STM32F4_STM32F4_LWIP_H
+
+#include 
+
+void ErrorHandler(void);
+void ETH_IRQHandler(void);
+
+#endif /* LIPLWIP_RTEMSLWIP_STM32F4_STM32F4_LWIP_H */
diff --git a/stm32/ethernetif.c b/stm32/ethernetif.c
index 7a82c51..e71ac8f 100644
--- a/stm32/ethernetif.c
+++ b/stm32/ethernetif.c
@@ -19,7 +19,12 @@
 /* USER CODE END Header */
 
 /* Includes 
--*/
+#ifndef __rtems__
 #include "main.h"
+#else
+#include 
+#include 
+#endif /* __rtems__ */
 #include "lwip/opt.h"
 #include "lwip/timeouts.h"
 #include "netif/ethernet.h"
@@ -28,7 +33,9 @@
 #include "ethernetif.h"
 #include "dp83848.h"
 #include 
+#ifndef __rtems__
 #include "cmsis_os.h"
+#endif /* __rtems__ */
 #include "lwip/tcpip.h"
 
 /* Within 'USER CODE' section, code will be kept by default at each generation 
*/
@@ -38,7 +45,12 @@
 
 /* Private define 
*/
 /* The time to block waiting for input. */
+#ifndef __rtems__
 #define TIME_WAITING_FOR_INPUT ( portMAX_DELAY )
+#else
+#define TIME_WAITING_FOR_INPUT ( RTEMS_NO_TIMEOUT )
+#endif /* __rtems__ */
+
 /* USER CODE BEGIN OS_THREAD_STACK_SIZE_WITH_RTOS */
 /* Stack size of the interface thread */
 #define INTERFACE_THREAD_STACK_SIZE ( 350 )
@@ -109,12 +121,20 @@ ETH_DMADescTypeDef  DMATxDscrTab[ETH_TX_DESC_CNT]; /* 
Ethernet Tx DMA Descriptor
 
 /* USER CODE END 2 */
 
+#ifndef __rtems__
 osSemaphoreId RxPktSemaphore = NULL;   /* Semaphore to signal incoming packets 
*/
 osSemaphoreId TxPktSemaphore = NULL;   /* Semaphore to signal transmit packet 
complete */
+#else
+rtems_id RxPktSemaphore;   /* Semaphore to signal incoming packets */
+rtems_id TxPktSemaphore;   /* Semaphore to signal transmit packet complete */
+#endif /* __rtems__ */
 
 /* Global Ethernet handle */
 ETH_HandleTypeDef heth;
 ETH_TxPacketConfig TxConfig;
+#ifdef __rtems__
+static uint8_t *MACAddr;
+#endif /* __rtems__ */
 
 /* Private function prototypes 
---*/
 int32_t ETH_PHY_IO_Init(void);
@@ -144,7 +164,11 @@ void pbuf_free_custom(struct pbuf *p);
   */
 void HAL_ETH_RxCpltCallback(ETH_HandleTypeDef *handlerEth)
 {
+#ifndef __rtems__
   osSemaphoreRelease(RxPktSemaphore);
+#else
+  rtems_semaphore_release(RxPktSemaphore);
+#endif /* __rtems__ */
 }
 /**
   * @brief  Ethernet Tx Transfer completed callback
@@ -153,7 +177,11 @@ void HAL_ETH_RxCpltCallback(ETH_HandleTypeDef *handlerEth)
   */
 void HAL_ETH_TxCpltCallback(ETH_HandleTypeDef *handlerEth)
 {
+#ifndef __rtems__
   osSemaphoreRelease(TxPktSemaphore);
+#else
+  rtems_semaphore_release(TxPktSemaphore);
+#endif /* __rtems__ */
 }
 /**
   * @brief  Ethernet DMA transfer error callback
@@ -164,12 +192,21 @@ void HAL_ETH_ErrorCallback(ETH_HandleTypeDef *handlerEth)
 {
   if((HAL_ETH_GetDMAError(handlerEth) & ETH_DMASR_RBUS) == ETH_DMASR_RBUS)
   {
- osSemaphoreRelease(RxPktSemaphore);
+#ifndef __rtems__
+osSemaphoreRelease(RxPktSemaphore);
+#else
+rtems_semaphore_release(RxPktSemaphore);
+#endif /* __rtems__ */
   }
 }
 
 /* USER CODE BEGIN 4 */
-
+#ifdef __rtems__
+void set_mac_addr(uint8_t *mac_addr)
+{
+  MACAddr = mac_addr;
+}
+#endif /* __rtems__ */
 /* USER CODE END 4 */
 
 
/***
@@ -186,15 +223,20 @@ static void low_level_init(struct netif *netif)
 {
   HAL_StatusTypeDef hal_eth_init_status = HAL_OK;
 /* USER CODE BEGIN OS_THREAD_ATTR_CMSIS_RTOS_V2 */
+#ifndef __rtems__
   osThreadAttr_t attributes;
+#endif /* __rtems__ */
 /* USER CODE END OS_THREAD_ATTR_CMSIS_RTOS_V2 */
   uint32_t duplex, speed = 0;
   int32_t PHYLinkState = 0;
   ETH_MACConfigTypeDef MACConf = {0};
   /* Start ETH HAL Init */
 
+#ifndef __rtems__
uint8_t MACAddr[6] ;
+#endif /* __rtems__ */
   heth.Instance = ETH;
+#ifndef __rtems__
   MACAddr[0] = 0x02;
   

[PATCH rtems-lwip v3 3/7] Add STM32 Ethernet source

2022-09-08 Thread Duc Doan
This patch adds ST's Ethernet and lwIP port and DP83848 driver. The
files are generated using STM32CubeIDE with STM32F4 Cube FW v1.27.1,
under RTOS mode.
---
 COPYING.stm32  |  28 ++
 ORIGIN.stm32   |   2 +
 stm32/driver/dp83848.c | 664 +++
 stm32/driver/dp83848.h | 436 
 stm32/ethernetif.c | 879 +
 stm32/ethernetif.h |  47 +++
 stm32/lwip.h   |  76 
 7 files changed, 2132 insertions(+)
 create mode 100644 COPYING.stm32
 create mode 100644 ORIGIN.stm32
 create mode 100644 stm32/driver/dp83848.c
 create mode 100644 stm32/driver/dp83848.h
 create mode 100644 stm32/ethernetif.c
 create mode 100644 stm32/ethernetif.h
 create mode 100644 stm32/lwip.h

diff --git a/COPYING.stm32 b/COPYING.stm32
new file mode 100644
index 000..f42052b
--- /dev/null
+++ b/COPYING.stm32
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2022 STMicroelectronics.
+ * All rights reserved. 
+ * 
+ * Redistribution and use in source and binary forms, with or without 
modification, 
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *this list of conditions and the following disclaimer in the documentation
+ *and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *derived from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 
IMPLIED 
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 
EVENT 
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
PROCUREMENT 
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING 
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
POSSIBILITY 
+ * OF SUCH DAMAGE.
+ */
+
+
diff --git a/ORIGIN.stm32 b/ORIGIN.stm32
new file mode 100644
index 000..afc15ed
--- /dev/null
+++ b/ORIGIN.stm32
@@ -0,0 +1,2 @@
+The files under stm32/ directory are generated using STM32CubeIDE with 
+STM32F4 Cube FW v1.27.1, under RTOS mode.
diff --git a/stm32/driver/dp83848.c b/stm32/driver/dp83848.c
new file mode 100644
index 000..2c5d59b
--- /dev/null
+++ b/stm32/driver/dp83848.c
@@ -0,0 +1,664 @@
+/**
+  
**
+  * @filedp83848.c
+  * @author  MCD Application Team
+  * @brief   This file provides a set of functions needed to manage the DP83848
+  *  PHY devices.
+  
**
+  * @attention
+  *
+  *  Copyright (c) 2021 STMicroelectronics.
+  * All rights reserved.
+  *
+  * This software component is licensed by ST under BSD 3-Clause license,
+  * the "License"; You may not use this file except in compliance with the
+  * License. You may obtain a copy of the License at:
+  *opensource.org/licenses/BSD-3-Clause
+  *
+  
**
+  */
+
+/* Includes 
--*/
+#include "dp83848.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup Component
+  * @{
+  */
+
+/** @defgroup DP83848 DP83848
+  * @{
+  */
+
+/* Private typedef 
---*/
+/* Private define 
*/
+/** @defgroup DP83848_Private_Defines DP83848 Private Defines
+  * @{
+  */
+#define DP83848_SW_RESET_TO((uint32_t)500U)
+#define DP83848_INIT_TO((uint32_t)2000U)
+#define DP83848_MAX_DEV_ADDR   ((uint32_t)31U)
+/**
+  * @}
+  */
+
+/* Private macro 
-*/
+/* Private variables 
-*/
+/* Private function prototypes 
---*/
+/* Private functions 
-*/
+/** @defgroup DP83848_Private_Functions DP83848 Private Functions
+  * @{
+  */
+
+/**
+  * @brief  Register IO functions to component object
+  * @param  pObj: device object  of DP83848_Object_t.
+  * @param  ioctx: holds device IO functions.
+  * @retval DP83848_STATUS_OK  if OK
+  * DP83848_STATUS_ERROR if missing mandatory function
+  */
+int32_t  

[PATCH rtems-lwip v3 4/7] rtemslwip: Add STM32F4 lwipopts.h and netstart.c

2022-09-08 Thread Duc Doan
---
 rtemslwip/stm32f4/lwipopts.h | 147 +++
 rtemslwip/stm32f4/netstart.c |  74 ++
 2 files changed, 221 insertions(+)
 create mode 100644 rtemslwip/stm32f4/lwipopts.h
 create mode 100644 rtemslwip/stm32f4/netstart.c

diff --git a/rtemslwip/stm32f4/lwipopts.h b/rtemslwip/stm32f4/lwipopts.h
new file mode 100644
index 000..aa6b95b
--- /dev/null
+++ b/rtemslwip/stm32f4/lwipopts.h
@@ -0,0 +1,147 @@
+/* USER CODE BEGIN Header */
+/**
+  
**
+  * File Name  : Target/lwipopts.h
+  * Description: This file overrides LwIP stack default configuration
+  *  done in opt.h file.
+  
**
+  * @attention
+  *
+  * Copyright (c) 2022 STMicroelectronics.
+  * All rights reserved.
+  *
+  * This software is licensed under terms that can be found in the LICENSE file
+  * in the root directory of this software component.
+  * If no LICENSE file comes with this software, it is provided AS-IS.
+  *
+  
**
+  */
+/* USER CODE END Header */
+
+/* Define to prevent recursive inclusion 
--*/
+#ifndef __LWIPOPTS__H__
+#define __LWIPOPTS__H__
+
+/*-*/
+/* Current version of LwIP supported by CubeMx: 2.1.2 -*/
+/*-*/
+
+/* Within 'USER CODE' section, code will be kept by default at each generation 
*/
+/* USER CODE BEGIN 0 */
+#include 
+/* USER CODE END 0 */
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* STM32CubeMX Specific Parameters (not defined in opt.h) 
-*/
+/* Parameters set in STM32CubeMX LwIP Configuration GUI -*/
+/*- WITH_RTOS disabled (Since FREERTOS is not set) -*/
+#define WITH_RTOS 1
+/*- CHECKSUM_BY_HARDWARE disabled -*/
+#define CHECKSUM_BY_HARDWARE 0
+/*-*/
+
+/* LwIP Stack Parameters (modified compared to initialization value in opt.h) 
-*/
+/* Parameters set in STM32CubeMX LwIP Configuration GUI -*/
+/*- Default value in ETH configuration GUI in CubeMx: 1524 -*/
+#define ETH_RX_BUFFER_SIZE 1536
+/*- Value in opt.h for NO_SYS: 0 -*/
+#define NO_SYS 0
+/*- Value in opt.h for SYS_LIGHTWEIGHT_PROT: 1 -*/
+#define SYS_LIGHTWEIGHT_PROT 1
+/*- Value in opt.h for MEM_ALIGNMENT: 1 -*/
+#define MEM_ALIGNMENT 4
+/*- Default Value for H7 devices: 0x30044000 -*/
+//#define LWIP_RAM_HEAP_POINTER 0x20017f58
+/*- Value supported for H7 devices: 1 -*/
+#define LWIP_SUPPORT_CUSTOM_PBUF 1
+/*- Value in opt.h for LWIP_ETHERNET: LWIP_ARP || PPPOE_SUPPORT -*/
+#define LWIP_ETHERNET 1
+/*- Value in opt.h for LWIP_DNS_SECURE: (LWIP_DNS_SECURE_RAND_XID | 
LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING | LWIP_DNS_SECURE_RAND_SRC_PORT) -*/
+#define LWIP_DNS_SECURE 7
+/*- Value in opt.h for TCP_SND_QUEUELEN: (4*TCP_SND_BUF + (TCP_MSS - 
1))/TCP_MSS -*/
+#define TCP_SND_QUEUELEN 9
+/*- Value in opt.h for TCP_SNDLOWAT: LWIP_MIN(LWIP_MAX(((TCP_SND_BUF)/2), 
(2 * TCP_MSS) + 1), (TCP_SND_BUF) - 1) -*/
+#define TCP_SNDLOWAT 1071
+/*- Value in opt.h for TCP_SNDQUEUELOWAT: LWIP_MAX(TCP_SND_QUEUELEN)/2, 5) 
-*/
+#define TCP_SNDQUEUELOWAT 5
+/*- Value in opt.h for TCP_WND_UPDATE_THRESHOLD: LWIP_MIN(TCP_WND/4, 
TCP_MSS*4) -*/
+#define TCP_WND_UPDATE_THRESHOLD 536
+/*- Value in opt.h for LWIP_NETIF_LINK_CALLBACK: 0 -*/
+//#define LWIP_NETIF_LINK_CALLBACK 0
+/*- Value in opt.h for LWIP_NETCONN: 1 -*/
+#define LWIP_NETCONN 1
+/*- Value in opt.h for LWIP_SOCKET: 1 -*/
+#define LWIP_SOCKET 1
+/*- Value in opt.h for RECV_BUFSIZE_DEFAULT: INT_MAX -*/
+//#define RECV_BUFSIZE_DEFAULT 20
+/*- Value in opt.h for LWIP_STATS: 1 -*/
+#define LWIP_STATS 0
+/*- Value in opt.h for CHECKSUM_GEN_IP: 1 -*/
+#define CHECKSUM_GEN_IP 0
+/*- Value in opt.h for CHECKSUM_GEN_UDP: 1 -*/
+#define CHECKSUM_GEN_UDP 0
+/*- Value in opt.h for CHECKSUM_GEN_TCP: 1 -*/
+#define CHECKSUM_GEN_TCP 0
+/*- Value in opt.h for CHECKSUM_GEN_ICMP: 1 -*/
+#define CHECKSUM_GEN_ICMP 0
+/*- Value in opt.h for CHECKSUM_GEN_ICMP6: 1 -*/
+#define CHECKSUM_GEN_ICMP6 0
+/*- Value in opt.h for CHECKSUM_CHECK_IP: 1 -*/
+#define CHECKSUM_CHECK_IP 0
+/*- Value in opt.h for CHECKSUM_CHECK_UDP: 1 -*/
+#define CHECKSUM_CHECK_UDP 0
+/*- Value in opt.h for CHECKSUM_CHECK_TCP: 1 -*/
+#define CHECKSUM_CHECK_TCP 0
+/*- Value in opt.h for CHECKSUM_CHECK_ICMP: 1 -*/
+#define CHECKSUM_CHECK_ICMP 0
+/*- Value in opt.h for CHECKSUM_CHECK_ICMP6: 1 -*/
+#define CHECKSUM_CHECK_ICMP6 0
+/*- Default Value for 

[PATCH rtems-lwip v3 2/7] lwip.py: Use ant_glob instead of os.walk()

2022-09-08 Thread Duc Doan
Updates #4714
---
 lwip.py | 10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/lwip.py b/lwip.py
index 1f0b8e2..593f0e0 100644
--- a/lwip.py
+++ b/lwip.py
@@ -110,15 +110,7 @@ def build(bld):
 source_files.extend(common_source_files)
 
 def walk_sources(path):
-sources = []
-for root, dirs, files in os.walk(path):
-for name in files:
-ext = os.path.splitext(name)[1]
-src_root = os.path.split(root)
-path = os.path.join(src_root[0], src_root[1])
-if ext == '.c' or ext == '.S':
-sources.append(os.path.join(path, name))
-return sources
+return bld.path.ant_glob([path + '/**/*.c', path + '/**/*.S']) 
 
 if arch == 'arm':
 # These files will not compile for BSPs other than TMS570
-- 
2.37.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH rtems-lwip v3 0/7] lwIP port for STM32F4 BSP

2022-09-08 Thread Duc Doan
This patch set aims to port RTEMS lwIP for STM32F4 BSP. It also contains
generic drivers for STM32 chips in general. It is tested with a TCP echo
server application on STM32F407 Discovery Board.

Prerequisite: this patch set requires my STM32F4 patches to be applied
because it uses STM32 HAL.

v2:
- Changes the arch and BSP check to use rtems.arch and rtems.bsp
- Updates #4714: replace os.walk by ant_glob
- Group STM32F4 BSP-specific files together

v3:
- Make BSP check exact
- Add ORIGIN.stm32 and COPYING.stm32
- Imported files under stm32/ are now generated by STM32CubeIDE under
RTOS mode
- Remove unused lwip.c

Duc Doan (7):
  lwip.py: Change arch and bsp check method
  lwip.py: Use ant_glob instead of os.walk()
  Add STM32 Ethernet source
  rtemslwip: Add STM32F4 lwipopts.h and netstart.c
  RTEMS port of lwIP for STM32 and STM32F4 BSP
  lwip.py: Add STM32 lwIP port to build
  stm32: Convert to Unix line endings

 COPYING.stm32|  28 +
 ORIGIN.stm32 |   2 +
 lwip.py  |  66 ++-
 rtemslwip/stm32f4/lwipopts.h | 147 +
 rtemslwip/stm32f4/netstart.c |  74 +++
 rtemslwip/stm32f4/stm32f4_lwip.c |  14 +
 rtemslwip/stm32f4/stm32f4_lwip.h |   9 +
 stm32/driver/dp83848.c   | 664 +
 stm32/driver/dp83848.h   | 436 ++
 stm32/ethernetif.c   | 985 +++
 stm32/ethernetif.h   |  53 ++
 stm32/lwip.h |  78 +++
 12 files changed, 2532 insertions(+), 24 deletions(-)
 create mode 100644 COPYING.stm32
 create mode 100644 ORIGIN.stm32
 create mode 100644 rtemslwip/stm32f4/lwipopts.h
 create mode 100644 rtemslwip/stm32f4/netstart.c
 create mode 100644 rtemslwip/stm32f4/stm32f4_lwip.c
 create mode 100644 rtemslwip/stm32f4/stm32f4_lwip.h
 create mode 100644 stm32/driver/dp83848.c
 create mode 100644 stm32/driver/dp83848.h
 create mode 100644 stm32/ethernetif.c
 create mode 100644 stm32/ethernetif.h
 create mode 100644 stm32/lwip.h

-- 
2.37.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH rtems-lwip v3 1/7] lwip.py: Change arch and bsp check method

2022-09-08 Thread Duc Doan
---
 lwip.py | 31 ++-
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/lwip.py b/lwip.py
index 84eef2c..1f0b8e2 100644
--- a/lwip.py
+++ b/lwip.py
@@ -99,6 +99,8 @@ def build(bld):
 drv_incl = []
 arch_lib_path = rtems.arch_bsp_lib_path(bld.env.RTEMS_VERSION,
 bld.env.RTEMS_ARCH_BSP)
+arch = rtems.arch(bld.env.RTEMS_ARCH_BSP)
+bsp = rtems.bsp(bld.env.RTEMS_ARCH_BSP)
 with open('file-import.json', 'r') as cf:
 files = json.load(cf)
 for f in files['files-to-import']:
@@ -118,27 +120,30 @@ def build(bld):
 sources.append(os.path.join(path, name))
 return sources
 
-# These files will not compile for BSPs other than TMS570
-if bld.env.RTEMS_ARCH_BSP.startswith('arm-rtems6-tms570ls3137_hdk'):
-drv_incl.append('uLan/ports/driver/tms570_emac')
-drv_incl.append('uLan/ports/os')
-driver_source.extend(walk_sources('uLan/ports/driver/tms570_emac'))
+if arch == 'arm':
+# These files will not compile for BSPs other than TMS570
+if bsp in ['tms570ls3137_hdk', 'tms570ls3137_hdk_intram', \
+   'tms570ls3137_hdk_sdram', 'tms570ls3137_hdk_with_loader']:
+drv_incl.append('uLan/ports/driver/tms570_emac')
+drv_incl.append('uLan/ports/os')
+driver_source.extend(walk_sources('uLan/ports/driver/tms570_emac'))
+
+# These files will only compile for BeagleBone BSPs
+if bsp in ['beagleboneblack', 'beaglebonewhite']:
+driver_source.extend(walk_sources('rtemslwip/beaglebone'))
+drv_incl.append('rtemslwip/beaglebone')
+drv_incl.append('cpsw/src/include')
+driver_source.extend(walk_sources('cpsw/src'))
 
-# These files will only compile for BeagleBone BSPs
-if bld.env.RTEMS_ARCH_BSP.startswith('arm-rtems6-beaglebone'):
-driver_source.extend(walk_sources('rtemslwip/beaglebone'))
-drv_incl.append('rtemslwip/beaglebone')
-drv_incl.append('cpsw/src/include')
-driver_source.extend(walk_sources('cpsw/src'))
 
 # These files will only compile for BSPs on Xilinx hardware
 is_xilinx_bsp = False
 is_aarch64_bsp = False
 is_qemu = False
-if bld.env.RTEMS_ARCH_BSP.startswith('aarch64-rtems6-xilinx_zynqmp'):
+if arch == 'aarch64' and bsp in ['xilinx_zynqmp_ultra96']:
 is_xilinx_bsp = True
 is_aarch64_bsp = True
-if bld.env.RTEMS_ARCH_BSP.endswith('_qemu'):
+if bsp in ['xilinx_zynq_a9_qemu']:
 is_qemu = True
 if is_xilinx_bsp:
 drv_incl.extend(xilinx_drv_incl)
-- 
2.37.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH RSB] rtems-tools-6.cfg: Bump hash to update BSP list

2022-09-08 Thread Joel Sherrill
---
 rtems/config/tools/rtems-tools-6.cfg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rtems/config/tools/rtems-tools-6.cfg 
b/rtems/config/tools/rtems-tools-6.cfg
index d7522fd..14ee346 100644
--- a/rtems/config/tools/rtems-tools-6.cfg
+++ b/rtems/config/tools/rtems-tools-6.cfg
@@ -10,14 +10,14 @@
  %define rtems_tools_source rtems-tools-%{rtems_tools_version}
  %define rtems_tools_ext xz
 %else
- %define rtems_tools_version 1cd476e155b3bb236b9bf5f79614cdced8d416a0
+ %define rtems_tools_version 53a8d8591433f72052c2216433fd53b37f018f65
  %define rtems_tools_ext bz2
 %endif
 
 %define rtems_tools_source rtems-tools-%{rtems_tools_version}
 %source set rtems-tools 
https://git.rtems.org/rtems-tools/snapshot/%{rtems_tools_source}.tar.%{rtems_tools_ext}
 %hash   sha512 rtems-tools-%{rtems_tools_version}.tar.bz2 \
-
oJ5RzHDsye/mM8cicHE9lD8avxlv/ZYbXjNO2MPMCwHHhDThSh7O0hi70ywaGLrQXSt1mywvKwDwBNH3hJRiEQ==
+
e9HwcZQlo9Vk8ZDL/K3oN+77UF4FJ/R3HjZdqZExnByEwB65bRSxdt2JyI74Z8paQudJtrR1dbB0OCMoEyO8zA==
 
 #
 # Optionally enable/disable building the RTEMS Tools via the command line.
-- 
1.8.3.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 00/15] Synchronize libcrypt and libmd with FreeBSD

2022-09-08 Thread Sebastian Huber

On 08/09/2022 16:27, Joel Sherrill wrote:


On Thu, Sep 8, 2022 at 9:26 AM Sebastian Huber 
> wrote:


On 08/09/2022 16:21, Joel Sherrill wrote:
 > Were there no updates to md4/md5 code in libmd? git blame shows
md4.c as
 > having mostly no updates in 15 years.

These hashes are obsolete for cryptographic purposes.


But they are good checksums. And we have the code. What's the upstream 
for it?


I don't have time to do this right now.

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 00/15] Synchronize libcrypt and libmd with FreeBSD

2022-09-08 Thread Joel Sherrill
On Thu, Sep 8, 2022 at 9:26 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> On 08/09/2022 16:21, Joel Sherrill wrote:
> > Were there no updates to md4/md5 code in libmd? git blame shows md4.c as
> > having mostly no updates in 15 years.
>
> These hashes are obsolete for cryptographic purposes.
>

But they are good checksums. And we have the code. What's the upstream for
it?

--joel

>
> --
> embedded brains GmbH
> Herr Sebastian HUBER
> Dornierstr. 4
> 82178 Puchheim
> Germany
> email: sebastian.hu...@embedded-brains.de
> phone: +49-89-18 94 741 - 16
> fax:   +49-89-18 94 741 - 08
>
> Registergericht: Amtsgericht München
> Registernummer: HRB 157899
> Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
> Unsere Datenschutzerklärung finden Sie hier:
> https://embedded-brains.de/datenschutzerklaerung/
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] minimum: Do not use unified work areas

2022-09-08 Thread Joel Sherrill
OK. Minimum is supposed to be just that. If something is in it which can be
trimmed out, it is up for discussion.

This looks good to me.

On Thu, Sep 8, 2022 at 9:15 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> The CONFIGURE_UNIFIED_WORK_AREAS option pulls in a system initialization
> handler which initializes the unified heap.
>
> Close #4108.
> ---
>  testsuites/samples/minimum/init.c | 15 ---
>  1 file changed, 15 deletions(-)
>
> diff --git a/testsuites/samples/minimum/init.c
> b/testsuites/samples/minimum/init.c
> index 347b6ce991..ee14a1aef4 100644
> --- a/testsuites/samples/minimum/init.c
> +++ b/testsuites/samples/minimum/init.c
> @@ -104,21 +104,6 @@ static void *Init( uintptr_t ignored )
>   */
>  #define CONFIGURE_MAXIMUM_PRIORITY 15
>
> -/*
> - *  This configures RTEMS to use a single memory pool for the RTEMS
> Workspace
> - *  and C Program Heap.  If not defined, there will be separate memory
> pools
> - *  for the RTEMS Workspace and C Program Heap.  Having separate pools
> - *  does haved some advantages in the event a task blows a stack or writes
> - *  outside its memory area. However, in low memory systems the overhead
> of
> - *  the two pools plus the potential for unused memory in either pool is
> - *  very undesirable.
> - *
> - *  In high memory environments, this is desirable when you want to use
> - *  the RTEMS "unlimited" objects option.  You will be able to create
> objects
> - *  until you run out of memory.
> - */
> -#define CONFIGURE_UNIFIED_WORK_AREAS
> -
>  /*
>   *  In this application, the initialization task performs the system
>   *  initialization and then transforms itself into the idle task.
> --
> 2.35.3
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 00/15] Synchronize libcrypt and libmd with FreeBSD

2022-09-08 Thread Sebastian Huber

On 08/09/2022 16:21, Joel Sherrill wrote:
Were there no updates to md4/md5 code in libmd? git blame shows md4.c as 
having mostly no updates in 15 years.


These hashes are obsolete for cryptographic purposes.

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 00/15] Synchronize libcrypt and libmd with FreeBSD

2022-09-08 Thread Joel Sherrill
Were there no updates to md4/md5 code in libmd? git blame shows md4.c as
having mostly no updates in 15 years.

--joel

On Thu, Sep 8, 2022 at 8:27 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> Alan Somers (1):
>   Fix C++ includability of crypto headers with static array sizes
>
> Allan Jude (2):
>   Replace sys/crypto/sha2/sha2.c with lib/libmd/sha512c.c
>   Implement SHA-512 truncated (224 and 256 bits)
>
> Colin Percival (1):
>   Retune SHA2 code for improved performance on CPUs
>
> Conrad Meyer (2):
>   crypto routines: Hint minimum buffer sizes to the compiler
>   Implement SHA2-224 submode of SHA2-256
>
> Pedro F. Giffuni (2):
>   General further adoption of SPDX licensing ID tags.
>   lib: further adoption of SPDX licensing ID tags.
>
> Sebastian Huber (4):
>   libtests/sha: Add tests for SHA224
>   libtests/sha: Add tests for SHA384
>   libtests/sha: Add tests for SHA512-224
>   libtests/sha: Add tests for SHA512-256
>
> Xin LI (3):
>   libmd: Always erase context in _Final method,
>   Get rid of unused variables.
>   libcrypt: There is no need to clear message digest
>
>  cpukit/include/sha224.h|  62 ++
>  cpukit/include/sha256.h|  16 +-
>  cpukit/include/sha384.h|  61 ++
>  cpukit/include/sha512.h|  17 +-
>  cpukit/include/sha512t.h   |  68 ++
>  cpukit/libcrypt/crypt-md5.c|   2 +
>  cpukit/libcrypt/crypt-sha256.c |  15 +-
>  cpukit/libcrypt/crypt-sha512.c |  15 +-
>  cpukit/libcrypt/misc.c |   4 +-
>  cpukit/libmd/sha256c.c | 230 
>  cpukit/libmd/sha512c.c | 377 +++--
>  testsuites/libtests/sha/init.c | 215 ++-
>  12 files changed, 843 insertions(+), 239 deletions(-)
>  create mode 100644 cpukit/include/sha224.h
>  create mode 100644 cpukit/include/sha384.h
>  create mode 100644 cpukit/include/sha512t.h
>
> --
> 2.35.3
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH] minimum: Do not use unified work areas

2022-09-08 Thread Sebastian Huber
The CONFIGURE_UNIFIED_WORK_AREAS option pulls in a system initialization
handler which initializes the unified heap.

Close #4108.
---
 testsuites/samples/minimum/init.c | 15 ---
 1 file changed, 15 deletions(-)

diff --git a/testsuites/samples/minimum/init.c 
b/testsuites/samples/minimum/init.c
index 347b6ce991..ee14a1aef4 100644
--- a/testsuites/samples/minimum/init.c
+++ b/testsuites/samples/minimum/init.c
@@ -104,21 +104,6 @@ static void *Init( uintptr_t ignored )
  */
 #define CONFIGURE_MAXIMUM_PRIORITY 15
 
-/*
- *  This configures RTEMS to use a single memory pool for the RTEMS Workspace
- *  and C Program Heap.  If not defined, there will be separate memory pools
- *  for the RTEMS Workspace and C Program Heap.  Having separate pools
- *  does haved some advantages in the event a task blows a stack or writes
- *  outside its memory area. However, in low memory systems the overhead of
- *  the two pools plus the potential for unused memory in either pool is
- *  very undesirable.
- *
- *  In high memory environments, this is desirable when you want to use
- *  the RTEMS "unlimited" objects option.  You will be able to create objects
- *  until you run out of memory.
- */
-#define CONFIGURE_UNIFIED_WORK_AREAS
-
 /*
  *  In this application, the initialization task performs the system
  *  initialization and then transforms itself into the idle task.
-- 
2.35.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH] score: Improve formatting

2022-09-08 Thread Joel Sherrill
On Thu, Sep 8, 2022 at 2:40 AM Chris Johns  wrote:

> On 8/9/2022 5:23 pm, Sebastian Huber wrote:
> > On 08/09/2022 08:56, Chris Johns wrote:
> >> Is the score going to be run through clang-format?
> >
> > I gave up finding the proper clang-format configuration which is close
> > to the RTEMS style.
>
> I thought it was decided to get as close as possible and adjust the
> style where it was not possible.
>
> > Is there someone else working on this?
>
> Did Gedare say he would look into this?
>

Yes. He mentored Ida and the last I knew the configuration was within
one configuration option of being able to match our style.

--joel

>
> Chris
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH 10/15] libtests/sha: Add tests for SHA512-224

2022-09-08 Thread Sebastian Huber
---
 testsuites/libtests/sha/init.c | 50 ++
 1 file changed, 50 insertions(+)

diff --git a/testsuites/libtests/sha/init.c b/testsuites/libtests/sha/init.c
index 43ba8e843d..6d29c3c8d0 100644
--- a/testsuites/libtests/sha/init.c
+++ b/testsuites/libtests/sha/init.c
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -174,6 +175,31 @@ 
test_sha512_results[RTEMS_ARRAY_SIZE(test_vectors)][SHA512_DIGEST_LENGTH] = {
   }
 };
 
+static const unsigned char test_sha512_224_results
+[RTEMS_ARRAY_SIZE(test_vectors)][SHA512_224_DIGEST_LENGTH] = {
+  {
+0x46, 0x34, 0x27, 0x0f, 0x70, 0x7b, 0x6a, 0x54,
+0xda, 0xae, 0x75, 0x30, 0x46, 0x08, 0x42, 0xe2,
+0x0e, 0x37, 0xed, 0x26, 0x5c, 0xee, 0xe9, 0xa4,
+0x3e, 0x89, 0x24, 0xaa
+  }, {
+0x6e, 0xd0, 0xdd, 0x02, 0x80, 0x6f, 0xa8, 0x9e,
+0x25, 0xde, 0x06, 0x0c, 0x19, 0xd3, 0xac, 0x86,
+0xca, 0xbb, 0x87, 0xd6, 0xa0, 0xdd, 0xd0, 0x5c,
+0x33, 0x3b, 0x84, 0xf4
+  }, {
+0xe5, 0x30, 0x2d, 0x6d, 0x54, 0xbb, 0x24, 0x22,
+0x75, 0xd1, 0xe7, 0x62, 0x2d, 0x68, 0xdf, 0x6e,
+0xb0, 0x2d, 0xed, 0xd1, 0x3f, 0x56, 0x4c, 0x13,
+0xdb, 0xda, 0x21, 0x74
+  }, {
+0x23, 0xfe, 0xc5, 0xbb, 0x94, 0xd6, 0x0b, 0x23,
+0x30, 0x81, 0x92, 0x64, 0x0b, 0x0c, 0x45, 0x33,
+0x35, 0xd6, 0x64, 0x73, 0x4f, 0xe4, 0x0e, 0x72,
+0x68, 0x67, 0x4a, 0xf9
+  }
+};
+
 static void print_result(const unsigned char *r, size_t n)
 {
   size_t i;
@@ -285,6 +311,29 @@ static void test_sha512(void)
   }
 }
 
+static void test_sha512_224(void)
+{
+  size_t i;
+
+  printf("test SHA512-224\n");
+
+  for (i = 0; i < RTEMS_ARRAY_SIZE(test_vectors); ++i) {
+SHA512_CTX ctx;
+unsigned char r[SHA512_224_DIGEST_LENGTH];
+const char *s = test_vectors[i];
+
+SHA512_224_Init();
+SHA512_224_Update(, s, strlen(s));
+SHA512_224_Final(r, );
+
+print_result([0], sizeof(r));
+
+rtems_test_assert(
+  memcmp([0], _sha512_224_results[i][0], sizeof(r)) == 0
+);
+  }
+}
+
 static void Init(rtems_task_argument arg)
 {
   TEST_BEGIN();
@@ -293,6 +342,7 @@ static void Init(rtems_task_argument arg)
   test_sha256();
   test_sha384();
   test_sha512();
+  test_sha512_224();
   rtems_stack_checker_report_usage();
 
   TEST_END();
-- 
2.35.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 14/15] Get rid of unused variables.

2022-09-08 Thread Sebastian Huber
From: Xin LI 

copied_key and copied_salt are assigned with NULL and never used
otherwise. Remove the two variables and related code.

Reviewed by:pfg
MFC after:  2 weeks
Differential Revision:  https://reviews.freebsd.org/D16314
---
 cpukit/libcrypt/crypt-sha256.c | 9 +
 cpukit/libcrypt/crypt-sha512.c | 9 +
 2 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/cpukit/libcrypt/crypt-sha256.c b/cpukit/libcrypt/crypt-sha256.c
index a70b92cc85..f6d510219e 100644
--- a/cpukit/libcrypt/crypt-sha256.c
+++ b/cpukit/libcrypt/crypt-sha256.c
@@ -69,15 +69,12 @@ crypt_sha256_r(const char *key, const char *salt, struct 
crypt_data *data)
uint8_t alt_result[32], temp_result[32];
SHA256_CTX ctx, alt_ctx;
size_t salt_len, key_len, cnt, rounds;
-   char *cp, *copied_key, *copied_salt, *p_bytes, *s_bytes, *endp;
+   char *cp, *p_bytes, *s_bytes, *endp;
const char *num;
bool rounds_custom;
char *buffer = >buffer[0];
int buflen = (int)sizeof(data->buffer);
 
-   copied_key = NULL;
-   copied_salt = NULL;
-
/* Default number of rounds. */
rounds = ROUNDS_DEFAULT;
rounds_custom = false;
@@ -262,10 +259,6 @@ crypt_sha256_r(const char *key, const char *salt, struct 
crypt_data *data)
memset(s_bytes, '\0', salt_len);
memset(, '\0', sizeof(ctx));
memset(_ctx, '\0', sizeof(alt_ctx));
-   if (copied_key != NULL)
-   memset(copied_key, '\0', key_len);
-   if (copied_salt != NULL)
-   memset(copied_salt, '\0', salt_len);
 
return buffer;
 }
diff --git a/cpukit/libcrypt/crypt-sha512.c b/cpukit/libcrypt/crypt-sha512.c
index 901b352ec5..6d680348a6 100644
--- a/cpukit/libcrypt/crypt-sha512.c
+++ b/cpukit/libcrypt/crypt-sha512.c
@@ -69,15 +69,12 @@ crypt_sha512_r(const char *key, const char *salt, struct 
crypt_data *data)
uint8_t alt_result[64], temp_result[64];
SHA512_CTX ctx, alt_ctx;
size_t salt_len, key_len, cnt, rounds;
-   char *cp, *copied_key, *copied_salt, *p_bytes, *s_bytes, *endp;
+   char *cp, *p_bytes, *s_bytes, *endp;
const char *num;
bool rounds_custom;
char *buffer = >buffer[0];
int buflen = (int)sizeof(data->buffer);
 
-   copied_key = NULL;
-   copied_salt = NULL;
-
/* Default number of rounds. */
rounds = ROUNDS_DEFAULT;
rounds_custom = false;
@@ -274,10 +271,6 @@ crypt_sha512_r(const char *key, const char *salt, struct 
crypt_data *data)
memset(s_bytes, '\0', salt_len);
memset(, '\0', sizeof(ctx));
memset(_ctx, '\0', sizeof(alt_ctx));
-   if (copied_key != NULL)
-   memset(copied_key, '\0', key_len);
-   if (copied_salt != NULL)
-   memset(copied_salt, '\0', salt_len);
 
return buffer;
 }
-- 
2.35.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 04/15] Retune SHA2 code for improved performance on CPUs

2022-09-08 Thread Sebastian Huber
From: Colin Percival 

with more ILP and a preference for memory load instructions over large code
footprints with embedded immediate variables.

On amd64 CPUs from 2007-2008 there is not a significant change, but
amd64 CPUs from 2009-2010 get roughly 10% more throughput with this
code; amd64 CPUs from 2011-2012 get roughly 15% more throughput; and
AMD64 CPUs from 2013-2015 get 20-25% more throughput.  The Raspberry
Pi 2 increases its throughput by 6-8%.

Sponsored by:   Tarsnap Backup Inc.
Performance tested by:  allanjude
MFC after:  3 weeks
---
 cpukit/libmd/sha256c.c | 174 -
 cpukit/libmd/sha512c.c | 214 +
 2 files changed, 198 insertions(+), 190 deletions(-)

diff --git a/cpukit/libmd/sha256c.c b/cpukit/libmd/sha256c.c
index f5a453e43b..197de94586 100644
--- a/cpukit/libmd/sha256c.c
+++ b/cpukit/libmd/sha256c.c
@@ -74,6 +74,26 @@ be32dec_vect(uint32_t *dst, const unsigned char *src, size_t 
len)
 
 #endif /* BYTE_ORDER != BIG_ENDIAN */
 
+/* SHA256 round constants. */
+static const uint32_t K[64] = {
+   0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
+   0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
+   0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
+   0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
+   0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
+   0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
+   0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
+   0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
+   0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
+   0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
+   0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
+   0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
+   0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
+   0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
+   0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
+   0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
+};
+
 /* Elementary functions used by SHA256 */
 #define Ch(x, y, z)((x & (y ^ z)) ^ z)
 #define Maj(x, y, z)   ((x & (y | z)) | (y & z))
@@ -86,18 +106,21 @@ be32dec_vect(uint32_t *dst, const unsigned char *src, 
size_t len)
 
 /* SHA256 round function */
 #define RND(a, b, c, d, e, f, g, h, k) \
-   t0 = h + S1(e) + Ch(e, f, g) + k;   \
-   t1 = S0(a) + Maj(a, b, c);  \
-   d += t0;\
-   h  = t0 + t1;
+   h += S1(e) + Ch(e, f, g) + k;   \
+   d += h; \
+   h += S0(a) + Maj(a, b, c);
 
 /* Adjusted round function for rotating state */
-#define RNDr(S, W, i, k)   \
+#define RNDr(S, W, i, ii)  \
RND(S[(64 - i) % 8], S[(65 - i) % 8],   \
S[(66 - i) % 8], S[(67 - i) % 8],   \
S[(68 - i) % 8], S[(69 - i) % 8],   \
S[(70 - i) % 8], S[(71 - i) % 8],   \
-   W[i] + k)
+   W[i + ii] + K[i + ii])
+
+/* Message schedule computation */
+#define MSCH(W, ii, i) \
+   W[i + ii + 16] = s1(W[i + ii + 14]) + W[i + ii + 9] + s0(W[i + ii + 1]) 
+ W[i + ii]
 
 /*
  * SHA256 block compression function.  The 256-bit state is transformed via
@@ -108,82 +131,52 @@ SHA256_Transform(uint32_t * state, const unsigned char 
block[64])
 {
uint32_t W[64];
uint32_t S[8];
-   uint32_t t0, t1;
int i;
 
-   /* 1. Prepare message schedule W. */
+   /* 1. Prepare the first part of the message schedule W. */
be32dec_vect(W, block, 64);
-   for (i = 16; i < 64; i++)
-   W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16];
 
/* 2. Initialize working variables. */
memcpy(S, state, 32);
 
/* 3. Mix. */
-   RNDr(S, W, 0, 0x428a2f98);
-   RNDr(S, W, 1, 0x71374491);
-   RNDr(S, W, 2, 0xb5c0fbcf);
-   RNDr(S, W, 3, 0xe9b5dba5);
-   RNDr(S, W, 4, 0x3956c25b);
-   RNDr(S, W, 5, 0x59f111f1);
-   RNDr(S, W, 6, 0x923f82a4);
-   RNDr(S, W, 7, 0xab1c5ed5);
-   RNDr(S, W, 8, 0xd807aa98);
-   RNDr(S, W, 9, 0x12835b01);
-   RNDr(S, W, 10, 0x243185be);
-   RNDr(S, W, 11, 0x550c7dc3);
-   RNDr(S, W, 12, 0x72be5d74);
-   RNDr(S, W, 13, 0x80deb1fe);
-   RNDr(S, W, 14, 0x9bdc06a7);
-   RNDr(S, W, 15, 0xc19bf174);
-   RNDr(S, W, 16, 0xe49b69c1);
-   RNDr(S, W, 17, 0xefbe4786);
-   RNDr(S, W, 18, 0x0fc19dc6);
-   RNDr(S, W, 19, 0x240ca1cc);
-   RNDr(S, W, 20, 0x2de92c6f);
-   RNDr(S, W, 21, 0x4a7484aa);
-   RNDr(S, W, 22, 0x5cb0a9dc);
-   RNDr(S, W, 23, 0x76f988da);
-   RNDr(S, W, 24, 0x983e5152);
-   RNDr(S, W, 25, 0xa831c66d);
-   RNDr(S, W, 26, 0xb00327c8);
-   RNDr(S, W, 27, 0xbf597fc7);
-   RNDr(S, W, 28, 0xc6e00bf3);
-   RNDr(S, W, 29, 0xd5a79147);
-   RNDr(S, W, 30, 0x06ca6351);
-   RNDr(S, W, 

[PATCH 06/15] Implement SHA2-224 submode of SHA2-256

2022-09-08 Thread Sebastian Huber
From: Conrad Meyer 

Like SHA2-384:SHA2-512, SHA2-224 is simply a truncated SHA2-256 with a
different initial vector.  Add to round out the complete basic SHA2 family.
---
 cpukit/include/sha224.h | 62 +
 cpukit/libmd/sha256c.c  | 51 +
 2 files changed, 113 insertions(+)
 create mode 100644 cpukit/include/sha224.h

diff --git a/cpukit/include/sha224.h b/cpukit/include/sha224.h
new file mode 100644
index 00..3085c7fcb2
--- /dev/null
+++ b/cpukit/include/sha224.h
@@ -0,0 +1,62 @@
+/*-
+ * Copyright 2005 Colin Percival
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _SHA224_H_
+#define _SHA224_H_
+
+#ifndef _KERNEL
+#include 
+#endif
+
+#define SHA224_BLOCK_LENGTH64
+#define SHA224_DIGEST_LENGTH   28
+#define SHA224_DIGEST_STRING_LENGTH(SHA224_DIGEST_LENGTH * 2 + 1)
+
+typedef struct SHA224Context {
+   uint32_t state[8];
+   uint64_t count;
+   uint8_t buf[SHA224_BLOCK_LENGTH];
+} SHA224_CTX;
+
+__BEGIN_DECLS
+
+void   SHA224_Init(SHA224_CTX *);
+void   SHA224_Update(SHA224_CTX *, const void *, size_t);
+void   SHA224_Final(unsigned char [__min_size(SHA224_DIGEST_LENGTH)],
+SHA224_CTX *);
+#ifndef _KERNEL
+char   *SHA224_End(SHA224_CTX *, char *);
+char   *SHA224_Data(const void *, unsigned int, char *);
+char   *SHA224_Fd(int, char *);
+char   *SHA224_FdChunk(int, char *, off_t, off_t);
+char   *SHA224_File(const char *, char *);
+char   *SHA224_FileChunk(const char *, char *, off_t, off_t);
+#endif
+__END_DECLS
+
+#endif /* !_SHA224_H_ */
diff --git a/cpukit/libmd/sha256c.c b/cpukit/libmd/sha256c.c
index 197de94586..7fd568a2ab 100644
--- a/cpukit/libmd/sha256c.c
+++ b/cpukit/libmd/sha256c.c
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#include "sha224.h"
 #include "sha256.h"
 
 #if BYTE_ORDER == BIG_ENDIAN
@@ -296,3 +297,53 @@ SHA256_Final(unsigned char digest[static 
SHA256_DIGEST_LENGTH], SHA256_CTX *ctx)
/* Clear the context state */
memset(ctx, 0, sizeof(*ctx));
 }
+
+/*** SHA-224: */
+/*
+ * the SHA224 and SHA256 transforms are identical
+ */
+
+/* SHA-224 initialization.  Begins a SHA-224 operation. */
+void
+SHA224_Init(SHA224_CTX * ctx)
+{
+
+   /* Zero bits processed so far */
+   ctx->count = 0;
+
+   /* Magic initialization constants */
+   ctx->state[0] = 0xC1059ED8;
+   ctx->state[1] = 0x367CD507;
+   ctx->state[2] = 0x3070DD17;
+   ctx->state[3] = 0xF70E5939;
+   ctx->state[4] = 0xFFC00B31;
+   ctx->state[5] = 0x68581511;
+   ctx->state[6] = 0x64f98FA7;
+   ctx->state[7] = 0xBEFA4FA4;
+}
+
+/* Add bytes into the SHA-224 hash */
+void
+SHA224_Update(SHA224_CTX * ctx, const void *in, size_t len)
+{
+
+   SHA256_Update((SHA256_CTX *)ctx, in, len);
+}
+
+/*
+ * SHA-224 finalization.  Pads the input data, exports the hash value,
+ * and clears the context state.
+ */
+void
+SHA224_Final(unsigned char digest[static SHA224_DIGEST_LENGTH], SHA224_CTX 
*ctx)
+{
+
+   /* Add padding */
+   SHA256_Pad((SHA256_CTX *)ctx);
+
+   /* Write the hash */
+   be32enc_vect(digest, ctx->state, SHA224_DIGEST_LENGTH);
+
+   /* Clear the context state */
+   explicit_bzero(ctx, sizeof(*ctx));
+}
-- 
2.35.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 09/15] libtests/sha: Add tests for SHA384

2022-09-08 Thread Sebastian Huber
---
 testsuites/libtests/sha/init.c | 58 ++
 1 file changed, 58 insertions(+)

diff --git a/testsuites/libtests/sha/init.c b/testsuites/libtests/sha/init.c
index 49cc17db44..43ba8e843d 100644
--- a/testsuites/libtests/sha/init.c
+++ b/testsuites/libtests/sha/init.c
@@ -31,6 +31,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -99,6 +100,39 @@ 
test_sha256_results[RTEMS_ARRAY_SIZE(test_vectors)][SHA256_DIGEST_LENGTH] = {
   }
 };
 
+static const unsigned char
+test_sha384_results[RTEMS_ARRAY_SIZE(test_vectors)][SHA384_DIGEST_LENGTH] = {
+  {
+0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b,
+0xb5, 0xa0, 0x3d, 0x69, 0x9a, 0xc6, 0x50, 0x07,
+0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63,
+0x1a, 0x8b, 0x60, 0x5a, 0x43, 0xff, 0x5b, 0xed,
+0x80, 0x86, 0x07, 0x2b, 0xa1, 0xe7, 0xcc, 0x23,
+0x58, 0xba, 0xec, 0xa1, 0x34, 0xc8, 0x25, 0xa7
+  }, {
+0x38, 0xb0, 0x60, 0xa7, 0x51, 0xac, 0x96, 0x38,
+0x4c, 0xd9, 0x32, 0x7e, 0xb1, 0xb1, 0xe3, 0x6a,
+0x21, 0xfd, 0xb7, 0x11, 0x14, 0xbe, 0x07, 0x43,
+0x4c, 0x0c, 0xc7, 0xbf, 0x63, 0xf6, 0xe1, 0xda,
+0x27, 0x4e, 0xde, 0xbf, 0xe7, 0x6f, 0x65, 0xfb,
+0xd5, 0x1a, 0xd2, 0xf1, 0x48, 0x98, 0xb9, 0x5b
+  }, {
+0x33, 0x91, 0xfd, 0xdd, 0xfc, 0x8d, 0xc7, 0x39,
+0x37, 0x07, 0xa6, 0x5b, 0x1b, 0x47, 0x09, 0x39,
+0x7c, 0xf8, 0xb1, 0xd1, 0x62, 0xaf, 0x05, 0xab,
+0xfe, 0x8f, 0x45, 0x0d, 0xe5, 0xf3, 0x6b, 0xc6,
+0xb0, 0x45, 0x5a, 0x85, 0x20, 0xbc, 0x4e, 0x6f,
+0x5f, 0xe9, 0x5b, 0x1f, 0xe3, 0xc8, 0x45, 0x2b
+  }, {
+0x09, 0x33, 0x0c, 0x33, 0xf7, 0x11, 0x47, 0xe8,
+0x3d, 0x19, 0x2f, 0xc7, 0x82, 0xcd, 0x1b, 0x47,
+0x53, 0x11, 0x1b, 0x17, 0x3b, 0x3b, 0x05, 0xd2,
+0x2f, 0xa0, 0x80, 0x86, 0xe3, 0xb0, 0xf7, 0x12,
+0xfc, 0xc7, 0xc7, 0x1a, 0x55, 0x7e, 0x2d, 0xb9,
+0x66, 0xc3, 0xe9, 0xfa, 0x91, 0x74, 0x60, 0x39
+  }
+};
+
 static const unsigned char
 test_sha512_results[RTEMS_ARRAY_SIZE(test_vectors)][SHA512_DIGEST_LENGTH] = {
   {
@@ -205,6 +239,29 @@ static void test_sha256(void)
   }
 }
 
+static void test_sha384(void)
+{
+  size_t i;
+
+  printf("test SHA384\n");
+
+  for (i = 0; i < RTEMS_ARRAY_SIZE(test_vectors); ++i) {
+SHA384_CTX ctx;
+unsigned char r[SHA384_DIGEST_LENGTH];
+const char *s = test_vectors[i];
+
+SHA384_Init();
+SHA384_Update(, s, strlen(s));
+SHA384_Final(r, );
+
+print_result([0], sizeof(r));
+
+rtems_test_assert(
+  memcmp([0], _sha384_results[i][0], sizeof(r)) == 0
+);
+  }
+}
+
 static void test_sha512(void)
 {
   size_t i;
@@ -234,6 +291,7 @@ static void Init(rtems_task_argument arg)
 
   test_sha224();
   test_sha256();
+  test_sha384();
   test_sha512();
   rtems_stack_checker_report_usage();
 
-- 
2.35.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 12/15] General further adoption of SPDX licensing ID tags.

2022-09-08 Thread Sebastian Huber
From: "Pedro F. Giffuni" 

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
---
 cpukit/libcrypt/misc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cpukit/libcrypt/misc.c b/cpukit/libcrypt/misc.c
index 5daffba391..b553068f10 100644
--- a/cpukit/libcrypt/misc.c
+++ b/cpukit/libcrypt/misc.c
@@ -1,4 +1,6 @@
-/*
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
  * Copyright (c) 1999
  *  University of California.  All rights reserved.
  *
-- 
2.35.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 15/15] libcrypt: There is no need to clear message digest

2022-09-08 Thread Sebastian Huber
From: Xin LI 

context after they are finialized after r336539, so do not do it.

Submitted by:   David CARLIER 
MFC after:  1 month (after r336539)
Differential Revision:  https://reviews.freebsd.org/D16059
---
 cpukit/libcrypt/crypt-sha256.c | 2 --
 cpukit/libcrypt/crypt-sha512.c | 2 --
 2 files changed, 4 deletions(-)

diff --git a/cpukit/libcrypt/crypt-sha256.c b/cpukit/libcrypt/crypt-sha256.c
index f6d510219e..24373680f7 100644
--- a/cpukit/libcrypt/crypt-sha256.c
+++ b/cpukit/libcrypt/crypt-sha256.c
@@ -257,8 +257,6 @@ crypt_sha256_r(const char *key, const char *salt, struct 
crypt_data *data)
memset(temp_result, '\0', sizeof(temp_result));
memset(p_bytes, '\0', key_len);
memset(s_bytes, '\0', salt_len);
-   memset(, '\0', sizeof(ctx));
-   memset(_ctx, '\0', sizeof(alt_ctx));
 
return buffer;
 }
diff --git a/cpukit/libcrypt/crypt-sha512.c b/cpukit/libcrypt/crypt-sha512.c
index 6d680348a6..da8acd7790 100644
--- a/cpukit/libcrypt/crypt-sha512.c
+++ b/cpukit/libcrypt/crypt-sha512.c
@@ -269,8 +269,6 @@ crypt_sha512_r(const char *key, const char *salt, struct 
crypt_data *data)
memset(temp_result, '\0', sizeof(temp_result));
memset(p_bytes, '\0', key_len);
memset(s_bytes, '\0', salt_len);
-   memset(, '\0', sizeof(ctx));
-   memset(_ctx, '\0', sizeof(alt_ctx));
 
return buffer;
 }
-- 
2.35.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 11/15] libtests/sha: Add tests for SHA512-256

2022-09-08 Thread Sebastian Huber
---
 testsuites/libtests/sha/init.c | 49 ++
 1 file changed, 49 insertions(+)

diff --git a/testsuites/libtests/sha/init.c b/testsuites/libtests/sha/init.c
index 6d29c3c8d0..ccb20750ec 100644
--- a/testsuites/libtests/sha/init.c
+++ b/testsuites/libtests/sha/init.c
@@ -200,6 +200,31 @@ static const unsigned char test_sha512_224_results
   }
 };
 
+static const unsigned char test_sha512_256_results
+[RTEMS_ARRAY_SIZE(test_vectors)][SHA512_256_DIGEST_LENGTH] = {
+  {
+0x53, 0x04, 0x8e, 0x26, 0x81, 0x94, 0x1e, 0xf9,
+0x9b, 0x2e, 0x29, 0xb7, 0x6b, 0x4c, 0x7d, 0xab,
+0xe4, 0xc2, 0xd0, 0xc6, 0x34, 0xfc, 0x6d, 0x46,
+0xe0, 0xe2, 0xf1, 0x31, 0x07, 0xe7, 0xaf, 0x23
+  }, {
+0xc6, 0x72, 0xb8, 0xd1, 0xef, 0x56, 0xed, 0x28,
+0xab, 0x87, 0xc3, 0x62, 0x2c, 0x51, 0x14, 0x06,
+0x9b, 0xdd, 0x3a, 0xd7, 0xb8, 0xf9, 0x73, 0x74,
+0x98, 0xd0, 0xc0, 0x1e, 0xce, 0xf0, 0x96, 0x7a
+  }, {
+0xbd, 0xe8, 0xe1, 0xf9, 0xf1, 0x9b, 0xb9, 0xfd,
+0x34, 0x06, 0xc9, 0x0e, 0xc6, 0xbc, 0x47, 0xbd,
+0x36, 0xd8, 0xad, 0xa9, 0xf1, 0x18, 0x80, 0xdb,
+0xc8, 0xa2, 0x2a, 0x70, 0x78, 0xb6, 0xa4, 0x61
+  }, {
+0x39, 0x28, 0xe1, 0x84, 0xfb, 0x86, 0x90, 0xf8,
+0x40, 0xda, 0x39, 0x88, 0x12, 0x1d, 0x31, 0xbe,
+0x65, 0xcb, 0x9d, 0x3e, 0xf8, 0x3e, 0xe6, 0x14,
+0x6f, 0xea, 0xc8, 0x61, 0xe1, 0x9b, 0x56, 0x3a
+  }
+};
+
 static void print_result(const unsigned char *r, size_t n)
 {
   size_t i;
@@ -334,6 +359,29 @@ static void test_sha512_224(void)
   }
 }
 
+static void test_sha512_256(void)
+{
+  size_t i;
+
+  printf("test SHA512-256\n");
+
+  for (i = 0; i < RTEMS_ARRAY_SIZE(test_vectors); ++i) {
+SHA512_CTX ctx;
+unsigned char r[SHA512_256_DIGEST_LENGTH];
+const char *s = test_vectors[i];
+
+SHA512_256_Init();
+SHA512_256_Update(, s, strlen(s));
+SHA512_256_Final(r, );
+
+print_result([0], sizeof(r));
+
+rtems_test_assert(
+  memcmp([0], _sha512_256_results[i][0], sizeof(r)) == 0
+);
+  }
+}
+
 static void Init(rtems_task_argument arg)
 {
   TEST_BEGIN();
@@ -343,6 +391,7 @@ static void Init(rtems_task_argument arg)
   test_sha384();
   test_sha512();
   test_sha512_224();
+  test_sha512_256();
   rtems_stack_checker_report_usage();
 
   TEST_END();
-- 
2.35.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 08/15] libtests/sha: Add tests for SHA224

2022-09-08 Thread Sebastian Huber
---
 testsuites/libtests/sha/init.c | 58 +++---
 1 file changed, 54 insertions(+), 4 deletions(-)

diff --git a/testsuites/libtests/sha/init.c b/testsuites/libtests/sha/init.c
index c65517253a..49cc17db44 100644
--- a/testsuites/libtests/sha/init.c
+++ b/testsuites/libtests/sha/init.c
@@ -29,6 +29,7 @@
 #include "config.h"
 #endif
 
+#include 
 #include 
 #include 
 #include 
@@ -49,7 +50,32 @@ static const char *const test_vectors[] = {
 };
 
 static const unsigned char
-test_sha256_results[RTEMS_ARRAY_SIZE(test_vectors)][32] = {
+test_sha224_results[RTEMS_ARRAY_SIZE(test_vectors)][SHA224_DIGEST_LENGTH] = {
+  {
+0x23, 0x09, 0x7d, 0x22, 0x34, 0x05, 0xd8, 0x22,
+0x86, 0x42, 0xa4, 0x77, 0xbd, 0xa2, 0x55, 0xb3,
+0x2a, 0xad, 0xbc, 0xe4, 0xbd, 0xa0, 0xb3, 0xf7,
+0xe3, 0x6c, 0x9d, 0xa7
+  }, {
+0xd1, 0x4a, 0x02, 0x8c, 0x2a, 0x3a, 0x2b, 0xc9,
+0x47, 0x61, 0x02, 0xbb, 0x28, 0x82, 0x34, 0xc4,
+0x15, 0xa2, 0xb0, 0x1f, 0x82, 0x8e, 0xa6, 0x2a,
+0xc5, 0xb3, 0xe4, 0x2f
+  }, {
+0x75, 0x38, 0x8b, 0x16, 0x51, 0x27, 0x76, 0xcc,
+0x5d, 0xba, 0x5d, 0xa1, 0xfd, 0x89, 0x01, 0x50,
+0xb0, 0xc6, 0x45, 0x5c, 0xb4, 0xf5, 0x8b, 0x19,
+0x52, 0x52, 0x25, 0x25
+  }, {
+0xc9, 0x7c, 0xa9, 0xa5, 0x59, 0x85, 0x0c, 0xe9,
+0x7a, 0x04, 0xa9, 0x6d, 0xef, 0x6d, 0x99, 0xa9,
+0xe0, 0xe0, 0xe2, 0xab, 0x14, 0xe6, 0xb8, 0xdf,
+0x26, 0x5f, 0xc0, 0xb3
+  }
+};
+
+static const unsigned char
+test_sha256_results[RTEMS_ARRAY_SIZE(test_vectors)][SHA256_DIGEST_LENGTH] = {
   {
 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea,
 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,
@@ -74,7 +100,7 @@ test_sha256_results[RTEMS_ARRAY_SIZE(test_vectors)][32] = {
 };
 
 static const unsigned char
-test_sha512_results[RTEMS_ARRAY_SIZE(test_vectors)][64] = {
+test_sha512_results[RTEMS_ARRAY_SIZE(test_vectors)][SHA512_DIGEST_LENGTH] = {
   {
 0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba,
 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31,
@@ -133,6 +159,29 @@ static void print_result(const unsigned char *r, size_t n)
   printf("\n");
 }
 
+static void test_sha224(void)
+{
+  size_t i;
+
+  printf("test SHA224\n");
+
+  for (i = 0; i < RTEMS_ARRAY_SIZE(test_vectors); ++i) {
+SHA224_CTX ctx;
+unsigned char r[SHA224_DIGEST_LENGTH];
+const char *s = test_vectors[i];
+
+SHA224_Init();
+SHA224_Update(, s, strlen(s));
+SHA224_Final(r, );
+
+print_result([0], sizeof(r));
+
+rtems_test_assert(
+  memcmp([0], _sha224_results[i][0], sizeof(r)) == 0
+);
+  }
+}
+
 static void test_sha256(void)
 {
   size_t i;
@@ -141,7 +190,7 @@ static void test_sha256(void)
 
   for (i = 0; i < RTEMS_ARRAY_SIZE(test_vectors); ++i) {
 SHA256_CTX ctx;
-unsigned char r[32];
+unsigned char r[SHA256_DIGEST_LENGTH];
 const char *s = test_vectors[i];
 
 SHA256_Init();
@@ -164,7 +213,7 @@ static void test_sha512(void)
 
   for (i = 0; i < RTEMS_ARRAY_SIZE(test_vectors); ++i) {
 SHA512_CTX ctx;
-unsigned char r[64];
+unsigned char r[SHA512_DIGEST_LENGTH];
 const char *s = test_vectors[i];
 
 SHA512_Init();
@@ -183,6 +232,7 @@ static void Init(rtems_task_argument arg)
 {
   TEST_BEGIN();
 
+  test_sha224();
   test_sha256();
   test_sha512();
   rtems_stack_checker_report_usage();
-- 
2.35.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 13/15] lib: further adoption of SPDX licensing ID tags.

2022-09-08 Thread Sebastian Huber
From: "Pedro F. Giffuni" 

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using mis-identified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
---
 cpukit/libcrypt/crypt-md5.c| 2 ++
 cpukit/libcrypt/crypt-sha256.c | 4 +++-
 cpukit/libcrypt/crypt-sha512.c | 4 +++-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/cpukit/libcrypt/crypt-md5.c b/cpukit/libcrypt/crypt-md5.c
index c60dcf8973..ca86bcd9b7 100644
--- a/cpukit/libcrypt/crypt-md5.c
+++ b/cpukit/libcrypt/crypt-md5.c
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2003 Poul-Henning Kamp
  * All rights reserved.
  *
diff --git a/cpukit/libcrypt/crypt-sha256.c b/cpukit/libcrypt/crypt-sha256.c
index 7a677284b5..a70b92cc85 100644
--- a/cpukit/libcrypt/crypt-sha256.c
+++ b/cpukit/libcrypt/crypt-sha256.c
@@ -1,4 +1,6 @@
-/*
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2011 The FreeBSD Project. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff --git a/cpukit/libcrypt/crypt-sha512.c b/cpukit/libcrypt/crypt-sha512.c
index d418b8946a..901b352ec5 100644
--- a/cpukit/libcrypt/crypt-sha512.c
+++ b/cpukit/libcrypt/crypt-sha512.c
@@ -1,4 +1,6 @@
-/*
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2011 The FreeBSD Project. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
-- 
2.35.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 07/15] libmd: Always erase context in _Final method,

2022-09-08 Thread Sebastian Huber
From: Xin LI 

and when doing it, consistently use explicit_bzero().

Update manual pages to match the behavior.

Reviewed by:pfg, allanjude, jmg
MFC after:  1 month
Differential Revision:  https://reviews.freebsd.org/D16316
---
 cpukit/libmd/sha256c.c | 2 +-
 cpukit/libmd/sha512c.c | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/cpukit/libmd/sha256c.c b/cpukit/libmd/sha256c.c
index 7fd568a2ab..563f9e2099 100644
--- a/cpukit/libmd/sha256c.c
+++ b/cpukit/libmd/sha256c.c
@@ -295,7 +295,7 @@ SHA256_Final(unsigned char digest[static 
SHA256_DIGEST_LENGTH], SHA256_CTX *ctx)
be32enc_vect(digest, ctx->state, SHA256_DIGEST_LENGTH);
 
/* Clear the context state */
-   memset(ctx, 0, sizeof(*ctx));
+   explicit_bzero(ctx, sizeof(*ctx));
 }
 
 /*** SHA-224: */
diff --git a/cpukit/libmd/sha512c.c b/cpukit/libmd/sha512c.c
index daeef9d671..0b03d09fa9 100644
--- a/cpukit/libmd/sha512c.c
+++ b/cpukit/libmd/sha512c.c
@@ -327,7 +327,7 @@ SHA512_Final(unsigned char digest[static 
SHA512_DIGEST_LENGTH], SHA512_CTX *ctx)
be64enc_vect(digest, ctx->state, SHA512_DIGEST_LENGTH);
 
/* Clear the context state */
-   memset(ctx, 0, sizeof(*ctx));
+   explicit_bzero(ctx, sizeof(*ctx));
 }
 
 /*** SHA-512t: */
@@ -370,7 +370,7 @@ SHA512_224_Final(unsigned char digest[static 
SHA512_224_DIGEST_LENGTH], SHA512_C
be64enc_vect(digest, ctx->state, SHA512_224_DIGEST_LENGTH);
 
/* Clear the context state */
-   memset(ctx, 0, sizeof(*ctx));
+   explicit_bzero(ctx, sizeof(*ctx));
 }
 
 void
@@ -409,7 +409,7 @@ SHA512_256_Final(unsigned char digest[static 
SHA512_256_DIGEST_LENGTH], SHA512_C
be64enc_vect(digest, ctx->state, SHA512_256_DIGEST_LENGTH);
 
/* Clear the context state */
-   memset(ctx, 0, sizeof(*ctx));
+   explicit_bzero(ctx, sizeof(*ctx));
 }
 
 /*** SHA-384: */
@@ -459,5 +459,5 @@ SHA384_Final(unsigned char digest[static 
SHA384_DIGEST_LENGTH], SHA384_CTX *ctx)
be64enc_vect(digest, ctx->state, SHA384_DIGEST_LENGTH);
 
/* Clear the context state */
-   memset(ctx, 0, sizeof(*ctx));
+   explicit_bzero(ctx, sizeof(*ctx));
 }
-- 
2.35.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 05/15] Fix C++ includability of crypto headers with static array sizes

2022-09-08 Thread Sebastian Huber
From: Alan Somers 

C99 allows array function parameters to use the static keyword for their
sizes. This tells the compiler that the parameter will have at least the
specified size, and calling code will fail to compile if that guarantee is
not met. However, this syntax is not legal in C++.

This commit reverts r300824, which worked around the problem for
sys/sys/md5.h only, and introduces a new macro: min_size(). min_size(x) can
be used in headers as a static array size, but will still compile in C++
mode.

Reviewed by:cem, ed
MFC after:  4 weeks
Sponsored by:   Spectra Logic Corp
Differential Revision:  https://reviews.freebsd.org/D8277
---
 cpukit/include/sha256.h  | 3 ++-
 cpukit/include/sha384.h  | 3 ++-
 cpukit/include/sha512.h  | 3 ++-
 cpukit/include/sha512t.h | 6 --
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/cpukit/include/sha256.h b/cpukit/include/sha256.h
index 4fe35935c0..f612713f3d 100644
--- a/cpukit/include/sha256.h
+++ b/cpukit/include/sha256.h
@@ -47,7 +47,8 @@ __BEGIN_DECLS
 
 void   SHA256_Init(SHA256_CTX *);
 void   SHA256_Update(SHA256_CTX *, const void *, size_t);
-void   SHA256_Final(unsigned char [static SHA256_DIGEST_LENGTH], SHA256_CTX *);
+void   SHA256_Final(unsigned char [__min_size(SHA256_DIGEST_LENGTH)],
+SHA256_CTX *);
 #ifndef _KERNEL
 char   *SHA256_End(SHA256_CTX *, char *);
 char   *SHA256_Data(const void *, unsigned int, char *);
diff --git a/cpukit/include/sha384.h b/cpukit/include/sha384.h
index 52f69efc95..4306d4195b 100644
--- a/cpukit/include/sha384.h
+++ b/cpukit/include/sha384.h
@@ -47,7 +47,8 @@ __BEGIN_DECLS
 
 void   SHA384_Init(SHA384_CTX *);
 void   SHA384_Update(SHA384_CTX *, const void *, size_t);
-void   SHA384_Final(unsigned char [static SHA384_DIGEST_LENGTH], SHA384_CTX *);
+void   SHA384_Final(unsigned char [__min_size(SHA384_DIGEST_LENGTH)],
+SHA384_CTX *);
 #ifndef _KERNEL
 char   *SHA384_End(SHA384_CTX *, char *);
 char   *SHA384_Data(const void *, unsigned int, char *);
diff --git a/cpukit/include/sha512.h b/cpukit/include/sha512.h
index de7d19abb3..89fbe0516e 100644
--- a/cpukit/include/sha512.h
+++ b/cpukit/include/sha512.h
@@ -47,7 +47,8 @@ __BEGIN_DECLS
 
 void   SHA512_Init(SHA512_CTX *);
 void   SHA512_Update(SHA512_CTX *, const void *, size_t);
-void   SHA512_Final(unsigned char [static SHA512_DIGEST_LENGTH], SHA512_CTX *);
+void   SHA512_Final(unsigned char [__min_size(SHA512_DIGEST_LENGTH)],
+SHA512_CTX *);
 #ifndef _KERNEL
 char   *SHA512_End(SHA512_CTX *, char *);
 char   *SHA512_Data(const void *, unsigned int, char *);
diff --git a/cpukit/include/sha512t.h b/cpukit/include/sha512t.h
index 20f206f141..f48606a393 100644
--- a/cpukit/include/sha512t.h
+++ b/cpukit/include/sha512t.h
@@ -44,7 +44,8 @@ __BEGIN_DECLS
 
 void   SHA512_224_Init(SHA512_CTX *);
 void   SHA512_224_Update(SHA512_CTX *, const void *, size_t);
-void   SHA512_224_Final(unsigned char [static SHA512_224_DIGEST_LENGTH], 
SHA512_CTX *);
+void   SHA512_224_Final(unsigned char [__min_size(SHA512_224_DIGEST_LENGTH)],
+SHA512_CTX *);
 #ifndef _KERNEL
 char   *SHA512_224_End(SHA512_CTX *, char *);
 char   *SHA512_224_Data(const void *, unsigned int, char *);
@@ -53,7 +54,8 @@ char   *SHA512_224_FileChunk(const char *, char *, off_t, 
off_t);
 #endif
 void   SHA512_256_Init(SHA512_CTX *);
 void   SHA512_256_Update(SHA512_CTX *, const void *, size_t);
-void   SHA512_256_Final(unsigned char [static SHA512_256_DIGEST_LENGTH], 
SHA512_CTX *);
+void   SHA512_256_Final(unsigned char [__min_size(SHA512_256_DIGEST_LENGTH)],
+SHA512_CTX *);
 #ifndef _KERNEL
 char   *SHA512_256_End(SHA512_CTX *, char *);
 char   *SHA512_256_Data(const void *, unsigned int, char *);
-- 
2.35.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 01/15] Replace sys/crypto/sha2/sha2.c with lib/libmd/sha512c.c

2022-09-08 Thread Sebastian Huber
From: Allan Jude 

cperciva's libmd implementation is 5-30% faster

The same was done for SHA256 previously in r263218

cperciva's implementation was lacking SHA-384 which I implemented, validated 
against OpenSSL and the NIST documentation

Extend sbin/md5 to create sha384(1)

Chase dependancies on sys/crypto/sha2/sha2.{c,h} and replace them with 
sha512{c.c,.h}

Reviewed by:cperciva, des, delphij
Approved by:secteam, bapt (mentor)
MFC after:  2 weeks
Sponsored by:   ScaleEngine Inc.
Differential Revision:  https://reviews.freebsd.org/D3929
---
 cpukit/include/sha256.h | 15 ++--
 cpukit/include/sha384.h | 60 
 cpukit/include/sha512.h | 16 +++--
 cpukit/libmd/sha512c.c  | 77 ++---
 4 files changed, 149 insertions(+), 19 deletions(-)
 create mode 100644 cpukit/include/sha384.h

diff --git a/cpukit/include/sha256.h b/cpukit/include/sha256.h
index 1b6a4f4c57..9deed91255 100644
--- a/cpukit/include/sha256.h
+++ b/cpukit/include/sha256.h
@@ -29,22 +29,31 @@
 #ifndef _SHA256_H_
 #define _SHA256_H_
 
+#ifndef _KERNEL
 #include 
+#endif
+
+#define SHA256_BLOCK_LENGTH64
+#define SHA256_DIGEST_LENGTH   32
+#define SHA256_DIGEST_STRING_LENGTH(SHA256_DIGEST_LENGTH * 2 + 1)
 
 typedef struct SHA256Context {
uint32_t state[8];
uint64_t count;
-   unsigned char buf[64];
+   uint8_t buf[SHA256_BLOCK_LENGTH];
 } SHA256_CTX;
 
 __BEGIN_DECLS
+
 void   SHA256_Init(SHA256_CTX *);
 void   SHA256_Update(SHA256_CTX *, const void *, size_t);
-void   SHA256_Final(unsigned char [32], SHA256_CTX *);
+void   SHA256_Final(unsigned char [SHA256_DIGEST_LENGTH], SHA256_CTX *);
+#ifndef _KERNEL
 char   *SHA256_End(SHA256_CTX *, char *);
+char   *SHA256_Data(const void *, unsigned int, char *);
 char   *SHA256_File(const char *, char *);
 char   *SHA256_FileChunk(const char *, char *, off_t, off_t);
-char   *SHA256_Data(const void *, unsigned int, char *);
+#endif
 __END_DECLS
 
 #endif /* !_SHA256_H_ */
diff --git a/cpukit/include/sha384.h b/cpukit/include/sha384.h
new file mode 100644
index 00..2035d6ff54
--- /dev/null
+++ b/cpukit/include/sha384.h
@@ -0,0 +1,60 @@
+/*-
+ * Copyright 2005 Colin Percival
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _SHA384_H_
+#define _SHA384_H_
+
+#ifndef _KERNEL
+#include 
+#endif
+
+#define SHA384_BLOCK_LENGTH128
+#define SHA384_DIGEST_LENGTH   48
+#define SHA384_DIGEST_STRING_LENGTH(SHA384_DIGEST_LENGTH * 2 + 1)
+
+typedef struct SHA384Context {
+   uint64_t state[8];
+   uint64_t count[2];
+   uint8_t buf[SHA384_BLOCK_LENGTH];
+} SHA384_CTX;
+
+__BEGIN_DECLS
+
+void   SHA384_Init(SHA384_CTX *);
+void   SHA384_Update(SHA384_CTX *, const void *, size_t);
+void   SHA384_Final(unsigned char [SHA384_DIGEST_LENGTH], SHA384_CTX *);
+#ifndef _KERNEL
+char   *SHA384_End(SHA384_CTX *, char *);
+char   *SHA384_Data(const void *, unsigned int, char *);
+char   *SHA384_File(const char *, char *);
+char   *SHA384_FileChunk(const char *, char *, off_t, off_t);
+#endif
+
+__END_DECLS
+
+#endif /* !_SHA384_H_ */
diff --git a/cpukit/include/sha512.h b/cpukit/include/sha512.h
index 8998f4c5bf..1964562160 100644
--- a/cpukit/include/sha512.h
+++ b/cpukit/include/sha512.h
@@ -29,22 +29,32 @@
 #ifndef _SHA512_H_
 #define _SHA512_H_
 
+#ifndef _KERNEL
 #include 
+#endif
+
+#define SHA512_BLOCK_LENGTH128
+#define SHA512_DIGEST_LENGTH   64
+#define SHA512_DIGEST_STRING_LENGTH(SHA512_DIGEST_LENGTH * 2 + 1)
 
 typedef struct SHA512Context {
uint64_t state[8];
uint64_t count[2];
-   unsigned char buf[128];
+

[PATCH 03/15] Implement SHA-512 truncated (224 and 256 bits)

2022-09-08 Thread Sebastian Huber
From: Allan Jude 

This implements SHA-512/256, which generates a 256 bit hash by
calculating the SHA-512 then truncating the result. A different initial
value is used, making the result different from the first 256 bits of
the SHA-512 of the same input. SHA-512 is ~50% faster than SHA-256 on
64bit platforms, so the result is a faster 256 bit hash.

The main goal of this implementation is to enable support for this
faster hashing algorithm in ZFS. The feature was introduced into ZFS
in r289422, but is disconnected because SHA-512/256 support was missing.
A further commit will enable it in ZFS.

This is the follow on to r292782

Reviewed by:cem
Sponsored by:   ScaleEngine Inc.
Differential Revision:  https://reviews.freebsd.org/D6061
---
 cpukit/include/sha512t.h | 66 +++
 cpukit/libmd/sha512c.c   | 84 
 2 files changed, 150 insertions(+)
 create mode 100644 cpukit/include/sha512t.h

diff --git a/cpukit/include/sha512t.h b/cpukit/include/sha512t.h
new file mode 100644
index 00..20f206f141
--- /dev/null
+++ b/cpukit/include/sha512t.h
@@ -0,0 +1,66 @@
+/*-
+ * Copyright (c) 2015 Allan Jude 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _SHA512T_H_
+#define _SHA512T_H_
+
+#include "sha512.h"
+
+#ifndef _KERNEL
+#include 
+#endif
+
+#define SHA512_224_DIGEST_LENGTH   28
+#define SHA512_224_DIGEST_STRING_LENGTH(SHA512_224_DIGEST_LENGTH * 2 + 
1)
+#define SHA512_256_DIGEST_LENGTH   32
+#define SHA512_256_DIGEST_STRING_LENGTH(SHA512_256_DIGEST_LENGTH * 2 + 
1)
+
+__BEGIN_DECLS
+
+void   SHA512_224_Init(SHA512_CTX *);
+void   SHA512_224_Update(SHA512_CTX *, const void *, size_t);
+void   SHA512_224_Final(unsigned char [static SHA512_224_DIGEST_LENGTH], 
SHA512_CTX *);
+#ifndef _KERNEL
+char   *SHA512_224_End(SHA512_CTX *, char *);
+char   *SHA512_224_Data(const void *, unsigned int, char *);
+char   *SHA512_224_File(const char *, char *);
+char   *SHA512_224_FileChunk(const char *, char *, off_t, off_t);
+#endif
+void   SHA512_256_Init(SHA512_CTX *);
+void   SHA512_256_Update(SHA512_CTX *, const void *, size_t);
+void   SHA512_256_Final(unsigned char [static SHA512_256_DIGEST_LENGTH], 
SHA512_CTX *);
+#ifndef _KERNEL
+char   *SHA512_256_End(SHA512_CTX *, char *);
+char   *SHA512_256_Data(const void *, unsigned int, char *);
+char   *SHA512_256_File(const char *, char *);
+char   *SHA512_256_FileChunk(const char *, char *, off_t, off_t);
+#endif
+
+__END_DECLS
+
+#endif /* !_SHA512T_H_ */
diff --git a/cpukit/libmd/sha512c.c b/cpukit/libmd/sha512c.c
index a93d8a44d8..abc5fd113b 100644
--- a/cpukit/libmd/sha512c.c
+++ b/cpukit/libmd/sha512c.c
@@ -1,5 +1,6 @@
 /*-
  * Copyright 2005 Colin Percival
+ * Copyright (c) 2015 Allan Jude 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -33,6 +34,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include "sha512.h"
+#include "sha512t.h"
 #include "sha384.h"
 
 #if BYTE_ORDER == BIG_ENDIAN
@@ -320,6 +322,88 @@ SHA512_Final(unsigned char digest[static 
SHA512_DIGEST_LENGTH], SHA512_CTX *ctx)
memset(ctx, 0, sizeof(*ctx));
 }
 
+/*** SHA-512t: */
+/*
+ * the SHA512t transforms are identical to SHA512 so reuse the existing 
function
+ */
+void
+SHA512_224_Init(SHA512_CTX * ctx)
+{
+
+   /* Zero bits processed so far */
+   ctx->count[0] = ctx->count[1] = 0;
+
+   /* Magic initialization constants */
+   ctx->state[0] = 0x8c3d37c819544da2ULL;
+   ctx->state[1] = 0x73e1996689dcd4d6ULL;
+   ctx->state[2] = 0x1dfab7ae32ff9c82ULL;
+   ctx->state[3] = 

[PATCH 02/15] crypto routines: Hint minimum buffer sizes to the compiler

2022-09-08 Thread Sebastian Huber
From: Conrad Meyer 

Use the C99 'static' keyword to hint to the compiler IVs and output digest
sizes.  The keyword informs the compiler of the minimum valid size for a given
array.  Obviously not every pointer can be validated (i.e., the compiler can
produce false negative but not false positive reports).

No functional change.  No ABI change.

Sponsored by:   EMC / Isilon Storage Division
---
 cpukit/include/sha256.h | 2 +-
 cpukit/include/sha384.h | 2 +-
 cpukit/include/sha512.h | 2 +-
 cpukit/libmd/sha256c.c  | 5 +++--
 cpukit/libmd/sha512c.c  | 8 
 5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/cpukit/include/sha256.h b/cpukit/include/sha256.h
index 9deed91255..4fe35935c0 100644
--- a/cpukit/include/sha256.h
+++ b/cpukit/include/sha256.h
@@ -47,7 +47,7 @@ __BEGIN_DECLS
 
 void   SHA256_Init(SHA256_CTX *);
 void   SHA256_Update(SHA256_CTX *, const void *, size_t);
-void   SHA256_Final(unsigned char [SHA256_DIGEST_LENGTH], SHA256_CTX *);
+void   SHA256_Final(unsigned char [static SHA256_DIGEST_LENGTH], SHA256_CTX *);
 #ifndef _KERNEL
 char   *SHA256_End(SHA256_CTX *, char *);
 char   *SHA256_Data(const void *, unsigned int, char *);
diff --git a/cpukit/include/sha384.h b/cpukit/include/sha384.h
index 2035d6ff54..52f69efc95 100644
--- a/cpukit/include/sha384.h
+++ b/cpukit/include/sha384.h
@@ -47,7 +47,7 @@ __BEGIN_DECLS
 
 void   SHA384_Init(SHA384_CTX *);
 void   SHA384_Update(SHA384_CTX *, const void *, size_t);
-void   SHA384_Final(unsigned char [SHA384_DIGEST_LENGTH], SHA384_CTX *);
+void   SHA384_Final(unsigned char [static SHA384_DIGEST_LENGTH], SHA384_CTX *);
 #ifndef _KERNEL
 char   *SHA384_End(SHA384_CTX *, char *);
 char   *SHA384_Data(const void *, unsigned int, char *);
diff --git a/cpukit/include/sha512.h b/cpukit/include/sha512.h
index 1964562160..de7d19abb3 100644
--- a/cpukit/include/sha512.h
+++ b/cpukit/include/sha512.h
@@ -47,7 +47,7 @@ __BEGIN_DECLS
 
 void   SHA512_Init(SHA512_CTX *);
 void   SHA512_Update(SHA512_CTX *, const void *, size_t);
-void   SHA512_Final(unsigned char [SHA512_DIGEST_LENGTH], SHA512_CTX *);
+void   SHA512_Final(unsigned char [static SHA512_DIGEST_LENGTH], SHA512_CTX *);
 #ifndef _KERNEL
 char   *SHA512_End(SHA512_CTX *, char *);
 char   *SHA512_Data(const void *, unsigned int, char *);
diff --git a/cpukit/libmd/sha256c.c b/cpukit/libmd/sha256c.c
index 4c0371dda7..f5a453e43b 100644
--- a/cpukit/libmd/sha256c.c
+++ b/cpukit/libmd/sha256c.c
@@ -283,7 +283,7 @@ SHA256_Update(SHA256_CTX * ctx, const void *in, size_t len)
  * and clears the context state.
  */
 void
-SHA256_Final(unsigned char digest[32], SHA256_CTX * ctx)
+SHA256_Final(unsigned char digest[static SHA256_DIGEST_LENGTH], SHA256_CTX 
*ctx)
 {
 
/* Add padding */
@@ -291,7 +291,8 @@ SHA256_Final(unsigned char digest[32], SHA256_CTX * ctx)
 
/* Write the hash */
be32enc_vect(digest, ctx->state, 32);
+   be32enc_vect(digest, ctx->state, SHA256_DIGEST_LENGTH);
 
/* Clear the context state */
-   memset((void *)ctx, 0, sizeof(*ctx));
+   memset(ctx, 0, sizeof(*ctx));
 }
diff --git a/cpukit/libmd/sha512c.c b/cpukit/libmd/sha512c.c
index 7d0e875550..a93d8a44d8 100644
--- a/cpukit/libmd/sha512c.c
+++ b/cpukit/libmd/sha512c.c
@@ -307,7 +307,7 @@ SHA512_Update(SHA512_CTX * ctx, const void *in, size_t len)
  * and clears the context state.
  */
 void
-SHA512_Final(unsigned char digest[SHA512_DIGEST_LENGTH], SHA512_CTX * ctx)
+SHA512_Final(unsigned char digest[static SHA512_DIGEST_LENGTH], SHA512_CTX 
*ctx)
 {
 
/* Add padding */
@@ -317,7 +317,7 @@ SHA512_Final(unsigned char digest[SHA512_DIGEST_LENGTH], 
SHA512_CTX * ctx)
be64enc_vect(digest, ctx->state, SHA512_DIGEST_LENGTH);
 
/* Clear the context state */
-   memset((void *)ctx, 0, sizeof(*ctx));
+   memset(ctx, 0, sizeof(*ctx));
 }
 
 /*** SHA-384: */
@@ -357,7 +357,7 @@ SHA384_Update(SHA384_CTX * ctx, const void *in, size_t len)
  * and clears the context state.
  */
 void
-SHA384_Final(unsigned char digest[SHA384_DIGEST_LENGTH], SHA384_CTX * ctx)
+SHA384_Final(unsigned char digest[static SHA384_DIGEST_LENGTH], SHA384_CTX 
*ctx)
 {
 
/* Add padding */
@@ -367,5 +367,5 @@ SHA384_Final(unsigned char digest[SHA384_DIGEST_LENGTH], 
SHA384_CTX * ctx)
be64enc_vect(digest, ctx->state, SHA384_DIGEST_LENGTH);
 
/* Clear the context state */
-   memset((void *)ctx, 0, sizeof(*ctx));
+   memset(ctx, 0, sizeof(*ctx));
 }
-- 
2.35.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 00/15] Synchronize libcrypt and libmd with FreeBSD

2022-09-08 Thread Sebastian Huber
Alan Somers (1):
  Fix C++ includability of crypto headers with static array sizes

Allan Jude (2):
  Replace sys/crypto/sha2/sha2.c with lib/libmd/sha512c.c
  Implement SHA-512 truncated (224 and 256 bits)

Colin Percival (1):
  Retune SHA2 code for improved performance on CPUs

Conrad Meyer (2):
  crypto routines: Hint minimum buffer sizes to the compiler
  Implement SHA2-224 submode of SHA2-256

Pedro F. Giffuni (2):
  General further adoption of SPDX licensing ID tags.
  lib: further adoption of SPDX licensing ID tags.

Sebastian Huber (4):
  libtests/sha: Add tests for SHA224
  libtests/sha: Add tests for SHA384
  libtests/sha: Add tests for SHA512-224
  libtests/sha: Add tests for SHA512-256

Xin LI (3):
  libmd: Always erase context in _Final method,
  Get rid of unused variables.
  libcrypt: There is no need to clear message digest

 cpukit/include/sha224.h|  62 ++
 cpukit/include/sha256.h|  16 +-
 cpukit/include/sha384.h|  61 ++
 cpukit/include/sha512.h|  17 +-
 cpukit/include/sha512t.h   |  68 ++
 cpukit/libcrypt/crypt-md5.c|   2 +
 cpukit/libcrypt/crypt-sha256.c |  15 +-
 cpukit/libcrypt/crypt-sha512.c |  15 +-
 cpukit/libcrypt/misc.c |   4 +-
 cpukit/libmd/sha256c.c | 230 
 cpukit/libmd/sha512c.c | 377 +++--
 testsuites/libtests/sha/init.c | 215 ++-
 12 files changed, 843 insertions(+), 239 deletions(-)
 create mode 100644 cpukit/include/sha224.h
 create mode 100644 cpukit/include/sha384.h
 create mode 100644 cpukit/include/sha512t.h

-- 
2.35.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH] rtems: Include

2022-09-08 Thread Joel Sherrill
Ok. Just push it then.

On Thu, Sep 8, 2022, 8:05 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> On 08/09/2022 15:03, Joel Sherrill wrote:
> > Ok. Did it get removed from anywhere?
>
> No, the header files are generated by a script and I improved the script
> input a bit.
>
> --
> embedded brains GmbH
> Herr Sebastian HUBER
> Dornierstr. 4
> 82178 Puchheim
> Germany
> email: sebastian.hu...@embedded-brains.de
> phone: +49-89-18 94 741 - 16
> fax:   +49-89-18 94 741 - 08
>
> Registergericht: Amtsgericht München
> Registernummer: HRB 157899
> Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
> Unsere Datenschutzerklärung finden Sie hier:
> https://embedded-brains.de/datenschutzerklaerung/
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] rtems: Include

2022-09-08 Thread Sebastian Huber

On 08/09/2022 15:03, Joel Sherrill wrote:

Ok. Did it get removed from anywhere?


No, the header files are generated by a script and I improved the script 
input a bit.


--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] rtems: Include

2022-09-08 Thread Joel Sherrill
Ok. Did it get removed from anywhere?

On Thu, Sep 8, 2022, 1:11 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> Directly include  in header files using CPU build
> options.
> ---
>  cpukit/include/rtems/config.h  | 1 +
>  cpukit/include/rtems/rtems/intr.h  | 1 +
>  cpukit/include/rtems/rtems/types.h | 1 +
>  3 files changed, 3 insertions(+)
>
> diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h
> index f3c806d494..56d8f2dd46 100644
> --- a/cpukit/include/rtems/config.h
> +++ b/cpukit/include/rtems/config.h
> @@ -61,6 +61,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> diff --git a/cpukit/include/rtems/rtems/intr.h
> b/cpukit/include/rtems/rtems/intr.h
> index 8128ff08af..07c55b27a8 100644
> --- a/cpukit/include/rtems/rtems/intr.h
> +++ b/cpukit/include/rtems/rtems/intr.h
> @@ -67,6 +67,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> diff --git a/cpukit/include/rtems/rtems/types.h
> b/cpukit/include/rtems/rtems/types.h
> index 4779e61b9c..1dd5f8da86 100644
> --- a/cpukit/include/rtems/rtems/types.h
> +++ b/cpukit/include/rtems/rtems/types.h
> @@ -61,6 +61,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> --
> 2.35.3
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH] Do not use RTEMS_INLINE_ROUTINE

2022-09-08 Thread Sebastian Huber
Directly use "static inline" which is available in C99 and later.  This brings
the RTEMS implementation closer to standard C.

Close #3935.
---
 bsps/i386/pc386/include/edid.h|   2 +-
 bsps/include/grlib/grlib_impl.h   |  18 +-
 bsps/m68k/shared/cache/cache.h|  56 +++---
 bsps/powerpc/gen5200/include/tm27.h   |   2 +-
 bsps/powerpc/motorola_powerpc/include/bsp.h   |   2 +-
 bsps/powerpc/mvme5500/include/tm27.h  |   2 +-
 bsps/powerpc/psim/include/tm27.h  |   2 +-
 bsps/powerpc/qoriq/include/tm27.h |  10 +-
 bsps/powerpc/t32mppc/include/bsp/irq.h|   4 +-
 bsps/powerpc/virtex/console/consolelite.c |   8 +-
 bsps/sparc/erc32/include/bsp/irq.h|   4 +-
 bsps/x86_64/amd64/start/page.c|   2 +-
 cpukit/include/drvmgr/drvmgr.h|   4 +-
 cpukit/include/pci/access.h   |  20 +--
 cpukit/include/pci/irq.h  |  10 +-
 cpukit/include/rtems/bsd.h|  24 +--
 cpukit/include/rtems/cbs.h|  24 +--
 cpukit/include/rtems/chain.h  |  64 +++
 cpukit/include/rtems/extensionimpl.h  |   6 +-
 cpukit/include/rtems/ioimpl.h |   4 +-
 cpukit/include/rtems/libio.h  |   2 +-
 cpukit/include/rtems/linkersets.h |   2 +-
 cpukit/include/rtems/mallocinitmulti.h|   2 +-
 cpukit/include/rtems/mallocinitone.h  |   2 +-
 cpukit/include/rtems/media.h  |   2 +-
 cpukit/include/rtems/posix/condimpl.h |  10 +-
 cpukit/include/rtems/posix/keyimpl.h  |  22 +--
 cpukit/include/rtems/posix/mqueueimpl.h   |  14 +-
 cpukit/include/rtems/posix/muteximpl.h|  32 ++--
 cpukit/include/rtems/posix/posixapi.h |  10 +-
 cpukit/include/rtems/posix/priorityimpl.h |   2 +-
 cpukit/include/rtems/posix/psignalimpl.h  |   4 +-
 cpukit/include/rtems/posix/pthreadattrimpl.h  |   6 +-
 cpukit/include/rtems/posix/pthreadimpl.h  |   4 +-
 cpukit/include/rtems/posix/rwlockimpl.h   |   2 +-
 cpukit/include/rtems/posix/semaphoreimpl.h|  18 +-
 cpukit/include/rtems/posix/shmimpl.h  |  10 +-
 cpukit/include/rtems/posix/spinlockimpl.h |   2 +-
 cpukit/include/rtems/posix/timerimpl.h|  10 +-
 cpukit/include/rtems/pty.h|   2 +-
 cpukit/include/rtems/qreslib.h|  24 +--
 cpukit/include/rtems/rbtree.h |  46 ++---
 cpukit/include/rtems/record.h |  22 +--
 cpukit/include/rtems/rtems/attrimpl.h |  28 +--
 cpukit/include/rtems/rtems/barrierimpl.h  |   6 +-
 cpukit/include/rtems/rtems/dpmemimpl.h|   6 +-
 cpukit/include/rtems/rtems/eventimpl.h|  10 +-
 cpukit/include/rtems/rtems/messageimpl.h  |   6 +-
 cpukit/include/rtems/rtems/modesimpl.h|  14 +-
 cpukit/include/rtems/rtems/msgmp.h|   2 +-
 cpukit/include/rtems/rtems/optionsimpl.h  |   4 +-
 cpukit/include/rtems/rtems/partimpl.h |   6 +-
 cpukit/include/rtems/rtems/partmp.h   |   2 +-
 cpukit/include/rtems/rtems/ratemonimpl.h  |  12 +-
 cpukit/include/rtems/rtems/regionimpl.h   |  12 +-
 cpukit/include/rtems/rtems/semimpl.h  |  24 +--
 cpukit/include/rtems/rtems/semmp.h|   2 +-
 cpukit/include/rtems/rtems/statusimpl.h   |   4 +-
 cpukit/include/rtems/rtems/tasksimpl.h|   6 +-
 cpukit/include/rtems/rtems/timerimpl.h|  22 +--
 cpukit/include/rtems/score/address.h  |  14 +-
 cpukit/include/rtems/score/chainimpl.h|  82 -
 cpukit/include/rtems/score/corebarrierimpl.h  |  10 +-
 cpukit/include/rtems/score/coremsgimpl.h  |  26 +--
 cpukit/include/rtems/score/coremuteximpl.h|  38 ++--
 cpukit/include/rtems/score/corerwlockimpl.h   |   6 +-
 cpukit/include/rtems/score/coresemimpl.h  |  12 +-
 cpukit/include/rtems/score/freechainimpl.h|   8 +-
 cpukit/include/rtems/score/hash.h |   8 +-
 cpukit/include/rtems/score/heap.h |   8 +-
 cpukit/include/rtems/score/heapimpl.h |  54 +++---
 cpukit/include/rtems/score/isrlock.h  |   2 +-
 cpukit/include/rtems/score/memory.h   |  26 +--
 cpukit/include/rtems/score/mpciimpl.h |   2 +-
 cpukit/include/rtems/score/mrspimpl.h |  32 ++--
 cpukit/include/rtems/score/object.h   |   8 +-
 cpukit/include/rtems/score/objectimpl.h   |  46 ++---
 cpukit/include/rtems/score/percpu.h   |   6 +-
 .../include/rtems/score/prioritybitmapimpl.h  |  22 +--
 cpukit/include/rtems/score/priorityimpl.h |  62 +++
 cpukit/include/rtems/score/processormask.h|  42 ++---
 cpukit/include/rtems/score/protectedheap.h|   6 +-
 cpukit/include/rtems/score/rbtree.h   |  38 ++--
 cpukit/include/rtems/score/schedulercbsimpl.h |   4 +-
 cpukit/include/rtems/score/scheduleredfimpl.h |  18 +-
 

[RSB 5 3/3] sb/getsources: Fixes to configurations

2022-09-08 Thread chrisj
From: Chris Johns 

Updates #4715
---
 bare/config/devel/binutils-2.22-1.cfg| 17 +++
 bare/config/devel/gcc-4.6-newlib-1.20-1.cfg  | 30 +
 bare/config/devel/gcc-4.8.2-newlib-cvs-1.cfg | 47 
 bare/config/gnu-tools-4.6.bset   |  8 ++--
 bare/config/gnu-tools-4.8.2.bset |  2 +-
 rtems/config/5/rtems-tier-4.bset |  2 +-
 6 files changed, 100 insertions(+), 6 deletions(-)
 create mode 100644 bare/config/devel/binutils-2.22-1.cfg
 create mode 100644 bare/config/devel/gcc-4.6-newlib-1.20-1.cfg
 create mode 100644 bare/config/devel/gcc-4.8.2-newlib-cvs-1.cfg

diff --git a/bare/config/devel/binutils-2.22-1.cfg 
b/bare/config/devel/binutils-2.22-1.cfg
new file mode 100644
index 000..e585483
--- /dev/null
+++ b/bare/config/devel/binutils-2.22-1.cfg
@@ -0,0 +1,17 @@
+#
+# Binutils 2.22.
+#
+
+%if %{release} == %{nil}
+%define release 1
+%endif
+
+%include %{_configdir}/checks.cfg
+%include %{_configdir}/base.cfg
+
+%define binutils_version 2.22
+
+#
+# The binutils build instructions. We use 2.xx Release 1.
+#
+%include %{_configdir}/binutils-2-1.cfg
diff --git a/bare/config/devel/gcc-4.6-newlib-1.20-1.cfg 
b/bare/config/devel/gcc-4.6-newlib-1.20-1.cfg
new file mode 100644
index 000..659752f
--- /dev/null
+++ b/bare/config/devel/gcc-4.6-newlib-1.20-1.cfg
@@ -0,0 +1,30 @@
+#
+# GCC 2.6, Newlib 1.20
+#
+
+%if %{release} == %{nil}
+%define release 1
+%endif
+
+%include %{_configdir}/checks.cfg
+%include %{_configdir}/base.cfg
+
+%define gcc_version4.6.3
+%define newlib_version 1.20.0
+%define mpfr_version   3.0.1
+%define mpc_version0.8.2
+%define gmp_version5.0.5
+
+%define mpc_url  https://www.multiprecision.org/downloads
+%define gmp_url  https://ftp.gnu.org/gnu/gmp
+%define mpfr_url https://ftp.gnu.org/gnu/mpfr
+
+#
+# Project custom message
+#
+%define gcc_version_message GCC 
%{release}-RSB(%{_sbgit_id}),gcc-%{gcc_version}/newlib-%{newlib_version}
+
+#
+# The gcc/newlib build instructions. We use 4.6 Release 1.
+#
+%include %{_configdir}/gcc-4.6-1.cfg
diff --git a/bare/config/devel/gcc-4.8.2-newlib-cvs-1.cfg 
b/bare/config/devel/gcc-4.8.2-newlib-cvs-1.cfg
new file mode 100644
index 000..7312673
--- /dev/null
+++ b/bare/config/devel/gcc-4.8.2-newlib-cvs-1.cfg
@@ -0,0 +1,47 @@
+#
+# GCC 4.8.2., Newlib CVS
+#
+
+%include %{_configdir}/bare-config.cfg
+
+%include %{_configdir}/checks.cfg
+%include %{_configdir}/base.cfg
+%include %{_configdir}/versions.cfg
+
+%define gcc_version4.8.2
+%define newlib_version 1-Nov-2013
+%define mpfr_version   3.0.1
+%define mpc_version0.8.2
+%define gmp_version5.0.5
+
+#
+# Project custom message
+#
+%define gcc_version_message 
RSB-%{_sbgit_id})-%{release},gcc-%{gcc_version}/newlib-%{newlib_version}
+
+%define with_threads 0
+%define with_plugin  0
+
+%ifn %{defined with_iconv}
+%define with_iconv 1
+%endif
+
+# Incompatible with Texinfo 5
+%if %{__makeinfo_ver} >= 5.0
+ %error Incomaptible version of makeinfo found!
+%endif
+
+#
+# Newlib is from CVS.
+#
+%source set newlib 
cvs://pserver:anon...@sourceware.org/cvs/src?module=newlib?src-prefix=src?date=%{newlib_version}?reset
+
+#
+# Joel's stack_t patch.
+#
+%patch add newlib -p0 %{bare_newlib_patches}/newlib-sys-signal-20130532.diff
+
+#
+# The gcc/newlib build instructions. We use 4.8 Release 1.
+#
+%include %{_configdir}/gcc-4.8-1.cfg
diff --git a/bare/config/gnu-tools-4.6.bset b/bare/config/gnu-tools-4.6.bset
index fa3ced8..6317d10 100644
--- a/bare/config/gnu-tools-4.6.bset
+++ b/bare/config/gnu-tools-4.6.bset
@@ -19,7 +19,7 @@ package: gnu-tool-%{_target}-%{_host}-%{release}
 #
 # Tool configuration.
 #
-binutils-2.22-1
-gcc-4.6-newlib-1.20-1
-expat-2.1.0-1
-gdb-7.5-1
+devel/binutils-2.22-1
+devel/gcc-4.6-newlib-1.20-1
+devel/expat-2.1.0-1
+devel/gdb-7.7-1
diff --git a/bare/config/gnu-tools-4.8.2.bset b/bare/config/gnu-tools-4.8.2.bset
index 9dd4b8a..9a75c35 100644
--- a/bare/config/gnu-tools-4.8.2.bset
+++ b/bare/config/gnu-tools-4.8.2.bset
@@ -22,4 +22,4 @@ package: gnu-tools-%{_target}-%{_host}-%{release}
 devel/expat-2.1.0-1
 devel/binutils-2.23.2-1
 devel/gcc-4.8.2-newlib-cvs-1
-devel/gdb-7.6.1-1
+devel/gdb-7.7-1
diff --git a/rtems/config/5/rtems-tier-4.bset b/rtems/config/5/rtems-tier-4.bset
index 2820fda..24d392d 100644
--- a/rtems/config/5/rtems-tier-4.bset
+++ b/rtems/config/5/rtems-tier-4.bset
@@ -6,5 +6,5 @@
 #
 5/rtems-epiphany
 5/rtems-microblaze
-5/rtems-riscv32
+5/rtems-riscv
 5/rtems-x86_64
-- 
2.24.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[RSB 5 2/3] sb: Back port fixes from the development branch

2022-09-08 Thread chrisj
From: Chris Johns 

Updates #4716
---
 source-builder/sb/build.py  |  18 +++-
 source-builder/sb/config.py | 161 ++--
 source-builder/sb/setbuilder.py |  39 ++--
 3 files changed, 133 insertions(+), 85 deletions(-)

diff --git a/source-builder/sb/build.py b/source-builder/sb/build.py
index ceb179a..c1b76a3 100644
--- a/source-builder/sb/build.py
+++ b/source-builder/sb/build.py
@@ -48,8 +48,7 @@ except KeyboardInterrupt:
 print('abort: user terminated')
 sys.exit(1)
 except:
-print('error: unknown application load error')
-sys.exit(1)
+raise
 
 def humanize_number(num, suffix):
 for unit in ['','K','M','G','T','P','E','Z']:
@@ -635,6 +634,10 @@ class build:
 return 0
 return package.get_size('installed')
 
+def includes(self):
+if self.config:
+return self.config.includes()
+
 def get_configs(opts):
 
 def _scan(_path, ext):
@@ -648,10 +651,17 @@ def get_configs(opts):
 return configs
 
 configs = { 'paths': [], 'files': [] }
-for cp in opts.defaults.expand('%{_configdir}').split(':'):
+paths = opts.defaults.expand('%{_configdir}').split(':')
+root = path.host(os.path.commonprefix(paths))
+configs['root'] = root
+configs['localpaths'] = [lp[len(root):] for lp in paths]
+for cp in paths:
 hcp = path.host(path.abspath(cp))
 configs['paths'] += [hcp]
-configs['files'] += _scan(hcp, ['.cfg', '.bset'])
+hpconfigs = sorted(set(_scan(hcp, ['.cfg', '.bset'])))
+hcplocal = hcp[len(root):]
+configs[hcplocal] = [path.join(hcplocal, c) for c in hpconfigs]
+configs['files'] += hpconfigs
 configs['files'] = sorted(set(configs['files']))
 return configs
 
diff --git a/source-builder/sb/config.py b/source-builder/sb/config.py
index a40147d..df2aa31 100644
--- a/source-builder/sb/config.py
+++ b/source-builder/sb/config.py
@@ -45,8 +45,7 @@ except KeyboardInterrupt:
 print('user terminated', file = sys.stderr)
 sys.exit(1)
 except:
-print('error: unknown application load error', file = sys.stderr)
-sys.exit(1)
+raise
 
 def _check_bool(value):
 istrue = None
@@ -69,6 +68,13 @@ def _check_nil(value):
 istrue = False
 return istrue
 
+def _check_number(value):
+try:
+float(value)
+return True
+except ValueError:
+return False
+
 class package:
 
 def __init__(self, name, arch, config):
@@ -283,6 +289,7 @@ class file:
 return s
 
 def _reset(self, name):
+self.parent = 'root'
 self.name = name
 self.load_depth = 0
 self.configpath = []
@@ -430,7 +437,8 @@ class file:
 if len(shell_macro) > 3:
 e = execute.capture_execution()
 if options.host_windows:
-shell_cmd = ''.join([c if c != '"' else '\\' + c for c in 
shell_macro[2:-1]])
+shell_cmd = \
+''.join([c if c != '"' else '\\' + c for c in 
shell_macro[2:-1]])
 cmd = '%s -c "%s"' % (self.macros.expand('%{__sh}'), 
shell_cmd)
 else:
 cmd = shell_macro[2:-1]
@@ -458,7 +466,8 @@ class file:
 if braces > 0:
 braces -= 1
 else:
-shell_cmd = '%(' + self._shell(line[pos + 2:p], 
nesting + 1) + ')'
+shell_cmd = '%(' + \
+self._shell(line[pos + 2:p], nesting + 1) + ')'
 line = line[:pos] + _exec(shell_cmd) + line[p + 1:]
 updating = True
 break
@@ -472,9 +481,10 @@ class file:
('with_download' in self.macros and self.macros['with_download'] == 
'1'):
 return '0'
 ok = False
-log.trace('pkgconfig: check: crossc=%d pkg_crossc=%d prefix=%s' % ( 
self._cross_compile(),
-
self.pkgconfig_crosscompile,
-
self.pkgconfig_prefix))
+log.trace('pkgconfig: check: crossc=%d pkg_crossc=%d prefix=%s'
+  % ( self._cross_compile(),
+  self.pkgconfig_crosscompile,
+  self.pkgconfig_prefix))
 log.trace('pkgconfig: check: test=%s' % (test))
 if type(test) == str:
 test = test.split()
@@ -496,6 +506,7 @@ class file:
 except pkgconfig.error as pe:
 self._error('pkgconfig: check: %s' % (pe))
 except:
+raise
 raise error.internal('pkgconfig failure')
 if ok:
 return '1'
@@ -520,6 +531,7 @@ class file:
 except pkgconfig.error as pe:
 self._error('pkgconfig: %s:  %s' % (flags, pe))
   

[RSB 5 1/3] sb/getsources: Fix getting sources

2022-09-08 Thread chrisj
From: Chris Johns 

- Back ported from the development branch

Updates #4715
---
 source-builder/sb/getsources.py | 614 +++
 source-builder/sb/simhost.py| 720 
 2 files changed, 771 insertions(+), 563 deletions(-)
 create mode 100644 source-builder/sb/simhost.py

diff --git a/source-builder/sb/getsources.py b/source-builder/sb/getsources.py
index 523a3a5..733598b 100644
--- a/source-builder/sb/getsources.py
+++ b/source-builder/sb/getsources.py
@@ -32,562 +32,15 @@ import sys
 
 try:
 import build
-import check
 import error
-import git
 import log
-import macros
-import path
-import sources
+import simhost
 import version
 except KeyboardInterrupt:
 print('abort: user terminated', file = sys.stderr)
 sys.exit(1)
 except:
-print('error: unknown application load error', file = sys.stderr)
-sys.exit(1)
-
-#
-# Define host profiles so it can simulated on another host.
-#
-host_profiles = {
-'darwin':  { '_os':  ('none','none', 'darwin'),
- '_host':('triplet', 'required', 
'x86_64-apple-darwin18.5.0'),
- '_host_vendor': ('none','none', 'apple'),
- '_host_os': ('none','none', 'darwin'),
- '_host_os_version': ('none','none', '18.5.0'),
- '_host_cpu':('none','none', 'x86_64'),
- '_host_alias':  ('none','none', '%{nil}'),
- '_host_arch':   ('none','none', 'x86_64'),
- '_usr': ('dir', 'optional', '/usr/local'),
- '_var': ('dir', 'optional', '/usr/local/var') 
},
-'freebsd': { '_os':  ('none','none', 'freebsd'),
- '_host':('triplet', 'required', 
'x86_64-freebsd12.0-RELEASE-p3'),
- '_host_vendor': ('none','none', 'pc'),
- '_host_os': ('none','none', 'freebsd'),
- '_host_os_version': ('none','none', 
'12.0-RELEASE-p3'),
- '_host_cpu':('none','none', 'x86_64'),
- '_host_alias':  ('none','none', '%{nil}'),
- '_host_arch':   ('none','none', 'x86_64'),
- '_usr': ('dir', 'optional', '/usr/local'),
- '_var': ('dir', 'optional', '/usr/local/var') 
},
-'linux':   { '_os':  ('none','none', 'linux'),
- '_host':('triplet', 'required', 
'x86_64-linux-gnu'),
- '_host_vendor': ('none','none', 'gnu'),
- '_host_os': ('none','none', 'linux'),
- '_host_os_version': ('none','none', '4.18.0-16'),
- '_host_cpu':('none','none', 'x86_64'),
- '_host_alias':  ('none','none', '%{nil}'),
- '_host_arch':   ('none','none', 'x86_64'),
- '_usr': ('dir', 'optional', '/usr/local'),
- '_var': ('dir', 'optional', '/usr/local/var') 
},
-'netbsd':  { '_os':  ('none','none', 'netbsd'),
- '_host':('triplet', 'required', 
'x86_64-netbsd8.0'),
- '_host_vendor': ('none','none', 'pc'),
- '_host_os': ('none','none', 'netbsd'),
- '_host_os_version': ('none','none', '8.0'),
- '_host_cpu':('none','none', 'x86_64'),
- '_host_alias':  ('none','none', '%{nil}'),
- '_host_arch':   ('none','none', 'x86_64'),
- '_usr': ('dir', 'optional', '/usr/local'),
- '_var': ('dir', 'optional', '/usr/local/var') 
},
-'solaris': { '_os':  ('none','none', 'solaris'),
- '_host':('triplet', 'required', 
'x86_64-pc-solaris2'),
- '_host_vendor': ('none','none', 'pc'),
- '_host_os': ('none','none', 'solaris'),
- '_host_os_version': ('none','none', '2'),
- '_host_cpu':('none','none', 'x86_64'),
- '_host_alias':  ('none','none', '%{nil}'),
- '_host_arch':   ('none','none', 'x86_64'),
- '_usr': ('dir', 'optional', '/usr/local'),
- '_var': ('dir', 'optional', '/usr/local/var') 
},
-'win32':   { '_os':  ('none','none', 'win32'),
- '_windows_os':  ('none','none', 'mingw32'),
- '_host':

[RSB 5] Back port RSB set sources fixes

2022-09-08 Thread chrisj
Hi,

These patches update the RSB 5 branch with fixes for getting
sources that are on the development branch.

Getting sources is used to create a release. The release process
fetches all the referenced sources in the RSB and they are 
part of the release.

Chris

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] score: Remove _CPU_Counter_difference()

2022-09-08 Thread Sebastian Huber
All CPU ports used the same _CPU_Counter_difference() implementation.  Remove
this CPU port interface and mandate a monotonically increasing CPU counter.

Close #3456.
---
 cpukit/include/rtems/counter.h|  8 ++--
 cpukit/include/rtems/score/profiling.h|  5 +--
 cpukit/include/rtems/score/smplockstats.h |  4 +-
 .../cpu/aarch64/include/rtems/score/cpu.h |  8 
 .../score/cpu/arm/include/rtems/score/cpu.h   |  8 
 .../score/cpu/bfin/include/rtems/score/cpu.h  |  8 
 .../score/cpu/i386/include/rtems/score/cpu.h  |  8 
 .../score/cpu/lm32/include/rtems/score/cpu.h  |  8 
 .../score/cpu/m68k/include/rtems/score/cpu.h  |  8 
 .../cpu/microblaze/include/rtems/score/cpu.h  |  8 
 .../score/cpu/mips/include/rtems/score/cpu.h  |  8 
 .../score/cpu/moxie/include/rtems/score/cpu.h |  8 
 .../score/cpu/nios2/include/rtems/score/cpu.h |  8 
 .../cpu/no_cpu/include/rtems/score/cpu.h  | 39 ++-
 .../score/cpu/or1k/include/rtems/score/cpu.h  |  8 
 .../cpu/powerpc/include/rtems/score/cpu.h |  8 
 .../score/cpu/riscv/include/rtems/score/cpu.h |  8 
 cpukit/score/cpu/sh/include/rtems/score/cpu.h |  8 
 .../score/cpu/sparc/include/rtems/score/cpu.h |  8 
 .../cpu/sparc64/include/rtems/score/cpu.h |  8 
 .../score/cpu/v850/include/rtems/score/cpu.h  |  8 
 .../cpu/x86_64/include/rtems/score/cpu.h  |  9 -
 cpukit/score/src/profilingisrentryexit.c  |  5 +--
 23 files changed, 19 insertions(+), 187 deletions(-)

diff --git a/cpukit/include/rtems/counter.h b/cpukit/include/rtems/counter.h
index ad6d5517a3..61a0677bd3 100644
--- a/cpukit/include/rtems/counter.h
+++ b/cpukit/include/rtems/counter.h
@@ -99,20 +99,20 @@ static inline rtems_counter_ticks rtems_counter_read( void )
  * @brief Returns the difference between the second and first CPU counter
  * value.
  *
- * This operation may be carried out as a modulo operation depending on the
- * range of the CPU counter device.
+ * This function is provided for backward compatibility.
+ * You may use "second - first" directly in the code.
  *
  * @param[in] second The second CPU counter value.
  * @param[in] first The first CPU counter value.
  *
- * @return Returns second minus first modulo counter period.
+ * @return Returns second minus first.
  */
 static inline rtems_counter_ticks rtems_counter_difference(
   rtems_counter_ticks second,
   rtems_counter_ticks first
 )
 {
-  return _CPU_Counter_difference( second, first );
+  return second - first;
 }
 
 /**
diff --git a/cpukit/include/rtems/score/profiling.h 
b/cpukit/include/rtems/score/profiling.h
index 90e470a775..90d441b0d0 100644
--- a/cpukit/include/rtems/score/profiling.h
+++ b/cpukit/include/rtems/score/profiling.h
@@ -129,10 +129,7 @@ static inline void _Profiling_Thread_dispatch_enable(
   if ( new_thread_dispatch_disable_level == 0 ) {
 Per_CPU_Stats *stats = >Stats;
 CPU_Counter_ticks now = _CPU_Counter_read();
-CPU_Counter_ticks delta = _CPU_Counter_difference(
-  now,
-  stats->thread_dispatch_disabled_instant
-);
+CPU_Counter_ticks delta = now - stats->thread_dispatch_disabled_instant;
 
 stats->total_thread_dispatch_disabled_time += delta;
 
diff --git a/cpukit/include/rtems/score/smplockstats.h 
b/cpukit/include/rtems/score/smplockstats.h
index 102fb6eac5..cebfb80bd6 100644
--- a/cpukit/include/rtems/score/smplockstats.h
+++ b/cpukit/include/rtems/score/smplockstats.h
@@ -235,7 +235,7 @@ static inline void _SMP_lock_Stats_acquire_end(
 
   second = _CPU_Counter_read();
   stats_context->acquire_instant = second;
-  delta = _CPU_Counter_difference( second, acquire_context->first );
+  delta = second - acquire_context->first;
 
   ++stats->usage_count;
 
@@ -270,7 +270,7 @@ static inline void _SMP_lock_Stats_release_update(
   stats = stats_context->stats;
   first = stats_context->acquire_instant;
   second = _CPU_Counter_read();
-  delta = _CPU_Counter_difference( second, first );
+  delta = second - first;
 
   stats->total_section_time += delta;
 
diff --git a/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h 
b/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h
index 282977853f..da91ba96e1 100644
--- a/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h
@@ -384,14 +384,6 @@ uint32_t _CPU_Counter_frequency( void );
 
 CPU_Counter_ticks _CPU_Counter_read( void );
 
-static inline CPU_Counter_ticks _CPU_Counter_difference(
-  CPU_Counter_ticks second,
-  CPU_Counter_ticks first
-)
-{
-  return second - first;
-}
-
 void *_CPU_Thread_Idle_body( uintptr_t ignored );
 
 typedef enum {
diff --git a/cpukit/score/cpu/arm/include/rtems/score/cpu.h 
b/cpukit/score/cpu/arm/include/rtems/score/cpu.h
index 7ac180ac26..3715031d06 100644
--- a/cpukit/score/cpu/arm/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/arm/include/rtems/score/cpu.h
@@ -574,14 +574,6 @@ uint32_t _CPU_Counter_frequency( void 

Re: [PATCH] score: Improve formatting

2022-09-08 Thread Chris Johns

On 8/9/2022 5:23 pm, Sebastian Huber wrote:

On 08/09/2022 08:56, Chris Johns wrote:

Is the score going to be run through clang-format?


I gave up finding the proper clang-format configuration which is close 
to the RTEMS style. 


I thought it was decided to get as close as possible and adjust the 
style where it was not possible.



Is there someone else working on this?


Did Gedare say he would look into this?

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH] score: Improve formatting

2022-09-08 Thread Sebastian Huber

On 08/09/2022 08:56, Chris Johns wrote:

Is the score going to be run through clang-format?


I gave up finding the proper clang-format configuration which is close 
to the RTEMS style. Is there someone else working on this?


--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] score: Improve formatting

2022-09-08 Thread Chris Johns

Hi,

Is the score going to be run through clang-format? If it is should we 
bother going this?


Chris

On 8/9/2022 4:09 pm, Sebastian Huber wrote:

---
  cpukit/include/rtems/score/basedefs.h | 14 ++
  1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/cpukit/include/rtems/score/basedefs.h 
b/cpukit/include/rtems/score/basedefs.h
index af732df3d3..c182ea02ec 100644
--- a/cpukit/include/rtems/score/basedefs.h
+++ b/cpukit/include/rtems/score/basedefs.h
@@ -474,12 +474,18 @@ extern "C" {
  ( const_cast<_type>( _var ) )
  #elif defined(__GNUC__)
#define RTEMS_DEQUALIFY_DEPTHX( _ptr_level, _type, _var ) \
-__builtin_choose_expr( __builtin_types_compatible_p( \
+__builtin_choose_expr( \
+  __builtin_types_compatible_p( \
  RTEMS_TYPEOF_REFX( _ptr_level, _var ), \
  RTEMS_TYPEOF_REFX( _ptr_level, _type ) \
-  ) || __builtin_types_compatible_p( _type, void * ), \
-(_type) ( _var ), \
-RTEMS_DEQUALIFY_types_not_compatible() )
+  ) || \
+  __builtin_types_compatible_p( \
+_type, \
+void * \
+  ), \
+  (_type) ( _var ), \
+  RTEMS_DEQUALIFY_types_not_compatible() \
+)
  #else
#define RTEMS_DEQUALIFY_DEPTHX( _ptr_level, _type, _var ) \
  ( (_type) (uintptr_t) (const volatile void *)( _var ) )

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] rtems: Include

2022-09-08 Thread Sebastian Huber
Directly include  in header files using CPU build
options.
---
 cpukit/include/rtems/config.h  | 1 +
 cpukit/include/rtems/rtems/intr.h  | 1 +
 cpukit/include/rtems/rtems/types.h | 1 +
 3 files changed, 3 insertions(+)

diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h
index f3c806d494..56d8f2dd46 100644
--- a/cpukit/include/rtems/config.h
+++ b/cpukit/include/rtems/config.h
@@ -61,6 +61,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/cpukit/include/rtems/rtems/intr.h 
b/cpukit/include/rtems/rtems/intr.h
index 8128ff08af..07c55b27a8 100644
--- a/cpukit/include/rtems/rtems/intr.h
+++ b/cpukit/include/rtems/rtems/intr.h
@@ -67,6 +67,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/cpukit/include/rtems/rtems/types.h 
b/cpukit/include/rtems/rtems/types.h
index 4779e61b9c..1dd5f8da86 100644
--- a/cpukit/include/rtems/rtems/types.h
+++ b/cpukit/include/rtems/rtems/types.h
@@ -61,6 +61,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-- 
2.35.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] score: Improve formatting

2022-09-08 Thread Sebastian Huber
---
 cpukit/include/rtems/score/basedefs.h | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/cpukit/include/rtems/score/basedefs.h 
b/cpukit/include/rtems/score/basedefs.h
index af732df3d3..c182ea02ec 100644
--- a/cpukit/include/rtems/score/basedefs.h
+++ b/cpukit/include/rtems/score/basedefs.h
@@ -474,12 +474,18 @@ extern "C" {
 ( const_cast<_type>( _var ) )
 #elif defined(__GNUC__)
   #define RTEMS_DEQUALIFY_DEPTHX( _ptr_level, _type, _var ) \
-__builtin_choose_expr( __builtin_types_compatible_p( \
+__builtin_choose_expr( \
+  __builtin_types_compatible_p( \
 RTEMS_TYPEOF_REFX( _ptr_level, _var ), \
 RTEMS_TYPEOF_REFX( _ptr_level, _type ) \
-  ) || __builtin_types_compatible_p( _type, void * ), \
-(_type) ( _var ), \
-RTEMS_DEQUALIFY_types_not_compatible() )
+  ) || \
+  __builtin_types_compatible_p( \
+_type, \
+void * \
+  ), \
+  (_type) ( _var ), \
+  RTEMS_DEQUALIFY_types_not_compatible() \
+)
 #else
   #define RTEMS_DEQUALIFY_DEPTHX( _ptr_level, _type, _var ) \
 ( (_type) (uintptr_t) (const volatile void *)( _var ) )
-- 
2.35.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel