micropython: bump to 1.23.0 release

Bump micropython to 1.23.0. This is done to fix support for MbedTLS 3.0

Lots changed between 1.21 and 1.23 for the library side.

Mainly the barkeley-db library was moved to micropython own fork and the
cdef patch required lots of changes. (we have to manually include a copy
of cdef.h as it was dropped by them)
Also a new patch is required to mute some compilarion error that are
false-positive. (variable not initialized but that are ALWAYS
initialized)

Also refresh the extmod patch with new files included.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
Christian Marangi
2024-10-22 15:27:36 +02:00
committed by Rosen Penev
parent e3217b54ed
commit 86602b5f3a
5 changed files with 176 additions and 81 deletions

View File

@@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=micropython PKG_NAME:=micropython
PKG_VERSION:=1.21.0 PKG_VERSION:=1.23.0
PKG_RELEASE:=2 PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://github.com/micropython/micropython/releases/download/v$(PKG_VERSION) PKG_SOURCE_URL:=https://github.com/micropython/micropython/releases/download/v$(PKG_VERSION)
PKG_HASH:=abd2152613559d3f44728668346e78be9d93458133a03b700baf222c322fd4d5 PKG_HASH:=0ab283c2fc98d466c1ff26692bee46abaeeab55d488a36fc3cb6372cb8fb390d
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com> PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
PKG_LICENSE:=MIT PKG_LICENSE:=MIT

View File

@@ -1,64 +0,0 @@
--- a/lib/berkeley-db-1.xx/PORT/bsd.4.4/include/db.h
+++ b/lib/berkeley-db-1.xx/PORT/bsd.4.4/include/db.h
@@ -37,7 +37,7 @@
#define _DB_H_
#include <sys/types.h>
-#include <sys/cdefs.h>
+#include "cdefs.h"
#include <limits.h>
--- a/lib/berkeley-db-1.xx/PORT/clib/memmove.c
+++ b/lib/berkeley-db-1.xx/PORT/clib/memmove.c
@@ -38,7 +38,7 @@
static char sccsid[] = "@(#)bcopy.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
+#include "cdefs.h"
#include <string.h>
/*
--- a/lib/berkeley-db-1.xx/PORT/clib/snprintf.c
+++ b/lib/berkeley-db-1.xx/PORT/clib/snprintf.c
@@ -1,5 +1,5 @@
#include <sys/types.h>
-#include <sys/cdefs.h>
+#include "cdefs.h"
#include <compat.h>
--- a/lib/berkeley-db-1.xx/PORT/hpux.9.01/local/hp_siglist.c
+++ b/lib/berkeley-db-1.xx/PORT/hpux.9.01/local/hp_siglist.c
@@ -2,7 +2,7 @@
* Derived from:
* static char sccsid[] = "@(#)siglist.c 8.1 (Berkeley) 6/4/93";
*/
-#include <sys/cdefs.h>
+#include "cdefs.h"
#include <signal.h>
--- a/lib/berkeley-db-1.xx/PORT/ultrix.4.2/include/db.h
+++ b/lib/berkeley-db-1.xx/PORT/ultrix.4.2/include/db.h
@@ -37,7 +37,7 @@
#define _DB_H_
#include <sys/types.h>
-#include <sys/cdefs.h>
+#include "cdefs.h"
#include <limits.h>
--- a/lib/berkeley-db-1.xx/include/db.h
+++ b/lib/berkeley-db-1.xx/include/db.h
@@ -37,7 +37,7 @@
#define _DB_H_
#include <sys/types.h>
-#include <sys/cdefs.h>
+#include "cdefs.h"
#include <limits.h>

View File

@@ -0,0 +1,136 @@
--- /dev/null
+++ b/lib/berkeley-db-1.xx/include/berkeley-db/cdefs.h
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Berkeley Software Design, Inc.
+ *
+ * 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ * @(#)cdefs.h 8.7 (Berkeley) 1/21/94
+ */
+
+#ifndef _CDEFS_H_
+#define _CDEFS_H_
+
+#if defined(__cplusplus)
+#define __BEGIN_DECLS extern "C" {
+#define __END_DECLS };
+#else
+#define __BEGIN_DECLS
+#define __END_DECLS
+#endif
+
+/*
+ * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
+ * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
+ * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
+ * in between its arguments. __CONCAT can also concatenate double-quoted
+ * strings produced by the __STRING macro, but this only works with ANSI C.
+ */
+#if defined(__STDC__) || defined(__cplusplus)
+#define __P(protos) protos /* full-blown ANSI C */
+#define __CONCAT(x,y) x ## y
+#define __STRING(x) #x
+
+#define __const const /* define reserved names to standard */
+#define __signed signed
+#define __volatile volatile
+#if defined(__cplusplus)
+#define __inline inline /* convert to C++ keyword */
+#else
+#ifndef __GNUC__
+#define __inline /* delete GCC keyword */
+#endif /* !__GNUC__ */
+#endif /* !__cplusplus */
+
+#else /* !(__STDC__ || __cplusplus) */
+#define __P(protos) () /* traditional C preprocessor */
+#define __CONCAT(x,y) x/**/y
+#define __STRING(x) "x"
+
+#ifndef __GNUC__
+#define __const /* delete pseudo-ANSI C keywords */
+#define __inline
+#define __signed
+#define __volatile
+/*
+ * In non-ANSI C environments, new programs will want ANSI-only C keywords
+ * deleted from the program and old programs will want them left alone.
+ * When using a compiler other than gcc, programs using the ANSI C keywords
+ * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
+ * When using "gcc -traditional", we assume that this is the intent; if
+ * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
+ */
+#ifndef NO_ANSI_KEYWORDS
+#define const /* delete ANSI C keywords */
+#define inline
+#define signed
+#define volatile
+#endif
+#endif /* !__GNUC__ */
+#endif /* !(__STDC__ || __cplusplus) */
+
+/*
+ * GCC1 and some versions of GCC2 declare dead (non-returning) and
+ * pure (no side effects) functions using "volatile" and "const";
+ * unfortunately, these then cause warnings under "-ansi -pedantic".
+ * GCC2 uses a new, peculiar __attribute__((attrs)) style. All of
+ * these work for GNU C++ (modulo a slight glitch in the C++ grammar
+ * in the distribution version of 2.5.5).
+ */
+#if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 5
+#define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+#define __dead __volatile
+#define __pure __const
+#endif
+#endif
+
+/* Delete pseudo-keywords wherever they are not available or needed. */
+#ifndef __dead
+#define __dead
+#define __pure
+#endif
+
+#endif /* !_CDEFS_H_ */
--- a/lib/berkeley-db-1.xx/include/berkeley-db/db.h
+++ b/lib/berkeley-db-1.xx/include/berkeley-db/db.h
@@ -34,7 +34,7 @@
#define _DB_H_
#include <sys/types.h>
-#include <sys/cdefs.h>
+#include "cdefs.h"
#include <limits.h>

View File

@@ -0,0 +1,22 @@
--- a/lib/berkeley-db-1.xx/btree/bt_split.c
+++ b/lib/berkeley-db-1.xx/btree/bt_split.c
@@ -91,7 +91,7 @@ __bt_split(t, sp, key, data, flags, ilen
PAGE *h, *l, *r, *lchild, *rchild;
indx_t nxtindex;
u_int16_t skip;
- u_int32_t n, nbytes, nksize = 0;
+ u_int32_t n, nbytes = 0, nksize = 0;
int parentsplit;
char *dest;
pgno_t pg_tmp;
@@ -626,8 +626,8 @@ bt_psplit(t, h, l, r, pskip, ilen)
PAGE *rval;
void *src = NULL;
indx_t full, half, nxt, off, skip, top, used;
- u_int32_t nbytes;
- int bigkeycnt, isbigkey;
+ u_int32_t nbytes = 0;
+ int bigkeycnt, isbigkey = 0;
/*
* Split the data to the left and right pages. Leave the skip index

View File

@@ -9,12 +9,12 @@ Subject: [PATCH 06/10] extmod: Use system mbedtls
--- a/extmod/extmod.mk --- a/extmod/extmod.mk
+++ b/extmod/extmod.mk +++ b/extmod/extmod.mk
@@ -131,85 +131,8 @@ SRC_THIRDPARTY_C += $(addprefix $(AXTLS_ @@ -235,86 +235,8 @@ SRC_THIRDPARTY_C += $(addprefix $(AXTLS_
crypto/sha1.c \ crypto/sha1.c \
) )
else ifeq ($(MICROPY_SSL_MBEDTLS),1) else ifeq ($(MICROPY_SSL_MBEDTLS),1)
-MBEDTLS_DIR = lib/mbedtls -MBEDTLS_DIR = lib/mbedtls
-MBEDTLS_CONFIG_FILE ?= \"mbedtls/mbedtls_config.h\" -MBEDTLS_CONFIG_FILE ?= \"mbedtls/mbedtls_config_port.h\"
-GIT_SUBMODULES += $(MBEDTLS_DIR) -GIT_SUBMODULES += $(MBEDTLS_DIR)
-CFLAGS_EXTMOD += -DMBEDTLS_CONFIG_FILE=$(MBEDTLS_CONFIG_FILE) -CFLAGS_EXTMOD += -DMBEDTLS_CONFIG_FILE=$(MBEDTLS_CONFIG_FILE)
-CFLAGS_EXTMOD += -DMICROPY_SSL_MBEDTLS=1 -I$(TOP)/$(MBEDTLS_DIR)/include -CFLAGS_EXTMOD += -DMICROPY_SSL_MBEDTLS=1 -I$(TOP)/$(MBEDTLS_DIR)/include
@@ -22,20 +22,25 @@ Subject: [PATCH 06/10] extmod: Use system mbedtls
-SRC_THIRDPARTY_C += $(addprefix $(MBEDTLS_DIR)/library/,\ -SRC_THIRDPARTY_C += $(addprefix $(MBEDTLS_DIR)/library/,\
- aes.c \ - aes.c \
- aesni.c \ - aesni.c \
- arc4.c \
- asn1parse.c \ - asn1parse.c \
- asn1write.c \ - asn1write.c \
- base64.c \ - base64.c \
- bignum_core.c \
- bignum_mod.c \
- bignum_mod_raw.c \
- bignum.c \ - bignum.c \
- blowfish.c \
- camellia.c \ - camellia.c \
- ccm.c \ - ccm.c \
- certs.c \
- chacha20.c \ - chacha20.c \
- chachapoly.c \ - chachapoly.c \
- cipher.c \ - cipher.c \
- cipher_wrap.c \ - cipher_wrap.c \
- nist_kw.c \
- aria.c \
- cmac.c \ - cmac.c \
- constant_time.c \
- mps_reader.c \
- mps_trace.c \
- ctr_drbg.c \ - ctr_drbg.c \
- debug.c \ - debug.c \
- des.c \ - des.c \
@@ -48,17 +53,13 @@ Subject: [PATCH 06/10] extmod: Use system mbedtls
- entropy.c \ - entropy.c \
- entropy_poll.c \ - entropy_poll.c \
- gcm.c \ - gcm.c \
- havege.c \
- hmac_drbg.c \ - hmac_drbg.c \
- md2.c \
- md4.c \
- md5.c \ - md5.c \
- md.c \ - md.c \
- oid.c \ - oid.c \
- padlock.c \ - padlock.c \
- pem.c \ - pem.c \
- pk.c \ - pk.c \
- pkcs11.c \
- pkcs12.c \ - pkcs12.c \
- pkcs5.c \ - pkcs5.c \
- pkparse.c \ - pkparse.c \
@@ -69,20 +70,21 @@ Subject: [PATCH 06/10] extmod: Use system mbedtls
- poly1305.c \ - poly1305.c \
- ripemd160.c \ - ripemd160.c \
- rsa.c \ - rsa.c \
- rsa_internal.c \ - rsa_alt_helpers.c \
- sha1.c \ - sha1.c \
- sha256.c \ - sha256.c \
- sha512.c \ - sha512.c \
- ssl_cache.c \ - ssl_cache.c \
- ssl_ciphersuites.c \ - ssl_ciphersuites.c \
- ssl_cli.c \ - ssl_client.c \
- ssl_cookie.c \ - ssl_cookie.c \
- ssl_srv.c \ - ssl_debug_helpers_generated.c \
- ssl_msg.c \ - ssl_msg.c \
- ssl_ticket.c \ - ssl_ticket.c \
- ssl_tls.c \ - ssl_tls.c \
- ssl_tls12_client.c \
- ssl_tls12_server.c \
- timing.c \ - timing.c \
- constant_time.c \
- x509.c \ - x509.c \
- x509_create.c \ - x509_create.c \
- x509_crl.c \ - x509_crl.c \
@@ -90,7 +92,6 @@ Subject: [PATCH 06/10] extmod: Use system mbedtls
- x509_csr.c \ - x509_csr.c \
- x509write_crt.c \ - x509write_crt.c \
- x509write_csr.c \ - x509write_csr.c \
- xtea.c \
- ) - )
+CFLAGS_EXTMOD += -DMICROPY_SSL_MBEDTLS=1 +CFLAGS_EXTMOD += -DMICROPY_SSL_MBEDTLS=1
+LDFLAGS_MOD += -lmbedx509 -lmbedtls -lmbedcrypto +LDFLAGS_MOD += -lmbedx509 -lmbedtls -lmbedcrypto