n2n/include/auth.h

44 lines
1.4 KiB
C
Raw Normal View History

/*
2022-03-12 10:22:42 +01:00
* (C) 2007-22 - ntop.org and contributors
*
* 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 3 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, see <http://www.gnu.org/licenses/>
*
*/
#include "n2n.h"
#ifndef AUTH_H
#define AUTH_H
int bin_to_ascii (char *out, uint8_t *in, size_t in_len);
int ascii_to_bin (uint8_t *out, char *in);
Basic C Code lint checker and shell checker (#859) * Factor build packages out into a more maintainable list * Create a location for scripts to live * Provide a make target to return the source dir as close as reasonable to the original distributed state * Add a code lint step, checking the coding style * Change test harness as recommended by shellcheck * Ensure we actually have the linter tool installed * Use the correct directory for cmake to run the tests * Adjust for the older uncrustify in the current github ubuntu-latest * Make one file pass the linter * Integrate the lint with the existing test workflow * Add files with minimal changes needed to the linter * Add more files with minimal changes needed to the linter * Dont build binaries if we fail the lint test * Update the phony targets with the lint steps * Ensure the flake8 package is installed in the new lint workflow job * Use the makefile to drive the packages needed to install for linting * No need to add dependancies on lint, just rely on the workflow status to show failure * Update the scripts dir README to reflect current assumptions * Rename and briefly document the indent.sh script * Fix the ignore to ignore the right Makefile * Rename the test_harness script to make it clear it is a shell script * Provide a master lint make target and add a shell script lint tool * Elminate stray tabs * Drop include/auth.h from linter - there are inconsistant results with function definitions when using the current uncrustify rules
2021-10-23 21:36:18 +02:00
int generate_private_key (n2n_private_public_key_t key, char *in);
int generate_public_key (n2n_private_public_key_t pub, n2n_private_public_key_t prv);
int generate_shared_secret (n2n_private_public_key_t shared, n2n_private_public_key_t prv, n2n_private_public_key_t pub);
int bind_private_key_to_username (n2n_private_public_key_t prv, char *username);
int calculate_dynamic_key (uint8_t out_key[N2N_AUTH_CHALLENGE_SIZE],
uint32_t key_time, n2n_community_t comm, n2n_community_t fed);
#endif