|
| 1 | +/* |
| 2 | + * Copyright (C) 2025 wolfSSL Inc. |
| 3 | + * |
| 4 | + * This file is part of wolfHSM. |
| 5 | + * |
| 6 | + * wolfHSM is free software; you can redistribute it and/or modify |
| 7 | + * it under the terms of the GNU General Public License as published by |
| 8 | + * the Free Software Foundation; either version 3 of the License, or |
| 9 | + * (at your option) any later version. |
| 10 | + * |
| 11 | + * wolfHSM is distributed in the hope that it will be useful, |
| 12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | + * GNU General Public License for more details. |
| 15 | + * |
| 16 | + * You should have received a copy of the GNU General Public License |
| 17 | + * along with wolfHSM. If not, see <http://www.gnu.org/licenses/>. |
| 18 | + */ |
| 19 | +/* |
| 20 | + * test/wh_test_auth.c |
| 21 | + */ |
| 22 | + |
| 23 | +#include <stdint.h> |
| 24 | +#include <stdio.h> |
| 25 | +#include <string.h> |
| 26 | + |
| 27 | +#include "wolfhsm/wh_settings.h" |
| 28 | +#include "wolfhsm/wh_error.h" |
| 29 | +#include "wolfhsm/wh_comm.h" |
| 30 | +#include "wolfhsm/wh_transport_mem.h" |
| 31 | +#include "wolfhsm/wh_client.h" |
| 32 | +#include "wolfhsm/wh_server.h" |
| 33 | +#include "wolfhsm/wh_auth.h" |
| 34 | +#include "wolfhsm/wh_auth_base.h" |
| 35 | +#include "wolfhsm/wh_nvm.h" |
| 36 | +#include "wolfhsm/wh_nvm_flash.h" |
| 37 | +#include "wolfhsm/wh_flash_ramsim.h" |
| 38 | + |
| 39 | +#include "wh_test_common.h" |
| 40 | +#include "wh_test_auth.h" |
| 41 | + |
| 42 | + |
| 43 | +/* test cases */ |
| 44 | + |
| 45 | +/* Logout tests */ |
| 46 | +/* test logout before login */ |
| 47 | +/* test logout after login */ |
| 48 | +/* test logout with invalid user id */ |
| 49 | + |
| 50 | +/* Login tests */ |
| 51 | +/* test login with invalid credentials */ |
| 52 | +/* test login with valid credentials */ |
| 53 | +/* test login with invalid user name */ |
| 54 | +/* test login if already logged in */ |
| 55 | + |
| 56 | +/* Add user tests */ |
| 57 | +/* test add user with invalid user name (too long?) */ |
| 58 | +/* test add user with invalid permissions */ |
| 59 | +/* test add user if already exists */ |
| 60 | + |
| 61 | +/* Delete user tests */ |
| 62 | +/* test delete user with invalid user id */ |
| 63 | +/* test delete user that does not exist */ |
| 64 | +/* test delete user when not logged in */ |
| 65 | + |
| 66 | +/* Set user permissions tests */ |
| 67 | +/* test set user permissions with invalid user id */ |
| 68 | +/* test set user permissions with invalid permissions */ |
| 69 | +/* test set user permissions that does not exist */ |
| 70 | +/* test set user permissions when not logged in */ |
| 71 | + |
| 72 | +/* Set user credentials tests */ |
| 73 | +/* test set user credentials with invalid user id */ |
| 74 | +/* test set user credentials with invalid credentials (wrong method) */ |
| 75 | +/* test set user credentials for a userthat does not exist */ |
| 76 | +/* test an admin user setting credentials for non admin user */ |
| 77 | + |
| 78 | +/* Tests for authorization checks */ |
| 79 | +/* try operation when not logged in and not allowed */ |
| 80 | +/* re-try operation when logged in and allowed */ |
| 81 | +/* try operation when logged in and not allowed */ |
| 82 | +/* try operation when logged in as different user and allowed */ |
| 83 | +/* try operation when logged in as different user and not allowed */ |
| 84 | + |
| 85 | +/* Tests for key authorization checks */ |
| 86 | +/* test of access to key ID that is not allowed */ |
| 87 | +/* test of access to key ID that is allowed */ |
| 88 | +/* test of access to key ID that is allowed for different user */ |
0 commit comments