Skip to content

Commit bcb2011

Browse files
authored
Use a non-deprecated OpeNSSL function (#1093)
1 parent 05d580d commit bcb2011

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/OpenSSL/crypto.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def _get_asn1_time(timestamp):
174174
elif (
175175
_lib.ASN1_STRING_type(string_timestamp) == _lib.V_ASN1_GENERALIZEDTIME
176176
):
177-
return _ffi.string(_lib.ASN1_STRING_data(string_timestamp))
177+
return _ffi.string(_lib.ASN1_STRING_get0_data(string_timestamp))
178178
else:
179179
generalized_timestamp = _ffi.new("ASN1_GENERALIZEDTIME**")
180180
_lib.ASN1_TIME_to_generalizedtime(timestamp, generalized_timestamp)
@@ -193,7 +193,7 @@ def _get_asn1_time(timestamp):
193193
string_timestamp = _ffi.cast(
194194
"ASN1_STRING*", generalized_timestamp[0]
195195
)
196-
string_data = _lib.ASN1_STRING_data(string_timestamp)
196+
string_data = _lib.ASN1_STRING_get0_data(string_timestamp)
197197
string_result = _ffi.string(string_data)
198198
_lib.ASN1_GENERALIZEDTIME_free(generalized_timestamp[0])
199199
return string_result
@@ -715,7 +715,7 @@ def get_components(self):
715715
# ffi.string does not handle strings containing NULL bytes
716716
# (which may have been generated by old, broken software)
717717
value = _ffi.buffer(
718-
_lib.ASN1_STRING_data(fval), _lib.ASN1_STRING_length(fval)
718+
_lib.ASN1_STRING_get0_data(fval), _lib.ASN1_STRING_length(fval)
719719
)[:]
720720
result.append((_ffi.string(name), value))
721721

@@ -869,7 +869,7 @@ def get_data(self):
869869
"""
870870
octet_result = _lib.X509_EXTENSION_get_data(self._extension)
871871
string_result = _ffi.cast("ASN1_STRING*", octet_result)
872-
char_result = _lib.ASN1_STRING_data(string_result)
872+
char_result = _lib.ASN1_STRING_get0_data(string_result)
873873
result_length = _lib.ASN1_STRING_length(string_result)
874874
return _ffi.buffer(char_result, result_length)[:]
875875

0 commit comments

Comments
 (0)