diff options
author | Sergei Golubchik <serg@mariadb.org> | 2017-03-05 16:18:16 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-03-10 18:21:28 +0100 |
commit | 7120118a5e97477778715ebdc8e4fba548a6dc87 (patch) | |
tree | e1f4c8108c21feab6a942faeda8addb901c98bfd /plugin/auth_ed25519/common.h | |
parent | 269ab56f8b4056ec63e712ba305761dd835ea10e (diff) | |
download | mariadb-git-7120118a5e97477778715ebdc8e4fba548a6dc87.tar.gz |
MDEV-12160 Modern alternative to the SHA1 authentication plugin
ED25519 authentication plugin
Diffstat (limited to 'plugin/auth_ed25519/common.h')
-rw-r--r-- | plugin/auth_ed25519/common.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/plugin/auth_ed25519/common.h b/plugin/auth_ed25519/common.h new file mode 100644 index 00000000000..df317535d01 --- /dev/null +++ b/plugin/auth_ed25519/common.h @@ -0,0 +1,32 @@ +/* + Copyright (c) 2017, MariaDB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include <mysql.h> +#include <string.h> + +#include "ref10/api.h" +#include "crypto_sign.h" +#include "crypto_hash_sha256.h" + +#define NONCE_BYTES 32 + +static inline void pw_to_sk_and_pk(const char *pw, size_t pwlen, + unsigned char *sk, unsigned char *pk) +{ + crypto_hash_sha256(sk, pw, pwlen); + crypto_sign_keypair(pk, sk); +} + |