Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
home:frank_kunz
basicstation
0001-build-with-mbedtls-3.x.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-build-with-mbedtls-3.x.patch of Package basicstation
From d766a8906d13518d111945a540f175472ae2ad66 Mon Sep 17 00:00:00 2001 From: Glenn Strauss <gstrauss@gluelogic.com> Date: Fri, 19 Jul 2024 11:26:39 -0400 Subject: [PATCH 1/3] build with mbedtls 3.x Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com> --- src/cups.c | 15 +++++++++------ src/tls.c | 8 ++++++-- src/tls.h | 6 +++++- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/cups.c b/src/cups.c index b655826..3682fe9 100644 --- a/src/cups.c +++ b/src/cups.c @@ -38,6 +38,9 @@ #include "mbedtls/sha512.h" #include "mbedtls/bignum.h" +#ifndef MBEDTLS_PRIVATE +#define MBEDTLS_PRIVATE(x) x +#endif #define FAIL_CNT_THRES 6 #define SIGCRC_LEN 4 @@ -72,12 +75,12 @@ static int cups_verifySig (cups_sig_t* sig) { mbedtls_ecdsa_context ecdsa; mbedtls_ecdsa_init(&ecdsa); int ret; - if ((ret = mbedtls_ecp_group_load (&k.grp, MBEDTLS_ECP_DP_SECP256R1) ) || - (ret = mbedtls_mpi_read_binary (&k.Q.X, (u1_t*)key.buf, 32) ) || - (ret = mbedtls_mpi_read_binary (&k.Q.Y, (u1_t*)key.buf+32, 32) ) || - (ret = mbedtls_mpi_lset (&k.Q.Z, 1) ) || - (ret = mbedtls_ecp_check_pubkey (&k.grp, &k.Q) ) || - (ret = mbedtls_ecdsa_from_keypair (&ecdsa, &k) ) || + if ((ret = mbedtls_ecp_group_load (&k.MBEDTLS_PRIVATE(grp), MBEDTLS_ECP_DP_SECP256R1) ) || + (ret = mbedtls_mpi_read_binary (&k.MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(X), (u1_t*)key.buf, 32) ) || + (ret = mbedtls_mpi_read_binary (&k.MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(Y), (u1_t*)key.buf+32, 32) ) || + (ret = mbedtls_mpi_lset (&k.MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(Z), 1) ) || + (ret = mbedtls_ecp_check_pubkey (&k.MBEDTLS_PRIVATE(grp), &k.MBEDTLS_PRIVATE(Q)) ) || + (ret = mbedtls_ecdsa_from_keypair (&ecdsa, &k) ) || (ret = mbedtls_ecdsa_read_signature (&ecdsa, sig->hash, sizeof(sig->hash), sig->signature, sig->len )) ) { verified = 0; diff --git a/src/tls.c b/src/tls.c index 8aa4ede..671d3c2 100644 --- a/src/tls.c +++ b/src/tls.c @@ -28,7 +28,6 @@ #include "mbedtls/net_sockets.h" #include "mbedtls/ssl.h" -#include "mbedtls/certs.h" #include "mbedtls/entropy.h" #include "mbedtls/ctr_drbg.h" #include "mbedtls/error.h" @@ -230,7 +229,12 @@ int tls_setMyCert (tlsconf_t* conf, const char* cert, int certlen, const char* k keyb = (u1_t*)dbuf.buf; keyl = dbuf.bufsize+1; } - if( (ret = mbedtls_pk_parse_key(mykey, keyb, keyl, (const u1_t*)pwd, pwd?strlen(pwd):0)) != 0 ) { + ret = mbedtls_pk_parse_key(mykey, keyb, keyl, (const u1_t*)pwd, pwd?strlen(pwd):0 +#if MBEDTLS_VERSION_NUMBER >= 0x03000000 /* mbedtls 3.0.0 */ + , mbedtls_ctr_drbg_random, assertDBRG() +#endif + ); + if( ret != 0 ) { log_mbedError(ERROR, ret, "Parsing key"); goto errexit; } diff --git a/src/tls.h b/src/tls.h index 5244551..d9d8dbe 100644 --- a/src/tls.h +++ b/src/tls.h @@ -30,7 +30,11 @@ #define _tls_h_ #include "mbedtls/ssl.h" -#include "mbedtls/net.h" +#if MBEDTLS_VERSION_NUMBER < 0x02040000L +#include <mbedtls/net.h> +#else +#include "mbedtls/net_sockets.h" +#endif typedef struct tlsconf tlsconf_t; typedef struct mbedtls_ssl_context* tlsctx_p; -- 2.47.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor