m4sterchain commented on code in PR #221:
URL:
https://github.com/apache/incubator-teaclave-trustzone-sdk/pull/221#discussion_r2281928317
##########
examples/tls_client-rs/ta/src/main.rs:
##########
@@ -17,18 +17,28 @@
#![no_main]
+use anyhow::Context;
use optee_utee::net::TcpStream;
use optee_utee::{
ta_close_session, ta_create, ta_destroy, ta_invoke_command,
ta_open_session, trace_println,
};
use optee_utee::{Error, ErrorKind, Parameters, Result};
use proto::Command;
-use rustls::{OwnedTrustAnchor, RootCertStore};
+use rustls::RootCertStore;
use std::convert::TryInto;
-use std::io::Read;
-use std::io::Write;
+use std::io::{Read, Write};
use std::sync::Arc;
+// Register the custom getrandom implementation.
+//
+// In getrandom 0.2 there is no built-in OP-TEE target, so we rely on the
+// `custom` feature to provide an OP-TEE RNG.
+// Reference:
https://docs.rs/getrandom/0.2.16/getrandom/macro.register_custom_getrandom.html
+//
+// For this example, the shared `optee_getrandom` function is defined in the
+// `rustls_provider` crate and registered here.
+getrandom::register_custom_getrandom!(rustls_provider::optee_getrandom);
Review Comment:
I just notice the difference about the return types. If they are not
compatible, the wrapper makes sense to me now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]