///
/// input must be a valid buffer of at least input_len bytes
#[no_mangle]
-pub unsafe extern "C" fn rs_x509_decode(
+pub unsafe extern "C" fn SCX509Decode(
input: *const u8,
input_len: u32,
err_code: *mut u32,
}
#[no_mangle]
-pub unsafe extern "C" fn rs_x509_get_subject(ptr: *const X509) -> *mut c_char {
+pub unsafe extern "C" fn SCX509GetSubject(ptr: *const X509) -> *mut c_char {
if ptr.is_null() {
return std::ptr::null_mut();
}
}
#[no_mangle]
-pub unsafe extern "C" fn rs_x509_get_subjectaltname_len(ptr: *const X509) -> u16 {
+pub unsafe extern "C" fn SCX509GetSubjectAltNameLen(ptr: *const X509) -> u16 {
if ptr.is_null() {
return 0;
}
}
#[no_mangle]
-pub unsafe extern "C" fn rs_x509_get_subjectaltname_at(ptr: *const X509, idx: u16) -> *mut c_char {
+pub unsafe extern "C" fn SCX509GetSubjectAltNameAt(ptr: *const X509, idx: u16) -> *mut c_char {
if ptr.is_null() {
return std::ptr::null_mut();
}
}
#[no_mangle]
-pub unsafe extern "C" fn rs_x509_get_issuer(ptr: *const X509) -> *mut c_char {
+pub unsafe extern "C" fn SCX509GetIssuer(ptr: *const X509) -> *mut c_char {
if ptr.is_null() {
return std::ptr::null_mut();
}
}
#[no_mangle]
-pub unsafe extern "C" fn rs_x509_get_serial(ptr: *const X509) -> *mut c_char {
+pub unsafe extern "C" fn SCX509GetSerial(ptr: *const X509) -> *mut c_char {
if ptr.is_null() {
return std::ptr::null_mut();
}
///
/// # Safety
///
-/// ptr must be a valid object obtained using `rs_x509_decode`
+/// ptr must be a valid object obtained using `SCX509Decode`
#[no_mangle]
-pub unsafe extern "C" fn rs_x509_get_validity(
+pub unsafe extern "C" fn SCX509GetValidity(
ptr: *const X509,
not_before: *mut i64,
not_after: *mut i64,
///
/// # Safety
///
-/// ptr must be a valid object obtained using `rs_x509_decode`
+/// ptr must be a valid object obtained using `SCX509Decode`
#[no_mangle]
-pub unsafe extern "C" fn rs_x509_free(ptr: *mut X509) {
+pub unsafe extern "C" fn SCX509Free(ptr: *mut X509) {
if ptr.is_null() {
return;
}
/* only store fields from the first certificate in the chain */
if (certn == 0 && connp->cert0_subject == NULL && connp->cert0_issuerdn == NULL &&
connp->cert0_serial == NULL) {
- x509 = rs_x509_decode(input, cert_len, &err_code);
+ x509 = SCX509Decode(input, cert_len, &err_code);
if (x509 == NULL) {
TlsDecodeHSCertificateErrSetEvent(ssl_state, err_code);
goto next;
}
- char *str = rs_x509_get_subject(x509);
+ char *str = SCX509GetSubject(x509);
if (str == NULL) {
err_code = ERR_EXTRACT_SUBJECT;
goto error;
}
connp->cert0_subject = str;
- str = rs_x509_get_issuer(x509);
+ str = SCX509GetIssuer(x509);
if (str == NULL) {
err_code = ERR_EXTRACT_ISSUER;
goto error;
}
connp->cert0_issuerdn = str;
- connp->cert0_sans_len = rs_x509_get_subjectaltname_len(x509);
+ connp->cert0_sans_len = SCX509GetSubjectAltNameLen(x509);
char **sans = SCCalloc(connp->cert0_sans_len, sizeof(char *));
if (sans == NULL) {
goto error;
}
for (uint16_t i = 0; i < connp->cert0_sans_len; i++) {
- sans[i] = rs_x509_get_subjectaltname_at(x509, i);
+ sans[i] = SCX509GetSubjectAltNameAt(x509, i);
}
connp->cert0_sans = sans;
- str = rs_x509_get_serial(x509);
+ str = SCX509GetSerial(x509);
if (str == NULL) {
err_code = ERR_INVALID_SERIAL;
goto error;
}
connp->cert0_serial = str;
- rc = rs_x509_get_validity(x509, &connp->cert0_not_before, &connp->cert0_not_after);
+ rc = SCX509GetValidity(x509, &connp->cert0_not_before, &connp->cert0_not_after);
if (rc != 0) {
err_code = ERR_EXTRACT_VALIDITY;
goto error;
}
- rs_x509_free(x509);
+ SCX509Free(x509);
x509 = NULL;
rc = TlsDecodeHSCertificateFingerprint(connp, input, cert_len);
if (err_code != 0)
TlsDecodeHSCertificateErrSetEvent(ssl_state, err_code);
if (x509 != NULL)
- rs_x509_free(x509);
+ SCX509Free(x509);
SSLStateCertSANFree(connp);
return -1;