mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-06-08 06:27:23 +02:00
unit: Use new precheck feature for storage encryption test
This commit is contained in:
parent
36b1086f60
commit
78f4e6240e
@ -30,26 +30,37 @@
|
|||||||
|
|
||||||
#include "src/storage.h"
|
#include "src/storage.h"
|
||||||
|
|
||||||
|
static bool aes_ctr_supported(void)
|
||||||
|
{
|
||||||
|
return l_cipher_is_supported(L_CIPHER_AES_CTR);
|
||||||
|
}
|
||||||
|
|
||||||
static void test_short_encrypted_bytes(const void *data)
|
static void test_short_encrypted_bytes(const void *data)
|
||||||
{
|
{
|
||||||
struct l_settings *settings = l_settings_new();
|
struct l_settings *settings = l_settings_new();
|
||||||
bool changed;
|
bool changed;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
storage_init((const uint8_t *)"abc123", 6);
|
||||||
|
|
||||||
l_settings_set_string(settings, "Security", "EncryptedSecurity", "012345");
|
l_settings_set_string(settings, "Security", "EncryptedSecurity", "012345");
|
||||||
l_settings_set_string(settings, "Security", "EncryptedSalt", "012345");
|
l_settings_set_string(settings, "Security", "EncryptedSalt", "012345");
|
||||||
|
|
||||||
assert(__storage_decrypt(settings, "mySSID", &changed) < 0);
|
err = __storage_decrypt(settings, "mySSID", &changed);
|
||||||
|
assert(err == -EBADMSG);
|
||||||
|
|
||||||
l_settings_free(settings);
|
l_settings_free(settings);
|
||||||
|
|
||||||
|
storage_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
l_test_init(&argc, &argv);
|
l_test_init(&argc, &argv);
|
||||||
|
|
||||||
storage_init((const uint8_t *)"abc123", 6);
|
l_test_add_func_precheck("/storage/profile encryption",
|
||||||
|
test_short_encrypted_bytes,
|
||||||
l_test_add("/storage/profile encryption",
|
aes_ctr_supported, 0);
|
||||||
test_short_encrypted_bytes, NULL);
|
|
||||||
|
|
||||||
return l_test_run();
|
return l_test_run();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user