@@ -249,8 +249,9 @@ def set_ciphers(self, ciphers):
249249 be selected (because compile-time options or other configuration
250250 forbids use of all the specified ciphers), an SSLError will be raised.
251251 """
252+ cipherBytes = t2b (ciphers )
252253 ret = _lib .wolfSSL_CTX_set_cipher_list (self .native_object ,
253- t2b ( ciphers ))
254+ _ffi . new ( "char[]" , cipherBytes ))
254255
255256 if ret != _SSL_SUCCESS :
256257 raise SSLError ("Unable to set cipher list" )
@@ -259,8 +260,11 @@ def use_sni(self, server_hostname):
259260 """
260261 Sets the SNI hostname, wraps native wolfSSL_CTX_UseSNI()
261262 """
263+
264+ sni = t2b (server_hostname )
265+
262266 ret = _lib .wolfSSL_CTX_UseSNI (self .native_object , 0 ,
263- server_hostname , len (server_hostname ))
267+ sni , len (sni ))
264268
265269 if ret != _SSL_SUCCESS :
266270 raise SSLError ("Unable to set wolfSSL CTX SNI" )
@@ -421,8 +425,10 @@ def __init__(self, sock=None, keyfile=None, certfile=None,
421425 # match domain name / host name if set in context
422426 if server_hostname is not None :
423427 if self ._context .check_hostname :
428+
429+ sni = _ffi .new ("char[]" , server_hostname .encode ("utf-8" ))
424430 _lib .wolfSSL_check_domain_name (self .native_object ,
425- server_hostname )
431+ sni )
426432
427433 if connected :
428434 try :
@@ -468,8 +474,11 @@ def use_sni(self, server_hostname):
468474 """
469475 Sets the SNI hostname, wraps native wolfSSL_UseSNI()
470476 """
477+
478+ sni = t2b (server_hostname )
479+
471480 ret = _lib .wolfSSL_UseSNI (self .native_object , 0 ,
472- server_hostname , len (server_hostname ))
481+ sni , len (sni ))
473482
474483 if ret != _SSL_SUCCESS :
475484 raise SSLError ("Unable to set wolfSSL SNI" )
0 commit comments