Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove write_pem function as its incorrect and write_pem_string should be used #311

Merged
merged 1 commit into from
Aug 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions mbedtls/src/x509/csr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,27 +167,6 @@ impl<'a> Builder<'a> {
)
}

pub fn write_pem<'buf, F: Random>(
&mut self,
buf: &'buf mut [u8],
rng: &mut F,
) -> Result<Option<&'buf [u8]>> {
match unsafe {
x509write_csr_der(
&mut self.inner,
buf.as_mut_ptr(),
buf.len(),
Some(F::call),
rng.data_ptr(),
)
.into_result()
} {
Err(e) if e.low_level() == Some(codes::Base64BufferTooSmall) => Ok(None),
Err(e) => Err(e),
Ok(n) => Ok(Some(&buf[buf.len() - (n as usize)..])),
}
}

pub fn write_pem_string<F: Random>(&mut self, rng: &mut F) -> Result<String> {
alloc_string_repeat(|buf, size| unsafe {
match x509write_csr_pem(
Expand Down