1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2026-05-19 03:51:17 +03:00

Refactor Base64 functions, encode/decode using OpenSSL's EVP interface

Our own implementation works fine, however we should use OpenSSL's one since we already link to the library.

Base64Decode() and Base64Encode() return the required buffer size when "dst" is NULL.

This allows to efficiently allocate a buffer, without wasting memory or risking an overflow.

Base64FromBin() and Base64ToBin() perform all steps, returning a heap-allocated buffer with the data in it.
This commit is contained in:
Davide Beatrici
2021-07-02 09:24:41 +02:00
parent 03d67fd5b1
commit 233e28f38c
14 changed files with 224 additions and 369 deletions
+4 -4
View File
@@ -84,10 +84,10 @@ struct WPC_PACKET
typedef bool (WPC_RECV_CALLBACK)(void *param, UINT total_size, UINT current_size, BUF *recv_buf);
// Function prototype
void EncodeSafe64(char *dst, void *src, UINT src_size);
UINT DecodeSafe64(void *dst, char *src, UINT src_strlen);
void Base64ToSafe64(char *str);
void Safe64ToBase64(char *str);
void Base64ToSafe64(char *str, const UINT size);
void Safe64ToBase64(char *str, const UINT size);
UINT DecodeSafe64(void *dst, const char *src, UINT size);
void EncodeSafe64(char *dst, const void *src, const UINT size);
bool ParseUrl(URL_DATA *data, char *str, bool is_post, char *referrer);
void CreateUrl(char *url, UINT url_size, URL_DATA *data);
void GetSystemInternetSetting(INTERNET_SETTING *setting);