Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
sslinfo.c File Reference
#include "ssl.h"
#include "sslimpl.h"
#include "sslproto.h"

Go to the source code of this file.

Defines

#define CS(x)   x, #x
#define CK(x)   x | 0xff00, #x
#define S_DSA   "DSA", ssl_auth_dsa
#define S_RSA   "RSA", ssl_auth_rsa
#define S_KEA   "KEA", ssl_auth_kea
#define S_ECDSA   "ECDSA", ssl_auth_ecdsa
#define K_DHE   "DHE", kt_dh
#define K_RSA   "RSA", kt_rsa
#define K_KEA   "KEA", kt_kea
#define K_ECDH   "ECDH", kt_ecdh
#define K_ECDHE   "ECDHE", kt_ecdh
#define C_AES   "AES", calg_aes
#define C_RC4   "RC4", calg_rc4
#define C_RC2   "RC2", calg_rc2
#define C_DES   "DES", calg_des
#define C_3DES   "3DES", calg_3des
#define C_NULL   "NULL", calg_null
#define C_SJ   "SKIPJACK", calg_sj
#define B_256   256, 256, 256
#define B_128   128, 128, 128
#define B_3DES   192, 156, 112
#define B_SJ   96, 80, 80
#define B_DES   64, 56, 56
#define B_56   128, 56, 56
#define B_40   128, 40, 40
#define B_0   0, 0, 0
#define M_SHA   "SHA1", ssl_mac_sha, 160
#define M_MD5   "MD5", ssl_mac_md5, 128
#define NUM_SUITEINFOS   ((sizeof suiteInfo) / (sizeof suiteInfo[0]))

Functions

SECStatus SSL_GetChannelInfo (PRFileDesc *fd, SSLChannelInfo *info, PRUintn len)
SECStatus SSL_GetCipherSuiteInfo (PRUint16 cipherSuite, SSLCipherSuiteInfo *info, PRUintn len)
SECStatus SSL_DisableDefaultExportCipherSuites (void)
SECStatus SSL_DisableExportCipherSuites (PRFileDesc *fd)
PRBool SSL_IsExportCipherSuite (PRUint16 cipherSuite)

Variables

static const SSLCipherSuiteInfo suiteInfo []

Define Documentation

#define B_0   0, 0, 0

Definition at line 127 of file sslinfo.c.

#define B_128   128, 128, 128

Definition at line 121 of file sslinfo.c.

#define B_256   256, 256, 256

Definition at line 120 of file sslinfo.c.

#define B_3DES   192, 156, 112

Definition at line 122 of file sslinfo.c.

#define B_40   128, 40, 40

Definition at line 126 of file sslinfo.c.

#define B_56   128, 56, 56

Definition at line 125 of file sslinfo.c.

#define B_DES   64, 56, 56

Definition at line 124 of file sslinfo.c.

#define B_SJ   96, 80, 80

Definition at line 123 of file sslinfo.c.

#define C_3DES   "3DES", calg_3des

Definition at line 116 of file sslinfo.c.

#define C_AES   "AES", calg_aes

Definition at line 112 of file sslinfo.c.

#define C_DES   "DES", calg_des

Definition at line 115 of file sslinfo.c.

#define C_NULL   "NULL", calg_null

Definition at line 117 of file sslinfo.c.

#define C_RC2   "RC2", calg_rc2

Definition at line 114 of file sslinfo.c.

#define C_RC4   "RC4", calg_rc4

Definition at line 113 of file sslinfo.c.

#define C_SJ   "SKIPJACK", calg_sj

Definition at line 118 of file sslinfo.c.

#define CK (   x)    x | 0xff00, #x

Definition at line 99 of file sslinfo.c.

#define CS (   x)    x, #x

Definition at line 98 of file sslinfo.c.

#define K_DHE   "DHE", kt_dh

Definition at line 106 of file sslinfo.c.

#define K_ECDH   "ECDH", kt_ecdh

Definition at line 109 of file sslinfo.c.

#define K_ECDHE   "ECDHE", kt_ecdh

Definition at line 110 of file sslinfo.c.

#define K_KEA   "KEA", kt_kea

Definition at line 108 of file sslinfo.c.

#define K_RSA   "RSA", kt_rsa

Definition at line 107 of file sslinfo.c.

#define M_MD5   "MD5", ssl_mac_md5, 128

Definition at line 130 of file sslinfo.c.

#define M_SHA   "SHA1", ssl_mac_sha, 160

Definition at line 129 of file sslinfo.c.

#define NUM_SUITEINFOS   ((sizeof suiteInfo) / (sizeof suiteInfo[0]))

Definition at line 198 of file sslinfo.c.

#define S_DSA   "DSA", ssl_auth_dsa

Definition at line 101 of file sslinfo.c.

#define S_ECDSA   "ECDSA", ssl_auth_ecdsa

Definition at line 104 of file sslinfo.c.

#define S_KEA   "KEA", ssl_auth_kea

Definition at line 103 of file sslinfo.c.

#define S_RSA   "RSA", ssl_auth_rsa

Definition at line 102 of file sslinfo.c.


Function Documentation

Definition at line 226 of file sslinfo.c.

{
    const SSLCipherSuiteInfo * pInfo = suiteInfo;
    unsigned int i;
    SECStatus rv;

    for (i = 0; i < NUM_SUITEINFOS; ++i, ++pInfo) {
       if (pInfo->isExportable) {
           rv = SSL_CipherPrefSetDefault(pInfo->cipherSuite, PR_FALSE);
           PORT_Assert(rv == SECSuccess);
       }
    }
    return SECSuccess;
}

Definition at line 247 of file sslinfo.c.

{
    const SSLCipherSuiteInfo * pInfo = suiteInfo;
    unsigned int i;
    SECStatus rv;

    for (i = 0; i < NUM_SUITEINFOS; ++i, ++pInfo) {
       if (pInfo->isExportable) {
           rv = SSL_CipherPrefSet(fd, pInfo->cipherSuite, PR_FALSE);
           PORT_Assert(rv == SECSuccess);
       }
    }
    return SECSuccess;
}
SECStatus SSL_GetChannelInfo ( PRFileDesc fd,
SSLChannelInfo info,
PRUintn  len 
)

Definition at line 43 of file sslinfo.c.

{
    sslSocket *      ss;
    SSLChannelInfo   inf;
    sslSessionID *   sid;

    if (!info || len < sizeof inf.length) { 
       return SECSuccess;
    }

    ss = ssl_FindSocket(fd);
    if (!ss) {
       SSL_DBG(("%d: SSL[%d]: bad socket in SSL_GetChannelInfo",
               SSL_GETPID(), fd));
       return SECFailure;
    }

    memset(&inf, 0, sizeof inf);
    inf.length = PR_MIN(sizeof inf, len);

    if (ss->opt.useSecurity && ss->firstHsDone) {
        sid = ss->sec.ci.sid;
       inf.protocolVersion  = ss->version;
       inf.authKeyBits      = ss->sec.authKeyBits;
       inf.keaKeyBits       = ss->sec.keaKeyBits;
       if (ss->version < SSL_LIBRARY_VERSION_3_0) { /* SSL2 */
           inf.cipherSuite      = ss->sec.cipherType | 0xff00;
       } else if (ss->ssl3.initialized) {        /* SSL3 and TLS */

           /* XXX  These should come from crSpec */
           inf.cipherSuite      = ss->ssl3.hs.cipher_suite;
       }
       if (sid) {
           inf.creationTime   = sid->creationTime;
           inf.lastAccessTime = sid->lastAccessTime;
           inf.expirationTime = sid->expirationTime;
           if (ss->version < SSL_LIBRARY_VERSION_3_0) { /* SSL2 */
               inf.sessionIDLength = SSL2_SESSIONID_BYTES;
              memcpy(inf.sessionID, sid->u.ssl2.sessionID, 
                     SSL2_SESSIONID_BYTES);
           } else {
              unsigned int sidLen = sid->u.ssl3.sessionIDLength;
               sidLen = PR_MIN(sidLen, sizeof inf.sessionID);
               inf.sessionIDLength = sidLen;
              memcpy(inf.sessionID, sid->u.ssl3.sessionID, sidLen);
           }
       }
    }

    memcpy(info, &inf, inf.length);

    return SECSuccess;
}
SECStatus SSL_GetCipherSuiteInfo ( PRUint16  cipherSuite,
SSLCipherSuiteInfo info,
PRUintn  len 
)

Definition at line 201 of file sslinfo.c.

{
    unsigned int i;

    len = PR_MIN(len, sizeof suiteInfo[0]);
    if (!info || len < sizeof suiteInfo[0].length) {
       PORT_SetError(SEC_ERROR_INVALID_ARGS);
       return SECFailure;
    }
    for (i = 0; i < NUM_SUITEINFOS; i++) {
       if (suiteInfo[i].cipherSuite == cipherSuite) {
           memcpy(info, &suiteInfo[i], len);
           info->length = len;
           return SECSuccess;
       }
    }
    PORT_SetError(SEC_ERROR_INVALID_ARGS);
    return SECFailure;
}

Definition at line 266 of file sslinfo.c.

{
    unsigned int i;
    for (i = 0; i < NUM_SUITEINFOS; i++) {
       if (suiteInfo[i].cipherSuite == cipherSuite) {
           return (PRBool)(suiteInfo[i].isExportable);
       }
    }
    return PR_FALSE;
}

Variable Documentation

Definition at line 132 of file sslinfo.c.