mirror of
https://github.com/polhenarejos/pico-fido.git
synced 2024-09-20 03:10:10 +00:00
Fix return value when bad key type is provided. Fixes #47.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
b0b0187919
commit
54bbc0e9ea
@ -225,9 +225,9 @@ int cbor_make_credential(const uint8_t *data, size_t len) {
|
|||||||
else if (pubKeyCredParams[i].alg <= FIDO2_ALG_RS256 && pubKeyCredParams[i].alg >= FIDO2_ALG_RS512) {
|
else if (pubKeyCredParams[i].alg <= FIDO2_ALG_RS256 && pubKeyCredParams[i].alg >= FIDO2_ALG_RS512) {
|
||||||
// pass
|
// pass
|
||||||
}
|
}
|
||||||
else {
|
//else {
|
||||||
CBOR_ERROR(CTAP2_ERR_CBOR_UNEXPECTED_TYPE);
|
// CBOR_ERROR(CTAP2_ERR_CBOR_UNEXPECTED_TYPE);
|
||||||
}
|
//}
|
||||||
if (curve > 0 && alg == 0) {
|
if (curve > 0 && alg == 0) {
|
||||||
alg = pubKeyCredParams[i].alg;
|
alg = pubKeyCredParams[i].alg;
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ def test_unsupported_algorithm(device):
|
|||||||
with pytest.raises(CtapError) as e:
|
with pytest.raises(CtapError) as e:
|
||||||
device.doMC(key_params=[{"alg": 1337, "type": "public-key"}])
|
device.doMC(key_params=[{"alg": 1337, "type": "public-key"}])
|
||||||
|
|
||||||
assert e.value.code == CtapError.ERR.CBOR_UNEXPECTED_TYPE
|
assert e.value.code == CtapError.ERR.UNSUPPORTED_ALGORITHM
|
||||||
|
|
||||||
def test_exclude_list(resetdevice):
|
def test_exclude_list(resetdevice):
|
||||||
resetdevice.doMC(exclude_list=[{"id": b"1234", "type": "rot13"}])
|
resetdevice.doMC(exclude_list=[{"id": b"1234", "type": "rot13"}])
|
||||||
|
Loading…
Reference in New Issue
Block a user