px5g-mbedtls: default to 2048 bit RSA keys

px5g uses a 512 bit RSA key by default, for rsakey without a size and
for selfsigned without -newkey. mbedtls 3.6 refuses to generate RSA
keys smaller than MBEDTLS_RSA_GEN_KEY_MIN_BITS, which is 1024 bits, so
both commands fail with "error: key generation failed". OpenWrt uses
mbedtls 3.6 since 24.10.

Use 2048 bits as the default RSA key size, like px5g-wolfssl and
OpenSSL do.

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25629
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Josef Schlehofer authored and Robert Marko committed 2026-10-06 13:34:56 +02:00
1 parent 7bc38db255
commit a31b1b75cb
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=px5g-mbedtls
PKG_RELEASE:=13
PKG_RELEASE:=14
PKG_LICENSE:=LGPL-2.1
PKG_BUILD_FLAGS:=no-mips16
+2 -2
View File
@@ -157,7 +157,7 @@ static void gen_key(mbedtls_pk_context *key, bool rsa, int ksize, int exp,
int dokey(bool rsa, char **arg)
{
mbedtls_pk_context key;
unsigned int ksize = 512;
unsigned int ksize = 2048;
int exp = 65537;
char *path = NULL;
bool pem = true;
@@ -212,7 +212,7 @@ int selfsigned(char **arg)
size_t iplen;
char *subject = "";
unsigned int ksize = 512;
unsigned int ksize = 2048;
int exp = 65537;
unsigned int days = 30;
char *keypath = NULL, *certpath = NULL;