|
| 1 | +/* we_fips.h |
| 2 | + * |
| 3 | + * Copyright (C) 2019-2021 wolfSSL Inc. |
| 4 | + * |
| 5 | + * This file is part of wolfengine. |
| 6 | + * |
| 7 | + * wolfengine is free software; you can redistribute it and/or modify |
| 8 | + * it under the terms of the GNU General Public License as published by |
| 9 | + * the Free Software Foundation; either version 2 of the License, or |
| 10 | + * (at your option) any later version. |
| 11 | + * |
| 12 | + * wolfengine is distributed in the hope that it will be useful, |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | + * GNU General Public License for more details. |
| 16 | + * |
| 17 | + * You should have received a copy of the GNU General Public License |
| 18 | + * along with this program; if not, write to the Free Software |
| 19 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA |
| 20 | + */ |
| 21 | + |
| 22 | +#ifndef WE_FIPS_H |
| 23 | +#define WE_FIPS_H |
| 24 | + |
| 25 | +#ifdef WOLFENGINE_USER_SETTINGS |
| 26 | + #include "user_settings.h" |
| 27 | +#endif |
| 28 | + |
| 29 | +#include <wolfssl/options.h> |
| 30 | + |
| 31 | +enum wolfEngine_FipsCheck { |
| 32 | + /* check that RSA key size is valid */ |
| 33 | + WE_FIPS_CHECK_RSA_KEY_SIZE = 0x0001, |
| 34 | + /* check that P-192 usage is valid */ |
| 35 | + WE_FIPS_CHECK_P192 = 0x0002, |
| 36 | + /* check that RSA signature with SHA-1 digest is valid */ |
| 37 | + WE_FIPS_CHECK_RSA_SHA1 = 0x0004, |
| 38 | + |
| 39 | + /* default FIPS checks (all with wolfCrypt FIPS, none without) */ |
| 40 | +#if defined(HAVE_FIPS) || defined(HAVE_FIPS_VERSION) |
| 41 | + WE_FIPS_CHECKS_DEFAULT = (WE_FIPS_CHECK_RSA_KEY_SIZE |
| 42 | + | WE_FIPS_CHECK_P192 |
| 43 | + | WE_FIPS_CHECK_RSA_SHA1) |
| 44 | +#else |
| 45 | + WE_FIPS_CHECKS_DEFAULT = 0 |
| 46 | +#endif /* HAVE_FIPS || HAVE_FIPS_VERSION */ |
| 47 | +}; |
| 48 | + |
| 49 | +/* Set FIPS checks, bitmask of wolfEngine_FipsCheck. */ |
| 50 | +void wolfEngine_SetFipsChecks(long checksMask); |
| 51 | +/* Get FIPS checks mask. */ |
| 52 | +long wolfEngine_GetFipsChecks(void); |
| 53 | + |
| 54 | +#endif /* WE_FIPS_H */ |
0 commit comments