VirtualBox

Ignore:
Timestamp:
Sep 9, 2015 1:15:21 PM (9 years ago)
Author:
vboxsync
Message:

UINetworkReply: Remove the ancient 1st generation verisign certificate requirement, and with it the maddening alternative certificate construct that was introduced to deal with the SHA-1 reissue of the original MD2 certificate.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkReply.cpp

    r57655 r57665  
    8686    typedef struct CERTINFO
    8787    {
    88         /** Gives the s_aCerts index this certificate is an alternative edition of,
    89          * UINT8_MAX if no alternative.  This is a complication caused by VeriSign
    90          * reissuing certificates signed with md2WithRSAEncryption using
    91          * sha1WithRSAEncryption, since MD2 is comprimised.  (Public key unmodified.)
    92          * It has no practical meaning for the trusted root anchor use we put it to.  */
    93         uint8_t     iAlternativeTo;
    9488        /** Set if mandatory. */
    9589        bool        fMandatory;
     
    107101    static unsigned countCertsFound(bool const *pafFoundCerts);
    108102    static bool areAllCertsFound(bool const *pafFoundCerts, bool fOnlyMandatory);
    109     static int  adjustCertsFound(int rc, bool *pafFoundCerts);
    110103    static void refreshCertificates(RTHTTP hHttp, RTCRSTORE hOldStore, bool *pafFoundCerts, const char *pszCaCertFile);
    111104    static void downloadMissingCertificates(RTCRSTORE hNewStore, bool *pafNewFoundCerts, RTHTTP hHttp,
     
    127120    static const QString s_strCertificateFileName;
    128121    static const RTCRCERTWANTED s_aCerts[3];
    129     static const CERTINFO s_CertInfoPcaCls3Gen1Md2;
    130     static const CERTINFO s_CertInfoPcaCls3Gen1Sha1;
    131122    static const CERTINFO s_CertInfoPcaCls3Gen5;
    132123};
    133124
    134 /*static*/ const UINetworkReplyPrivateThread::CERTINFO UINetworkReplyPrivateThread::s_CertInfoPcaCls3Gen1Sha1 =
    135 {
    136     /*.iAlternativeTo =*/   1,
    137     /*.fMandatory     =*/   false,
    138     /*.pszZipFile     =*/
    139     "VeriSign Root Certificates/Generation 1 (G1) PCAs/Class 3 Public Primary Certification Authority.pem",
    140     /*.apszUrls[3]    =*/
    141     {
    142         "http://www.symantec.com/content/en/us/enterprise/verisign/roots/Class-3-Public-Primary-Certification-Authority.pem",
    143         "http://www.verisign.com/repository/roots/root-certificates/PCA-3.pem", /* dead */
    144         NULL,
    145         "http://update.virtualbox.org/cacerts-symantec-PCA-3-pem-has-gone-missing-again" /* attention getter */
    146     }
    147 };
    148 
    149 /*static*/ const UINetworkReplyPrivateThread::CERTINFO UINetworkReplyPrivateThread::s_CertInfoPcaCls3Gen1Md2 =
    150 {
    151     /*.iAlternativeTo =*/   0,
    152     /*.fMandatory     =*/   false,
    153     /*.pszZipFile     =*/   NULL,
    154     /*.apszUrls[3]    =*/   { NULL, NULL, NULL },
    155 };
    156 
    157125/*static*/ const UINetworkReplyPrivateThread::CERTINFO UINetworkReplyPrivateThread::s_CertInfoPcaCls3Gen5 =
    158126{
    159     /*.iAlternativeTo =*/   UINT8_MAX,
    160127    /*.fMandatory     =*/   true,
    161128    /*.pszZipFile     =*/
     
    177144/* static */ const RTCRCERTWANTED UINetworkReplyPrivateThread::s_aCerts[3] =
    178145{
    179     /*[0] =*/   /* The reissued version with the SHA-1 signature. */
    180 /** @todo r=bird: Why do we need this certificate? Neither update.virtualbox.org nor www.virtualbox.org uses it...  ElCapitan doesn't ship this. */
    181     {
    182         /*.pszSubject        =*/    "C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification Authority",
    183         /*.cbEncoded         =*/    0x240,
    184         /*.Sha1Fingerprint   =*/    true,
    185         /*.Sha512Fingerprint =*/    true,
    186         /*.abSha1            =*/
    187         {
    188             0xa1, 0xdb, 0x63, 0x93, 0x91, 0x6f, 0x17, 0xe4, 0x18, 0x55,
    189             0x09, 0x40, 0x04, 0x15, 0xc7, 0x02, 0x40, 0xb0, 0xae, 0x6b
    190         },
    191         /*.abSha512          =*/
    192         {
    193             0xbb, 0xf7, 0x8a, 0x19, 0x9f, 0x37, 0xee, 0xa2,
    194             0xce, 0xc8, 0xaf, 0xe3, 0xd6, 0x22, 0x54, 0x20,
    195             0x74, 0x67, 0x6e, 0xa5, 0x19, 0xb7, 0x62, 0x1e,
    196             0xc1, 0x2f, 0xd5, 0x08, 0xf4, 0x64, 0xc4, 0xc6,
    197             0xbb, 0xc2, 0xf2, 0x35, 0xe7, 0xbe, 0x32, 0x0b,
    198             0xde, 0xb2, 0xfc, 0x44, 0x92, 0x5b, 0x8b, 0x9b,
    199             0x77, 0xa5, 0x40, 0x22, 0x18, 0x12, 0xcb, 0x3d,
    200             0x0a, 0x67, 0x83, 0x87, 0xc5, 0x45, 0xc4, 0x99
    201         },
    202         /*.pvUser */ &UINetworkReplyPrivateThread::s_CertInfoPcaCls3Gen1Sha1
    203     },
    204     /*[1] =*/   /* The original version with the MD2 signature. */
    205     {
    206         /*.pszSubject        =*/    "C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification Authority",
    207         /*.cbEncoded         =*/    0x240,
    208         /*.Sha1Fingerprint   =*/    true,
    209         /*.Sha512Fingerprint =*/    true,
    210         /*.abSha1            =*/
    211         {
    212             0x74, 0x2c, 0x31, 0x92, 0xe6, 0x07, 0xe4, 0x24, 0xeb, 0x45,
    213             0x49, 0x54, 0x2b, 0xe1, 0xbb, 0xc5, 0x3e, 0x61, 0x74, 0xe2
    214         },
    215         /*.abSha512          =*/
    216         {
    217             0x7c, 0x2f, 0x94, 0x22, 0x5f, 0x67, 0x98, 0x89,
    218             0xb9, 0xde, 0xd7, 0x41, 0xa0, 0x0d, 0xb1, 0x5c,
    219             0xc6, 0xca, 0x28, 0x12, 0xbf, 0xbc, 0xa8, 0x2b,
    220             0x22, 0x53, 0x7a, 0xf8, 0x32, 0x41, 0x2a, 0xbb,
    221             0xc1, 0x05, 0xe0, 0x0c, 0xd0, 0xa3, 0x97, 0x9d,
    222             0x5f, 0xcd, 0xe9, 0x9b, 0x68, 0x06, 0xe8, 0xe6,
    223             0xce, 0xef, 0xb2, 0x71, 0x8e, 0x91, 0x60, 0xa2,
    224             0xc8, 0x0c, 0x5a, 0xe7, 0x8b, 0x33, 0xf2, 0xaa
    225         },
    226         /*.pvUser */ &UINetworkReplyPrivateThread::s_CertInfoPcaCls3Gen1Md2
    227     },
    228     /*[2] =*/
     146    /*[0] =*/
    229147    {
    230148        /*.pszSubject        =*/
     
    358276             */
    359277            rc = RTCrStoreCertCheckWanted(hCurStore, s_aCerts, RT_ELEMENTS(s_aCerts), afCertsFound);
    360             rc = adjustCertsFound(rc, afCertsFound);
    361278            AssertRC(rc);
    362279            RTTIMESPEC RefreshAge;
     
    488405    /* Apply HTTP headers: */
    489406    return RTHttpSetHeaders(hHttp, formattedHeaderPointers.size(), ppFormattedHeaders);
    490 }
    491 
    492 /**
    493  * Adjusts the set of found certificates by marking all alternatives found if
    494  * one is.
    495  *
    496  * @returns Adjusted rc (VINF_SUCCESS instead of VWRN_NOT_FOUND if all found).
    497  * @param   rc                  The status code.
    498  * @param   pafFoundCerts       Array parallel to s_aCerts with the status of
    499  *                              each wanted certificate.
    500  */
    501 /*static*/ int
    502 UINetworkReplyPrivateThread::adjustCertsFound(int rc, bool *pafFoundCerts)
    503 {
    504     for (uint32_t i = 0; i < RT_ELEMENTS(s_aCerts); i++)
    505         if (pafFoundCerts[i])
    506         {
    507             uint8_t iAlt = i;
    508             for (;;)
    509             {
    510                 const CERTINFO *pCertInfo = (const CERTINFO *)s_aCerts[iAlt].pvUser;
    511                 iAlt = pCertInfo->iAlternativeTo;
    512                 if (iAlt >= RT_ELEMENTS(s_aCerts) || iAlt == i)
    513                 {
    514                     Assert(iAlt == UINT8_MAX || iAlt < RT_ELEMENTS(s_aCerts));
    515                     break;
    516                 }
    517                 if (!pafFoundCerts[iAlt])
    518                     pafFoundCerts[iAlt] = true;
    519             }
    520         }
    521 
    522     if (rc == VINF_SUCCESS || rc == VWRN_NOT_FOUND)
    523         rc = countCertsFound(pafFoundCerts) == RT_ELEMENTS(s_aCerts) ? VINF_SUCCESS : VWRN_NOT_FOUND;
    524     return rc;
    525407}
    526408
     
    598480
    599481            rc = RTCrStoreCertCheckWanted(hNewStore, s_aCerts, RT_ELEMENTS(s_aCerts), afNewFoundCerts);
    600             rc = adjustCertsFound(rc, afNewFoundCerts);
    601482            AssertLogRelRC(rc);
    602483            Assert(rc != VINF_SUCCESS || areAllCertsFound(afNewFoundCerts, false /*fOnlyMandatory*/));
     
    606487                                                     RTCRCERTCTX_F_ADD_IF_NOT_FOUND | RTCRCERTCTX_F_ADD_CONTINUE_ON_ERROR,
    607488                                                     hOldStore, s_aCerts, RT_ELEMENTS(s_aCerts), afNewFoundCerts);
    608                 rc = adjustCertsFound(rc, afNewFoundCerts);
    609489                AssertLogRelRC(rc);
    610490                Assert(rc != VINF_SUCCESS || areAllCertsFound(afNewFoundCerts, false /*fOnlyMandatory*/));
     
    622502                                                                 s_aCerts, RT_ELEMENTS(s_aCerts), afNewFoundCerts,
    623503                                                                 RTErrInfoInitStatic(&StaticErrInfo));
    624                 rc = adjustCertsFound(rc, afNewFoundCerts);
    625504                if (RTErrInfoIsSet(&StaticErrInfo.Core))
    626505                    LogRel(("refreshCertificates/#2: %s\n", StaticErrInfo.Core.pszMsg));
     
    704583                                 */
    705584                                pafNewFoundCerts[i] = true;
    706                                 if (adjustCertsFound(VWRN_NOT_FOUND, pafNewFoundCerts) == VINF_SUCCESS)
     585                                if (areAllCertsFound(pafNewFoundCerts, false /*fOnlyMandator*/) == VINF_SUCCESS)
    707586                                {
    708587                                    RTHttpFreeResponse(pvRootsZip);
     
    737616                        {
    738617                            pafNewFoundCerts[i] = true;
    739                             adjustCertsFound(VWRN_NOT_FOUND, pafNewFoundCerts);
    740618                            break;
    741619                        }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette