~ubuntu-branches/ubuntu/quantal/curl/quantal-updates

« back to all changes in this revision

Viewing changes to lib/gtls.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-08-20 13:54:01 UTC
  • mfrom: (3.4.30 sid)
  • Revision ID: package-import@ubuntu.com-20120820135401-5845kg6puoh2jcnh
Tags: 7.27.0-1ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Drop dependencies not in main:
    + Build-Depends: Drop stunnel4 and libssh2-1-dev.
    + Drop libssh2-1-dev from binary package Depends.
  - Add new libcurl3-udeb package.
  - Add new curl-udeb package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
413
413
                                              data->set.ssl.CRLfile,
414
414
                                              GNUTLS_X509_FMT_PEM);
415
415
    if(rc < 0) {
416
 
      failf(data, "error reading crl file %s (%s)\n",
 
416
      failf(data, "error reading crl file %s (%s)",
417
417
            data->set.ssl.CRLfile, gnutls_strerror(rc));
418
418
      return CURLE_SSL_CRL_BADFILE;
419
419
    }
1060
1060
  return 0;
1061
1061
}
1062
1062
 
 
1063
void Curl_gtls_random(struct SessionHandle *data,
 
1064
                      unsigned char *entropy,
 
1065
                      size_t length)
 
1066
{
 
1067
#if defined(USE_GNUTLS_NETTLE)
 
1068
  (void)data;
 
1069
  gnutls_rnd(GNUTLS_RND_RANDOM, entropy, length);
 
1070
#elif defined(USE_GNUTLS)
 
1071
  Curl_gtls_seed(data); /* Initiate the seed if not already done */
 
1072
  gcry_randomize(entropy, length, GCRY_STRONG_RANDOM);
 
1073
#endif
 
1074
}
 
1075
 
 
1076
void Curl_gtls_md5sum(unsigned char *tmp, /* input */
 
1077
                      size_t tmplen,
 
1078
                      unsigned char *md5sum, /* output */
 
1079
                      size_t md5len)
 
1080
{
 
1081
#if defined(USE_GNUTLS_NETTLE)
 
1082
  struct md5_ctx MD5pw;
 
1083
  md5_init(&MD5pw);
 
1084
  md5_update(&MD5pw, tmplen, tmp);
 
1085
  md5_digest(&MD5pw, md5len, md5sum);
 
1086
#elif defined(USE_GNUTLS)
 
1087
  gcry_md_hd_t MD5pw;
 
1088
  gcry_md_open(&MD5pw, GCRY_MD_MD5, 0);
 
1089
  gcry_md_write(MD5pw, tmp, tmplen);
 
1090
  memcpy(md5sum, gcry_md_read (MD5pw, 0), md5len);
 
1091
  gcry_md_close(MD5pw);
 
1092
#endif
 
1093
}
 
1094
 
1063
1095
#endif /* USE_GNUTLS */