diff options
author | Isaac Boukris <iboukris@gmail.com> | 2020-08-20 12:45:49 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2020-10-29 14:19:36 +0000 |
commit | 32d4c75d6cbf9153068a0487347097707afb356a (patch) | |
tree | 1d3bc8fc47a583c31d82eee6bc80b11ed5f1fc75 /lib/crypto | |
parent | a9c532c6d3e85fbe49b7040254cfc66ab54074bc (diff) | |
download | samba-32d4c75d6cbf9153068a0487347097707afb356a.tar.gz |
lib:crypto: Add py binding for set_relax/strict fips mode
Signed-off-by: Isaac Boukris <iboukris@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Diffstat (limited to 'lib/crypto')
-rw-r--r-- | lib/crypto/py_crypto.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/crypto/py_crypto.c b/lib/crypto/py_crypto.c index 32b946eee8f..ad18d3ada0f 100644 --- a/lib/crypto/py_crypto.c +++ b/lib/crypto/py_crypto.c @@ -24,6 +24,7 @@ #include <gnutls/gnutls.h> #include <gnutls/crypto.h> +#include "lib/crypto/gnutls_helpers.h" static PyObject *py_crypto_arcfour_crypt_blob(PyObject *module, PyObject *args) { @@ -85,12 +86,27 @@ static PyObject *py_crypto_arcfour_crypt_blob(PyObject *module, PyObject *args) return result; } +static PyObject *py_crypto_set_relax_mode(PyObject *module) +{ + GNUTLS_FIPS140_SET_LAX_MODE(); + + Py_RETURN_NONE; +} + +static PyObject *py_crypto_set_strict_mode(PyObject *module) +{ + GNUTLS_FIPS140_SET_STRICT_MODE(); + + Py_RETURN_NONE; +} static const char py_crypto_arcfour_crypt_blob_doc[] = "arcfour_crypt_blob(data, key)\n" "Encrypt the data with RC4 algorithm using the key"; static PyMethodDef py_crypto_methods[] = { { "arcfour_crypt_blob", (PyCFunction)py_crypto_arcfour_crypt_blob, METH_VARARGS, py_crypto_arcfour_crypt_blob_doc }, + { "set_relax_mode", (PyCFunction)py_crypto_set_relax_mode, METH_NOARGS, "Set fips to relax mode" }, + { "set_strict_mode", (PyCFunction)py_crypto_set_strict_mode, METH_NOARGS, "Set fips to strict mode" }, {0}, }; |