Skip to content

Commit 1714fd9

Browse files
committed
Fix some result code checks (rc == 1 for success rather than rc == 0)
1 parent e9ca244 commit 1714fd9

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

platform/posix/transport/src/openssl_posix.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -631,13 +631,13 @@ static int32_t initializePkcs11Engine( ENGINE ** ppEngine,
631631
const char * pP11ModulePath,
632632
const char * pP11ModulePin )
633633
{
634-
int32_t sslStatus = 0;
634+
int32_t sslStatus = 1;
635635
ENGINE * pEngine = NULL;
636636

637637
assert( ppEngine != NULL );
638638

639639
/* Initialize pkcs11 config and engine */
640-
ENGINE_add_conf_module();
640+
// ENGINE_add_conf_module();
641641

642642
ENGINE_load_builtin_engines();
643643

@@ -652,45 +652,45 @@ static int32_t initializePkcs11Engine( ENGINE ** ppEngine,
652652

653653
/* Increase log level if necessary */
654654
#if LIBRARY_LOG_LEVEL >= LOG_INFO
655-
if( ( sslStatus == 0 ) &&
656-
( ENGINE_ctrl_cmd_string(engine, "VERBOSE", NULL, 0 ) != 0 ) )
655+
if( ( sslStatus == 1 ) &&
656+
( ENGINE_ctrl_cmd_string(engine, "VERBOSE", NULL, 0 ) != 1 ) )
657657
{
658658
LogError( ( "Failed to increment the pkcs11 engine verbosity level." ) );
659659
sslStatus = opensslError();
660660
}
661661
#endif
662662

663663
/* Set module path if specified */
664-
if( sslStatus == 0 && pP11ModulePath != NULL )
664+
if( sslStatus == 1 && pP11ModulePath != NULL )
665665
{
666-
if( ENGINE_ctrl_cmd_string( pEngine, "MODULE_PATH", pP11ModulePath, 0 ) != 0 )
666+
if( ENGINE_ctrl_cmd_string( pEngine, "MODULE_PATH", pP11ModulePath, 0 ) != 1 )
667667
{
668668
LogError( ( "Failed to set the pkcs11 module path: %s.", pP11ModulePath ) );
669669
sslStatus = opensslError();
670670
}
671671
}
672672

673-
if( sslStatus == 0 )
673+
if( sslStatus == 1 )
674674
{
675675
/* Initialize the pkcs11 engine and acquire a functional reference to it */
676-
if( ENGINE_init( pEngine ) != 0 )
676+
if( ENGINE_init( pEngine ) != 1 )
677677
{
678678
LogError( ( "Failed to initialize the openssl pkcs11 engine." ) );
679679
sslStatus = opensslError();
680680
}
681681
}
682682

683683
/* Unlock with pin code if specified */
684-
if( sslStatus == 0 && pP11ModulePin != NULL )
684+
if( sslStatus == 1 && pP11ModulePin != NULL )
685685
{
686-
if( ENGINE_ctrl_cmd_string( pEngine, "PIN", pP11ModulePin, 0 ) != 0 )
686+
if( ENGINE_ctrl_cmd_string( pEngine, "PIN", pP11ModulePin, 0 ) != 1 )
687687
{
688688
LogError( ( "Failed to unlock the pkcs11 module with the given pin code." ) );
689689
sslStatus = opensslError();
690690
}
691691
}
692692

693-
if( sslStatus == 0 )
693+
if( sslStatus == 1 )
694694
{
695695
*ppEngine = pEngine;
696696
}
@@ -706,7 +706,7 @@ static int32_t initializePkcs11Engine( ENGINE ** ppEngine,
706706
static int32_t setCredentials( SSL_CTX * pSslContext,
707707
const OpensslCredentials_t * pOpensslCredentials )
708708
{
709-
int32_t sslStatus = 0;
709+
int32_t sslStatus = 1;
710710
ENGINE * pEngine = NULL;
711711
bool certFromEngine = false;
712712
bool pkeyFromEngine = false;

0 commit comments

Comments
 (0)