From: Nikos Mavrogiannopoulos Date: Wed, 24 Oct 2007 20:48:27 +0000 (+0300) Subject: removed unused code. X-Git-Tag: gnutls_2_1_4~19^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=867ffe404fbc7e16a543d2314bca85d613a902ef;p=thirdparty%2Fgnutls.git removed unused code. --- diff --git a/libextra/gnutls_openpgp.c b/libextra/gnutls_openpgp.c index 36b54077b4..4a48114259 100644 --- a/libextra/gnutls_openpgp.c +++ b/libextra/gnutls_openpgp.c @@ -99,144 +99,6 @@ buftou32 (const uint8_t * buf) return a; } - -static int -kbx_blob_new (keybox_blob ** r_ctx) -{ - keybox_blob *c; - - if (!r_ctx) - { - gnutls_assert (); - return GNUTLS_E_INVALID_REQUEST; - } - - c = cdk_calloc (1, sizeof *c); - if (!c) - { - gnutls_assert (); - return GNUTLS_E_MEMORY_ERROR; - } - *r_ctx = c; - - return 0; -} - - -static void -kbx_blob_release (keybox_blob * ctx) -{ - if (!ctx) - return; - cdk_free (ctx->data); - cdk_free (ctx); -} - - -static cdk_keydb_hd_t -kbx_to_keydb (keybox_blob * blob) -{ - cdk_keydb_hd_t db; - cdk_error_t rc; - - if (!blob) - { - gnutls_assert (); - return NULL; - } - - switch (blob->type) - { - case KBX_BLOB_FILE: - rc = cdk_keydb_new_from_file (&db, 0, (const char*)blob->data); - break; - - case KBX_BLOB_DATA: - rc = cdk_keydb_new_from_mem (&db, 0, blob->data, blob->size); - break; - - default: - gnutls_assert (); - db = NULL; - break; - } - - return db; -} - - -/* Extract a keybox blob from the given position. */ -static keybox_blob * -kbx_read_blob (const gnutls_datum_t * keyring, size_t pos) -{ - keybox_blob *blob = NULL; - int rc; - - if (!keyring || !keyring->data || pos > keyring->size) - { - gnutls_assert (); - return NULL; - } - - rc = kbx_blob_new (&blob); - if (rc) - return NULL; - - blob->type = keyring->data[pos]; - if (blob->type != KBX_BLOB_FILE && blob->type != KBX_BLOB_DATA) - { - kbx_blob_release (blob); - return NULL; - } - blob->size = buftou32 (keyring->data + pos + 2); - if (!blob->size) - { - kbx_blob_release (blob); - return NULL; - } - blob->data = cdk_calloc (1, blob->size + 1); - if (!blob->data) - return NULL; - memcpy (blob->data, keyring->data + (pos + 6), blob->size); - blob->data[blob->size] = '\0'; - - return blob; -} - - -/* Creates a keyring blob from raw data - * - * Format: - * 1 octet type - * 1 octet armored - * 4 octet size of blob - * n octets data - */ -static uint8_t * -kbx_data_to_keyring (int type, int enc, const char *data, - size_t size, size_t * r_size) -{ - uint8_t *p = NULL; - - if (!data) - return NULL; - - p = gnutls_malloc (1 + 1 + 4 + size); - if (!p) - return NULL; - p[0] = type; /* type: {keyring,name} */ - p[1] = enc; /* encoded: {plain, armored} */ - p[2] = size >> 24; - p[3] = size >> 16; - p[4] = size >> 8; - p[5] = size; - memcpy (p + 6, data, size); - if (r_size) - *r_size = 6 + size; - return p; -} - - static int openpgp_pk_to_gnutls_cert (gnutls_cert * cert, cdk_pkt_pubkey_t pk) {