diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2002-01-05 18:04:00 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2002-01-05 18:04:00 +0000 |
commit | a21349b7bd4aa45ed9ece6d8ac77735744f46e2d (patch) | |
tree | 27f3dfd4d445c57e5e33881150ea45ae0e02d56b | |
parent | 0fdccd83cca4233548dce581d5f0dc3734ecf050 (diff) | |
download | gnutls-a21349b7bd4aa45ed9ece6d8ac77735744f46e2d.tar.gz |
renamed gnutls_b64_encode() to gnutls_b64_encode_fmt()
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | lib/gnutls_ui.h | 4 | ||||
-rw-r--r-- | lib/x509_b64.c | 124 |
3 files changed, 66 insertions, 66 deletions
@@ -1,8 +1,8 @@ -Version ?.?.? +Version 0.3.2 - Corrected bug which did not allow a client to accept multiple CA names - Added gnutls_fingerprint() - Added gnutls_x509pki_extract_certificate_serial() -- Added gnutls_b64_encode() and gnutls_b64_decode() +- Added gnutls_b64_encode_fmt() and gnutls_b64_decode_fmt() - Corrected behaviour in version advertizing - Updated documentation diff --git a/lib/gnutls_ui.h b/lib/gnutls_ui.h index 237de35d25..9057fec8a1 100644 --- a/lib/gnutls_ui.h +++ b/lib/gnutls_ui.h @@ -89,8 +89,8 @@ int gnutls_x509pki_get_peer_certificate_status( GNUTLS_STATE); #define gnutls_x509pki_client_get_peer_certificate_status gnutls_x509pki_get_peer_certificate_status #define gnutls_x509pki_client_get_peer_certificate_list gnutls_x509pki_get_peer_certificate_list -int gnutls_b64_encode( const char* msg, const gnutls_datum *data, char* result, int* result_size); -int gnutls_b64_decode( const gnutls_datum *b64_data, char* result, int* result_size); +int gnutls_b64_encode_fmt( const char* msg, const gnutls_datum *data, char* result, int* result_size); +int gnutls_b64_decode_fmt( const gnutls_datum *b64_data, char* result, int* result_size); # endif /* LIBGNUTLS_VERSION */ diff --git a/lib/x509_b64.c b/lib/x509_b64.c index 899f57ca3a..ce26b85603 100644 --- a/lib/x509_b64.c +++ b/lib/x509_b64.c @@ -160,38 +160,6 @@ int _gnutls_base64_encode(uint8 * data, int data_size, uint8 ** result) return ret; } -/** - * gnutls_b64_encode - This function will convert DER data to Base64 encoded - * @msg: is a message to be put in the header - * @data: contain the DER data - * @result: the place where base64 data will be copied - * @result_size: holds the size of the result - * - * This function will convert the given data to printable data, using the base64 - * encoding. - * - **/ -int gnutls_b64_encode( const char* msg, const gnutls_datum *data, char* result, int* result_size) { -opaque* ret; -int size; - - size = _gnutls_fbase64_encode( msg, pem_data->data, pem_data->size, &ret); - if (size < 0) - return size; - - if (result==NULL || *result_size < size) { - gnutls_free(ret); - *result_size = size; - return GNUTLS_E_INVALID_REQUEST; - } else { - memcpy( result, ret, size); - gnutls_free(ret); - *result_size = size; - } - - return 0; -} - /* encodes data and puts the result into result (localy alocated) * The result_size is the return value */ @@ -275,6 +243,38 @@ int _gnutls_fbase64_encode(const char *msg, const uint8 * data, int data_size, return ret; } +/** + * gnutls_b64_encode_fmt - This function will convert raw data to Base64 encoded + * @msg: is a message to be put in the header + * @data: contain the raw data + * @result: the place where base64 data will be copied + * @result_size: holds the size of the result + * + * This function will convert the given data to printable data, using the base64 + * encoding. This is the encoding used in PEM messages. + * + **/ +int gnutls_b64_encode_fmt( const char* msg, const gnutls_datum *data, char* result, int* result_size) { +opaque* ret; +int size; + + size = _gnutls_fbase64_encode( msg, data->data, data->size, &ret); + if (size < 0) + return size; + + if (result==NULL || *result_size < size) { + gnutls_free(ret); + *result_size = size; + return GNUTLS_E_INVALID_REQUEST; + } else { + memcpy( result, ret, size); + gnutls_free(ret); + *result_size = size; + } + + return 0; +} + /* decodes data and puts the result into result (localy alocated) * The result_size is the return value @@ -326,36 +326,6 @@ inline static int cpydata(uint8 * data, int data_size, uint8 ** result) return j; } -/** - * gnutls_b64_decode - This function will decode base64 encoded data - * @b64_data: contain the encoded data - * @result: the place where decoded data will be copied - * @result_size: holds the size of the result - * - * This function will decode the given encoded data. - * - **/ -int gnutls_b64_decode( const gnutls_datum *b64_data, char* result, int* result_size) { -opaque* ret; -int size; - - size = _gnutls_fbase64_decode( pem_data->data, pem_data->size, &ret); - if (size < 0) - return size; - - if (result==NULL || *result_size < size) { - gnutls_free(ret); - *result_size = size; - return GNUTLS_E_INVALID_REQUEST; - } else { - memcpy( result, ret, size); - gnutls_free(ret); - *result_size = size; - } - - return 0; -} - /* decodes data and puts the result into result (localy alocated) * The result_size is the return value */ @@ -426,6 +396,36 @@ int _gnutls_fbase64_decode( uint8 * data, int data_size, return ret; } +/** + * gnutls_b64_decode_fmt - This function will decode base64 encoded data + * @b64_data: contain the encoded data + * @result: the place where decoded data will be copied + * @result_size: holds the size of the result + * + * This function will decode the given encoded data. + * + **/ +int gnutls_b64_decode_fmt( const gnutls_datum *b64_data, char* result, int* result_size) { +opaque* ret; +int size; + + size = _gnutls_fbase64_decode( b64_data->data, b64_data->size, &ret); + if (size < 0) + return size; + + if (result==NULL || *result_size < size) { + gnutls_free(ret); + *result_size = size; + return GNUTLS_E_INVALID_REQUEST; + } else { + memcpy( result, ret, size); + gnutls_free(ret); + *result_size = size; + } + + return 0; +} + #ifdef B64_TEST int main() |