diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2024-02-11 19:11:24 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2024-02-11 19:11:24 -0300 |
commit | 230a70d02e13123436815635a41824f906671505 (patch) | |
tree | 478c27a66deb81a03e81c1b4bb8d241990dd5a2b /src/common/scram.h | |
parent | 014b242df803089c34084de3d806a7c4e4dad75e (diff) | |
parent | b544ac3350e85d4cc41fe3414cbdb82d75ce5d7a (diff) |
Merge remote-tracking branch 'upstream/master' into default
Diffstat (limited to 'src/common/scram.h')
-rw-r--r-- | src/common/scram.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/common/scram.h b/src/common/scram.h new file mode 100644 index 00000000..ffe22037 --- /dev/null +++ b/src/common/scram.h @@ -0,0 +1,51 @@ +/* HexChat + * Copyright (C) 2023 Patrick Okraku + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ +#ifndef HEXCHAT_SCRAM_H +#define HEXCHAT_SCRAM_H + +#include "config.h" +#ifdef USE_OPENSSL +#include <openssl/evp.h> + +typedef struct +{ + const EVP_MD *digest; + size_t digest_size; + char *username; + char *password; + char *client_nonce_b64; + char *client_first_message_bare; + unsigned char *salted_password; + char *auth_message; + char *error; + int step; +} scram_session; + +typedef enum +{ + SCRAM_ERROR = 0, + SCRAM_IN_PROGRESS, + SCRAM_SUCCESS +} scram_status; + +scram_session *scram_session_create (const char *digset, const char *username, const char *password); +void scram_session_free (scram_session *session); +scram_status scram_process (scram_session *session, const char *input, char **output, size_t *output_len); + +#endif +#endif \ No newline at end of file |