Run rustfmt on github actions
This commit is contained in:
parent
72048765c7
commit
406031991f
|
|
@ -0,0 +1,25 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- github-actions
|
||||||
|
|
||||||
|
env:
|
||||||
|
RUSTFLAGS: -Dwarnings
|
||||||
|
RUST_BACKTRACE: 1
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
rustfmt:
|
||||||
|
name: rustfmt
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install Rust
|
||||||
|
run: rustup update stable && rustup default stable
|
||||||
|
- name: Check formatting
|
||||||
|
run: cargo fmt --all -- --check
|
||||||
|
|
@ -207,10 +207,7 @@ fn try_vcpkg() {
|
||||||
.find_package("openssl");
|
.find_package("openssl");
|
||||||
|
|
||||||
if let Err(e) = lib {
|
if let Err(e) = lib {
|
||||||
println!(
|
println!("note: vcpkg did not find openssl: {}", e);
|
||||||
"note: vcpkg did not find openssl: {}",
|
|
||||||
e
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ extern "C" {
|
||||||
pub fn EVP_DecryptFinal_ex(
|
pub fn EVP_DecryptFinal_ex(
|
||||||
ctx: *mut EVP_CIPHER_CTX,
|
ctx: *mut EVP_CIPHER_CTX,
|
||||||
outm: *mut c_uchar,
|
outm: *mut c_uchar,
|
||||||
outl: *mut c_int
|
outl: *mut c_int,
|
||||||
) -> c_int;
|
) -> c_int;
|
||||||
}
|
}
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
|
|
|
||||||
|
|
@ -142,9 +142,7 @@ extern "C" {
|
||||||
buf: *mut *const u8,
|
buf: *mut *const u8,
|
||||||
length: c_long,
|
length: c_long,
|
||||||
) -> *mut PKCS8_PRIV_KEY_INFO;
|
) -> *mut PKCS8_PRIV_KEY_INFO;
|
||||||
pub fn PKCS8_PRIV_KEY_INFO_free(
|
pub fn PKCS8_PRIV_KEY_INFO_free(p8inf: *mut PKCS8_PRIV_KEY_INFO);
|
||||||
p8inf: *mut PKCS8_PRIV_KEY_INFO,
|
|
||||||
);
|
|
||||||
|
|
||||||
pub fn PEM_read_bio_PKCS7(
|
pub fn PEM_read_bio_PKCS7(
|
||||||
bio: *mut BIO,
|
bio: *mut BIO,
|
||||||
|
|
|
||||||
|
|
@ -527,10 +527,7 @@ impl PKey<Private> {
|
||||||
/// Deserializes a DER-formatted PKCS#8 unencrypted private key.
|
/// Deserializes a DER-formatted PKCS#8 unencrypted private key.
|
||||||
///
|
///
|
||||||
/// This method is mainly for interoperability reasons. Encrypted keyfiles should be preferred.
|
/// This method is mainly for interoperability reasons. Encrypted keyfiles should be preferred.
|
||||||
pub fn private_key_from_pkcs8(
|
pub fn private_key_from_pkcs8(der: &[u8]) -> Result<PKey<Private>, ErrorStack> {
|
||||||
der: &[u8],
|
|
||||||
) -> Result<PKey<Private>, ErrorStack>
|
|
||||||
{
|
|
||||||
unsafe {
|
unsafe {
|
||||||
ffi::init();
|
ffi::init();
|
||||||
let len = der.len().min(c_long::max_value() as usize) as c_long;
|
let len = der.len().min(c_long::max_value() as usize) as c_long;
|
||||||
|
|
@ -539,8 +536,7 @@ impl PKey<Private> {
|
||||||
&mut der.as_ptr(),
|
&mut der.as_ptr(),
|
||||||
len,
|
len,
|
||||||
))?;
|
))?;
|
||||||
let res = cvt_p(ffi::EVP_PKCS82PKEY(p8inf))
|
let res = cvt_p(ffi::EVP_PKCS82PKEY(p8inf)).map(|p| PKey::from_ptr(p));
|
||||||
.map(|p| PKey::from_ptr(p));
|
|
||||||
ffi::PKCS8_PRIV_KEY_INFO_free(p8inf);
|
ffi::PKCS8_PRIV_KEY_INFO_free(p8inf);
|
||||||
res
|
res
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -354,7 +354,11 @@ impl<'a> Signer<'a> {
|
||||||
///
|
///
|
||||||
/// [`EVP_DigestSign`]: https://www.openssl.org/docs/man1.1.1/man3/EVP_DigestSign.html
|
/// [`EVP_DigestSign`]: https://www.openssl.org/docs/man1.1.1/man3/EVP_DigestSign.html
|
||||||
#[cfg(ossl111)]
|
#[cfg(ossl111)]
|
||||||
pub fn sign_oneshot(&mut self, sig_buf: &mut [u8], data_buf: &[u8]) -> Result<usize, ErrorStack> {
|
pub fn sign_oneshot(
|
||||||
|
&mut self,
|
||||||
|
sig_buf: &mut [u8],
|
||||||
|
data_buf: &[u8],
|
||||||
|
) -> Result<usize, ErrorStack> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut sig_len = sig_buf.len();
|
let mut sig_len = sig_buf.len();
|
||||||
cvt(ffi::EVP_DigestSign(
|
cvt(ffi::EVP_DigestSign(
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use ffi::{
|
use ffi::{
|
||||||
self, BIO_clear_retry_flags, BIO_new, BIO_set_retry_read, BIO_set_retry_write, BIO,
|
self, BIO_clear_retry_flags, BIO_new, BIO_set_retry_read, BIO_set_retry_write, BIO,
|
||||||
BIO_CTRL_FLUSH, BIO_CTRL_DGRAM_QUERY_MTU,
|
BIO_CTRL_DGRAM_QUERY_MTU, BIO_CTRL_FLUSH,
|
||||||
};
|
};
|
||||||
use libc::{c_char, c_int, c_long, c_void, strlen};
|
use libc::{c_char, c_int, c_long, c_void, strlen};
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
|
|
|
||||||
|
|
@ -320,9 +320,9 @@ impl Cipher {
|
||||||
/// Determines whether the cipher is using OCB mode
|
/// Determines whether the cipher is using OCB mode
|
||||||
#[cfg(ossl110)]
|
#[cfg(ossl110)]
|
||||||
fn is_ocb(&self) -> bool {
|
fn is_ocb(&self) -> bool {
|
||||||
*self == Cipher::aes_128_ocb() ||
|
*self == Cipher::aes_128_ocb()
|
||||||
*self == Cipher::aes_192_ocb() ||
|
|| *self == Cipher::aes_192_ocb()
|
||||||
*self == Cipher::aes_256_ocb()
|
|| *self == Cipher::aes_256_ocb()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(ossl110))]
|
#[cfg(not(ossl110))]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue