micropython: bump to 1.23.0 release
authorChristian Marangi <redacted>
Tue, 22 Oct 2024 13:27:36 +0000 (15:27 +0200)
committerRosen Penev <redacted>
Sun, 27 Oct 2024 22:09:50 +0000 (15:09 -0700)
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 <redacted>
lang/python/micropython/Makefile
lang/python/micropython/patches/010-cdefs.patch [deleted file]
lang/python/micropython/patches/010-lib-berkeley-db-cdefs.patch [new file with mode: 0644]
lang/python/micropython/patches/011-lib-berkeley-db-fix-no-init.patch [new file with mode: 0644]
lang/python/micropython/patches/040-extmod-use-external-mbedtls.patch

index 5867da1de770026e02636a0b44d40bfdb9e40b6c..5c76dae287873d24348c57cd29e074988f766d83 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=micropython
-PKG_VERSION:=1.21.0
-PKG_RELEASE:=2
+PKG_VERSION:=1.23.0
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 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_LICENSE:=MIT
diff --git a/lang/python/micropython/patches/010-cdefs.patch b/lang/python/micropython/patches/010-cdefs.patch
deleted file mode 100644 (file)
index 897c880..0000000
+++ /dev/null
@@ -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>
diff --git a/lang/python/micropython/patches/010-lib-berkeley-db-cdefs.patch b/lang/python/micropython/patches/010-lib-berkeley-db-cdefs.patch
new file mode 100644 (file)
index 0000000..443e40b
--- /dev/null
@@ -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>
diff --git a/lang/python/micropython/patches/011-lib-berkeley-db-fix-no-init.patch b/lang/python/micropython/patches/011-lib-berkeley-db-fix-no-init.patch
new file mode 100644 (file)
index 0000000..730dc18
--- /dev/null
@@ -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
index 3399412e4acf4b17ab5ccac63c5babad8c1fc33a..1cf2b12c070d5fc4735897dbc530228cb3102db5 100644 (file)
@@ -9,12 +9,12 @@ Subject: [PATCH 06/10] extmod: Use system mbedtls
 
 --- a/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 \
        )
  else ifeq ($(MICROPY_SSL_MBEDTLS),1)
 -MBEDTLS_DIR = lib/mbedtls
--MBEDTLS_CONFIG_FILE ?= \"mbedtls/mbedtls_config.h\"
+-MBEDTLS_CONFIG_FILE ?= \"mbedtls/mbedtls_config_port.h\"
 -GIT_SUBMODULES += $(MBEDTLS_DIR)
 -CFLAGS_EXTMOD += -DMBEDTLS_CONFIG_FILE=$(MBEDTLS_CONFIG_FILE)
 -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/,\
 -      aes.c \
 -      aesni.c \
--      arc4.c \
 -      asn1parse.c \
 -      asn1write.c \
 -      base64.c \
+-      bignum_core.c \
+-      bignum_mod.c \
+-      bignum_mod_raw.c \
 -      bignum.c \
--      blowfish.c \
 -      camellia.c \
 -      ccm.c \
--      certs.c \
 -      chacha20.c \
 -      chachapoly.c \
 -      cipher.c \
 -      cipher_wrap.c \
+-      nist_kw.c \
+-      aria.c \
 -      cmac.c \
+-      constant_time.c \
+-      mps_reader.c \
+-      mps_trace.c \
 -      ctr_drbg.c \
 -      debug.c \
 -      des.c \
@@ -48,17 +53,13 @@ Subject: [PATCH 06/10] extmod: Use system mbedtls
 -      entropy.c \
 -      entropy_poll.c \
 -      gcm.c \
--      havege.c \
 -      hmac_drbg.c \
--      md2.c \
--      md4.c \
 -      md5.c \
 -      md.c \
 -      oid.c \
 -      padlock.c \
 -      pem.c \
 -      pk.c \
--      pkcs11.c \
 -      pkcs12.c \
 -      pkcs5.c \
 -      pkparse.c \
@@ -69,20 +70,21 @@ Subject: [PATCH 06/10] extmod: Use system mbedtls
 -      poly1305.c \
 -      ripemd160.c \
 -      rsa.c \
--      rsa_internal.c \
+-      rsa_alt_helpers.c \
 -      sha1.c \
 -      sha256.c \
 -      sha512.c \
 -      ssl_cache.c \
 -      ssl_ciphersuites.c \
--      ssl_cli.c \
+-      ssl_client.c \
 -      ssl_cookie.c \
--      ssl_srv.c \
+-      ssl_debug_helpers_generated.c \
 -      ssl_msg.c \
 -      ssl_ticket.c \
 -      ssl_tls.c \
+-      ssl_tls12_client.c \
+-      ssl_tls12_server.c \
 -      timing.c \
--      constant_time.c \
 -      x509.c \
 -      x509_create.c \
 -      x509_crl.c \
@@ -90,7 +92,6 @@ Subject: [PATCH 06/10] extmod: Use system mbedtls
 -      x509_csr.c \
 -      x509write_crt.c \
 -      x509write_csr.c \
--      xtea.c \
 -      )
 +CFLAGS_EXTMOD += -DMICROPY_SSL_MBEDTLS=1
 +LDFLAGS_MOD += -lmbedx509 -lmbedtls -lmbedcrypto
git clone https://git.99rst.org/PROJECT