~ubuntu-branches/ubuntu/saucy/openssl/saucy-updates

« back to all changes in this revision

Viewing changes to ssl/t1_lib.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2013-05-21 16:31:47 UTC
  • mfrom: (11.1.41 sid)
  • Revision ID: package-import@ubuntu.com-20130521163147-96isrq0asz929zm6
Tags: 1.0.1e-2ubuntu1
* Resynchronise with Debian unstable.  Remaining changes:
  - debian/libssl1.0.0.postinst:
    + Display a system restart required notification on libssl1.0.0
      upgrade on servers.
    + Use a different priority for libssl1.0.0/restart-services depending
      on whether a desktop, or server dist-upgrade is being performed.
  - debian/{libssl1.0.0-udeb.dirs, control, rules}: Create
    libssl1.0.0-udeb, for the benefit of wget-udeb (no wget-udeb package
    in Debian).
  - debian/{libcrypto1.0.0-udeb.dirs, libssl1.0.0.dirs, libssl1.0.0.files,
    rules}: Move runtime libraries to /lib, for the benefit of
    wpasupplicant.
  - debian/patches/perlpath-quilt.patch: Don't change perl #! paths under
    .pc.
  - debian/rules:
    + Don't run 'make test' when cross-building.
    + Use host compiler when cross-building.  Patch from Neil Williams.
    + Don't build for processors no longer supported: i586 (on i386)
    + Fix Makefile to properly clean up libs/ dirs in clean target.
    + Replace duplicate files in the doc directory with symlinks.
  - Unapply patch c_rehash-multi and comment it out in the series as it
    breaks parsing of certificates with CRLF line endings and other cases
    (see Debian #642314 for discussion), it also changes the semantics of
    c_rehash directories by requiring applications to parse hash link
    targets as files containing potentially *multiple* certificates rather
    than exactly one.
  - debian/patches/tls12_workarounds.patch: Workaround large client hello
    issues when TLS 1.1 and lower is in use
  - debian/control: Mark Debian Vcs-* as XS-Debian-Vcs-*
  - debian/patches/ubuntu_deb676533_arm_asm.patch: Enable arm assembly
    code.
  - debian/patches/arm64-support: Add basic arm64 support (no assembler)
  - debian/rules: Enable optimized 64bit elliptic curve code contributed
    by Google.
* debian/patches/tls12_workarounds.patch: updated to also disable TLS 1.2
  in test suite since we disable it in the client.
* Dropped changes:
  - debian/patches/CVE-2013-0169.patch: upstream.
  - debian/patches/fix_key_decoding_deadlock.patch: upstream.
  - debian/patches/CVE-2013-0166.patch: upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
649
649
                }
650
650
#endif
651
651
 
 
652
#ifndef OPENSSL_NO_SRTP
652
653
        if(SSL_get_srtp_profiles(s))
653
654
                {
654
655
                int el;
667
668
                        }
668
669
                ret += el;
669
670
                }
 
671
#endif
670
672
 
671
673
        if ((extdatalen = ret-p-2)== 0) 
672
674
                return p;
781
783
                }
782
784
#endif
783
785
 
 
786
#ifndef OPENSSL_NO_SRTP
784
787
        if(s->srtp_profile)
785
788
                {
786
789
                int el;
799
802
                        }
800
803
                ret+=el;
801
804
                }
 
805
#endif
802
806
 
803
807
        if (((s->s3->tmp.new_cipher->id & 0xFFFF)==0x80 || (s->s3->tmp.new_cipher->id & 0xFFFF)==0x81) 
804
808
                && (SSL_get_options(s) & SSL_OP_CRYPTOPRO_TLSEXT_BUG))
1077
1081
                        int ellipticcurvelist_length = (*(sdata++) << 8);
1078
1082
                        ellipticcurvelist_length += (*(sdata++));
1079
1083
 
1080
 
                        if (ellipticcurvelist_length != size - 2)
 
1084
                        if (ellipticcurvelist_length != size - 2 ||
 
1085
                                ellipticcurvelist_length < 1)
1081
1086
                                {
1082
1087
                                *al = TLS1_AD_DECODE_ERROR;
1083
1088
                                return 0;
1328
1333
#endif
1329
1334
 
1330
1335
                /* session ticket processed earlier */
 
1336
#ifndef OPENSSL_NO_SRTP
1331
1337
                else if (type == TLSEXT_TYPE_use_srtp)
1332
 
                        {
 
1338
                        {
1333
1339
                        if(ssl_parse_clienthello_use_srtp_ext(s, data, size,
1334
1340
                                                              al))
1335
1341
                                return 0;
1336
 
                        }
 
1342
                        }
 
1343
#endif
1337
1344
 
1338
1345
                data+=size;
1339
1346
                }
1433
1440
                        unsigned char *sdata = data;
1434
1441
                        int ecpointformatlist_length = *(sdata++);
1435
1442
 
1436
 
                        if (ecpointformatlist_length != size - 1)
 
1443
                        if (ecpointformatlist_length != size - 1 || 
 
1444
                                ecpointformatlist_length < 1)
1437
1445
                                {
1438
1446
                                *al = TLS1_AD_DECODE_ERROR;
1439
1447
                                return 0;
1527
1535
                        unsigned char selected_len;
1528
1536
 
1529
1537
                        /* We must have requested it. */
1530
 
                        if ((s->ctx->next_proto_select_cb == NULL))
 
1538
                        if (s->ctx->next_proto_select_cb == NULL)
1531
1539
                                {
1532
1540
                                *al = TLS1_AD_UNSUPPORTED_EXTENSION;
1533
1541
                                return 0;
1577
1585
                                }
1578
1586
                        }
1579
1587
#endif
 
1588
#ifndef OPENSSL_NO_SRTP
1580
1589
                else if (type == TLSEXT_TYPE_use_srtp)
1581
 
                        {
 
1590
                        {
1582
1591
                        if(ssl_parse_serverhello_use_srtp_ext(s, data, size,
1583
1592
                                                              al))
1584
1593
                                return 0;
1585
 
                        }
 
1594
                        }
 
1595
#endif
1586
1596
 
1587
1597
                data+=size;             
1588
1598
                }
1763
1773
        return 1;
1764
1774
        }
1765
1775
 
1766
 
int ssl_check_clienthello_tlsext(SSL *s)
 
1776
int ssl_check_clienthello_tlsext_early(SSL *s)
1767
1777
        {
1768
1778
        int ret=SSL_TLSEXT_ERR_NOACK;
1769
1779
        int al = SSL_AD_UNRECOGNIZED_NAME;
1782
1792
        else if (s->initial_ctx != NULL && s->initial_ctx->tlsext_servername_callback != 0)             
1783
1793
                ret = s->initial_ctx->tlsext_servername_callback(s, &al, s->initial_ctx->tlsext_servername_arg);
1784
1794
 
1785
 
        /* If status request then ask callback what to do.
1786
 
         * Note: this must be called after servername callbacks in case 
1787
 
         * the certificate has changed.
1788
 
         */
1789
 
        if ((s->tlsext_status_type != -1) && s->ctx && s->ctx->tlsext_status_cb)
1790
 
                {
1791
 
                int r;
1792
 
                r = s->ctx->tlsext_status_cb(s, s->ctx->tlsext_status_arg);
1793
 
                switch (r)
1794
 
                        {
1795
 
                        /* We don't want to send a status request response */
1796
 
                        case SSL_TLSEXT_ERR_NOACK:
1797
 
                                s->tlsext_status_expected = 0;
1798
 
                                break;
1799
 
                        /* status request response should be sent */
1800
 
                        case SSL_TLSEXT_ERR_OK:
1801
 
                                if (s->tlsext_ocsp_resp)
1802
 
                                        s->tlsext_status_expected = 1;
1803
 
                                else
1804
 
                                        s->tlsext_status_expected = 0;
1805
 
                                break;
1806
 
                        /* something bad happened */
1807
 
                        case SSL_TLSEXT_ERR_ALERT_FATAL:
1808
 
                                ret = SSL_TLSEXT_ERR_ALERT_FATAL;
1809
 
                                al = SSL_AD_INTERNAL_ERROR;
1810
 
                                goto err;
1811
 
                        }
1812
 
                }
1813
 
        else
1814
 
                s->tlsext_status_expected = 0;
1815
 
 
1816
1795
#ifdef TLSEXT_TYPE_opaque_prf_input
1817
1796
        {
1818
1797
                /* This sort of belongs into ssl_prepare_serverhello_tlsext(),
1819
1798
                 * but we might be sending an alert in response to the client hello,
1820
 
                 * so this has to happen here in ssl_check_clienthello_tlsext(). */
 
1799
                 * so this has to happen here in
 
1800
                 * ssl_check_clienthello_tlsext_early(). */
1821
1801
 
1822
1802
                int r = 1;
1823
1803
        
1869
1849
                        }
1870
1850
        }
1871
1851
 
 
1852
 err:
1872
1853
#endif
1873
 
 err:
1874
1854
        switch (ret)
1875
1855
                {
1876
1856
                case SSL_TLSEXT_ERR_ALERT_FATAL:
1888
1868
                }
1889
1869
        }
1890
1870
 
 
1871
int ssl_check_clienthello_tlsext_late(SSL *s)
 
1872
        {
 
1873
        int ret = SSL_TLSEXT_ERR_OK;
 
1874
        int al;
 
1875
 
 
1876
        /* If status request then ask callback what to do.
 
1877
         * Note: this must be called after servername callbacks in case 
 
1878
         * the certificate has changed, and must be called after the cipher
 
1879
         * has been chosen because this may influence which certificate is sent
 
1880
         */
 
1881
        if ((s->tlsext_status_type != -1) && s->ctx && s->ctx->tlsext_status_cb)
 
1882
                {
 
1883
                int r;
 
1884
                CERT_PKEY *certpkey;
 
1885
                certpkey = ssl_get_server_send_pkey(s);
 
1886
                /* If no certificate can't return certificate status */
 
1887
                if (certpkey == NULL)
 
1888
                        {
 
1889
                        s->tlsext_status_expected = 0;
 
1890
                        return 1;
 
1891
                        }
 
1892
                /* Set current certificate to one we will use so
 
1893
                 * SSL_get_certificate et al can pick it up.
 
1894
                 */
 
1895
                s->cert->key = certpkey;
 
1896
                r = s->ctx->tlsext_status_cb(s, s->ctx->tlsext_status_arg);
 
1897
                switch (r)
 
1898
                        {
 
1899
                        /* We don't want to send a status request response */
 
1900
                        case SSL_TLSEXT_ERR_NOACK:
 
1901
                                s->tlsext_status_expected = 0;
 
1902
                                break;
 
1903
                        /* status request response should be sent */
 
1904
                        case SSL_TLSEXT_ERR_OK:
 
1905
                                if (s->tlsext_ocsp_resp)
 
1906
                                        s->tlsext_status_expected = 1;
 
1907
                                else
 
1908
                                        s->tlsext_status_expected = 0;
 
1909
                                break;
 
1910
                        /* something bad happened */
 
1911
                        case SSL_TLSEXT_ERR_ALERT_FATAL:
 
1912
                                ret = SSL_TLSEXT_ERR_ALERT_FATAL;
 
1913
                                al = SSL_AD_INTERNAL_ERROR;
 
1914
                                goto err;
 
1915
                        }
 
1916
                }
 
1917
        else
 
1918
                s->tlsext_status_expected = 0;
 
1919
 
 
1920
 err:
 
1921
        switch (ret)
 
1922
                {
 
1923
                case SSL_TLSEXT_ERR_ALERT_FATAL:
 
1924
                        ssl3_send_alert(s,SSL3_AL_FATAL,al); 
 
1925
                        return -1;
 
1926
 
 
1927
                case SSL_TLSEXT_ERR_ALERT_WARNING:
 
1928
                        ssl3_send_alert(s,SSL3_AL_WARNING,al);
 
1929
                        return 1; 
 
1930
 
 
1931
                default:
 
1932
                        return 1;
 
1933
                }
 
1934
        }
 
1935
 
1891
1936
int ssl_check_serverhello_tlsext(SSL *s)
1892
1937
        {
1893
1938
        int ret=SSL_TLSEXT_ERR_NOACK;
2414
2459
         */
2415
2460
#ifndef OPENSSL_NO_DSA
2416
2461
        if (!c->pkeys[SSL_PKEY_DSA_SIGN].digest)
2417
 
                c->pkeys[SSL_PKEY_DSA_SIGN].digest = EVP_dss1();
 
2462
                c->pkeys[SSL_PKEY_DSA_SIGN].digest = EVP_sha1();
2418
2463
#endif
2419
2464
#ifndef OPENSSL_NO_RSA
2420
2465
        if (!c->pkeys[SSL_PKEY_RSA_SIGN].digest)
2425
2470
#endif
2426
2471
#ifndef OPENSSL_NO_ECDSA
2427
2472
        if (!c->pkeys[SSL_PKEY_ECC].digest)
2428
 
                c->pkeys[SSL_PKEY_ECC].digest = EVP_ecdsa();
 
2473
                c->pkeys[SSL_PKEY_ECC].digest = EVP_sha1();
2429
2474
#endif
2430
2475
        return 1;
2431
2476
        }