Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 572564 Details for
Bug 806588
Disable SSL PKCS #11 bypass at build time
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Disables ssl bypass at build time
Bug-806588-disable-sslbypass.patch (text/plain), 12.83 KB, created by
Elio Maldonado Batiz
on 2012-03-25 18:58:57 UTC
(
hide
)
Description:
Disables ssl bypass at build time
Filename:
MIME Type:
Creator:
Elio Maldonado Batiz
Created:
2012-03-25 18:58:57 UTC
Size:
12.83 KB
patch
obsolete
>Index: ./mozilla/security/nss/lib/ssl/ssl3con.c >=================================================================== >RCS file: /cvsroot/mozilla/security/nss/lib/ssl/ssl3con.c,v >retrieving revision 1.164 >diff -u -p -r1.164 ssl3con.c >--- ./mozilla/security/nss/lib/ssl/ssl3con.c 17 Feb 2012 09:50:04 -0000 1.164 >+++ ./mozilla/security/nss/lib/ssl/ssl3con.c 25 Mar 2012 05:48:42 -0000 >@@ -1006,10 +1006,12 @@ ssl3_ComputeCommonKeyHash(PRUint8 * hash > { > SECStatus rv = SECSuccess; > >+#ifdef NSS_ALLOW_SSLBYPASS > if (bypassPKCS11) { > MD5_HashBuf (hashes->md5, hashBuf, bufLen); > SHA1_HashBuf(hashes->sha, hashBuf, bufLen); > } else { >+#endif > rv = PK11_HashBuf(SEC_OID_MD5, hashes->md5, hashBuf, bufLen); > if (rv != SECSuccess) { > ssl_MapLowLevelError(SSL_ERROR_MD5_DIGEST_FAILURE); >@@ -1022,7 +1024,9 @@ ssl3_ComputeCommonKeyHash(PRUint8 * hash > ssl_MapLowLevelError(SSL_ERROR_SHA_DIGEST_FAILURE); > rv = SECFailure; > } >+#ifdef NSS_ALLOW_SSLBYPASS > } >+#endif > done: > return rv; > } >@@ -1787,6 +1791,7 @@ ssl3_InitPendingCipherSpec(sslSocket *ss > goto done; /* err code set by ssl3_DeriveMasterSecret */ > } > } >+#ifdef NSS_ALLOW_SSLBYPASS > if (ss->opt.bypassPKCS11 && pwSpec->msItem.len && pwSpec->msItem.data) { > /* Double Bypass succeeded in extracting the master_secret */ > const ssl3KEADef * kea_def = ss->ssl3.hs.kea_def; >@@ -1801,7 +1806,9 @@ ssl3_InitPendingCipherSpec(sslSocket *ss > if (rv == SECSuccess) { > rv = ssl3_InitPendingContextsBypass(ss); > } >- } else if (pwSpec->master_secret) { >+ } else >+#endif >+ if (pwSpec->master_secret) { > rv = ssl3_DeriveConnectionKeysPKCS11(ss); > if (rv == SECSuccess) { > rv = ssl3_InitPendingContextsPKCS11(ss); >@@ -1904,7 +1911,9 @@ ssl3_ComputeRecordMAC( > *outLength = 0; > return SECSuccess; > } >+#ifdef NSS_ALLOW_SSLBYPASS > if (! spec->bypassCiphers) { >+#endif > PK11Context *mac_context = > (useServerMacKey ? spec->server.write_mac_context > : spec->client.write_mac_context); >@@ -1912,6 +1921,7 @@ ssl3_ComputeRecordMAC( > rv |= PK11_DigestOp(mac_context, temp, tempLen); > rv |= PK11_DigestOp(mac_context, input, inputLength); > rv |= PK11_DigestFinal(mac_context, outbuf, outLength, spec->mac_size); >+#ifdef NSS_ALLOW_SSLBYPASS > } else { > /* bypass version */ > const SECHashObject *hashObj = NULL; >@@ -1996,6 +2006,7 @@ ssl3_ComputeRecordMAC( > #undef cx > } > } >+#endif > > PORT_Assert(rv != SECSuccess || *outLength == (unsigned)spec->mac_size); > >@@ -3176,11 +3187,13 @@ ssl3_RestartHandshakeHashes(sslSocket *s > { > SECStatus rv = SECSuccess; > >+#ifdef NSS_ALLOW_SSLBYPASS > if (ss->opt.bypassPKCS11) { > ss->ssl3.hs.messages.len = 0; > MD5_Begin((MD5Context *)ss->ssl3.hs.md5_cx); > SHA1_Begin((SHA1Context *)ss->ssl3.hs.sha_cx); > } else { >+#endif > rv = PK11_DigestBegin(ss->ssl3.hs.md5); > if (rv != SECSuccess) { > ssl_MapLowLevelError(SSL_ERROR_MD5_DIGEST_FAILURE); >@@ -3191,7 +3204,9 @@ ssl3_RestartHandshakeHashes(sslSocket *s > ssl_MapLowLevelError(SSL_ERROR_SHA_DIGEST_FAILURE); > return rv; > } >+#ifdef NSS_ALLOW_SSLBYPASS > } >+#endif > return rv; > } > >@@ -3207,11 +3222,13 @@ ssl3_NewHandshakeHashes(sslSocket *ss) > * that the master secret will wind up in ... > */ > SSL_TRC(30,("%d: SSL3[%d]: start handshake hashes", SSL_GETPID(), ss->fd)); >+#ifdef NSS_ALLOW_SSLBYPASS > if (ss->opt.bypassPKCS11) { > PORT_Assert(!ss->ssl3.hs.messages.buf && !ss->ssl3.hs.messages.space); > ss->ssl3.hs.messages.buf = NULL; > ss->ssl3.hs.messages.space = 0; > } else { >+#endif > ss->ssl3.hs.md5 = md5 = PK11_CreateDigestContext(SEC_OID_MD5); > ss->ssl3.hs.sha = sha = PK11_CreateDigestContext(SEC_OID_SHA1); > if (md5 == NULL) { >@@ -3222,7 +3239,9 @@ ssl3_NewHandshakeHashes(sslSocket *ss) > ssl_MapLowLevelError(SSL_ERROR_SHA_DIGEST_FAILURE); > goto loser; > } >+#ifdef NSS_ALLOW_SSLBYPASS > } >+#endif > if (SECSuccess == ssl3_RestartHandshakeHashes(ss)) { > return SECSuccess; > } >@@ -3259,6 +3278,7 @@ ssl3_UpdateHandshakeHashes(sslSocket *ss > > PRINT_BUF(90, (NULL, "MD5 & SHA handshake hash input:", b, l)); > >+#ifdef NSS_ALLOW_SSLBYPASS > if (ss->opt.bypassPKCS11) { > MD5_Update((MD5Context *)ss->ssl3.hs.md5_cx, b, l); > SHA1_Update((SHA1Context *)ss->ssl3.hs.sha_cx, b, l); >@@ -3267,6 +3287,7 @@ ssl3_UpdateHandshakeHashes(sslSocket *ss > #endif > return rv; > } >+#endif > rv = PK11_DigestOp(ss->ssl3.hs.md5, b, l); > if (rv != SECSuccess) { > ssl_MapLowLevelError(SSL_ERROR_MD5_DIGEST_FAILURE); >@@ -3523,6 +3544,7 @@ ssl3_ComputeHandshakeHashes(sslSocket * > > PORT_Assert( ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss) ); > >+#ifdef NSS_ALLOW_SSLBYPASS > if (ss->opt.bypassPKCS11) { > /* compute them without PKCS11 */ > PRUint64 md5_cx[MAX_MAC_CONTEXT_LLONGS]; >@@ -3606,6 +3628,7 @@ ssl3_ComputeHandshakeHashes(sslSocket * > #undef md5cx > #undef shacx > } else { >+#endif > /* compute hases with PKCS11 */ > PK11Context * md5; > PK11Context * sha = NULL; >@@ -3749,7 +3772,9 @@ ssl3_ComputeHandshakeHashes(sslSocket * > PORT_ZFree(shaStateBuf, shaStateLen); > } > } >+#ifdef NSS_ALLOW_SSLBYPASS > } >+#endif > return rv; > } > >@@ -6453,11 +6478,18 @@ compression_found: > break; /* not an error */ > } > } else if (ss->opt.bypassPKCS11) { >+#ifdef NO_SSLBYPASS >+ /* Do nothing. The else below is to restart a bypass >+ * session in a non-bypass socket which doesn't make >+ * as we are disallowing pypass any way. >+ */ >+#else > wrappedMS.data = sid->u.ssl3.keys.wrapped_master_secret; > wrappedMS.len = sid->u.ssl3.keys.wrapped_master_secret_len; > memcpy(pwSpec->raw_master_secret, wrappedMS.data, wrappedMS.len); > pwSpec->msItem.data = pwSpec->raw_master_secret; > pwSpec->msItem.len = wrappedMS.len; >+#endif > } else { > /* We CAN restart a bypass session in a non-bypass socket. */ > /* need to import the raw master secret to session object */ >@@ -9588,10 +9620,12 @@ ssl3_DestroySSL3Info(sslSocket *ss) > } > > /* clean up handshake */ >+#ifdef NSS_ALLOW_SSLBYPASS > if (ss->opt.bypassPKCS11) { > SHA1_DestroyContext((SHA1Context *)ss->ssl3.hs.sha_cx, PR_FALSE); > MD5_DestroyContext((MD5Context *)ss->ssl3.hs.md5_cx, PR_FALSE); > } >+#endif > if (ss->ssl3.hs.md5) { > PK11_DestroyContext(ss->ssl3.hs.md5,PR_TRUE); > } >Index: ./mozilla/security/nss/lib/ssl/ssl3ext.c >=================================================================== >RCS file: /cvsroot/mozilla/security/nss/lib/ssl/ssl3ext.c,v >retrieving revision 1.21 >diff -u -p -r1.21 ssl3ext.c >--- ./mozilla/security/nss/lib/ssl/ssl3ext.c 15 Feb 2012 21:52:08 -0000 1.21 >+++ ./mozilla/security/nss/lib/ssl/ssl3ext.c 25 Mar 2012 05:48:43 -0000 >@@ -722,13 +722,17 @@ ssl3_SendNewSessionTicket(sslSocket *ss) > rv = PK11_GenerateRandom(iv, sizeof(iv)); > if (rv != SECSuccess) goto loser; > >+#ifdef NSS_ALLOW_SSLBYPASS > if (ss->opt.bypassPKCS11) { > rv = ssl3_GetSessionTicketKeys(&aes_key, &aes_key_length, > &mac_key, &mac_key_length); > } else { >+#endif > rv = ssl3_GetSessionTicketKeysPKCS11(ss, &aes_key_pkcs11, > &mac_key_pkcs11); >+#ifdef NSS_ALLOW_SSLBYPASS > } >+#endif > if (rv != SECSuccess) goto loser; > > if (ss->ssl3.pwSpec->msItem.len && ss->ssl3.pwSpec->msItem.data) { >@@ -892,6 +896,7 @@ ssl3_SendNewSessionTicket(sslSocket *ss) > } > > /* Generate encrypted portion of ticket. */ >+#ifdef NSS_ALLOW_SSLBYPASS > if (ss->opt.bypassPKCS11) { > aes_ctx = (AESContext *)aes_ctx_buf; > rv = AES_InitContext(aes_ctx, aes_key, aes_key_length, iv, >@@ -903,6 +908,7 @@ ssl3_SendNewSessionTicket(sslSocket *ss) > plaintext_item.len); > if (rv != SECSuccess) goto loser; > } else { >+#endif > aes_ctx_pkcs11 = PK11_CreateContextBySymKey(cipherMech, > CKA_ENCRYPT, aes_key_pkcs11, &ivItem); > if (!aes_ctx_pkcs11) >@@ -914,13 +920,16 @@ ssl3_SendNewSessionTicket(sslSocket *ss) > PK11_Finalize(aes_ctx_pkcs11); > PK11_DestroyContext(aes_ctx_pkcs11, PR_TRUE); > if (rv != SECSuccess) goto loser; >+#ifdef NSS_ALLOW_SSLBYPASS > } >+#endif > > /* Convert ciphertext length to network order. */ > length_buf[0] = (ciphertext.len >> 8) & 0xff; > length_buf[1] = (ciphertext.len ) & 0xff; > > /* Compute MAC. */ >+#ifdef NSS_ALLOW_SSLBYPASS > if (ss->opt.bypassPKCS11) { > hmac_ctx = (HMACContext *)hmac_ctx_buf; > hashObj = HASH_GetRawHashObject(HASH_AlgSHA256); >@@ -936,6 +945,7 @@ ssl3_SendNewSessionTicket(sslSocket *ss) > HMAC_Finish(hmac_ctx, computed_mac, &computed_mac_length, > sizeof(computed_mac)); > } else { >+#endif > SECItem macParam; > macParam.data = NULL; > macParam.len = 0; >@@ -954,7 +964,9 @@ ssl3_SendNewSessionTicket(sslSocket *ss) > &computed_mac_length, sizeof(computed_mac)); > PK11_DestroyContext(hmac_ctx_pkcs11, PR_TRUE); > if (rv != SECSuccess) goto loser; >+#ifdef NSS_ALLOW_SSLBYPASS > } >+#endif > > /* Serialize the handshake message. */ > rv = ssl3_AppendHandshakeHeader(ss, new_session_ticket, message_length); >@@ -1075,13 +1087,17 @@ ssl3_ServerHandleSessionTicketXtn(sslSoc > return SECFailure; > > /* Get session ticket keys. */ >+#ifdef NSS_ALLOW_SSLBYPASS > if (ss->opt.bypassPKCS11) { > rv = ssl3_GetSessionTicketKeys(&aes_key, &aes_key_length, > &mac_key, &mac_key_length); > } else { >+#endif > rv = ssl3_GetSessionTicketKeysPKCS11(ss, &aes_key_pkcs11, > &mac_key_pkcs11); >+#ifdef NSS_ALLOW_SSLBYPASS > } >+#endif > if (rv != SECSuccess) { > SSL_DBG(("%d: SSL[%d]: Unable to get/generate session ticket keys.", > SSL_GETPID(), ss->fd)); >@@ -1101,6 +1117,7 @@ ssl3_ServerHandleSessionTicketXtn(sslSoc > /* Verify the MAC on the ticket. MAC verification may also > * fail if the MAC key has been recently refreshed. > */ >+#ifdef NSS_ALLOW_SSLBYPASS > if (ss->opt.bypassPKCS11) { > hmac_ctx = (HMACContext *)hmac_ctx_buf; > hashObj = HASH_GetRawHashObject(HASH_AlgSHA256); >@@ -1114,6 +1131,7 @@ ssl3_ServerHandleSessionTicketXtn(sslSoc > sizeof(computed_mac)) != SECSuccess) > goto no_ticket; > } else { >+#endif > SECItem macParam; > macParam.data = NULL; > macParam.len = 0; >@@ -1139,7 +1157,9 @@ ssl3_ServerHandleSessionTicketXtn(sslSoc > PK11_DestroyContext(hmac_ctx_pkcs11, PR_TRUE); > if (rv != SECSuccess) > goto no_ticket; >+#ifdef NSS_ALLOW_SSLBYPASS > } >+#endif > if (NSS_SecureMemcmp(computed_mac, enc_session_ticket.mac, > computed_mac_length) != 0) { > SSL_DBG(("%d: SSL[%d]: Session ticket MAC mismatch.", >@@ -1157,6 +1177,7 @@ ssl3_ServerHandleSessionTicketXtn(sslSoc > decrypted_state = SECITEM_AllocItem(NULL, NULL, > enc_session_ticket.encrypted_state.len); > >+#ifdef NSS_ALLOW_SSLBYPASS > if (ss->opt.bypassPKCS11) { > aes_ctx = (AESContext *)aes_ctx_buf; > rv = AES_InitContext(aes_ctx, aes_key, >@@ -1175,6 +1196,7 @@ ssl3_ServerHandleSessionTicketXtn(sslSoc > if (rv != SECSuccess) > goto no_ticket; > } else { >+#endif > SECItem ivItem; > ivItem.data = enc_session_ticket.iv; > ivItem.len = AES_BLOCK_SIZE; >@@ -1194,7 +1216,9 @@ ssl3_ServerHandleSessionTicketXtn(sslSoc > PK11_DestroyContext(aes_ctx_pkcs11, PR_TRUE); > if (rv != SECSuccess) > goto no_ticket; >+#ifdef NSS_ALLOW_SSLBYPASS > } >+#endif > > /* Check padding. */ > padding_length = >@@ -1348,9 +1372,11 @@ ssl3_ServerHandleSessionTicketXtn(sslSoc > sid->keaKeyBits = parsed_session_ticket->keaKeyBits; > > /* Copy master secret. */ >+#ifdef NSS_ALLOW_SSLBYPASS > if (ss->opt.bypassPKCS11 && > parsed_session_ticket->ms_is_wrapped) > goto no_ticket; >+#endif > if (parsed_session_ticket->ms_length > > sizeof(sid->u.ssl3.keys.wrapped_master_secret)) > goto no_ticket; >Index: ./mozilla/security/nss/lib/ssl/sslsock.c >=================================================================== >RCS file: /cvsroot/mozilla/security/nss/lib/ssl/sslsock.c,v >retrieving revision 1.82 >diff -u -p -r1.82 sslsock.c >--- ./mozilla/security/nss/lib/ssl/sslsock.c 15 Feb 2012 21:52:08 -0000 1.82 >+++ ./mozilla/security/nss/lib/ssl/sslsock.c 25 Mar 2012 05:48:44 -0000 >@@ -686,6 +686,7 @@ SSL_OptionSet(PRFileDesc *fd, PRInt32 wh > PORT_SetError(PR_INVALID_STATE_ERROR); > rv = SECFailure; > } else { >+#ifdef NSS_ALLOW_SSLBYPASS > if (PR_FALSE != on) { > if (PR_SUCCESS == SSL_BypassSetup() ) { > ss->opt.bypassPKCS11 = on; >@@ -695,6 +696,9 @@ SSL_OptionSet(PRFileDesc *fd, PRInt32 wh > } else { > ss->opt.bypassPKCS11 = PR_FALSE; > } >+#else >+ ss->opt.bypassPKCS11 = PR_FALSE; >+#endif > } > break; > >@@ -969,6 +973,7 @@ SSL_OptionSetDefault(PRInt32 which, PRBo > SSL_DisableDefaultExportCipherSuites(); > break; > >+#ifdef NSS_ALLOW_SSLBYPASS > case SSL_BYPASS_PKCS11: > if (PR_FALSE != on) { > if (PR_SUCCESS == SSL_BypassSetup()) { >@@ -979,6 +984,9 @@ SSL_OptionSetDefault(PRInt32 which, PRBo > } else { > ssl_defaults.bypassPKCS11 = PR_FALSE; > } >+#else >+ ssl_defaults.bypassPKCS11 = PR_FALSE; >+#endif > break; > > case SSL_NO_LOCKS:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 806588
:
572564
|
574100
|
577475
|
584430
|
594623
|
594787
|
641885