DemesneGH commented on code in PR #221:
URL: 
https://github.com/apache/incubator-teaclave-trustzone-sdk/pull/221#discussion_r2281921952


##########
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:
   We can't, because the required custom fn has different signature with 
`optee_utee::Random::generate` (`pub fn generate(res_buffer: &mut [u8])`).
   It requires: `pub fn custom_rng(buf: &mut [u8]) -> Result<(), 
getrandom::Error>`



-- 
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: dev-unsubscr...@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@teaclave.apache.org
For additional commands, e-mail: dev-h...@teaclave.apache.org

Reply via email to