@@ -1447,13 +1447,14 @@ mod test {
1447
1447
const VENDOR_CHANNEL : Channel = Channel :: VendorHid ( [ 0x12 , 0x34 , 0x56 , 0x78 ] ) ;
1448
1448
1449
1449
fn check_make_response (
1450
+ env : & mut impl Env ,
1450
1451
make_credential_response : & CtapResult < ResponseData > ,
1451
1452
flags : u8 ,
1452
- expected_aaguid : & [ u8 ] ,
1453
1453
expected_credential_id_size : u8 ,
1454
1454
expected_extension_cbor : & [ u8 ] ,
1455
1455
) {
1456
- const INITIAL_SIGNATURE_COUNTER : u32 = 1 ;
1456
+ let expected_aaguid = env. customization ( ) . aaguid ( ) ;
1457
+ let signature_counter = env. persist ( ) . global_signature_counter ( ) . unwrap ( ) ;
1457
1458
match make_credential_response. as_ref ( ) . unwrap ( ) {
1458
1459
ResponseData :: AuthenticatorMakeCredential ( make_credential_response) => {
1459
1460
let AuthenticatorMakeCredentialResponse {
@@ -1468,9 +1469,9 @@ mod test {
1468
1469
let mut expected_auth_data = vec ! [
1469
1470
0xA3 , 0x79 , 0xA6 , 0xF6 , 0xEE , 0xAF , 0xB9 , 0xA5 , 0x5E , 0x37 , 0x8C , 0x11 , 0x80 ,
1470
1471
0x34 , 0xE2 , 0x75 , 0x1E , 0x68 , 0x2F , 0xAB , 0x9F , 0x2D , 0x30 , 0xAB , 0x13 , 0xD2 ,
1471
- 0x12 , 0x55 , 0x86 , 0xCE , 0x19 , 0x47 , flags, 0x00 , 0x00 , 0x00 ,
1472
+ 0x12 , 0x55 , 0x86 , 0xCE , 0x19 , 0x47 , flags,
1472
1473
] ;
1473
- expected_auth_data. push ( INITIAL_SIGNATURE_COUNTER as u8 ) ;
1474
+ expected_auth_data. extend ( & signature_counter . to_be_bytes ( ) ) ;
1474
1475
expected_auth_data. extend ( expected_aaguid) ;
1475
1476
expected_auth_data. extend ( & [ 0x00 , expected_credential_id_size] ) ;
1476
1477
assert_eq ! (
@@ -1648,13 +1649,7 @@ mod test {
1648
1649
let make_credential_response =
1649
1650
ctap_state. process_make_credential ( & mut env, make_credential_params, DUMMY_CHANNEL ) ;
1650
1651
1651
- check_make_response (
1652
- & make_credential_response,
1653
- 0x41 ,
1654
- env. customization ( ) . aaguid ( ) ,
1655
- 0x20 ,
1656
- & [ ] ,
1657
- ) ;
1652
+ check_make_response ( & mut env, & make_credential_response, 0x41 , 0x20 , & [ ] ) ;
1658
1653
}
1659
1654
1660
1655
#[ test]
@@ -1668,9 +1663,9 @@ mod test {
1668
1663
ctap_state. process_make_credential ( & mut env, make_credential_params, DUMMY_CHANNEL ) ;
1669
1664
1670
1665
check_make_response (
1666
+ & mut env,
1671
1667
& make_credential_response,
1672
1668
0x41 ,
1673
- env. customization ( ) . aaguid ( ) ,
1674
1669
CBOR_CREDENTIAL_ID_SIZE as u8 ,
1675
1670
& [ ] ,
1676
1671
) ;
@@ -1838,9 +1833,9 @@ mod test {
1838
1833
0xA1 , 0x6B , 0x68 , 0x6D , 0x61 , 0x63 , 0x2D , 0x73 , 0x65 , 0x63 , 0x72 , 0x65 , 0x74 , 0xF5 ,
1839
1834
] ;
1840
1835
check_make_response (
1836
+ & mut env,
1841
1837
& make_credential_response,
1842
1838
0xC1 ,
1843
- env. customization ( ) . aaguid ( ) ,
1844
1839
CBOR_CREDENTIAL_ID_SIZE as u8 ,
1845
1840
& expected_extension_cbor,
1846
1841
) ;
@@ -1864,9 +1859,9 @@ mod test {
1864
1859
0xA1 , 0x6B , 0x68 , 0x6D , 0x61 , 0x63 , 0x2D , 0x73 , 0x65 , 0x63 , 0x72 , 0x65 , 0x74 , 0xF5 ,
1865
1860
] ;
1866
1861
check_make_response (
1862
+ & mut env,
1867
1863
& make_credential_response,
1868
1864
0xC1 ,
1869
- env. customization ( ) . aaguid ( ) ,
1870
1865
0x20 ,
1871
1866
& expected_extension_cbor,
1872
1867
) ;
@@ -1886,13 +1881,7 @@ mod test {
1886
1881
make_credential_params. extensions = extensions;
1887
1882
let make_credential_response =
1888
1883
ctap_state. process_make_credential ( & mut env, make_credential_params, DUMMY_CHANNEL ) ;
1889
- check_make_response (
1890
- & make_credential_response,
1891
- 0x41 ,
1892
- env. customization ( ) . aaguid ( ) ,
1893
- 0x20 ,
1894
- & [ ] ,
1895
- ) ;
1884
+ check_make_response ( & mut env, & make_credential_response, 0x41 , 0x20 , & [ ] ) ;
1896
1885
1897
1886
// Second part: The extension is used.
1898
1887
assert_eq ! (
@@ -1913,9 +1902,9 @@ mod test {
1913
1902
0x04 ,
1914
1903
] ;
1915
1904
check_make_response (
1905
+ & mut env,
1916
1906
& make_credential_response,
1917
1907
0xC1 ,
1918
- env. customization ( ) . aaguid ( ) ,
1919
1908
0x20 ,
1920
1909
& expected_extension_cbor,
1921
1910
) ;
@@ -1938,9 +1927,9 @@ mod test {
1938
1927
0xA1 , 0x68 , 0x63 , 0x72 , 0x65 , 0x64 , 0x42 , 0x6C , 0x6F , 0x62 , 0xF5 ,
1939
1928
] ;
1940
1929
check_make_response (
1930
+ & mut env,
1941
1931
& make_credential_response,
1942
1932
0xC1 ,
1943
- env. customization ( ) . aaguid ( ) ,
1944
1933
0x20 ,
1945
1934
& expected_extension_cbor,
1946
1935
) ;
@@ -1970,9 +1959,9 @@ mod test {
1970
1959
0xA1 , 0x68 , 0x63 , 0x72 , 0x65 , 0x64 , 0x42 , 0x6C , 0x6F , 0x62 , 0xF4 ,
1971
1960
] ;
1972
1961
check_make_response (
1962
+ & mut env,
1973
1963
& make_credential_response,
1974
1964
0xC1 ,
1975
- env. customization ( ) . aaguid ( ) ,
1976
1965
0x20 ,
1977
1966
& expected_extension_cbor,
1978
1967
) ;
@@ -2047,13 +2036,7 @@ mod test {
2047
2036
DUMMY_CHANNEL ,
2048
2037
) ;
2049
2038
2050
- check_make_response (
2051
- & make_credential_response,
2052
- 0x45 ,
2053
- env. customization ( ) . aaguid ( ) ,
2054
- 0x20 ,
2055
- & [ ] ,
2056
- ) ;
2039
+ check_make_response ( & mut env, & make_credential_response, 0x45 , 0x20 , & [ ] ) ;
2057
2040
2058
2041
let make_credential_response =
2059
2042
ctap_state. process_make_credential ( & mut env, make_credential_params, DUMMY_CHANNEL ) ;
@@ -2085,9 +2068,9 @@ mod test {
2085
2068
ctap_state. process_make_credential ( & mut env, make_credential_params, DUMMY_CHANNEL ) ;
2086
2069
2087
2070
check_make_response (
2071
+ & mut env,
2088
2072
& make_credential_response,
2089
2073
0x41 ,
2090
- env. customization ( ) . aaguid ( ) ,
2091
2074
CBOR_CREDENTIAL_ID_SIZE as u8 ,
2092
2075
& [ ] ,
2093
2076
) ;
@@ -2784,9 +2767,9 @@ mod test {
2784
2767
0xA1 , 0x68 , 0x63 , 0x72 , 0x65 , 0x64 , 0x42 , 0x6C , 0x6F , 0x62 , 0xF5 ,
2785
2768
] ;
2786
2769
check_make_response (
2770
+ & mut env,
2787
2771
& make_credential_response,
2788
2772
0xC1 ,
2789
- env. customization ( ) . aaguid ( ) ,
2790
2773
CBOR_CREDENTIAL_ID_SIZE as u8 ,
2791
2774
& expected_extension_cbor,
2792
2775
) ;
0 commit comments