Skip to content

Commit e1ede23

Browse files
committed
Fix wolfSSL_Init return type and check
1 parent c81c839 commit e1ede23

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

wolfssl/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ class SSLContext(object):
152152
"""
153153

154154
def __init__(self, protocol, server_side=None):
155-
_lib.wolfSSL_Init()
155+
if _lib.wolfSSL_Init() != _SSL_SUCCESS:
156+
raise RuntimeError(
157+
"wolfSSL library initialization failed")
156158
method = _WolfSSLMethod(protocol, server_side)
157159

158160
self.protocol = protocol

wolfssl/_build_ffi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ def generate_libwolfssl():
474474
/*
475475
* SSL/TLS Session functions
476476
*/
477-
void wolfSSL_Init();
477+
int wolfSSL_Init(void);
478478
WOLFSSL* wolfSSL_new(WOLFSSL_CTX*);
479479
void wolfSSL_free(WOLFSSL*);
480480

0 commit comments

Comments
 (0)