| OLD | NEW |
| 1 /* | 1 /* |
| 2 * vtables (and methods that call through them) for the 4 types of | 2 * vtables (and methods that call through them) for the 4 types of |
| 3 * SSLSockets supported. Only one type is still supported. | 3 * SSLSockets supported. Only one type is still supported. |
| 4 * Various other functions. | 4 * Various other functions. |
| 5 * | 5 * |
| 6 * ***** BEGIN LICENSE BLOCK ***** | 6 * ***** BEGIN LICENSE BLOCK ***** |
| 7 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 7 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 8 * | 8 * |
| 9 * The contents of this file are subject to the Mozilla Public License Version | 9 * The contents of this file are subject to the Mozilla Public License Version |
| 10 * 1.1 (the "License"); you may not use this file except in compliance with | 10 * 1.1 (the "License"); you may not use this file except in compliance with |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 PRBool locksEverDisabled; /* implicitly PR_FALSE */ | 218 PRBool locksEverDisabled; /* implicitly PR_FALSE */ |
| 219 PRBool ssl_force_locks; /* implicitly PR_FALSE */ | 219 PRBool ssl_force_locks; /* implicitly PR_FALSE */ |
| 220 int ssl_lock_readers = 1; /* default true. */ | 220 int ssl_lock_readers = 1; /* default true. */ |
| 221 char ssl_debug; | 221 char ssl_debug; |
| 222 char ssl_trace; | 222 char ssl_trace; |
| 223 FILE * ssl_trace_iob; | 223 FILE * ssl_trace_iob; |
| 224 FILE * ssl_keylog_iob; | 224 FILE * ssl_keylog_iob; |
| 225 char lockStatus[] = "Locks are ENABLED. "; | 225 char lockStatus[] = "Locks are ENABLED. "; |
| 226 #define LOCKSTATUS_OFFSET 10 /* offset of ENABLED */ | 226 #define LOCKSTATUS_OFFSET 10 /* offset of ENABLED */ |
| 227 | 227 |
| 228 static PRUint16 srtpCiphers[] = { |
| 229 SRTP_AES128_CM_SHA1_80, |
| 230 SRTP_AES128_CM_SHA1_32, |
| 231 0 |
| 232 }; |
| 233 |
| 228 /* forward declarations. */ | 234 /* forward declarations. */ |
| 229 static sslSocket *ssl_NewSocket(PRBool makeLocks, SSLProtocolVariant variant); | 235 static sslSocket *ssl_NewSocket(PRBool makeLocks, SSLProtocolVariant variant); |
| 230 static SECStatus ssl_MakeLocks(sslSocket *ss); | 236 static SECStatus ssl_MakeLocks(sslSocket *ss); |
| 231 static void ssl_SetDefaultsFromEnvironment(void); | 237 static void ssl_SetDefaultsFromEnvironment(void); |
| 232 static PRStatus ssl_PushIOLayer(sslSocket *ns, PRFileDesc *stack, | 238 static PRStatus ssl_PushIOLayer(sslSocket *ns, PRFileDesc *stack, |
| 233 PRDescIdentity id); | 239 PRDescIdentity id); |
| 234 | 240 |
| 235 /************************************************************************/ | 241 /************************************************************************/ |
| 236 | 242 |
| 237 /* | 243 /* |
| (...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1589 } | 1595 } |
| 1590 PORT_Memcpy(buf, ss->ssl3.nextProto.data, ss->ssl3.nextProto.len); | 1596 PORT_Memcpy(buf, ss->ssl3.nextProto.data, ss->ssl3.nextProto.len); |
| 1591 *bufLen = ss->ssl3.nextProto.len; | 1597 *bufLen = ss->ssl3.nextProto.len; |
| 1592 } else { | 1598 } else { |
| 1593 *bufLen = 0; | 1599 *bufLen = 0; |
| 1594 } | 1600 } |
| 1595 | 1601 |
| 1596 return SECSuccess; | 1602 return SECSuccess; |
| 1597 } | 1603 } |
| 1598 | 1604 |
| 1605 SSL_IMPORT SECStatus SSL_SetSRTPCiphers(PRFileDesc *socket, |
| 1606 const PRUint16 *ciphers, |
| 1607 unsigned int num_ciphers) |
| 1608 { |
| 1609 sslSocket * ss; |
| 1610 int i; |
| 1611 |
| 1612 ss = ssl_FindSocket(socket); |
| 1613 if (!ss) { |
| 1614 SSL_DBG(("%d: SSL[%d]: bad socket in SSL_SetSRTPCiphers")); |
| 1615 PORT_SetError(SEC_ERROR_INVALID_ARGS); |
| 1616 return SECFailure; |
| 1617 } |
| 1618 |
| 1619 for (i=0; i<num_ciphers; i++) { |
| 1620 PRUint16 *srtpCipher = srtpCiphers; |
| 1621 |
| 1622 while (*srtpCipher) { |
| 1623 if (ciphers[i] == *srtpCipher) |
| 1624 break; |
| 1625 srtpCipher++; |
| 1626 } |
| 1627 if (!*srtpCipher) { |
| 1628 SSL_DBG(("%d: SSL[%d]: invalid SRTP cipher suite specified")); |
| 1629 PORT_SetError(SEC_ERROR_INVALID_ARGS); |
| 1630 return SECFailure; |
| 1631 } |
| 1632 } |
| 1633 |
| 1634 if (num_ciphers > MAX_DTLS_SRTP_CIPHER_SUITES) { |
| 1635 PORT_SetError(SEC_ERROR_INVALID_ARGS); |
| 1636 return SECFailure; |
| 1637 } |
| 1638 memcpy(ss->ssl3.dtlsSRTPCiphers, ciphers, sizeof(PRUint16) * num_ciphers); |
| 1639 ss->ssl3.dtlsSRTPCipherCt = num_ciphers; |
| 1640 |
| 1641 return SECSuccess; |
| 1642 } |
| 1643 |
| 1644 |
| 1645 SECStatus |
| 1646 SSL_GetSRTPCipher(PRFileDesc *socket, PRUint16 *cipher) |
| 1647 { |
| 1648 sslSocket * ss; |
| 1649 |
| 1650 ss = ssl_FindSocket(socket); |
| 1651 if (!ss) { |
| 1652 SSL_DBG(("%d: SSL[%d]: bad socket in SSL_GetSRTPCipher")); |
| 1653 PORT_SetError(SEC_ERROR_INVALID_ARGS); |
| 1654 return SECFailure; |
| 1655 } |
| 1656 |
| 1657 if (!ss->ssl3.dtlsSRTPCipherSuite) |
| 1658 return SECFailure; |
| 1659 |
| 1660 *cipher = ss->ssl3.dtlsSRTPCipherSuite; |
| 1661 return SECSuccess; |
| 1662 } |
| 1663 |
| 1599 PRFileDesc * | 1664 PRFileDesc * |
| 1600 SSL_ReconfigFD(PRFileDesc *model, PRFileDesc *fd) | 1665 SSL_ReconfigFD(PRFileDesc *model, PRFileDesc *fd) |
| 1601 { | 1666 { |
| 1602 PORT_SetError(PR_NOT_IMPLEMENTED_ERROR); | 1667 PORT_SetError(PR_NOT_IMPLEMENTED_ERROR); |
| 1603 PR_NOT_REACHED("not implemented"); | 1668 PR_NOT_REACHED("not implemented"); |
| 1604 return NULL; | 1669 return NULL; |
| 1605 | 1670 |
| 1606 #if 0 | 1671 #if 0 |
| 1607 sslSocket * sm = NULL, *ss = NULL; | 1672 sslSocket * sm = NULL, *ss = NULL; |
| 1608 int i; | 1673 int i; |
| (...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2981 ssl_DestroySocketContents(ss); | 3046 ssl_DestroySocketContents(ss); |
| 2982 ssl_DestroyLocks(ss); | 3047 ssl_DestroyLocks(ss); |
| 2983 PORT_Free(ss); | 3048 PORT_Free(ss); |
| 2984 ss = NULL; | 3049 ss = NULL; |
| 2985 } | 3050 } |
| 2986 ss->protocolVariant = protocolVariant; | 3051 ss->protocolVariant = protocolVariant; |
| 2987 } | 3052 } |
| 2988 return ss; | 3053 return ss; |
| 2989 } | 3054 } |
| 2990 | 3055 |
| OLD | NEW |