uint8_t sslCipherSuiteGetMacSize(SSLCipherSuite cipherSuite) {
    switch (sslCipherSuiteGetMacAlgorithm(cipherSuite)) {
        case HA_Null:
            return 0;
        case HA_MD5:
            return 16;
        case HA_SHA1:
            return 20;
        case HA_SHA256:
            return 32;
        case HA_SHA384:
            return 48;
        default:
            return 0;
    }
}
static const HashHmacReference *sslCipherSuiteGetHashHmacReference(uint16_t selectedCipher)
{
    HMAC_Algs alg = sslCipherSuiteGetMacAlgorithm(selectedCipher);

    switch (alg) {
        case HA_Null:
            return &HashHmacNull;
        case HA_MD5:
            return &HashHmacMD5;
        case HA_SHA1:
            return &HashHmacSHA1;
        case HA_SHA256:
            return &HashHmacSHA256;
        case HA_SHA384:
            return &HashHmacSHA384;
        default:
            sslErrorLog("Invalid hashAlgorithm %d", alg);
            check(0);
            return &HashHmacNull;
    }
}
예제 #3
0
static const struct ccdigest_info *sslCipherSuiteGetDigestInfo(uint16_t selectedCipher)
{
    HMAC_Algs alg = sslCipherSuiteGetMacAlgorithm(selectedCipher);

    switch (alg) {
        case HA_Null:
            return &null_di;
        case HA_MD5:
            return ccmd5_di();
        case HA_SHA1:
            return ccsha1_di();
        case HA_SHA256:
            return ccsha256_di();
        case HA_SHA384:
            return ccsha384_di();
        default:
            sslErrorLog("Invalid hashAlgorithm %d", alg);
            check(0);
            return NULL;
    }
}