Merge "Don't set /dev/hwrng to O_NONBLOCK"

This commit is contained in:
Treehugger Robot 2023-03-09 20:01:54 +00:00 committed by Gerrit Code Review
commit 94ad8ad990
2 changed files with 2 additions and 5 deletions

View file

@ -1,2 +1,2 @@
paulcrowley@google.com
prb@google.com
prb@google.com

View file

@ -12,11 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use std::{fs::File, io::Read, os::unix::io::AsRawFd};
use std::{fs::File, io::Read};
use anyhow::{ensure, Context, Result};
use log::debug;
use nix::fcntl::{fcntl, FcntlArg::F_SETFL, OFlag};
use tokio::io::AsyncReadExt;
use crate::drbg;
@ -34,8 +33,6 @@ impl ConditionerBuilder {
let mut et: drbg::Entropy = [0; drbg::ENTROPY_LEN];
hwrng.read_exact(&mut et).context("hwrng.read_exact in new")?;
let rg = drbg::Drbg::new(&et)?;
fcntl(hwrng.as_raw_fd(), F_SETFL(OFlag::O_NONBLOCK))
.context("setting O_NONBLOCK on hwrng")?;
Ok(ConditionerBuilder { hwrng, rg })
}