From a40aa4baf05cb8d65320e044bcaf61433b4f9404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Czerpak?= Date: Sun, 19 Jan 2025 02:08:01 +0100 Subject: [PATCH] 2025-01-19 02:08 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/hbssl/hbssl.h * contrib/hbssl/rsa.c * renamed hb_RSA_par_free() to hb_RSA_par_remove() * contrib/hbssl/evppkey.c * few code clenups * contrib/hbssl/x509.c ! use GC pointer items instead of raw ones --- ChangeLog.txt | 11 +++++++++++ contrib/hbssl/evppkey.c | 11 ++++++----- contrib/hbssl/hbssl.h | 2 +- contrib/hbssl/rsa.c | 2 +- contrib/hbssl/x509.c | 2 +- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 9518b336cf..74da74dd2d 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,17 @@ Entries may not always be in chronological/commit order. See license at the end of file. */ +2025-01-19 02:08 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * contrib/hbssl/hbssl.h + * contrib/hbssl/rsa.c + * renamed hb_RSA_par_free() to hb_RSA_par_remove() + + * contrib/hbssl/evppkey.c + * few code clenups + + * contrib/hbssl/x509.c + ! use GC pointer items instead of raw ones + 2025-01-18 09:33 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/hbssl/evp.c * clear key and iv buffers before passing them to EVP_BytesToKey() diff --git a/contrib/hbssl/evppkey.c b/contrib/hbssl/evppkey.c index ee989efa07..dc35ba5dd4 100644 --- a/contrib/hbssl/evppkey.c +++ b/contrib/hbssl/evppkey.c @@ -227,19 +227,20 @@ HB_FUNC( EVP_PKEY_ASSIGN ) HB_FUNC( EVP_PKEY_ASSIGN_RSA ) { #ifndef OPENSSL_NO_RSA - if( hb_EVP_PKEY_is( 1 ) && HB_ISPOINTER( 2 ) ) + if( hb_EVP_PKEY_is( 1 ) && hb_RSA_is( 2 ) ) { EVP_PKEY * pkey = hb_EVP_PKEY_par( 1 ); RSA * key = hb_RSA_par( 2 ); + int res = 0; if( pkey && key ) { - int result = EVP_PKEY_assign_RSA( pkey, key ); + res = EVP_PKEY_assign_RSA( pkey, key ); - if( result != 0 ) - hb_RSA_par_free( 2 ); - hb_retni( result ); + if( res != 0 ) + hb_RSA_par_remove( 2 ); } + hb_retni( res ); } else hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); diff --git a/contrib/hbssl/hbssl.h b/contrib/hbssl/hbssl.h index 004eaf4905..a367b917e0 100644 --- a/contrib/hbssl/hbssl.h +++ b/contrib/hbssl/hbssl.h @@ -219,7 +219,7 @@ extern void hb_X509_ret( X509 * x509, HB_BOOL fRelease ); extern HB_BOOL hb_RSA_is( int iParam ); extern RSA * hb_RSA_par( int iParam ); -extern void hb_RSA_par_free( int iParam ); +extern void hb_RSA_par_remove( int iParam ); extern void hb_RSA_ret( RSA * rsa ); extern HB_BOOL hb_EVP_MD_is( int iParam ); diff --git a/contrib/hbssl/rsa.c b/contrib/hbssl/rsa.c index aed04343a2..5160b5c13e 100644 --- a/contrib/hbssl/rsa.c +++ b/contrib/hbssl/rsa.c @@ -81,7 +81,7 @@ RSA * hb_RSA_par( int iParam ) return ph ? ( RSA * ) *ph : NULL; } -void hb_RSA_par_free( int iParam ) +void hb_RSA_par_remove( int iParam ) { void ** ph = ( void ** ) hb_parptrGC( &s_gcRSA_funcs, iParam ); diff --git a/contrib/hbssl/x509.c b/contrib/hbssl/x509.c index 4ce431045f..365c2083f1 100644 --- a/contrib/hbssl/x509.c +++ b/contrib/hbssl/x509.c @@ -156,7 +156,7 @@ HB_FUNC( X509_GET_PUBKEY ) X509 * x509 = hb_X509_par( 1 ); if( x509 ) - hb_retptr( X509_get_pubkey( x509 ) ); + hb_EVP_PKEY_ret( X509_get_pubkey( x509 ) ); } else hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );