core: Use FreeBSD's public domain SHA1 instead of OpenSSL's so that jettisoning OpenSSL is an option.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 32m49s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 32m49s
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "http.h"
|
||||
#include "log.h"
|
||||
#include "mem.h"
|
||||
#include "sha1.h"
|
||||
#include "ssb.db.h"
|
||||
#include "task.h"
|
||||
#include "tls.h"
|
||||
@@ -14,8 +15,6 @@
|
||||
#include "sodium/crypto_sign.h"
|
||||
#include "sodium/utils.h"
|
||||
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#define CYAN "\e[1;36m"
|
||||
#define MAGENTA "\e[1;35m"
|
||||
#define YELLOW "\e[1;33m"
|
||||
@@ -169,8 +168,13 @@ static JSValue _httpd_websocket_upgrade(JSContext* context, JSValueConst this_va
|
||||
uint8_t* key_magic = alloca(size);
|
||||
memcpy(key_magic, header_sec_websocket_key, key_length);
|
||||
memcpy(key_magic + key_length, k_magic, 36);
|
||||
|
||||
uint8_t digest[20];
|
||||
SHA1(key_magic, size, digest);
|
||||
SHA1_CTX sha1 = { 0 };
|
||||
SHA1Init(&sha1);
|
||||
SHA1Update(&sha1, key_magic, size);
|
||||
SHA1Final(digest, &sha1);
|
||||
|
||||
char key[41] = { 0 };
|
||||
tf_base64_encode(digest, sizeof(digest), key, sizeof(key));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user