mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-12 05:59:10 +00:00
Add SSL to redbean
Your redbean can now interoperate with clients that require TLS crypto. This is accomplished using a protocol polyglot that lets us distinguish between HTTP and HTTPS regardless of the port number. Certificates will be generated automatically, if none are supplied by the user. Footprint increases by only a few hundred kb so redbean in MODY=tiny is now 1.0mb - Add lseek() polyfills for ZIP executable - Automatically polyfill /tmp/FOO paths on NT - Fix readdir() / ftw() / nftw() bugs on Windows - Introduce -B flag for slower SSL that's stronger - Remove mbedtls features Cosmopolitan doesn't need - Have base64 decoder support the uri-safe alternative - Remove Truncated HMAC because it's forbidden by the IETF - Add all the mbedtls test suites and make them go 3x faster - Support opendir() / readdir() / closedir() on ZIP executable - Use Everest for ECDHE-ECDSA because it's so good it's so good - Add tinier implementation of sha1 since it's not worth the rom - Add chi-square monte-carlo mean correlation tests for getrandom() - Source entropy on Windows from the proper interface everyone uses We're continuing to outperform NGINX and other servers on raw message throughput. Using SSL means that instead of 1,000,000 qps you can get around 300,000 qps. However redbean isn't as fast as NGINX yet at SSL handshakes, since redbean can do 2,627 per second and NGINX does 4.3k Right now, the SSL UX story works best if you give your redbean a key signing key since that can be easily generated by openssl using a one liner then redbean will do all the things that are impossibly hard to do like signing ecdsa and rsa certificates that'll work in chrome. We should integrate the let's encrypt acme protocol in the future. Live Demo: https://redbean.justine.lol/ Root Cert: https://redbean.justine.lol/redbean1.crt
This commit is contained in:
parent
1beeb7a829
commit
cc1920749e
1032 changed files with 152673 additions and 69310 deletions
|
@ -3,63 +3,20 @@
|
|||
#include "libc/nexgen32e/kcpuids.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
/*
|
||||
* Known 80x86 Vendors (CPUID.0 EBX+EDX+ECX)
|
||||
*
|
||||
* ╤ ╤
|
||||
* GenuineIntel
|
||||
* AuthenticAMD
|
||||
* GenuineCosmo
|
||||
* NexGenDriven
|
||||
* AMDisbetter!
|
||||
* CentaurHauls
|
||||
* TransmetaCPU
|
||||
* GenuineTMx86
|
||||
* CyrixInstead
|
||||
* UMC UMC UMC
|
||||
* SiS SiS SiS
|
||||
* Geode by NSC
|
||||
* RiseRiseRise
|
||||
* Vortex86 SoC
|
||||
* VIA VIA VIA
|
||||
* VMwareVMware
|
||||
* XenVMMXenVMM
|
||||
* Microsoft Hv
|
||||
* └────┐ │
|
||||
* G ⊕ t = 0x33 Intel
|
||||
* A ⊕ A = 0x00 AMD
|
||||
* G ⊕ s = 0x34 Cosmopolitan
|
||||
* N ⊕ v = 0x38 NexGen (Modern x86)
|
||||
* A ⊕ e = 0x24 AMD (Rank & File)
|
||||
* C ⊕ u = 0x36 Via (DBA Centaur)
|
||||
* T ⊕ C = 0x17 Transmeta (Historical)
|
||||
* G ⊕ x = 0x3f Transmeta (Historical)
|
||||
* C ⊕ e = 0x26 Cyrix (Historical)
|
||||
* U ⊕ M = 0x18 UMC (Taiwan)
|
||||
* S ⊕ i = 0x3a SiS (Historical)
|
||||
* G ⊕ N = 0x09 National Semiconductors (OLPC)
|
||||
* R ⊕ i = 0x3b Rise Technology (Historical)
|
||||
* V ⊕ S = 0x05 DM&P (Vortex86)
|
||||
* V ⊕ I = 0x1f Via
|
||||
* V ⊕ a = 0x37 VMware
|
||||
* X ⊕ V = 0x0e Xen
|
||||
* M ⊕ = 0x6d Microsoft (Win10 Hyper-V)
|
||||
* │ │
|
||||
* │ │ perfect
|
||||
* │ │ (𝑠)=𝑠₀⊕𝑠₉
|
||||
* ╧ ╧
|
||||
*
|
||||
* @note Parallels Desktop CPU brand string is " lrpepyh vr " since even
|
||||
* folks designing microprocessor emulators apparently struggle w/
|
||||
* endianness lool.
|
||||
*/
|
||||
#define IsAuthenticAMD() (_KCPUIDS_VENDOR() == 0x00)
|
||||
#define IsGenuineIntel() (_KCPUIDS_VENDOR() == 0x33)
|
||||
#define IsGenuineCosmo() (_KCPUIDS_VENDOR() == 0x34)
|
||||
#define IsAuthenticAMD() \
|
||||
(kCpuids[KCPUIDS_0H][KCPUIDS_EBX] == 0x68747541 /* Auth */ && \
|
||||
kCpuids[KCPUIDS_0H][KCPUIDS_EDX] == 0x69746e65 /* enti */ && \
|
||||
kCpuids[KCPUIDS_0H][KCPUIDS_ECX] == 0x444d4163 /* cAMD */)
|
||||
|
||||
#define _KCPUIDS_VENDOR() \
|
||||
(((kCpuids[KCPUIDS_0H][KCPUIDS_EBX] >> 000) & 0xff) ^ \
|
||||
((kCpuids[KCPUIDS_0H][KCPUIDS_ECX] >> 010) & 0xff))
|
||||
#define IsGenuineIntel() \
|
||||
(kCpuids[KCPUIDS_0H][KCPUIDS_EBX] == 0x756e6547 /* Genu */ && \
|
||||
kCpuids[KCPUIDS_0H][KCPUIDS_EDX] == 0x49656e69 /* ineI */ && \
|
||||
kCpuids[KCPUIDS_0H][KCPUIDS_ECX] == 0x6c65746e /* ntel */)
|
||||
|
||||
#define IsGenuineCosmo() \
|
||||
(kCpuids[KCPUIDS_0H][KCPUIDS_EBX] == 0x756e6547 /* Genu */ && \
|
||||
kCpuids[KCPUIDS_0H][KCPUIDS_EDX] == 0x43656e69 /* ineC */ && \
|
||||
kCpuids[KCPUIDS_0H][KCPUIDS_ECX] == 0x6f6d736f /* osmo */)
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NEXGEN32E_VENDOR_H_ */
|
||||
|
|
|
@ -10,11 +10,12 @@
|
|||
#define kX86CpuExtfamilyid ((KCPUIDS(1H, EAX) >> 20) & 255)
|
||||
|
||||
#define kX86CpuFamily \
|
||||
(kX86CpuFamilyid + (kX86CpuFamily == 15 ? kX86CpuExtfamilyid : 0))
|
||||
(kX86CpuFamilyid + (kX86CpuFamilyid == 15 ? kX86CpuExtfamilyid : 0))
|
||||
|
||||
#define kX86CpuModel \
|
||||
(kX86CpuModelid | \
|
||||
(kX86CpuFamily == 6 || kX86CpuFamily == 15 ? kX86CpuExtmodelid : 0) << 4)
|
||||
#define kX86CpuModel \
|
||||
(kX86CpuModelid | \
|
||||
(kX86CpuFamilyid == 6 || kX86CpuFamilyid == 15 ? kX86CpuExtmodelid : 0) \
|
||||
<< 4)
|
||||
|
||||
#define kX86ProcessorModelKey \
|
||||
(kX86CpuExtfamilyid << 12 | kX86CpuFamilyid << 8 | kX86CpuExtmodelid << 4 | \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue