diff options
author | Jack Lloyd <[email protected]> | 2018-08-16 16:46:58 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-08-16 16:50:30 -0400 |
commit | 4766fb375ab35026389d39547695be2237f6c1ca (patch) | |
tree | 683a0f68a5d36c646a5fbef4c7536b179bec509d /src/tests | |
parent | 15e149ac2dab3b22273c166839cfbf1fb947b2d4 (diff) |
Fix bug introduced in 15e149ac
This caused get_field, when called with a non-existing field, to
return success and set the field to a small negative integer.
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/test_ffi.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tests/test_ffi.cpp b/src/tests/test_ffi.cpp index c516fb873..45c756706 100644 --- a/src/tests/test_ffi.cpp +++ b/src/tests/test_ffi.cpp @@ -1646,6 +1646,9 @@ class FFI_Unit_Tests final : public Test botan_mp_init(&n); botan_mp_init(&e); + TEST_FFI_RC(BOTAN_FFI_ERROR_BAD_PARAMETER, botan_privkey_get_field, (p, priv, "quux")); + TEST_FFI_RC(BOTAN_FFI_ERROR_BAD_PARAMETER, botan_pubkey_get_field, (p, pub, "quux")); + TEST_FFI_OK(botan_privkey_rsa_get_p, (p, priv)); TEST_FFI_OK(botan_privkey_rsa_get_q, (q, priv)); TEST_FFI_OK(botan_privkey_rsa_get_d, (d, priv)); @@ -1799,10 +1802,14 @@ class FFI_Unit_Tests final : public Test botan_mp_t cmp; botan_mp_init(&cmp); + TEST_FFI_RC(BOTAN_FFI_ERROR_BAD_PARAMETER, botan_privkey_get_field, (cmp, priv, "quux")); + TEST_FFI_OK(botan_privkey_get_field, (cmp, priv, "x")); TEST_FFI_RC(1, botan_mp_equal, (cmp, x)); + TEST_FFI_OK(botan_privkey_get_field, (cmp, priv, "y")); TEST_FFI_RC(1, botan_mp_equal, (cmp, y)); + TEST_FFI_OK(botan_privkey_get_field, (cmp, priv, "p")); TEST_FFI_RC(1, botan_mp_equal, (cmp, p)); botan_mp_destroy(cmp); @@ -1912,6 +1919,9 @@ class FFI_Unit_Tests final : public Test botan_mp_init(&public_x); botan_mp_init(&public_y); + TEST_FFI_RC(BOTAN_FFI_ERROR_BAD_PARAMETER, botan_privkey_get_field, (private_scalar, priv, "quux")); + TEST_FFI_RC(BOTAN_FFI_ERROR_BAD_PARAMETER, botan_pubkey_get_field, (private_scalar, pub, "quux")); + TEST_FFI_OK(botan_privkey_get_field, (private_scalar, priv, "x")); TEST_FFI_OK(botan_pubkey_get_field, (public_x, pub, "public_x")); TEST_FFI_OK(botan_pubkey_get_field, (public_y, pub, "public_y")); |