mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-21 07:47:32 +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
|
|
@ -7,6 +7,7 @@
|
|||
#include "sslimpl.h"
|
||||
#include "sslproto.h"
|
||||
#include "tls13hkdf.h"
|
||||
#include "tls13psk.h"
|
||||
#include "tls13subcerts.h"
|
||||
|
||||
SECStatus
|
||||
|
|
@ -80,7 +81,15 @@ SSL_GetChannelInfo(PRFileDesc *fd, SSLChannelInfo *info, PRUintn len)
|
|||
inf.signatureScheme = sid->sigScheme;
|
||||
}
|
||||
inf.resumed = ss->statelessResume || ss->ssl3.hs.isResuming;
|
||||
if (inf.resumed) {
|
||||
inf.pskType = ssl_psk_resume;
|
||||
} else if (inf.authType == ssl_auth_psk) {
|
||||
inf.pskType = ssl_psk_external;
|
||||
} else {
|
||||
inf.pskType = ssl_psk_none;
|
||||
}
|
||||
inf.peerDelegCred = tls13_IsVerifyingWithDelegatedCredential(ss);
|
||||
inf.echAccepted = ss->ssl3.hs.echAccepted;
|
||||
|
||||
if (sid) {
|
||||
unsigned int sidLen;
|
||||
|
|
@ -101,6 +110,7 @@ SSL_GetChannelInfo(PRFileDesc *fd, SSLChannelInfo *info, PRUintn len)
|
|||
sidLen = PR_MIN(sidLen, sizeof inf.sessionID);
|
||||
inf.sessionIDLength = sidLen;
|
||||
memcpy(inf.sessionID, sid->u.ssl3.sessionID, sidLen);
|
||||
inf.isFIPS = ssl_isFIPS(ss);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -132,6 +142,7 @@ SSL_GetPreliminaryChannelInfo(PRFileDesc *fd,
|
|||
return SECFailure;
|
||||
}
|
||||
|
||||
/* All fields MUST be zero initialized! */
|
||||
memset(&inf, 0, sizeof(inf));
|
||||
inf.length = PR_MIN(sizeof(inf), len);
|
||||
|
||||
|
|
@ -144,19 +155,32 @@ SSL_GetPreliminaryChannelInfo(PRFileDesc *fd,
|
|||
/* We shouldn't be able to send early data if the handshake is done. */
|
||||
PORT_Assert(!ss->firstHsDone || !inf.canSendEarlyData);
|
||||
|
||||
if (ss->sec.ci.sid &&
|
||||
(ss->ssl3.hs.zeroRttState == ssl_0rtt_sent ||
|
||||
ss->ssl3.hs.zeroRttState == ssl_0rtt_accepted)) {
|
||||
inf.maxEarlyDataSize =
|
||||
if (ss->sec.ci.sid) {
|
||||
PRUint32 ticketMaxEarlyData =
|
||||
ss->sec.ci.sid->u.ssl3.locked.sessionTicket.max_early_data_size;
|
||||
} else {
|
||||
inf.maxEarlyDataSize = 0;
|
||||
|
||||
/* Resumption token info. */
|
||||
inf.ticketSupportsEarlyData = (ticketMaxEarlyData > 0);
|
||||
|
||||
if (ss->ssl3.hs.zeroRttState == ssl_0rtt_sent ||
|
||||
ss->ssl3.hs.zeroRttState == ssl_0rtt_accepted) {
|
||||
if (ss->statelessResume) {
|
||||
inf.maxEarlyDataSize = ticketMaxEarlyData;
|
||||
} else if (ss->psk) {
|
||||
/* We may have cleared the handshake list, so check the socket.
|
||||
* This is permissable since we only support one EPSK at a time. */
|
||||
inf.maxEarlyDataSize = ss->psk->maxEarlyData;
|
||||
}
|
||||
}
|
||||
}
|
||||
inf.zeroRttCipherSuite = ss->ssl3.hs.zeroRttSuite;
|
||||
|
||||
inf.peerDelegCred = tls13_IsVerifyingWithDelegatedCredential(ss);
|
||||
inf.authKeyBits = ss->sec.authKeyBits;
|
||||
inf.signatureScheme = ss->sec.signatureScheme;
|
||||
inf.echAccepted = ss->ssl3.hs.echAccepted;
|
||||
/* Only expose this if the application should use it for verification. */
|
||||
inf.echPublicName = (inf.echAccepted == PR_FALSE) ? ss->ssl3.hs.echPublicName : NULL;
|
||||
|
||||
memcpy(info, &inf, inf.length);
|
||||
return SECSuccess;
|
||||
|
|
@ -300,10 +324,8 @@ static const SSLCipherSuiteInfo suiteInfo[] = {
|
|||
{ 0, CS(ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA), S_ECDSA, K_ECDHE, C_3DES, B_3DES, M_SHA, F_FIPS_STD, A_ECDSA, ssl_hash_none },
|
||||
{ 0, CS(ECDHE_ECDSA_WITH_AES_128_CBC_SHA), S_ECDSA, K_ECDHE, C_AES, B_128, M_SHA, F_FIPS_STD, A_ECDSA, ssl_hash_none },
|
||||
{ 0, CS(ECDHE_ECDSA_WITH_AES_128_CBC_SHA256), S_ECDSA, K_ECDHE, C_AES, B_128, M_SHA256, F_FIPS_STD, A_ECDSA, ssl_hash_sha256 },
|
||||
{ 0, CS(ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256), S_ECDSA, K_ECDHE, C_CAMELLIA, B_128, M_SHA256, F_NFIPS_STD, A_ECDSA, ssl_hash_sha256 },
|
||||
{ 0, CS(ECDHE_ECDSA_WITH_AES_256_CBC_SHA), S_ECDSA, K_ECDHE, C_AES, B_256, M_SHA, F_FIPS_STD, A_ECDSA, ssl_hash_none },
|
||||
{ 0, CS(ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256), S_ECDSA, K_ECDHE, C_CHACHA20, B_256, M_AEAD_128, F_NFIPS_STD, A_ECDSA, ssl_hash_sha256 },
|
||||
{ 0, CS(ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384), S_ECDSA, K_ECDHE, C_CAMELLIA, B_256, M_SHA384, F_NFIPS_STD, A_ECDSA, ssl_hash_sha384 },
|
||||
|
||||
{ 0, CS(ECDH_RSA_WITH_NULL_SHA), S_RSA, K_ECDH, C_NULL, B_0, M_SHA, F_NFIPS_STD, A_ECDH_R, ssl_hash_none },
|
||||
{ 0, CS(ECDH_RSA_WITH_RC4_128_SHA), S_RSA, K_ECDH, C_RC4, B_128, M_SHA, F_NFIPS_STD, A_ECDH_R, ssl_hash_none },
|
||||
|
|
@ -316,14 +338,12 @@ static const SSLCipherSuiteInfo suiteInfo[] = {
|
|||
{ 0, CS(ECDHE_RSA_WITH_3DES_EDE_CBC_SHA), S_RSA, K_ECDHE, C_3DES, B_3DES, M_SHA, F_FIPS_STD, A_RSAS, ssl_hash_none },
|
||||
{ 0, CS(ECDHE_RSA_WITH_AES_128_CBC_SHA), S_RSA, K_ECDHE, C_AES, B_128, M_SHA, F_FIPS_STD, A_RSAS, ssl_hash_none },
|
||||
{ 0, CS(ECDHE_RSA_WITH_AES_128_CBC_SHA256), S_RSA, K_ECDHE, C_AES, B_128, M_SHA256, F_FIPS_STD, A_RSAS, ssl_hash_sha256 },
|
||||
{ 0, CS(ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256), S_RSA, K_ECDHE, C_CAMELLIA, B_128, M_SHA256, F_NFIPS_STD, A_RSAS, ssl_hash_sha256 },
|
||||
{ 0, CS(ECDHE_RSA_WITH_AES_256_CBC_SHA), S_RSA, K_ECDHE, C_AES, B_256, M_SHA, F_FIPS_STD, A_RSAS, ssl_hash_none },
|
||||
{ 0, CS(ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256), S_RSA, K_ECDHE, C_CHACHA20, B_256, M_AEAD_128, F_NFIPS_STD, A_RSAS, ssl_hash_sha256 },
|
||||
{ 0, CS(ECDHE_RSA_WITH_AES_256_CBC_SHA384), S_RSA, K_ECDHE, C_AES, B_256, M_SHA384, F_FIPS_STD, A_RSAS, ssl_hash_sha384 },
|
||||
{ 0, CS(ECDHE_ECDSA_WITH_AES_256_CBC_SHA384), S_ECDSA, K_ECDHE, C_AES, B_256, M_SHA384, F_FIPS_STD, A_ECDSA, ssl_hash_sha384 },
|
||||
{ 0, CS(ECDHE_ECDSA_WITH_AES_256_GCM_SHA384), S_ECDSA, K_ECDHE, C_AESGCM, B_256, M_AEAD_128, F_FIPS_STD, A_ECDSA, ssl_hash_sha384 },
|
||||
{ 0, CS(ECDHE_RSA_WITH_AES_256_GCM_SHA384), S_RSA, K_ECDHE, C_AESGCM, B_256, M_AEAD_128, F_FIPS_STD, A_RSAS, ssl_hash_sha384 },
|
||||
{ 0, CS(ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384), S_RSA, K_ECDHE, C_CAMELLIA, B_256, M_SHA384, F_NFIPS_STD, A_RSAS, ssl_hash_sha384 },
|
||||
|
||||
{ 0, CS(DHE_DSS_WITH_AES_256_GCM_SHA384), S_DSA, K_DHE, C_AESGCM, B_256, M_AEAD_128, F_FIPS_STD, A_DSA, ssl_hash_sha384 },
|
||||
{ 0, CS(DHE_RSA_WITH_AES_256_GCM_SHA384), S_RSA, K_DHE, C_AESGCM, B_256, M_AEAD_128, F_FIPS_STD, A_RSAS, ssl_hash_sha384 },
|
||||
|
|
@ -419,24 +439,37 @@ tls13_Exporter(sslSocket *ss, PK11SymKey *secret,
|
|||
return SECFailure;
|
||||
}
|
||||
|
||||
SSLHashType hashAlg;
|
||||
/* Early export requires a PSK. As in 0-RTT, default
|
||||
* to the first PSK if no suite is negotiated yet. */
|
||||
if (secret == ss->ssl3.hs.earlyExporterSecret && !ss->ssl3.hs.suite_def) {
|
||||
if (PR_CLIST_IS_EMPTY(&ss->ssl3.hs.psks)) {
|
||||
PORT_SetError(SEC_ERROR_INVALID_ARGS);
|
||||
return SECFailure;
|
||||
}
|
||||
hashAlg = ((sslPsk *)PR_LIST_HEAD(&ss->ssl3.hs.psks))->hash;
|
||||
} else {
|
||||
hashAlg = tls13_GetHash(ss);
|
||||
}
|
||||
|
||||
/* Pre-hash the context. */
|
||||
rv = tls13_ComputeHash(ss, &contextHash, context, contextLen);
|
||||
rv = tls13_ComputeHash(ss, &contextHash, context, contextLen, hashAlg);
|
||||
if (rv != SECSuccess) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = tls13_DeriveSecretNullHash(ss, secret, label, labelLen,
|
||||
&innerSecret);
|
||||
&innerSecret, hashAlg);
|
||||
if (rv != SECSuccess) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = tls13_HkdfExpandLabelRaw(innerSecret,
|
||||
tls13_GetHash(ss),
|
||||
hashAlg,
|
||||
contextHash.u.raw, contextHash.len,
|
||||
kExporterInnerLabel,
|
||||
strlen(kExporterInnerLabel),
|
||||
out, outLen);
|
||||
ss->protocolVariant, out, outLen);
|
||||
PK11_FreeSymKey(innerSecret);
|
||||
return rv;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue