File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
enclave/safetrace/enclave/src Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ use serde_json::{Value, json};
12
12
use serde:: { Deserialize , Serialize } ;
13
13
use rmp_serde:: { Deserializer , Serializer } ;
14
14
15
- extern crate rgsl;
15
+ use rgsl:: types :: Rng ;
16
16
17
17
use sgx_tseal:: { SgxSealedData } ;
18
18
use sgx_types:: marker:: ContiguousMemory ;
@@ -31,6 +31,7 @@ pub enum Error {
31
31
SliceError ,
32
32
UnsealError ( sgx_status_t ) ,
33
33
SerializeError ,
34
+ RandomGeneratorError ,
34
35
Other
35
36
}
36
37
@@ -251,7 +252,7 @@ pub fn find_match_internal(
251
252
// https://stackoverflow.com/questions/5031268/algorithm-to-find-all-latitude-longitude-locations-within-a-certain-distance-fro
252
253
253
254
if ( e. lat - d. lat ) . abs ( ) * 111000.0 < DISTANCE * 0.71 {
254
- let mut r = Rng :: new ( gsl_rng_taus ) ;
255
+ let mut r = Rng :: new ( & rgsl :: types :: rng :: algorithms :: taus ( ) ) . ok_or ( Error :: RandomGeneratorError ) ? ;
255
256
let lapnoise = rgsl:: randist:: laplace:: laplace ( & mut r, 0.87 ) . abs ( ) * 2.0 ;
256
257
// then we can run a more computationally expensive and precise comparison
257
258
if ( e. lat . sin ( ) * d. lat . sin ( ) +e. lat . cos ( ) * d. lat . cos ( ) * ( e. lng -d. lng ) . cos ( ) ) . acos ( ) * EARTH_RADIUS - lapnoise < DISTANCE {
You can’t perform that action at this time.
0 commit comments