int gnutls_x509_crt_import(gnutls_x509_crt cert, const gnutls_datum * data,
gnutls_x509_crt_fmt format);
int gnutls_x509_crt_export( gnutls_x509_crt cert,
- gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size);
+ gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size);
int gnutls_x509_crt_get_issuer_dn(gnutls_x509_crt cert, char *buf,
- int *sizeof_buf);
+ size_t *sizeof_buf);
int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt cert,
- const char* oid, int indx, char *buf, int *sizeof_buf);
+ const char* oid, int indx, char *buf, size_t *sizeof_buf);
int gnutls_x509_crt_get_dn(gnutls_x509_crt cert, char *buf,
- int *sizeof_buf);
+ size_t *sizeof_buf);
int gnutls_x509_crt_get_dn_by_oid(gnutls_x509_crt cert,
- const char* oid, int indx, char *buf, int *sizeof_buf);
+ const char* oid, int indx, char *buf, size_t *sizeof_buf);
int gnutls_x509_crt_check_hostname(gnutls_x509_crt cert,
const char *hostname);
int gnutls_x509_crt_get_signature_algorithm(gnutls_x509_crt cert);
int gnutls_x509_crt_get_version(gnutls_x509_crt cert);
int gnutls_x509_crt_get_key_id( gnutls_x509_crt crt, unsigned int flags,
- unsigned char* output_data, int* output_data_size);
+ unsigned char* output_data, size_t* output_data_size);
time_t gnutls_x509_crt_get_activation_time(gnutls_x509_crt cert);
time_t gnutls_x509_crt_get_expiration_time(gnutls_x509_crt cert);
-int gnutls_x509_crt_get_serial(gnutls_x509_crt cert, char* result, int* result_size);
+int gnutls_x509_crt_get_serial(gnutls_x509_crt cert, char* result, size_t* result_size);
int gnutls_x509_crt_get_pk_algorithm( gnutls_x509_crt cert, int* bits);
int gnutls_x509_crt_get_subject_alt_name(gnutls_x509_crt cert,
- int seq, char *ret, int *ret_size, int* critical);
+ int seq, char *ret, size_t *ret_size, int* critical);
int gnutls_x509_crt_get_ca_status(gnutls_x509_crt cert, int* critical);
int gnutls_x509_crt_get_key_usage( gnutls_x509_crt cert, unsigned int* key_usage,
int gnutls_x509_crt_get_extension_by_oid(gnutls_x509_crt cert,
const char* oid, int indx,
- unsigned char* buf, int * sizeof_buf, int * critical);
+ unsigned char* buf, size_t * sizeof_buf, int * critical);
int gnutls_x509_crt_to_xml(gnutls_x509_crt cert, gnutls_datum* res, int detail);
/* RDN handling */
int gnutls_x509_rdn_get(const gnutls_datum * idn,
- char *buf, unsigned int *sizeof_buf);
+ char *buf, size_t *sizeof_buf);
int gnutls_x509_rdn_get_by_oid(const gnutls_datum * idn, const char* oid,
- int indx, char *buf, unsigned int *sizeof_buf);
+ int indx, char *buf, size_t *sizeof_buf);
/* CRL handling functions */
int gnutls_x509_crl_import(gnutls_x509_crl crl, const gnutls_datum * data,
gnutls_x509_crt_fmt format);
int gnutls_x509_crl_export( gnutls_x509_crl crl,
- gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size);
+ gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size);
int gnutls_x509_crl_get_issuer_dn(const gnutls_x509_crl crl,
- char *buf, int *sizeof_buf);
+ char *buf, size_t *sizeof_buf);
int gnutls_x509_crl_get_issuer_dn_by_oid(gnutls_x509_crl crl,
- const char* oid, int indx, char *buf, int *sizeof_buf);
+ const char* oid, int indx, char *buf, size_t *sizeof_buf);
int gnutls_x509_crl_get_signature_algorithm(gnutls_x509_crl crl);
int gnutls_x509_crl_get_version(gnutls_x509_crl crl);
int gnutls_x509_crl_get_certificate_count(gnutls_x509_crl crl);
int gnutls_x509_crl_get_certificate(gnutls_x509_crl crl, int index, unsigned char* serial,
- int* serial_size, time_t* time);
+ size_t* serial_size, time_t* time);
int gnutls_x509_crl_check_issuer( gnutls_x509_crl crl,
gnutls_x509_crt issuer);
int gnutls_pkcs7_import(gnutls_pkcs7 pkcs7, const gnutls_datum * data,
gnutls_x509_crt_fmt format);
int gnutls_pkcs7_export( gnutls_pkcs7 pkcs7,
- gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size);
+ gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size);
int gnutls_pkcs7_get_certificate(gnutls_pkcs7 pkcs7, int indx,
- unsigned char* certificate, int* certificate_size);
+ unsigned char* certificate, size_t* certificate_size);
int gnutls_pkcs7_set_certificate(gnutls_pkcs7 pkcs7,
const gnutls_datum* crt);
int gnutls_pkcs7_get_crl(gnutls_pkcs7 pkcs7,
- int indx, unsigned char* crl, int* crl_size);
+ int indx, unsigned char* crl, size_t* crl_size);
int gnutls_pkcs7_get_crl_count(gnutls_pkcs7 pkcs7);
int gnutls_pkcs7_set_crl(gnutls_pkcs7 pkcs7,
const gnutls_datum* crt);
int gnutls_x509_crt_get_fingerprint(gnutls_x509_crt cert,
gnutls_digest_algorithm algo, char *buf,
- int *sizeof_buf);
+ size_t *sizeof_buf);
/* Private key handling
*/
const gnutls_datum *u);
int gnutls_x509_privkey_get_pk_algorithm( gnutls_x509_privkey key);
int gnutls_x509_privkey_get_key_id( gnutls_x509_privkey key, unsigned int flags,
- unsigned char* output_data, int* output_data_size);
+ unsigned char* output_data, size_t* output_data_size);
int gnutls_x509_privkey_generate( gnutls_x509_privkey key, gnutls_pk_algorithm algo,
int bits, unsigned int flags);
int gnutls_x509_privkey_export( gnutls_x509_privkey key,
- gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size);
+ gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size);
int gnutls_x509_privkey_export_pkcs8( gnutls_x509_privkey key,
gnutls_x509_crt_fmt format, const char* password, unsigned int flags,
- unsigned char* output_data, int* output_data_size);
+ unsigned char* output_data, size_t* output_data_size);
int gnutls_x509_privkey_export_rsa_raw(gnutls_x509_privkey key,
gnutls_datum * m, gnutls_datum *e,
gnutls_datum *d, gnutls_datum *p, gnutls_datum* q,
int gnutls_x509_crq_import(gnutls_x509_crq crq, const gnutls_datum * data,
gnutls_x509_crt_fmt format);
int gnutls_x509_crq_get_dn(gnutls_x509_crq crq, char *buf,
- int *sizeof_buf);
+ size_t *sizeof_buf);
int gnutls_x509_crq_get_dn_by_oid(gnutls_x509_crq crq, const char* oid,
- int indx, char *buf, int *sizeof_buf);
+ int indx, char *buf, size_t *sizeof_buf);
int gnutls_x509_crq_set_dn_by_oid(gnutls_x509_crq crq, const char* oid,
const char *name, int sizeof_name);
int gnutls_x509_crq_set_version(gnutls_x509_crq crq, int version);
int gnutls_x509_crq_set_challenge_password(gnutls_x509_crq crq, const char* pass);
int gnutls_x509_crq_get_challenge_password(gnutls_x509_crq crq,
- const char* pass, int* sizeof_pass);
+ const char* pass, size_t* sizeof_pass);
int gnutls_x509_crq_export( gnutls_x509_crq crq,
- gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size);
+ gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size);
# include <stdarg.h>
#endif
-extern void (*_gnutls_log_func)( int, const char*);
+extern LOG_FUNC _gnutls_log_func;
#define ERROR_ENTRY(desc, name, fatal) \
{ desc, #name, name, fatal}
#include <gnutls_dh.h>
#include "x509/rc2.h"
-typedef void (*LOG_FUNC)( int, const char*);
#define gnutls_log_func LOG_FUNC
/* created by asn1c */
/* STATE (stop) */
+typedef void (*LOG_FUNC)( int, const char*);
/* Pull & Push functions defines:
*/
*/
int _gnutls_x509_export_int( ASN1_TYPE asn1_data,
gnutls_x509_crt_fmt format, char* pem_header,
- int tmp_buf_size, unsigned char* output_data, int* output_data_size)
+ int tmp_buf_size, unsigned char* output_data, size_t* output_data_size)
{
int result;
if (tmp_buf_size == 0) tmp_buf_size = 16*1024;
int _gnutls_x509_export_int( ASN1_TYPE asn1_data,
gnutls_x509_crt_fmt format, char* pem_header,
- int tmp_buf_size, unsigned char* output_data, int* output_data_size);
+ int tmp_buf_size, unsigned char* output_data, size_t* output_data_size);
int _gnutls_x509_read_value( ASN1_TYPE c, const char* root, gnutls_datum *ret, int str);
int _gnutls_x509_write_value( ASN1_TYPE c, const char* root, const gnutls_datum* data, int str);
*
**/
int gnutls_x509_crl_get_issuer_dn(gnutls_x509_crl crl, char *buf,
- int *sizeof_buf)
+ size_t *sizeof_buf)
{
if (sizeof_buf == 0 || crl == NULL) {
return GNUTLS_E_INVALID_REQUEST;
**/
int gnutls_x509_crl_get_issuer_dn_by_oid(gnutls_x509_crl crl,
const char *oid, int indx,
- char *buf, int *sizeof_buf)
+ char *buf, size_t *sizeof_buf)
{
if (sizeof_buf == 0 || crl == NULL) {
return GNUTLS_E_INVALID_REQUEST;
**/
int gnutls_x509_crl_get_certificate(gnutls_x509_crl crl, int index,
unsigned char *serial,
- int *serial_size, time_t * time)
+ size_t *serial_size, time_t * time)
{
int result;
*
**/
int gnutls_x509_crl_export( gnutls_x509_crl crl,
- gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size)
+ gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size)
{
return _gnutls_x509_export_int( crl->crl, format, PEM_CRL, *output_data_size,
output_data, output_data_size);
*
**/
int gnutls_x509_crq_get_dn(gnutls_x509_crq crq, char *buf,
- int *sizeof_buf)
+ size_t *sizeof_buf)
{
if (sizeof_buf == 0 || crq == NULL) {
return GNUTLS_E_INVALID_REQUEST;
*
**/
int gnutls_x509_crq_get_dn_by_oid(gnutls_x509_crq crq, const char* oid,
- int indx, char *buf, int *sizeof_buf)
+ int indx, char *buf, size_t *sizeof_buf)
{
if (sizeof_buf == 0 || crq == NULL) {
return GNUTLS_E_INVALID_REQUEST;
static int parse_attribute(ASN1_TYPE asn1_struct,
const char *attr_name,
const char *given_oid, int indx,
- char *buf, int *sizeof_buf)
+ char *buf, size_t *sizeof_buf)
{
int k1, result;
char tmpbuffer1[64];
*
**/
int gnutls_x509_crq_get_challenge_password(gnutls_x509_crq crq,
- char* pass, int* sizeof_pass)
+ char* pass, size_t* sizeof_pass)
{
return parse_attribute( crq->crq, "certificationRequestInfo.attributes",
"1.2.840.113549.1.9.7", 0, pass, sizeof_pass);
*
**/
int gnutls_x509_crq_export( gnutls_x509_crq crq,
- gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size)
+ gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size)
{
return _gnutls_x509_export_int( crq->crq, format, PEM_CRQ, *output_data_size,
output_data, output_data_size);
typedef struct gnutls_x509_crq_int *gnutls_x509_crq;
int gnutls_x509_crt_get_dn_by_oid(gnutls_x509_crt cert, const char* oid,
- int indx, char *buf, int *sizeof_buf);
+ int indx, char *buf, size_t *sizeof_buf);
int gnutls_x509_crq_init(gnutls_x509_crq * crq);
void gnutls_x509_crq_deinit(gnutls_x509_crq crq);
*
**/
int gnutls_x509_rdn_get(const gnutls_datum * idn,
- char *buf, unsigned int *sizeof_buf)
+ char *buf, size_t *sizeof_buf)
{
int result;
ASN1_TYPE dn = ASN1_TYPE_EMPTY;
*
**/
int gnutls_x509_rdn_get_by_oid(const gnutls_datum * idn, const char* oid, int indx,
- char *buf, unsigned int *sizeof_buf)
+ char *buf, size_t *sizeof_buf)
{
int result;
ASN1_TYPE dn = ASN1_TYPE_EMPTY;
*
**/
int gnutls_pkcs7_get_certificate(gnutls_pkcs7 pkcs7,
- int indx, unsigned char* certificate, int* certificate_size)
+ int indx, unsigned char* certificate, size_t* certificate_size)
{
ASN1_TYPE c2 = ASN1_TYPE_EMPTY;
int result, len;
*
**/
int gnutls_pkcs7_export( gnutls_pkcs7 pkcs7,
- gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size)
+ gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size)
{
return _gnutls_x509_export_int( pkcs7->pkcs7, format, PEM_PKCS7, *output_data_size,
output_data, output_data_size);
*
**/
int gnutls_pkcs7_get_crl(gnutls_pkcs7 pkcs7,
- int indx, unsigned char* crl, int* crl_size)
+ int indx, unsigned char* crl, size_t* crl_size)
{
ASN1_TYPE c2 = ASN1_TYPE_EMPTY;
int result;
int gnutls_pkcs7_import(gnutls_pkcs7 pkcs7, const gnutls_datum * data,
gnutls_x509_crt_fmt format);
int gnutls_pkcs7_get_certificate(gnutls_pkcs7 pkcs7,
- int indx, unsigned char* certificate, int* certificate_size);
+ int indx, unsigned char* certificate, size_t* certificate_size);
int gnutls_pkcs7_get_certificate_count(gnutls_pkcs7 pkcs7);
*
**/
int gnutls_x509_privkey_export( gnutls_x509_privkey key,
- gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size)
+ gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size)
{
char * msg;
*
**/
int gnutls_x509_privkey_get_key_id( gnutls_x509_privkey key, unsigned int flags,
- unsigned char* output_data, int* output_data_size)
+ unsigned char* output_data, size_t* output_data_size)
{
if (key->pk_algorithm == GNUTLS_PK_RSA)
const char *password,
unsigned int flags,
unsigned char *output_data,
- int *output_data_size)
+ size_t *output_data_size)
{
ASN1_TYPE pkcs8_asn, pkey_info;
int ret;
*
**/
int gnutls_x509_crt_get_issuer_dn(gnutls_x509_crt cert, char *buf,
- int *sizeof_buf)
+ size_t *sizeof_buf)
{
if (sizeof_buf == 0 || cert == NULL) {
return GNUTLS_E_INVALID_REQUEST;
*
**/
int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt cert, const char* oid,
- int indx, char *buf, int *sizeof_buf)
+ int indx, char *buf, size_t *sizeof_buf)
{
if (sizeof_buf == 0 || cert == NULL) {
return GNUTLS_E_INVALID_REQUEST;
*
**/
int gnutls_x509_crt_get_dn(gnutls_x509_crt cert, char *buf,
- int *sizeof_buf)
+ size_t *sizeof_buf)
{
if (sizeof_buf == 0 || cert == NULL) {
return GNUTLS_E_INVALID_REQUEST;
*
**/
int gnutls_x509_crt_get_dn_by_oid(gnutls_x509_crt cert, const char* oid,
- int indx, char *buf, int *sizeof_buf)
+ int indx, char *buf, size_t *sizeof_buf)
{
if (sizeof_buf == 0 || cert == NULL) {
return GNUTLS_E_INVALID_REQUEST;
* Returns a negative value in case of an error, and 0 on success.
*
**/
-int gnutls_x509_crt_get_serial(gnutls_x509_crt cert, char* result, int* result_size)
+int gnutls_x509_crt_get_serial(gnutls_x509_crt cert, char* result,
+ size_t* result_size)
{
int ret;
*
**/
int gnutls_x509_crt_get_subject_alt_name(gnutls_x509_crt cert,
- int seq, char *ret, int *ret_size, int *critical)
+ int seq, char *ret, size_t *ret_size, int *critical)
{
int result;
gnutls_datum dnsname;
*
**/
int gnutls_x509_crt_get_extension_by_oid(gnutls_x509_crt cert, const char* oid,
- int indx, unsigned char* buf, int * sizeof_buf, int * critical)
+ int indx, unsigned char* buf, size_t * sizeof_buf, int * critical)
{
int result;
gnutls_datum output;
**/
int gnutls_x509_crt_get_fingerprint(gnutls_x509_crt cert,
gnutls_digest_algorithm algo, char *buf,
- int *sizeof_buf)
+ size_t *sizeof_buf)
{
opaque *cert_buf;
int cert_buf_size;
*
**/
int gnutls_x509_crt_export( gnutls_x509_crt cert,
- gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size)
+ gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size)
{
return _gnutls_x509_export_int( cert->cert, format, "CERTIFICATE", *output_data_size,
output_data, output_data_size);
*
**/
int gnutls_x509_crt_get_key_id( gnutls_x509_crt crt, unsigned int flags,
- unsigned char* output_data, int* output_data_size)
+ unsigned char* output_data, size_t* output_data_size)
{
GNUTLS_MPI params[MAX_PUBLIC_PARAMS_SIZE];
int params_size = MAX_PUBLIC_PARAMS_SIZE;
typedef struct gnutls_x509_privkey_int *gnutls_x509_privkey;
int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt cert, const char* oid,
- int indx, char *buf, int *sizeof_buf);
+ int indx, char *buf, size_t *sizeof_buf);
int gnutls_x509_crt_get_subject_alt_name(gnutls_x509_crt cert,
- int seq, char *ret, int *ret_size, int* critical);
+ int seq, char *ret, size_t *ret_size, int* critical);
int gnutls_x509_crt_get_dn_by_oid(gnutls_x509_crt cert, const char* oid,
- int indx, char *buf, int *sizeof_buf);
+ int indx, char *buf, size_t *sizeof_buf);
int gnutls_x509_crt_get_ca_status(gnutls_x509_crt cert, int* critical);
int gnutls_x509_crt_get_pk_algorithm( gnutls_x509_crt cert, int* bits);
int _gnutls_x509_crt_get_raw_dn( gnutls_x509_crt cert,
gnutls_const_datum* start);
-int gnutls_x509_crt_get_serial(gnutls_x509_crt cert, char* result, int* result_size);
+int gnutls_x509_crt_get_serial(gnutls_x509_crt cert, char* result, size_t* result_size);
int _gnutls_x509_compare_raw_dn(const gnutls_const_datum * dn1,
const gnutls_const_datum * dn2);
int gnutls_x509_crl_get_certificate_count(gnutls_x509_crl crl);
int gnutls_x509_crl_get_certificate(gnutls_x509_crl crl, int index,
unsigned char *serial,
- int *serial_size, time_t * time);
+ size_t *serial_size, time_t * time);
void gnutls_x509_crl_deinit(gnutls_x509_crl crl);
int gnutls_x509_crl_init(gnutls_x509_crl * crl);
int gnutls_x509_crl_import(gnutls_x509_crl crl, const gnutls_datum * data,
gnutls_x509_crt_fmt format);
int gnutls_x509_crl_export( gnutls_x509_crl crl,
- gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size);
+ gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size);
int gnutls_x509_crt_init(gnutls_x509_crt * cert);
void gnutls_x509_crt_deinit(gnutls_x509_crt cert);
int gnutls_x509_crt_import(gnutls_x509_crt cert, const gnutls_datum * data,
gnutls_x509_crt_fmt format);
int gnutls_x509_crt_export( gnutls_x509_crt cert,
- gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size);
+ gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size);
int gnutls_x509_crt_get_key_usage(gnutls_x509_crt cert, unsigned int *key_usage,
int *critical);
gnutls_datum *d, gnutls_datum *p, gnutls_datum* q,
gnutls_datum* u);
int gnutls_x509_privkey_export( gnutls_x509_privkey key,
- gnutls_x509_crt_fmt format, unsigned char* output_data, int* output_data_size);
+ gnutls_x509_crt_fmt format, unsigned char* output_data, size_t* output_data_size);
#endif
#include <gnutls_datum.h>
#include <x509_b64.h>
-static const uint8 b64table[64] =
+static const uint8 b64table[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
static const uint8 asciitable[128] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
/* this a modified base64 for srp !!!
* It seems that everybody makes an own base64 conversion.
*/
-static const uint8 b64table[64] =
+static const uint8 b64table[] =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz./";
static const uint8 asciitable[128] = {