~ubuntu-branches/ubuntu/saucy/gnutls28/saucy

« back to all changes in this revision

Viewing changes to lib/gnutls_datum.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-07-30 21:40:07 UTC
  • mfrom: (14.1.9 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130730214007-9mrd08xo61kla008
Tags: 3.2.3-1ubuntu1
* Sync with Debian (LP: #1068029). Remaining change:
  - Drop gnutls-bin and -doc since we want to use the versions
    in gnutls26 as the defaults instead

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 *
8
8
 * The GnuTLS is free software; you can redistribute it and/or
9
9
 * modify it under the terms of the GNU Lesser General Public License
10
 
 * as published by the Free Software Foundation; either version 3 of
 
10
 * as published by the Free Software Foundation; either version 2.1 of
11
11
 * the License, or (at your option) any later version.
12
12
 *
13
13
 * This library is distributed in the hope that it will be useful, but
30
30
#include <gnutls_datum.h>
31
31
#include <gnutls_errors.h>
32
32
 
33
 
 
34
 
void
35
 
_gnutls_write_datum16 (uint8_t * dest, gnutls_datum_t dat)
36
 
{
37
 
  _gnutls_write_uint16 (dat.size, dest);
38
 
  if (dat.data != NULL)
39
 
    memcpy (&dest[2], dat.data, dat.size);
40
 
}
41
 
 
42
 
void
43
 
_gnutls_write_datum24 (uint8_t * dest, gnutls_datum_t dat)
44
 
{
45
 
  _gnutls_write_uint24 (dat.size, dest);
46
 
  if (dat.data != NULL)
47
 
    memcpy (&dest[3], dat.data, dat.size);
48
 
}
49
 
 
50
 
void
51
 
_gnutls_write_datum32 (uint8_t * dest, gnutls_datum_t dat)
52
 
{
53
 
  _gnutls_write_uint32 (dat.size, dest);
54
 
  if (dat.data != NULL)
55
 
    memcpy (&dest[4], dat.data, dat.size);
56
 
}
57
 
 
58
 
void
59
 
_gnutls_write_datum8 (uint8_t * dest, gnutls_datum_t dat)
60
 
{
61
 
  dest[0] = (uint8_t) dat.size;
62
 
  if (dat.data != NULL)
63
 
    memcpy (&dest[1], dat.data, dat.size);
64
 
}
65
 
 
66
 
 
67
33
int
68
34
_gnutls_set_datum (gnutls_datum_t * dat, const void *data,
69
35
                     size_t data_size)
90
56
                        size_t data_size)
91
57
{
92
58
 
93
 
  dst->data = gnutls_realloc (dst->data, data_size + dst->size);
 
59
  dst->data = gnutls_realloc_fast (dst->data, data_size + dst->size);
94
60
  if (dst->data == NULL)
95
61
    return GNUTLS_E_MEMORY_ERROR;
96
62