gnutls_str.c   gnutls_str.c 
skipping to change at line 540 skipping to change at line 540
} }
/** /**
* gnutls_hex_decode2: * gnutls_hex_decode2:
* @hex_data: contain the encoded data * @hex_data: contain the encoded data
* @result: the result in an allocated string * @result: the result in an allocated string
* *
* This function will decode the given encoded data, using the hex * This function will decode the given encoded data, using the hex
* encoding used by PSK password files. * encoding used by PSK password files.
* *
* Returns: %GNUTLS_E_SHORT_MEMORY_BUFFER if the buffer given is not * Returns: %GNUTLS_E_PARSING_ERROR on invalid hex data, or 0 on success.
* long enough, or 0 on success.
**/ **/
int int
gnutls_hex_decode2(const gnutls_datum_t * hex_data, gnutls_datum_t *result) gnutls_hex_decode2(const gnutls_datum_t * hex_data, gnutls_datum_t *result)
{ {
int ret; int ret;
int size = hex_data_size(hex_data->size); int size = hex_data_size(hex_data->size);
result->data = gnutls_malloc(size); result->data = gnutls_malloc(size);
if (result->data == NULL) { if (result->data == NULL) {
gnutls_assert(); gnutls_assert();
return GNUTLS_E_MEMORY_ERROR; return GNUTLS_E_MEMORY_ERROR;
} }
result->size = size; result->size = size;
ret = hex_decode((char *) hex_data->data, hex_data->size, ret = hex_decode((char *) hex_data->data, hex_data->size,
result->data, result->size); result->data, result->size);
if (ret == 0) { if (ret == 0) {
gnutls_assert(); gnutls_assert();
gnutls_free(result->data); gnutls_free(result->data);
return GNUTLS_E_BASE64_DECODING_ERROR; return GNUTLS_E_PARSING_ERROR;
} }
return 0; return 0;
} }
/** /**
* gnutls_hex_decode: * gnutls_hex_decode:
* @hex_data: contain the encoded data * @hex_data: contain the encoded data
* @result: the place where decoded data will be copied * @result: the place where decoded data will be copied
* @result_size: holds the size of the result * @result_size: holds the size of the result
* *
* This function will decode the given encoded data, using the hex * This function will decode the given encoded data, using the hex
* encoding used by PSK password files. * encoding used by PSK password files.
* *
* Initially @result_size must hold the maximum size available in * Initially @result_size must hold the maximum size available in
* @result, and on return it will contain the number of bytes written. * @result, and on return it will contain the number of bytes written.
* *
* Returns: %GNUTLS_E_SHORT_MEMORY_BUFFER if the buffer given is not * Returns: %GNUTLS_E_SHORT_MEMORY_BUFFER if the buffer given is not
* long enough, or 0 on success. * long enough, %GNUTLS_E_PARSING_ERROR on invalid hex data, or 0 on succ ess.
**/ **/
int int
gnutls_hex_decode(const gnutls_datum_t * hex_data, void *result, gnutls_hex_decode(const gnutls_datum_t * hex_data, void *result,
size_t * result_size) size_t * result_size)
{ {
int ret; int ret;
size_t size = hex_data_size(hex_data->size); size_t size = hex_data_size(hex_data->size);
if (*result_size < size) { if (*result_size < size) {
gnutls_assert(); gnutls_assert();
return GNUTLS_E_SHORT_MEMORY_BUFFER; return GNUTLS_E_SHORT_MEMORY_BUFFER;
} }
ret = hex_decode((char *) hex_data->data, hex_data->size, ret = hex_decode((char *) hex_data->data, hex_data->size,
result, size); result, size);
if (ret == 0) { if (ret == 0) {
return GNUTLS_E_BASE64_DECODING_ERROR; return gnutls_assert_val(GNUTLS_E_PARSING_ERROR);
} }
*result_size = size; *result_size = size;
return 0; return 0;
} }
/** /**
* gnutls_hex_encode: * gnutls_hex_encode:
* @data: contain the raw data * @data: contain the raw data
* @result: the place where hex data will be copied * @result: the place where hex data will be copied
skipping to change at line 632 skipping to change at line 631
int ret; int ret;
size_t size = hex_str_size(data->size); size_t size = hex_str_size(data->size);
if (*result_size < size) { if (*result_size < size) {
gnutls_assert(); gnutls_assert();
return GNUTLS_E_SHORT_MEMORY_BUFFER; return GNUTLS_E_SHORT_MEMORY_BUFFER;
} }
ret = hex_encode(data->data, data->size, result, *result_size); ret = hex_encode(data->data, data->size, result, *result_size);
if (ret == 0) { if (ret == 0) {
return gnutls_assert_val(GNUTLS_E_BASE64_ENCODING_ERROR); return gnutls_assert_val(GNUTLS_E_PARSING_ERROR);
} }
*result_size = size; *result_size = size;
return 0; return 0;
} }
/** /**
* gnutls_hex_encode2: * gnutls_hex_encode2:
* @data: contain the raw data * @data: contain the raw data
skipping to change at line 667 skipping to change at line 666
result->data = gnutls_malloc(size); result->data = gnutls_malloc(size);
if (result->data == NULL) { if (result->data == NULL) {
gnutls_assert(); gnutls_assert();
return GNUTLS_E_MEMORY_ERROR; return GNUTLS_E_MEMORY_ERROR;
} }
ret = hex_encode((char*)data->data, data->size, (char*)result->data, size); ret = hex_encode((char*)data->data, data->size, (char*)result->data, size);
if (ret == 0) { if (ret == 0) {
gnutls_free(result->data); gnutls_free(result->data);
return gnutls_assert_val(GNUTLS_E_BASE64_ENCODING_ERROR); return gnutls_assert_val(GNUTLS_E_PARSING_ERROR);
} }
result->size = size-1; result->size = size-1;
return 0; return 0;
} }
static int static int
hostname_compare_raw(const char *certname, hostname_compare_raw(const char *certname,
size_t certnamesize, const char *hostname) size_t certnamesize, const char *hostname)
 End of changes. 6 change blocks. 
7 lines changed or deleted 6 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/