@@ -112,12 +112,14 @@ impl StateMachine {
112112 } ,
113113 ) ;
114114
115+ let app_id_hash = application. to_u2f ( ) ;
116+
115117 // Iterate the exclude list and see if there are any matches.
116118 // If so, we'll keep polling the device anyway to test for user
117119 // consent, to be consistent with CTAP2 device behavior.
118120 let excluded = key_handles. iter ( ) . any ( |key_handle| {
119121 is_valid_transport ( key_handle. transports )
120- && u2f_is_keyhandle_valid ( dev, & challenge, & application , & key_handle. credential )
122+ && u2f_is_keyhandle_valid ( dev, & challenge, & app_id_hash , & key_handle. credential )
121123 . unwrap_or ( false ) /* no match on failure */
122124 } ) ;
123125
@@ -130,7 +132,7 @@ impl StateMachine {
130132 ) ) ) ;
131133 break ;
132134 }
133- } else if let Ok ( bytes) = u2f_register ( dev, & challenge, & application ) {
135+ } else if let Ok ( bytes) = u2f_register ( dev, & challenge, & app_id_hash ) {
134136 let dev_info = dev. get_device_info ( ) ;
135137 send_status (
136138 & status_mutex,
@@ -201,7 +203,9 @@ impl StateMachine {
201203 // valid key handle for an appId, we'll use that appId below.
202204 let ( app_id, valid_handles) =
203205 find_valid_key_handles ( & app_ids, & key_handles, |app_id, key_handle| {
204- u2f_is_keyhandle_valid ( dev, & challenge, app_id, & key_handle. credential )
206+ let app_id: crate :: AppId = app_id. clone ( ) . into ( ) ;
207+ let app_id_hash = app_id. to_u2f ( ) ;
208+ u2f_is_keyhandle_valid ( dev, & challenge, & app_id_hash, & key_handle. credential )
205209 . unwrap_or ( false ) /* no match on failure */
206210 } ) ;
207211
@@ -225,6 +229,8 @@ impl StateMachine {
225229 } ,
226230 ) ;
227231
232+ let app_id_hash = app_id. to_u2f ( ) ;
233+
228234 ' outer: while alive ( ) {
229235 // If the device matches none of the given key handles
230236 // then just make it blink with bogus data.
@@ -239,7 +245,8 @@ impl StateMachine {
239245 } else {
240246 // Otherwise, try to sign.
241247 for key_handle in & valid_handles {
242- if let Ok ( bytes) = u2f_sign ( dev, & challenge, app_id, & key_handle. credential )
248+ if let Ok ( bytes) =
249+ u2f_sign ( dev, & challenge, & app_id_hash, & key_handle. credential )
243250 {
244251 let dev_info = dev. get_device_info ( ) ;
245252 send_status (
0 commit comments