pike.git / lib / modules / SSL.pmod / Session.pike

version» Context lines:

pike.git/lib/modules/SSL.pmod/Session.pike:164:    if (!(ke_mask & cp->ke_mask_invariant)) return 0;       // Check that all sign_algs in the cert chain are supported by the peer.    foreach(cp->sign_algs, array(int) sign_alg) {    int found;    foreach(signature_algorithms, array(int) sup_alg) {    if (found = equal(sign_alg, sup_alg)) break;    }    if (!found) return 0;    } -  } else { -  if (!(ke_mask & cp->ke_mask)) return 0; +  } else if (!(ke_mask & cp->ke_mask)) +  return 0;    -  // GNU-TLS doesn't like eg SHA being used with SHA256 certs. -  Crypto.Hash hash = [object(Crypto.Hash)]HASH_lookup[cp->sign_algs[0][0]]; -  if (!hash) return 0; -  if (hash->digest_size() > h_max) return 0; -  } -  +    #if constant(Crypto.ECC.Curve)    if (cp->key->curve) {    // Is the ECC curve supported by the client?    Crypto.ECC.Curve c =    ([object(Crypto.ECC.SECP_521R1.ECDSA)]cp->key)->curve();    SSL3_DEBUG_MSG("Curve: %O (%O)\n",    c, ECC_NAME_TO_CURVE[c->name()]);    return has_value(ecc_curves, ECC_NAME_TO_CURVE[c->name()]);    }   #endif
pike.git/lib/modules/SSL.pmod/Session.pike:286:    if (hash && (hash->digest_size() > h_max)) {    h_max = hash->digest_size();    }    }    }       // Filter any certs that the client doesn't support.    certs = [array(CertificatePair)]    filter(certs, is_supported_cert, ke_mask, h_max, version, ecc_curves);    +  if( version<PROTOCOL_TLS_1_2 && sizeof(certs)>1 ) +  { +  // GNU-TLS doesn't like eg SHA being used with SHA256 certs. +  // FIXME: Can this be made more narrow? +  array(CertificatePair) c = [array(CertificatePair)] +  filter(certs, lambda(CertificatePair cp) +  { +  Crypto.Hash hash = [object(Crypto.Hash)] +  HASH_lookup[cp->sign_algs[0][0]]; +  return hash->digest_size() <= h_max; +  }); +  // Don't clear out the entire list though, as that makes all peers +  // fail. +  if( sizeof(c) ) +  certs = c; +  } +     SSL3_DEBUG_MSG("Client supported certificates: %O\n", certs);       // Find the set of key exchange algorithms supported by    // the remaining certs.    ke_mask = (1<<KE_null)|(1<<KE_dh_anon)   #if constant(Crypto.ECC.Curve)    |(1<<KE_ecdh_anon)   #endif    ;    if (version >= PROTOCOL_TLS_1_2) {