mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 08:18:41 +09:00
Replace NSS with Pale Moon's
This commit is contained in:
parent
ff1e5e48bf
commit
8c2e376f94
2870 changed files with 1762232 additions and 1374220 deletions
|
|
@ -40,6 +40,9 @@ sslBuffer_Grow(sslBuffer *b, unsigned int newLen)
|
|||
return SECSuccess;
|
||||
}
|
||||
|
||||
/* If buf is non-NULL, space must be non-zero;
|
||||
* if buf is NULL, space must be zero. */
|
||||
PORT_Assert((b->buf && b->space) || (!b->buf && !b->space));
|
||||
newLen = PR_MAX(newLen, b->len + 1024);
|
||||
if (newLen > b->space) {
|
||||
unsigned char *newBuf;
|
||||
|
|
@ -57,6 +60,22 @@ sslBuffer_Grow(sslBuffer *b, unsigned int newLen)
|
|||
return SECSuccess;
|
||||
}
|
||||
|
||||
/* Appends len copies of c to b */
|
||||
SECStatus
|
||||
sslBuffer_Fill(sslBuffer *b, PRUint8 c, size_t len)
|
||||
{
|
||||
PORT_Assert(b);
|
||||
SECStatus rv = sslBuffer_Grow(b, b->len + len);
|
||||
if (rv != SECSuccess) {
|
||||
return SECFailure;
|
||||
}
|
||||
if (len > 0) {
|
||||
memset(SSL_BUFFER_NEXT(b), c, len);
|
||||
}
|
||||
b->len += len;
|
||||
return SECSuccess;
|
||||
}
|
||||
|
||||
SECStatus
|
||||
sslBuffer_Append(sslBuffer *b, const void *data, unsigned int len)
|
||||
{
|
||||
|
|
@ -64,7 +83,10 @@ sslBuffer_Append(sslBuffer *b, const void *data, unsigned int len)
|
|||
if (rv != SECSuccess) {
|
||||
return SECFailure; /* Code already set. */
|
||||
}
|
||||
PORT_Memcpy(SSL_BUFFER_NEXT(b), data, len);
|
||||
if (len > 0) {
|
||||
PORT_Assert(data);
|
||||
PORT_Memcpy(SSL_BUFFER_NEXT(b), data, len);
|
||||
}
|
||||
b->len += len;
|
||||
return SECSuccess;
|
||||
}
|
||||
|
|
@ -162,6 +184,23 @@ sslBuffer_InsertLength(sslBuffer *b, unsigned int at, unsigned int size)
|
|||
return SECSuccess;
|
||||
}
|
||||
|
||||
SECStatus
|
||||
sslBuffer_InsertNumber(sslBuffer *b, unsigned int at,
|
||||
PRUint64 v, unsigned int size)
|
||||
{
|
||||
PORT_Assert(b->len >= at + size);
|
||||
PORT_Assert(b->space >= at + size);
|
||||
|
||||
PORT_Assert(size <= 4 && size > 0);
|
||||
if (v >= (1ULL << (8 * size))) {
|
||||
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
|
||||
return SECFailure;
|
||||
}
|
||||
|
||||
ssl_EncodeUintX(SSL_BUFFER_BASE(b) + at, v, size);
|
||||
return SECSuccess;
|
||||
}
|
||||
|
||||
void
|
||||
sslBuffer_Clear(sslBuffer *b)
|
||||
{
|
||||
|
|
@ -244,8 +283,8 @@ sslRead_ReadNumber(sslReader *reader, unsigned int bytes, PRUint64 *num)
|
|||
#define MAX_SEND_BUF_LENGTH 32000 /* watch for 16-bit integer overflow */
|
||||
#define MIN_SEND_BUF_LENGTH 4000
|
||||
|
||||
SECStatus
|
||||
ssl3_AppendHandshake(sslSocket *ss, const void *void_src, unsigned int bytes)
|
||||
static SECStatus
|
||||
ssl3_AppendHandshakeInternal(sslSocket *ss, const void *void_src, unsigned int bytes, PRBool suppressHash)
|
||||
{
|
||||
unsigned char *src = (unsigned char *)void_src;
|
||||
int room = ss->sec.ci.sendBuf.space - ss->sec.ci.sendBuf.len;
|
||||
|
|
@ -264,7 +303,8 @@ ssl3_AppendHandshake(sslSocket *ss, const void *void_src, unsigned int bytes)
|
|||
}
|
||||
|
||||
PRINT_BUF(60, (ss, "Append to Handshake", (unsigned char *)void_src, bytes));
|
||||
if (!ss->firstHsDone || ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
|
||||
// TODO: Move firstHsDone and version check into callers as a suppression.
|
||||
if (!suppressHash && (!ss->firstHsDone || ss->version < SSL_LIBRARY_VERSION_TLS_1_3)) {
|
||||
rv = ssl3_UpdateHandshakeHashes(ss, src, bytes);
|
||||
if (rv != SECSuccess)
|
||||
return SECFailure; /* error code set by ssl3_UpdateHandshakeHashes */
|
||||
|
|
@ -289,6 +329,18 @@ ssl3_AppendHandshake(sslSocket *ss, const void *void_src, unsigned int bytes)
|
|||
return SECSuccess;
|
||||
}
|
||||
|
||||
SECStatus
|
||||
ssl3_AppendHandshakeSuppressHash(sslSocket *ss, const void *void_src, unsigned int bytes)
|
||||
{
|
||||
return ssl3_AppendHandshakeInternal(ss, void_src, bytes, PR_TRUE);
|
||||
}
|
||||
|
||||
SECStatus
|
||||
ssl3_AppendHandshake(sslSocket *ss, const void *void_src, unsigned int bytes)
|
||||
{
|
||||
return ssl3_AppendHandshakeInternal(ss, void_src, bytes, PR_FALSE);
|
||||
}
|
||||
|
||||
SECStatus
|
||||
ssl3_AppendHandshakeNumber(sslSocket *ss, PRUint64 num, unsigned int lenSize)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue