mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-21 22:43:48 +00:00
The programs now use only the C++ codecs. The C stream/AEAD/AEAD-2022
implementations stay as the reference the differential tests and the C
unit tests compare against. Key derivation and the cipher tables used by
the doc snippets move to src/crypto/keys.{hpp,cpp}.
ss-manager keeps its servers in an ss_list (at most MAX_PORT_NUM,
looked up only on control messages) instead of a uthash table, and
tests/test_manager.py covers add/ping/list/remove end to end.
63 lines
1.6 KiB
C
63 lines
1.6 KiB
C
/*
|
|
* encrypt.h - Define the enryptor's interface
|
|
*
|
|
* Copyright (C) 2013 - 2019, Max Lv <max.c.lv@gmail.com>
|
|
*
|
|
* This file is part of the shadowsocks-libev.
|
|
*
|
|
* shadowsocks-libev 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.
|
|
*
|
|
* shadowsocks-libev 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 shadowsocks-libev; see the file COPYING. If not, see
|
|
* <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef _STREAM_H
|
|
#define _STREAM_H
|
|
|
|
#ifndef __MINGW32__
|
|
#include <sys/socket.h>
|
|
#endif
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <stdint.h>
|
|
#ifdef HAVE_STDINT_H
|
|
#include <stdint.h>
|
|
#elif HAVE_INTTYPES_H
|
|
#include <inttypes.h>
|
|
#endif
|
|
|
|
#include <sodium.h>
|
|
#define STREAM_CIPHER_NUM 21
|
|
|
|
#include "crypto.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
int stream_encrypt_all(buffer_t *, cipher_t *, size_t);
|
|
int stream_decrypt_all(buffer_t *, cipher_t *, size_t);
|
|
int stream_encrypt(buffer_t *, cipher_ctx_t *, size_t);
|
|
int stream_decrypt(buffer_t *, cipher_ctx_t *, size_t);
|
|
|
|
void stream_ctx_init(cipher_t *, cipher_ctx_t *, int);
|
|
void stream_ctx_release(cipher_ctx_t *);
|
|
|
|
cipher_t *stream_init(const char *pass, const char *key, const char *method);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // _STREAM_H
|