Merged adium-1.5.4 into adium-1.6
--- a/Adium.xcodeproj/project.pbxproj Thu Sep 06 00:17:15 2012 +0200
+++ b/Adium.xcodeproj/project.pbxproj Thu Sep 06 21:09:12 2012 +0200
@@ -1363,6 +1363,10 @@
6EC1684F06C170A000F9FAD3 /* DCInviteToChatWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6EC1684A06C170A000F9FAD3 /* DCInviteToChatWindowController.m */; };
6EC1685006C170A000F9FAD3 /* InviteToChatWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6EC1684B06C170A000F9FAD3 /* InviteToChatWindow.xib */; };
766ABAB61306D1020049FFB7 /* AIUnreadMessagesTooltip.m in Sources */ = {isa = PBXBuildFile; fileRef = 766ABAB51306D1020049FFB7 /* AIUnreadMessagesTooltip.m */; };
+ 76731DE215F90538007728C3 /* libgcrypt.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76731DE015F90538007728C3 /* libgcrypt.framework */; }; + 76731DE315F90538007728C3 /* libgpgerror.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76731DE115F90538007728C3 /* libgpgerror.framework */; }; + 76731DE415F9057F007728C3 /* libgcrypt.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 76731DE015F90538007728C3 /* libgcrypt.framework */; }; + 76731DE515F90582007728C3 /* libgpgerror.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 76731DE115F90538007728C3 /* libgpgerror.framework */; }; 76889DEB12D3CA17007AEF00 /* get-info.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 76889DEA12D3CA17007AEF00 /* get-info.tiff */; };
76889DEF12D3CA40007AEF00 /* Personal.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 76889DEE12D3CA40007AEF00 /* Personal.tiff */; };
76C1AF9C125A906A00D269A9 /* AIAdiumURLProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 76C1AF9B125A906A00D269A9 /* AIAdiumURLProtocol.m */; };
@@ -1661,6 +1665,8 @@
11EE1CD50CDD01120097F246 /* libpurple.framework in Copy Frameworks */,
EE5754ED0B3D7A7A00100989 /* Sparkle.framework in Copy Frameworks */,
377ED0220AE95D7D00CB7BDF /* PSMTabBarControl.framework in Copy Frameworks */,
+ 76731DE515F90582007728C3 /* libgpgerror.framework in Copy Frameworks */, + 76731DE415F9057F007728C3 /* libgcrypt.framework in Copy Frameworks */, 9E1E1E270A96770C00E16DFC /* LMX.framework in Copy Frameworks */,
9719C92F1530EE4800217FBE /* FriBidi.framework in Copy Frameworks */,
9719C9301530EE4800217FBE /* ShortcutRecorder.framework in Copy Frameworks */,
@@ -4380,6 +4386,8 @@
6FB330A40C7235BF00B001A8 /* EKEzvOutgoingFileTransfer.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = EKEzvOutgoingFileTransfer.m; path = Plugins/Bonjour/libezv/Classes/EKEzvOutgoingFileTransfer.m; sourceTree = SOURCE_ROOT; };
766ABAB41306D1020049FFB7 /* AIUnreadMessagesTooltip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIUnreadMessagesTooltip.h; path = Source/AIUnreadMessagesTooltip.h; sourceTree = "<group>"; };
766ABAB51306D1020049FFB7 /* AIUnreadMessagesTooltip.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIUnreadMessagesTooltip.m; path = Source/AIUnreadMessagesTooltip.m; sourceTree = "<group>"; };
+ 76731DE015F90538007728C3 /* libgcrypt.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = libgcrypt.framework; path = Frameworks/libgcrypt.framework; sourceTree = "<group>"; }; + 76731DE115F90538007728C3 /* libgpgerror.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = libgpgerror.framework; path = Frameworks/libgpgerror.framework; sourceTree = "<group>"; }; 76889DEA12D3CA17007AEF00 /* get-info.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = "get-info.tiff"; path = "Resources/get-info.tiff"; sourceTree = "<group>"; };
76889DEE12D3CA40007AEF00 /* Personal.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = Personal.tiff; path = Resources/Personal.tiff; sourceTree = "<group>"; };
76C1AF9A125A906A00D269A9 /* AIAdiumURLProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIAdiumURLProtocol.h; path = "Plugins/WebKit Message View/AIAdiumURLProtocol.h"; sourceTree = "<group>"; };
@@ -4767,6 +4775,8 @@
34C846AF101E515900140B4B /* QTKit.framework in Frameworks */,
9719C92C1530EDF700217FBE /* FriBidi.framework in Frameworks */,
9719C92E1530EE0C00217FBE /* ShortcutRecorder.framework in Frameworks */,
+ 76731DE215F90538007728C3 /* libgcrypt.framework in Frameworks */, + 76731DE315F90538007728C3 /* libgpgerror.framework in Frameworks */, runOnlyForDeploymentPostprocessing = 0;
@@ -8131,6 +8141,8 @@
979AA6A914D59EF3008730DF /* Others */ = {
+ 76731DE015F90538007728C3 /* libgcrypt.framework */, + 76731DE115F90538007728C3 /* libgpgerror.framework */, 3496A8E707CE6CA30055BBAB /* AutoHyperlinks.framework.xcodeproj */,
9719C92B1530EDF700217FBE /* FriBidi.framework */,
7E9A8CB2104DEBC400F210CC /* Growl.framework */,
--- a/ChangeLogs/Changes.txt Thu Sep 06 00:17:15 2012 +0200
+++ b/ChangeLogs/Changes.txt Thu Sep 06 21:09:12 2012 +0200
@@ -2,8 +2,10 @@
Version 1.5.4 (XX/XX/XXXX)
* Updated the included Growl SDK to 2.0, adding support for Notification Center on 10.8 if Growl is not installed. (#15867)
+ * Updated libotr to 3.2.1, fixing a security vulnerability. (#16122) * Fixed a problem where accepting a group chat invite on Sametime 8.5.1 would crash Adium. (Jere Krischel and Jonathan Rice) (#16114)
* Limit the tracking of the last seen time to contacts who are on your contact list.
+ * Changed the default tab switching shortcuts for new users to Control-Tab/Control-Shift-Tab, to match Safari. (#16102) Version 1.5.3 (8/12/2012)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libgcrypt.framework/Headers Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,1 @@
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libgcrypt.framework/Resources Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,1 @@
+Versions/1.5.0/Resources \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libgcrypt.framework/Versions/1.5.0/Headers/gcrypt-module.h Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,240 @@
+/* gcrypt-module.h - GNU Cryptographic Library Interface + Copyright (C) 2003, 2007 Free Software Foundation, Inc. + This file is part of Libgcrypt. + Libgcrypt is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + Libgcrypt is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public + License along with this program; if not, see <http://www.gnu.org/licenses/>. + This file contains the necessary declarations/definitions for + working with Libgcrypt modules. +#ifndef _GCRYPT_MODULE_H +#define _GCRYPT_MODULE_H +#if 0 /* keep Emacsens's auto-indent happy */ +/* The interfaces using the module system reserve a certain range of + IDs for application use. These IDs are not valid within Libgcrypt + but Libgcrypt makes sure never to allocate such a module ID. */ +#define GCRY_MODULE_ID_USER 1024 +#define GCRY_MODULE_ID_USER_LAST 4095 +/* This type represents a `module'. */ +typedef struct gcry_module *gcry_module_t; +/* Check that the library fulfills the version requirement. */ +/* Type for the cipher_setkey function. */ +typedef gcry_err_code_t (*gcry_cipher_setkey_t) (void *c, + const unsigned char *key, +/* Type for the cipher_encrypt function. */ +typedef void (*gcry_cipher_encrypt_t) (void *c, + const unsigned char *inbuf); +/* Type for the cipher_decrypt function. */ +typedef void (*gcry_cipher_decrypt_t) (void *c, + const unsigned char *inbuf); +/* Type for the cipher_stencrypt function. */ +typedef void (*gcry_cipher_stencrypt_t) (void *c, + const unsigned char *inbuf, +/* Type for the cipher_stdecrypt function. */ +typedef void (*gcry_cipher_stdecrypt_t) (void *c, + const unsigned char *inbuf, +typedef struct gcry_cipher_oid_spec +} gcry_cipher_oid_spec_t; +/* Module specification structure for ciphers. */ +typedef struct gcry_cipher_spec + gcry_cipher_oid_spec_t *oids; + gcry_cipher_setkey_t setkey; + gcry_cipher_encrypt_t encrypt; + gcry_cipher_decrypt_t decrypt; + gcry_cipher_stencrypt_t stencrypt; + gcry_cipher_stdecrypt_t stdecrypt; +/* Register a new cipher module whose specification can be found in + CIPHER. On success, a new algorithm ID is stored in ALGORITHM_ID + and a pointer representing this module is stored in MODULE. */ +gcry_error_t gcry_cipher_register (gcry_cipher_spec_t *cipher, + /* */ _GCRY_ATTR_INTERNAL; +/* Unregister the cipher identified by MODULE, which must have been + registered with gcry_cipher_register. */ +void gcry_cipher_unregister (gcry_module_t module) + /* */ _GCRY_ATTR_INTERNAL; +/* ********************** */ +/* Type for the pk_generate function. */ +typedef gcry_err_code_t (*gcry_pk_generate_t) (int algo, + gcry_mpi_t **retfactors); +/* Type for the pk_check_secret_key function. */ +typedef gcry_err_code_t (*gcry_pk_check_secret_key_t) (int algo, +/* Type for the pk_encrypt function. */ +typedef gcry_err_code_t (*gcry_pk_encrypt_t) (int algo, +/* Type for the pk_decrypt function. */ +typedef gcry_err_code_t (*gcry_pk_decrypt_t) (int algo, +/* Type for the pk_sign function. */ +typedef gcry_err_code_t (*gcry_pk_sign_t) (int algo, +/* Type for the pk_verify function. */ +typedef gcry_err_code_t (*gcry_pk_verify_t) (int algo, + int (*cmp) (void *, gcry_mpi_t), +/* Type for the pk_get_nbits function. */ +typedef unsigned (*gcry_pk_get_nbits_t) (int algo, gcry_mpi_t *pkey); +/* Module specification structure for message digests. */ +typedef struct gcry_pk_spec + const char *elements_pkey; + const char *elements_skey; + const char *elements_enc; + const char *elements_sig; + const char *elements_grip; + gcry_pk_generate_t generate; + gcry_pk_check_secret_key_t check_secret_key; + gcry_pk_encrypt_t encrypt; + gcry_pk_decrypt_t decrypt; + gcry_pk_verify_t verify; + gcry_pk_get_nbits_t get_nbits; +/* Register a new pubkey module whose specification can be found in + PUBKEY. On success, a new algorithm ID is stored in ALGORITHM_ID + and a pointer representhing this module is stored in MODULE. */ +gcry_error_t gcry_pk_register (gcry_pk_spec_t *pubkey, + unsigned int *algorithm_id, + /* */ _GCRY_ATTR_INTERNAL; +/* Unregister the pubkey identified by ID, which must have been + registered with gcry_pk_register. */ +void gcry_pk_unregister (gcry_module_t module) + /* */ _GCRY_ATTR_INTERNAL; +/* ********************** */ +/* Type for the md_init function. */ +typedef void (*gcry_md_init_t) (void *c); +/* Type for the md_write function. */ +typedef void (*gcry_md_write_t) (void *c, const void *buf, size_t nbytes); +/* Type for the md_final function. */ +typedef void (*gcry_md_final_t) (void *c); +/* Type for the md_read function. */ +typedef unsigned char *(*gcry_md_read_t) (void *c); +typedef struct gcry_md_oid_spec +/* Module specification structure for message digests. */ +typedef struct gcry_md_spec + gcry_md_oid_spec_t *oids; + size_t contextsize; /* allocate this amount of context */ +/* Register a new digest module whose specification can be found in + DIGEST. On success, a new algorithm ID is stored in ALGORITHM_ID + and a pointer representhing this module is stored in MODULE. */ +gcry_error_t gcry_md_register (gcry_md_spec_t *digest, + unsigned int *algorithm_id, + /* */ _GCRY_ATTR_INTERNAL; +/* Unregister the digest identified by ID, which must have been + registered with gcry_digest_register. */ +void gcry_md_unregister (gcry_module_t module) + /* */ _GCRY_ATTR_INTERNAL; +#if 0 /* keep Emacsens's auto-indent happy */ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libgcrypt.framework/Versions/1.5.0/Headers/gcrypt.h Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,1915 @@
+/* gcrypt.h - GNU Cryptographic Library Interface -*- c -*- + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006 + 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + This file is part of Libgcrypt. + Libgcrypt is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + Libgcrypt is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public + License along with this program; if not, see <http://www.gnu.org/licenses/>. + File: src/gcrypt.h. Generated from gcrypt.h.in by configure. */ +#if defined _WIN32 || defined __WIN32__ +# include <sys/socket.h> +# include <sys/select.h> +typedef socklen_t gcry_socklen_t; +/* This is required for error code compatibility. */ +#define _GCRY_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GCRYPT +#if 0 /* (Keep Emacsens' auto-indent happy.) */ +/* The version of this header should match the one of the library. It + should not be used by a program because gcry_check_version() should + return the same version. The purpose of this macro is to let + autoconf (using the AM_PATH_GCRYPT macro) check that this header + matches the installed library. */ +#define GCRYPT_VERSION "1.5.0" +/* Internal: We can't use the convenience macros for the multi + precision integer functions when building this library. */ +#ifdef _GCRYPT_IN_LIBGCRYPT +#ifndef GCRYPT_NO_MPI_MACROS +#define GCRYPT_NO_MPI_MACROS 1 +/* We want to use gcc attributes when possible. Warning: Don't use + these macros in your programs: As indicated by the leading + underscore they are subject to change without notice. */ +#define _GCRY_GCC_VERSION (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100 \ +#if _GCRY_GCC_VERSION >= 30100 +#define _GCRY_GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__)) +#if _GCRY_GCC_VERSION >= 29600 +#define _GCRY_GCC_ATTR_PURE __attribute__ ((__pure__)) +#if _GCRY_GCC_VERSION >= 30200 +#define _GCRY_GCC_ATTR_MALLOC __attribute__ ((__malloc__)) +#ifndef _GCRY_GCC_ATTR_DEPRECATED +#define _GCRY_GCC_ATTR_DEPRECATED +#ifndef _GCRY_GCC_ATTR_PURE +#define _GCRY_GCC_ATTR_PURE +#ifndef _GCRY_GCC_ATTR_MALLOC +#define _GCRY_GCC_ATTR_MALLOC +/* Make up an attribute to mark functions and types as deprecated but + allow internal use by Libgcrypt. */ +#ifdef _GCRYPT_IN_LIBGCRYPT +#define _GCRY_ATTR_INTERNAL +#define _GCRY_ATTR_INTERNAL _GCRY_GCC_ATTR_DEPRECATED +/* Wrappers for the libgpg-error library. */ +typedef gpg_error_t gcry_error_t; +typedef gpg_err_code_t gcry_err_code_t; +typedef gpg_err_source_t gcry_err_source_t; +static GPG_ERR_INLINE gcry_error_t +gcry_err_make (gcry_err_source_t source, gcry_err_code_t code) + return gpg_err_make (source, code); +/* The user can define GPG_ERR_SOURCE_DEFAULT before including this + file to specify a default source for gpg_error. */ +#ifndef GCRY_ERR_SOURCE_DEFAULT +#define GCRY_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_USER_1 +static GPG_ERR_INLINE gcry_error_t +gcry_error (gcry_err_code_t code) + return gcry_err_make (GCRY_ERR_SOURCE_DEFAULT, code); +static GPG_ERR_INLINE gcry_err_code_t +gcry_err_code (gcry_error_t err) + return gpg_err_code (err); +static GPG_ERR_INLINE gcry_err_source_t +gcry_err_source (gcry_error_t err) + return gpg_err_source (err); +/* Return a pointer to a string containing a description of the error + code in the error value ERR. */ +const char *gcry_strerror (gcry_error_t err); +/* Return a pointer to a string containing a description of the error + source in the error value ERR. */ +const char *gcry_strsource (gcry_error_t err); +/* Retrieve the error code for the system error ERR. This returns + GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report +gcry_err_code_t gcry_err_code_from_errno (int err); +/* Retrieve the system error for the error code CODE. This returns 0 + if CODE is not a system error code. */ +int gcry_err_code_to_errno (gcry_err_code_t code); +/* Return an error value with the error source SOURCE and the system +gcry_error_t gcry_err_make_from_errno (gcry_err_source_t source, int err); +/* Return an error value with the system error ERR. */ +gcry_err_code_t gcry_error_from_errno (int err); +/* This enum is deprecated; it is only declared for the sake of + complete API compatibility. */ + _GCRY_THREAD_OPTION_DUMMY + } _GCRY_GCC_ATTR_DEPRECATED; +/* Constants defining the thread model to use. Used with the OPTION + field of the struct gcry_thread_cbs. */ +#define GCRY_THREAD_OPTION_DEFAULT 0 +#define GCRY_THREAD_OPTION_USER 1 +#define GCRY_THREAD_OPTION_PTH 2 +#define GCRY_THREAD_OPTION_PTHREAD 3 +/* The version number encoded in the OPTION field of the struct +#define GCRY_THREAD_OPTION_VERSION 0 +/* Wrapper for struct ath_ops. */ + /* The OPTION field encodes the thread model and the version number + Bits 7 - 0 are used for the thread model + Bits 15 - 8 are used for the version number. + int (*mutex_init) (void **priv); + int (*mutex_destroy) (void **priv); + int (*mutex_lock) (void **priv); + int (*mutex_unlock) (void **priv); + ssize_t (*read) (int fd, void *buf, size_t nbytes); + ssize_t (*write) (int fd, const void *buf, size_t nbytes); + ssize_t (*select) (int nfd, void *rset, void *wset, void *eset, + struct timeval *timeout); + ssize_t (*waitpid) (pid_t pid, int *status, int options); + int (*accept) (int s, void *addr, int *length_ptr); + int (*connect) (int s, void *addr, gcry_socklen_t length); + int (*sendmsg) (int s, const void *msg, int flags); + int (*recvmsg) (int s, void *msg, int flags); + ssize_t (*select) (int nfd, fd_set *rset, fd_set *wset, fd_set *eset, + struct timeval *timeout); + ssize_t (*waitpid) (pid_t pid, int *status, int options); + int (*accept) (int s, struct sockaddr *addr, gcry_socklen_t *length_ptr); + int (*connect) (int s, struct sockaddr *addr, gcry_socklen_t length); + int (*sendmsg) (int s, const struct msghdr *msg, int flags); + int (*recvmsg) (int s, struct msghdr *msg, int flags); +# define _GCRY_THREAD_OPTION_PTH_IMPL_NET \ +static ssize_t gcry_pth_select (int nfd, void *rset, void *wset, \ + void *eset, struct timeval *timeout) \ + { return pth_select (nfd, rset, wset, eset, timeout); } \ +static ssize_t gcry_pth_waitpid (pid_t pid, int *status, int options) \ + { return pth_waitpid (pid, status, options); } \ +static int gcry_pth_accept (int s, void *addr, \ + gcry_socklen_t *length_ptr) \ + { return pth_accept (s, addr, length_ptr); } \ +static int gcry_pth_connect (int s, void *addr, \ + gcry_socklen_t length) \ + { return pth_connect (s, addr, length); } +# define _GCRY_THREAD_OPTION_PTH_IMPL_NET \ +static ssize_t gcry_pth_select (int nfd, fd_set *rset, fd_set *wset, \ + fd_set *eset, struct timeval *timeout) \ + { return pth_select (nfd, rset, wset, eset, timeout); } \ +static ssize_t gcry_pth_waitpid (pid_t pid, int *status, int options) \ + { return pth_waitpid (pid, status, options); } \ +static int gcry_pth_accept (int s, struct sockaddr *addr, \ + gcry_socklen_t *length_ptr) \ + { return pth_accept (s, addr, length_ptr); } \ +static int gcry_pth_connect (int s, struct sockaddr *addr, \ + gcry_socklen_t length) \ + { return pth_connect (s, addr, length); } +#define GCRY_THREAD_OPTION_PTH_IMPL \ +static int gcry_pth_init (void) \ +{ return (pth_init () == FALSE) ? errno : 0; } \ +static int gcry_pth_mutex_init (void **priv) \ + pth_mutex_t *lock = malloc (sizeof (pth_mutex_t)); \ + err = pth_mutex_init (lock); \ +static int gcry_pth_mutex_destroy (void **lock) \ + { /* GNU Pth has no destructor function. */ free (*lock); return 0; } \ +static int gcry_pth_mutex_lock (void **lock) \ + { return ((pth_mutex_acquire (*lock, 0, NULL)) == FALSE) \ +static int gcry_pth_mutex_unlock (void **lock) \ + { return ((pth_mutex_release (*lock)) == FALSE) \ +static ssize_t gcry_pth_read (int fd, void *buf, size_t nbytes) \ + { return pth_read (fd, buf, nbytes); } \ +static ssize_t gcry_pth_write (int fd, const void *buf, size_t nbytes) \ + { return pth_write (fd, buf, nbytes); } \ +_GCRY_THREAD_OPTION_PTH_IMPL_NET \ +/* Note: GNU Pth is missing pth_sendmsg and pth_recvmsg. */ \ +static struct gcry_thread_cbs gcry_threads_pth = { \ + (GCRY_THREAD_OPTION_PTH | (GCRY_THREAD_OPTION_VERSION << 8)), \ + gcry_pth_init, gcry_pth_mutex_init, gcry_pth_mutex_destroy, \ + gcry_pth_mutex_lock, gcry_pth_mutex_unlock, gcry_pth_read, gcry_pth_write, \ + gcry_pth_select, gcry_pth_waitpid, gcry_pth_accept, gcry_pth_connect, \ +#define GCRY_THREAD_OPTION_PTHREAD_IMPL \ +static int gcry_pthread_mutex_init (void **priv) \ + pthread_mutex_t *lock = (pthread_mutex_t*)malloc (sizeof (pthread_mutex_t));\ + err = pthread_mutex_init (lock, NULL); \ +static int gcry_pthread_mutex_destroy (void **lock) \ + { int err = pthread_mutex_destroy ((pthread_mutex_t*)*lock); \ + free (*lock); return err; } \ +static int gcry_pthread_mutex_lock (void **lock) \ + { return pthread_mutex_lock ((pthread_mutex_t*)*lock); } \ +static int gcry_pthread_mutex_unlock (void **lock) \ + { return pthread_mutex_unlock ((pthread_mutex_t*)*lock); } \ +static struct gcry_thread_cbs gcry_threads_pthread = { \ + (GCRY_THREAD_OPTION_PTHREAD | (GCRY_THREAD_OPTION_VERSION << 8)), \ + NULL, gcry_pthread_mutex_init, gcry_pthread_mutex_destroy, \ + gcry_pthread_mutex_lock, gcry_pthread_mutex_unlock, \ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } +/* The data object used to hold a multi precision integer. */ +typedef struct gcry_mpi *gcry_mpi_t; +#ifndef GCRYPT_NO_DEPRECATED +typedef struct gcry_mpi *GCRY_MPI _GCRY_GCC_ATTR_DEPRECATED; +typedef struct gcry_mpi *GcryMPI _GCRY_GCC_ATTR_DEPRECATED; +/* Check that the library fulfills the version requirement. */ +const char *gcry_check_version (const char *req_version); +/* Codes for function dispatchers. */ +/* Codes used with the gcry_control function. */ + GCRYCTL_RESET = 4, /* e.g. for MDs */ + GCRYCTL_GET_KEYLEN = 6, + GCRYCTL_GET_BLKLEN = 7, + GCRYCTL_GET_ASNOID = 10, + GCRYCTL_ENABLE_ALGO = 11, + GCRYCTL_DISABLE_ALGO = 12, + GCRYCTL_DUMP_RANDOM_STATS = 13, + GCRYCTL_DUMP_SECMEM_STATS = 14, + GCRYCTL_GET_ALGO_NPKEY = 15, + GCRYCTL_GET_ALGO_NSKEY = 16, + GCRYCTL_GET_ALGO_NSIGN = 17, + GCRYCTL_GET_ALGO_NENCR = 18, + GCRYCTL_SET_VERBOSITY = 19, + GCRYCTL_SET_DEBUG_FLAGS = 20, + GCRYCTL_CLEAR_DEBUG_FLAGS = 21, + GCRYCTL_USE_SECURE_RNDPOOL= 22, + GCRYCTL_DUMP_MEMORY_STATS = 23, + GCRYCTL_INIT_SECMEM = 24, + GCRYCTL_TERM_SECMEM = 25, + GCRYCTL_DISABLE_SECMEM_WARN = 27, + GCRYCTL_SUSPEND_SECMEM_WARN = 28, + GCRYCTL_RESUME_SECMEM_WARN = 29, + GCRYCTL_DROP_PRIVS = 30, + GCRYCTL_ENABLE_M_GUARD = 31, + GCRYCTL_START_DUMP = 32, + GCRYCTL_STOP_DUMP = 33, + GCRYCTL_GET_ALGO_USAGE = 34, + GCRYCTL_IS_ALGO_ENABLED = 35, + GCRYCTL_DISABLE_INTERNAL_LOCKING = 36, + GCRYCTL_DISABLE_SECMEM = 37, + GCRYCTL_INITIALIZATION_FINISHED = 38, + GCRYCTL_INITIALIZATION_FINISHED_P = 39, + GCRYCTL_ANY_INITIALIZATION_P = 40, + GCRYCTL_SET_CBC_CTS = 41, + GCRYCTL_SET_CBC_MAC = 42, + GCRYCTL_ENABLE_QUICK_RANDOM = 44, + GCRYCTL_SET_RANDOM_SEED_FILE = 45, + GCRYCTL_UPDATE_RANDOM_SEED_FILE = 46, + GCRYCTL_SET_THREAD_CBS = 47, + GCRYCTL_FAST_POLL = 48, + GCRYCTL_SET_RANDOM_DAEMON_SOCKET = 49, + GCRYCTL_USE_RANDOM_DAEMON = 50, + GCRYCTL_FAKED_RANDOM_P = 51, + GCRYCTL_SET_RNDEGD_SOCKET = 52, + GCRYCTL_PRINT_CONFIG = 53, + GCRYCTL_OPERATIONAL_P = 54, + GCRYCTL_FIPS_MODE_P = 55, + GCRYCTL_FORCE_FIPS_MODE = 56, + /* Note: 58 .. 62 are used internally. */ + GCRYCTL_DISABLE_HWF = 63 +/* Perform various operations defined by CMD. */ +gcry_error_t gcry_control (enum gcry_ctl_cmds CMD, ...); +/* S-expression management. */ +/* The object to represent an S-expression as used with the public key +typedef struct gcry_sexp *gcry_sexp_t; +#ifndef GCRYPT_NO_DEPRECATED +typedef struct gcry_sexp *GCRY_SEXP _GCRY_GCC_ATTR_DEPRECATED; +typedef struct gcry_sexp *GcrySexp _GCRY_GCC_ATTR_DEPRECATED; +/* The possible values for the S-expression format. */ + GCRYSEXP_FMT_DEFAULT = 0, + GCRYSEXP_FMT_CANON = 1, + GCRYSEXP_FMT_BASE64 = 2, + GCRYSEXP_FMT_ADVANCED = 3 +/* Create an new S-expression object from BUFFER of size LENGTH and + return it in RETSEXP. With AUTODETECT set to 0 the data in BUFFER + is expected to be in canonized format. */ +gcry_error_t gcry_sexp_new (gcry_sexp_t *retsexp, + const void *buffer, size_t length, + /* Same as gcry_sexp_new but allows to pass a FREEFNC which has the + effect to transfer ownership of BUFFER to the created object. */ +gcry_error_t gcry_sexp_create (gcry_sexp_t *retsexp, + void *buffer, size_t length, + int autodetect, void (*freefnc) (void *)); +/* Scan BUFFER and return a new S-expression object in RETSEXP. This + function expects a printf like string in BUFFER. */ +gcry_error_t gcry_sexp_sscan (gcry_sexp_t *retsexp, size_t *erroff, + const char *buffer, size_t length); +/* Same as gcry_sexp_sscan but expects a string in FORMAT and can thus + only be used for certain encodings. */ +gcry_error_t gcry_sexp_build (gcry_sexp_t *retsexp, size_t *erroff, + const char *format, ...); +/* Like gcry_sexp_build, but uses an array instead of variable +gcry_error_t gcry_sexp_build_array (gcry_sexp_t *retsexp, size_t *erroff, + const char *format, void **arg_list); +/* Release the S-expression object SEXP */ +void gcry_sexp_release (gcry_sexp_t sexp); +/* Calculate the length of an canonized S-expresion in BUFFER and + check for a valid encoding. */ +size_t gcry_sexp_canon_len (const unsigned char *buffer, size_t length, + size_t *erroff, gcry_error_t *errcode); +/* Copies the S-expression object SEXP into BUFFER using the format +size_t gcry_sexp_sprint (gcry_sexp_t sexp, int mode, void *buffer, +/* Dumps the S-expression object A in a format suitable for debugging + to Libgcrypt's logging stream. */ +void gcry_sexp_dump (const gcry_sexp_t a); +gcry_sexp_t gcry_sexp_cons (const gcry_sexp_t a, const gcry_sexp_t b); +gcry_sexp_t gcry_sexp_alist (const gcry_sexp_t *array); +gcry_sexp_t gcry_sexp_vlist (const gcry_sexp_t a, ...); +gcry_sexp_t gcry_sexp_append (const gcry_sexp_t a, const gcry_sexp_t n); +gcry_sexp_t gcry_sexp_prepend (const gcry_sexp_t a, const gcry_sexp_t n); +/* Scan the S-expression for a sublist with a type (the car of the + list) matching the string TOKEN. If TOKLEN is not 0, the token is + assumed to be raw memory of this length. The function returns a + newly allocated S-expression consisting of the found sublist or + `NULL' when not found. */ +gcry_sexp_t gcry_sexp_find_token (gcry_sexp_t list, + const char *tok, size_t toklen); +/* Return the length of the LIST. For a valid S-expression this + should be at least 1. */ +int gcry_sexp_length (const gcry_sexp_t list); +/* Create and return a new S-expression from the element with index + NUMBER in LIST. Note that the first element has the index 0. If + there is no such element, `NULL' is returned. */ +gcry_sexp_t gcry_sexp_nth (const gcry_sexp_t list, int number); +/* Create and return a new S-expression from the first element in + LIST; this called the "type" and should always exist and be a + string. `NULL' is returned in case of a problem. */ +gcry_sexp_t gcry_sexp_car (const gcry_sexp_t list); +/* Create and return a new list form all elements except for the first + one. Note, that this function may return an invalid S-expression + because it is not guaranteed, that the type exists and is a string. + However, for parsing a complex S-expression it might be useful for + intermediate lists. Returns `NULL' on error. */ +gcry_sexp_t gcry_sexp_cdr (const gcry_sexp_t list); +gcry_sexp_t gcry_sexp_cadr (const gcry_sexp_t list); +/* This function is used to get data from a LIST. A pointer to the + actual data with index NUMBER is returned and the length of this + data will be stored to DATALEN. If there is no data at the given + index or the index represents another list, `NULL' is returned. + *Note:* The returned pointer is valid as long as LIST is not + modified or released. */ +const char *gcry_sexp_nth_data (const gcry_sexp_t list, int number, +/* This function is used to get and convert data from a LIST. The + data is assumed to be a Nul terminated string. The caller must + release the returned value using `gcry_free'. If there is no data + at the given index, the index represents a list or the value can't + be converted to a string, `NULL' is returned. */ +char *gcry_sexp_nth_string (gcry_sexp_t list, int number); +/* This function is used to get and convert data from a LIST. This + data is assumed to be an MPI stored in the format described by + MPIFMT and returned as a standard Libgcrypt MPI. The caller must + release this returned value using `gcry_mpi_release'. If there is + no data at the given index, the index represents a list or the + value can't be converted to an MPI, `NULL' is returned. */ +gcry_mpi_t gcry_sexp_nth_mpi (gcry_sexp_t list, int number, int mpifmt); +/******************************************* + * Multi Precision Integer Functions * + *******************************************/ +/* Different formats of external big integer representation. */ + GCRYMPI_FMT_STD = 1, /* Twos complement stored without length. */ + GCRYMPI_FMT_PGP = 2, /* As used by OpenPGP (unsigned only). */ + GCRYMPI_FMT_SSH = 3, /* As used by SSH (like STD but with length). */ + GCRYMPI_FMT_HEX = 4, /* Hex format. */ + GCRYMPI_FMT_USG = 5 /* Like STD but unsigned. */ +/* Flags used for creating big integers. */ + GCRYMPI_FLAG_SECURE = 1, /* Allocate the number in "secure" memory. */ + GCRYMPI_FLAG_OPAQUE = 2 /* The number is not a real one but just + a way to store some bytes. This is + useful for encrypted big integers. */ +/* Allocate a new big integer object, initialize it with 0 and + initially allocate memory for a number of at least NBITS. */ +gcry_mpi_t gcry_mpi_new (unsigned int nbits); +/* Same as gcry_mpi_new() but allocate in "secure" memory. */ +gcry_mpi_t gcry_mpi_snew (unsigned int nbits); +/* Release the number A and free all associated resources. */ +void gcry_mpi_release (gcry_mpi_t a); +/* Create a new number with the same value as A. */ +gcry_mpi_t gcry_mpi_copy (const gcry_mpi_t a); +/* Store the big integer value U in W. */ +gcry_mpi_t gcry_mpi_set (gcry_mpi_t w, const gcry_mpi_t u); +/* Store the unsigned integer value U in W. */ +gcry_mpi_t gcry_mpi_set_ui (gcry_mpi_t w, unsigned long u); +/* Swap the values of A and B. */ +void gcry_mpi_swap (gcry_mpi_t a, gcry_mpi_t b); +/* Compare the big integer number U and V returning 0 for equality, a + positive value for U > V and a negative for U < V. */ +int gcry_mpi_cmp (const gcry_mpi_t u, const gcry_mpi_t v); +/* Compare the big integer number U with the unsigned integer V + returning 0 for equality, a positive value for U > V and a negative +int gcry_mpi_cmp_ui (const gcry_mpi_t u, unsigned long v); +/* Convert the external representation of an integer stored in BUFFER + with a length of BUFLEN into a newly create MPI returned in + RET_MPI. If NSCANNED is not NULL, it will receive the number of + bytes actually scanned after a successful operation. */ +gcry_error_t gcry_mpi_scan (gcry_mpi_t *ret_mpi, enum gcry_mpi_format format, + const void *buffer, size_t buflen, +/* Convert the big integer A into the external representation + described by FORMAT and store it in the provided BUFFER which has + been allocated by the user with a size of BUFLEN bytes. NWRITTEN + receives the actual length of the external representation unless it + has been passed as NULL. */ +gcry_error_t gcry_mpi_print (enum gcry_mpi_format format, + unsigned char *buffer, size_t buflen, +/* Convert the big integer A int the external representation described + by FORMAT and store it in a newly allocated buffer which address + will be put into BUFFER. NWRITTEN receives the actual lengths of the + external representation. */ +gcry_error_t gcry_mpi_aprint (enum gcry_mpi_format format, + unsigned char **buffer, size_t *nwritten, +/* Dump the value of A in a format suitable for debugging to + Libgcrypt's logging stream. Note that one leading space but no + trailing space or linefeed will be printed. It is okay to pass +void gcry_mpi_dump (const gcry_mpi_t a); +void gcry_mpi_add (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v); +/* W = U + V. V is an unsigned integer. */ +void gcry_mpi_add_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v); +void gcry_mpi_addm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m); +void gcry_mpi_sub (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v); +/* W = U - V. V is an unsigned integer. */ +void gcry_mpi_sub_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v ); +void gcry_mpi_subm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m); +void gcry_mpi_mul (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v); +/* W = U * V. V is an unsigned integer. */ +void gcry_mpi_mul_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v ); +void gcry_mpi_mulm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m); +/* W = U * (2 ^ CNT). */ +void gcry_mpi_mul_2exp (gcry_mpi_t w, gcry_mpi_t u, unsigned long cnt); +/* Q = DIVIDEND / DIVISOR, R = DIVIDEND % DIVISOR, + Q or R may be passed as NULL. ROUND should be negative or 0. */ +void gcry_mpi_div (gcry_mpi_t q, gcry_mpi_t r, + gcry_mpi_t dividend, gcry_mpi_t divisor, int round); +/* R = DIVIDEND % DIVISOR */ +void gcry_mpi_mod (gcry_mpi_t r, gcry_mpi_t dividend, gcry_mpi_t divisor); +void gcry_mpi_powm (gcry_mpi_t w, + const gcry_mpi_t b, const gcry_mpi_t e, +/* Set G to the greatest common divisor of A and B. + Return true if the G is 1. */ +int gcry_mpi_gcd (gcry_mpi_t g, gcry_mpi_t a, gcry_mpi_t b); +/* Set X to the multiplicative inverse of A mod M. + Return true if the value exists. */ +int gcry_mpi_invm (gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t m); +/* Return the number of bits required to represent A. */ +unsigned int gcry_mpi_get_nbits (gcry_mpi_t a); +/* Return true when bit number N (counting from 0) is set in A. */ +int gcry_mpi_test_bit (gcry_mpi_t a, unsigned int n); +/* Set bit number N in A. */ +void gcry_mpi_set_bit (gcry_mpi_t a, unsigned int n); +/* Clear bit number N in A. */ +void gcry_mpi_clear_bit (gcry_mpi_t a, unsigned int n); +/* Set bit number N in A and clear all bits greater than N. */ +void gcry_mpi_set_highbit (gcry_mpi_t a, unsigned int n); +/* Clear bit number N in A and all bits greater than N. */ +void gcry_mpi_clear_highbit (gcry_mpi_t a, unsigned int n); +/* Shift the value of A by N bits to the right and store the result in X. */ +void gcry_mpi_rshift (gcry_mpi_t x, gcry_mpi_t a, unsigned int n); +/* Shift the value of A by N bits to the left and store the result in X. */ +void gcry_mpi_lshift (gcry_mpi_t x, gcry_mpi_t a, unsigned int n); +/* Store NBITS of the value P points to in A and mark A as an opaque + value. WARNING: Never use an opaque MPI for anything thing else then + gcry_mpi_release, gcry_mpi_get_opaque. */ +gcry_mpi_t gcry_mpi_set_opaque (gcry_mpi_t a, void *p, unsigned int nbits); +/* Return a pointer to an opaque value stored in A and return its size + in NBITS. Note that the returned pointer is still owned by A and + that the function should never be used for an non-opaque MPI. */ +void *gcry_mpi_get_opaque (gcry_mpi_t a, unsigned int *nbits); +/* Set the FLAG for the big integer A. Currently only the flag + GCRYMPI_FLAG_SECURE is allowed to convert A into an big intger + stored in "secure" memory. */ +void gcry_mpi_set_flag (gcry_mpi_t a, enum gcry_mpi_flag flag); +/* Clear FLAG for the big integer A. Note that this function is + currently useless as no flags are allowed. */ +void gcry_mpi_clear_flag (gcry_mpi_t a, enum gcry_mpi_flag flag); +/* Return true when the FLAG is set for A. */ +int gcry_mpi_get_flag (gcry_mpi_t a, enum gcry_mpi_flag flag); +/* Unless the GCRYPT_NO_MPI_MACROS is used, provide a couple of + convenience macros for the big integer functions. */ +#ifndef GCRYPT_NO_MPI_MACROS +#define mpi_new(n) gcry_mpi_new( (n) ) +#define mpi_secure_new( n ) gcry_mpi_snew( (n) ) +#define mpi_release(a) \ + gcry_mpi_release ((a)); \ +#define mpi_copy( a ) gcry_mpi_copy( (a) ) +#define mpi_set( w, u) gcry_mpi_set( (w), (u) ) +#define mpi_set_ui( w, u) gcry_mpi_set_ui( (w), (u) ) +#define mpi_cmp( u, v ) gcry_mpi_cmp( (u), (v) ) +#define mpi_cmp_ui( u, v ) gcry_mpi_cmp_ui( (u), (v) ) +#define mpi_add_ui(w,u,v) gcry_mpi_add_ui((w),(u),(v)) +#define mpi_add(w,u,v) gcry_mpi_add ((w),(u),(v)) +#define mpi_addm(w,u,v,m) gcry_mpi_addm ((w),(u),(v),(m)) +#define mpi_sub_ui(w,u,v) gcry_mpi_sub_ui ((w),(u),(v)) +#define mpi_sub(w,u,v) gcry_mpi_sub ((w),(u),(v)) +#define mpi_subm(w,u,v,m) gcry_mpi_subm ((w),(u),(v),(m)) +#define mpi_mul_ui(w,u,v) gcry_mpi_mul_ui ((w),(u),(v)) +#define mpi_mul_2exp(w,u,v) gcry_mpi_mul_2exp ((w),(u),(v)) +#define mpi_mul(w,u,v) gcry_mpi_mul ((w),(u),(v)) +#define mpi_mulm(w,u,v,m) gcry_mpi_mulm ((w),(u),(v),(m)) +#define mpi_powm(w,b,e,m) gcry_mpi_powm ( (w), (b), (e), (m) ) +#define mpi_tdiv(q,r,a,m) gcry_mpi_div ( (q), (r), (a), (m), 0) +#define mpi_fdiv(q,r,a,m) gcry_mpi_div ( (q), (r), (a), (m), -1) +#define mpi_mod(r,a,m) gcry_mpi_mod ((r), (a), (m)) +#define mpi_gcd(g,a,b) gcry_mpi_gcd ( (g), (a), (b) ) +#define mpi_invm(g,a,b) gcry_mpi_invm ( (g), (a), (b) ) +#define mpi_get_nbits(a) gcry_mpi_get_nbits ((a)) +#define mpi_test_bit(a,b) gcry_mpi_test_bit ((a),(b)) +#define mpi_set_bit(a,b) gcry_mpi_set_bit ((a),(b)) +#define mpi_set_highbit(a,b) gcry_mpi_set_highbit ((a),(b)) +#define mpi_clear_bit(a,b) gcry_mpi_clear_bit ((a),(b)) +#define mpi_clear_highbit(a,b) gcry_mpi_clear_highbit ((a),(b)) +#define mpi_rshift(a,b,c) gcry_mpi_rshift ((a),(b),(c)) +#define mpi_lshift(a,b,c) gcry_mpi_lshift ((a),(b),(c)) +#define mpi_set_opaque(a,b,c) gcry_mpi_set_opaque( (a), (b), (c) ) +#define mpi_get_opaque(a,b) gcry_mpi_get_opaque( (a), (b) ) +#endif /* GCRYPT_NO_MPI_MACROS */ +/************************************ + * Symmetric Cipher Functions * + ************************************/ +/* The data object used to hold a handle to an encryption object. */ +struct gcry_cipher_handle; +typedef struct gcry_cipher_handle *gcry_cipher_hd_t; +#ifndef GCRYPT_NO_DEPRECATED +typedef struct gcry_cipher_handle *GCRY_CIPHER_HD _GCRY_GCC_ATTR_DEPRECATED; +typedef struct gcry_cipher_handle *GcryCipherHd _GCRY_GCC_ATTR_DEPRECATED; +/* All symmetric encryption algorithms are identified by their IDs. + More IDs may be registered at runtime. */ + GCRY_CIPHER_BLOWFISH = 4, + GCRY_CIPHER_SAFER_SK128 = 5, + GCRY_CIPHER_DES_SK = 6, + GCRY_CIPHER_AES192 = 8, + GCRY_CIPHER_AES256 = 9, + GCRY_CIPHER_TWOFISH = 10, + /* Other cipher numbers are above 300 for OpenPGP reasons. */ + GCRY_CIPHER_ARCFOUR = 301, /* Fully compatible with RSA's RC4 (tm). */ + GCRY_CIPHER_DES = 302, /* Yes, this is single key 56 bit DES. */ + GCRY_CIPHER_TWOFISH128 = 303, + GCRY_CIPHER_SERPENT128 = 304, + GCRY_CIPHER_SERPENT192 = 305, + GCRY_CIPHER_SERPENT256 = 306, + GCRY_CIPHER_RFC2268_40 = 307, /* Ron's Cipher 2 (40 bit). */ + GCRY_CIPHER_RFC2268_128 = 308, /* Ron's Cipher 2 (128 bit). */ + GCRY_CIPHER_SEED = 309, /* 128 bit cipher described in RFC4269. */ + GCRY_CIPHER_CAMELLIA128 = 310, + GCRY_CIPHER_CAMELLIA192 = 311, + GCRY_CIPHER_CAMELLIA256 = 312 +/* The Rijndael algorithm is basically AES, so provide some macros. */ +#define GCRY_CIPHER_AES128 GCRY_CIPHER_AES +#define GCRY_CIPHER_RIJNDAEL GCRY_CIPHER_AES +#define GCRY_CIPHER_RIJNDAEL128 GCRY_CIPHER_AES128 +#define GCRY_CIPHER_RIJNDAEL192 GCRY_CIPHER_AES192 +#define GCRY_CIPHER_RIJNDAEL256 GCRY_CIPHER_AES256 +/* The supported encryption modes. Note that not all of them are + supported for each algorithm. */ + GCRY_CIPHER_MODE_NONE = 0, /* Not yet specified. */ + GCRY_CIPHER_MODE_ECB = 1, /* Electronic codebook. */ + GCRY_CIPHER_MODE_CFB = 2, /* Cipher feedback. */ + GCRY_CIPHER_MODE_CBC = 3, /* Cipher block chaining. */ + GCRY_CIPHER_MODE_STREAM = 4, /* Used with stream ciphers. */ + GCRY_CIPHER_MODE_OFB = 5, /* Outer feedback. */ + GCRY_CIPHER_MODE_CTR = 6, /* Counter. */ + GCRY_CIPHER_MODE_AESWRAP= 7 /* AES-WRAP algorithm. */ +/* Flags used with the open function. */ + GCRY_CIPHER_SECURE = 1, /* Allocate in secure memory. */ + GCRY_CIPHER_ENABLE_SYNC = 2, /* Enable CFB sync mode. */ + GCRY_CIPHER_CBC_CTS = 4, /* Enable CBC cipher text stealing (CTS). */ + GCRY_CIPHER_CBC_MAC = 8 /* Enable CBC message auth. code (MAC). */ +/* Create a handle for algorithm ALGO to be used in MODE. FLAGS may + be given as an bitwise OR of the gcry_cipher_flags values. */ +gcry_error_t gcry_cipher_open (gcry_cipher_hd_t *handle, + int algo, int mode, unsigned int flags); +/* Close the cioher handle H and release all resource. */ +void gcry_cipher_close (gcry_cipher_hd_t h); +/* Perform various operations on the cipher object H. */ +gcry_error_t gcry_cipher_ctl (gcry_cipher_hd_t h, int cmd, void *buffer, +/* Retrieve various information about the cipher object H. */ +gcry_error_t gcry_cipher_info (gcry_cipher_hd_t h, int what, void *buffer, +/* Retrieve various information about the cipher algorithm ALGO. */ +gcry_error_t gcry_cipher_algo_info (int algo, int what, void *buffer, +/* Map the cipher algorithm whose ID is contained in ALGORITHM to a + string representation of the algorithm name. For unknown algorithm + IDs this function returns "?". */ +const char *gcry_cipher_algo_name (int algorithm) _GCRY_GCC_ATTR_PURE; +/* Map the algorithm name NAME to an cipher algorithm ID. Return 0 if + the algorithm name is not known. */ +int gcry_cipher_map_name (const char *name) _GCRY_GCC_ATTR_PURE; +/* Given an ASN.1 object identifier in standard IETF dotted decimal + format in STRING, return the encryption mode associated with that + OID or 0 if not known or applicable. */ +int gcry_cipher_mode_from_oid (const char *string) _GCRY_GCC_ATTR_PURE; +/* Encrypt the plaintext of size INLEN in IN using the cipher handle H + into the buffer OUT which has an allocated length of OUTSIZE. For + most algorithms it is possible to pass NULL for in and 0 for INLEN + and do a in-place decryption of the data provided in OUT. */ +gcry_error_t gcry_cipher_encrypt (gcry_cipher_hd_t h, + void *out, size_t outsize, + const void *in, size_t inlen); +/* The counterpart to gcry_cipher_encrypt. */ +gcry_error_t gcry_cipher_decrypt (gcry_cipher_hd_t h, + void *out, size_t outsize, + const void *in, size_t inlen); +/* Set KEY of length KEYLEN bytes for the cipher handle HD. */ +gcry_error_t gcry_cipher_setkey (gcry_cipher_hd_t hd, + const void *key, size_t keylen); +/* Set initialization vector IV of length IVLEN for the cipher handle HD. */ +gcry_error_t gcry_cipher_setiv (gcry_cipher_hd_t hd, + const void *iv, size_t ivlen); +/* Reset the handle to the state after open. */ +#define gcry_cipher_reset(h) gcry_cipher_ctl ((h), GCRYCTL_RESET, NULL, 0) +/* Perform the OpenPGP sync operation if this is enabled for the +#define gcry_cipher_sync(h) gcry_cipher_ctl( (h), GCRYCTL_CFB_SYNC, NULL, 0) +/* Enable or disable CTS in future calls to gcry_encrypt(). CBC mode only. */ +#define gcry_cipher_cts(h,on) gcry_cipher_ctl( (h), GCRYCTL_SET_CBC_CTS, \ +/* Set counter for CTR mode. (CTR,CTRLEN) must denote a buffer of + block size length, or (NULL,0) to set the CTR to the all-zero block. */ +gpg_error_t gcry_cipher_setctr (gcry_cipher_hd_t hd, + const void *ctr, size_t ctrlen); +/* Retrieved the key length in bytes used with algorithm A. */ +size_t gcry_cipher_get_algo_keylen (int algo); +/* Retrieve the block length in bytes used with algorithm A. */ +size_t gcry_cipher_get_algo_blklen (int algo); +/* Return 0 if the algorithm A is available for use. */ +#define gcry_cipher_test_algo(a) \ + gcry_cipher_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL ) +/* Get a list consisting of the IDs of the loaded cipher modules. If + LIST is zero, write the number of loaded cipher modules to + LIST_LENGTH and return. If LIST is non-zero, the first + *LIST_LENGTH algorithm IDs are stored in LIST, which must be of + according size. In case there are less cipher modules than + *LIST_LENGTH, *LIST_LENGTH is updated to the correct number. */ +gcry_error_t gcry_cipher_list (int *list, int *list_length); +/************************************ + * Asymmetric Cipher Functions * + ************************************/ +/* The algorithms and their IDs we support. */ + GCRY_PK_RSA_E = 2, /* (deprecated) */ + GCRY_PK_RSA_S = 3, /* (deprecated) */ +/* Flags describing usage capabilities of a PK algorithm. */ +#define GCRY_PK_USAGE_SIGN 1 /* Good for signatures. */ +#define GCRY_PK_USAGE_ENCR 2 /* Good for encryption. */ +#define GCRY_PK_USAGE_CERT 4 /* Good to certify other keys. */ +#define GCRY_PK_USAGE_AUTH 8 /* Good for authentication. */ +#define GCRY_PK_USAGE_UNKN 128 /* Unknown usage flag. */ +/* Encrypt the DATA using the public key PKEY and store the result as + a newly created S-expression at RESULT. */ +gcry_error_t gcry_pk_encrypt (gcry_sexp_t *result, + gcry_sexp_t data, gcry_sexp_t pkey); +/* Decrypt the DATA using the private key SKEY and store the result as + a newly created S-expression at RESULT. */ +gcry_error_t gcry_pk_decrypt (gcry_sexp_t *result, + gcry_sexp_t data, gcry_sexp_t skey); +/* Sign the DATA using the private key SKEY and store the result as + a newly created S-expression at RESULT. */ +gcry_error_t gcry_pk_sign (gcry_sexp_t *result, + gcry_sexp_t data, gcry_sexp_t skey); +/* Check the signature SIGVAL on DATA using the public key PKEY. */ +gcry_error_t gcry_pk_verify (gcry_sexp_t sigval, + gcry_sexp_t data, gcry_sexp_t pkey); +/* Check that private KEY is sane. */ +gcry_error_t gcry_pk_testkey (gcry_sexp_t key); +/* Generate a new key pair according to the parameters given in + S_PARMS. The new key pair is returned in as an S-expression in +gcry_error_t gcry_pk_genkey (gcry_sexp_t *r_key, gcry_sexp_t s_parms); +/* Catch all function for miscellaneous operations. */ +gcry_error_t gcry_pk_ctl (int cmd, void *buffer, size_t buflen); +/* Retrieve information about the public key algorithm ALGO. */ +gcry_error_t gcry_pk_algo_info (int algo, int what, + void *buffer, size_t *nbytes); +/* Map the public key algorithm whose ID is contained in ALGORITHM to + a string representation of the algorithm name. For unknown + algorithm IDs this functions returns "?". */ +const char *gcry_pk_algo_name (int algorithm) _GCRY_GCC_ATTR_PURE; +/* Map the algorithm NAME to a public key algorithm Id. Return 0 if + the algorithm name is not known. */ +int gcry_pk_map_name (const char* name) _GCRY_GCC_ATTR_PURE; +/* Return what is commonly referred as the key length for the given + public or private KEY. */ +unsigned int gcry_pk_get_nbits (gcry_sexp_t key) _GCRY_GCC_ATTR_PURE; +/* Please note that keygrip is still experimental and should not be + used without contacting the author. */ +unsigned char *gcry_pk_get_keygrip (gcry_sexp_t key, unsigned char *array); +/* Return the name of the curve matching KEY. */ +const char *gcry_pk_get_curve (gcry_sexp_t key, int iterator, + unsigned int *r_nbits); +/* Return an S-expression with the parameters of the named ECC curve + NAME. ALGO must be set to an ECC algorithm. */ +gcry_sexp_t gcry_pk_get_param (int algo, const char *name); +/* Return 0 if the public key algorithm A is available for use. */ +#define gcry_pk_test_algo(a) \ + gcry_pk_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL ) +/* Get a list consisting of the IDs of the loaded pubkey modules. If + LIST is zero, write the number of loaded pubkey modules to + LIST_LENGTH and return. If LIST is non-zero, the first + *LIST_LENGTH algorithm IDs are stored in LIST, which must be of + according size. In case there are less pubkey modules than + *LIST_LENGTH, *LIST_LENGTH is updated to the correct number. */ +gcry_error_t gcry_pk_list (int *list, int *list_length); +/************************************ + * Cryptograhic Hash Functions * + ************************************/ +/* Algorithm IDs for the hash functions we know about. Not all of them + GCRY_MD_TIGER = 6, /* TIGER/192 as used by gpg <= 1.3.2. */ + GCRY_MD_HAVAL = 7, /* HAVAL, 5 pass, 160 bit. */ + GCRY_MD_CRC32_RFC1510 = 303, + GCRY_MD_CRC24_RFC2440 = 304, + GCRY_MD_WHIRLPOOL = 305, + GCRY_MD_TIGER1 = 306, /* TIGER fixed. */ + GCRY_MD_TIGER2 = 307 /* TIGER2 variant. */ +/* Flags used with the open function. */ + GCRY_MD_FLAG_SECURE = 1, /* Allocate all buffers in "secure" memory. */ + GCRY_MD_FLAG_HMAC = 2 /* Make an HMAC out of this algorithm. */ +/* (Forward declaration.) */ +/* This object is used to hold a handle to a message digest object. + This structure is private - only to be used by the public gcry_md_* +typedef struct gcry_md_handle + struct gcry_md_context *ctx; + /* Buffer management. */ +/* Compatibility types, do not use them. */ +#ifndef GCRYPT_NO_DEPRECATED +typedef struct gcry_md_handle *GCRY_MD_HD _GCRY_GCC_ATTR_DEPRECATED; +typedef struct gcry_md_handle *GcryMDHd _GCRY_GCC_ATTR_DEPRECATED; +/* Create a message digest object for algorithm ALGO. FLAGS may be + given as an bitwise OR of the gcry_md_flags values. ALGO may be + given as 0 if the algorithms to be used are later set using +gcry_error_t gcry_md_open (gcry_md_hd_t *h, int algo, unsigned int flags); +/* Release the message digest object HD. */ +void gcry_md_close (gcry_md_hd_t hd); +/* Add the message digest algorithm ALGO to the digest object HD. */ +gcry_error_t gcry_md_enable (gcry_md_hd_t hd, int algo); +/* Create a new digest object as an exact copy of the object HD. */ +gcry_error_t gcry_md_copy (gcry_md_hd_t *bhd, gcry_md_hd_t ahd); +/* Reset the digest object HD to its initial state. */ +void gcry_md_reset (gcry_md_hd_t hd); +/* Perform various operations on the digest object HD. */ +gcry_error_t gcry_md_ctl (gcry_md_hd_t hd, int cmd, + void *buffer, size_t buflen); +/* Pass LENGTH bytes of data in BUFFER to the digest object HD so that + it can update the digest values. This is the actual hash +void gcry_md_write (gcry_md_hd_t hd, const void *buffer, size_t length); +/* Read out the final digest from HD return the digest value for +unsigned char *gcry_md_read (gcry_md_hd_t hd, int algo); +/* Convenience function to calculate the hash from the data in BUFFER + of size LENGTH using the algorithm ALGO avoiding the creating of a + hash object. The hash is returned in the caller provided buffer + DIGEST which must be large enough to hold the digest of the given +void gcry_md_hash_buffer (int algo, void *digest, + const void *buffer, size_t length); +/* Retrieve the algorithm used with HD. This does not work reliable + if more than one algorithm is enabled in HD. */ +int gcry_md_get_algo (gcry_md_hd_t hd); +/* Retrieve the length in bytes of the digest yielded by algorithm +unsigned int gcry_md_get_algo_dlen (int algo); +/* Return true if the the algorithm ALGO is enabled in the digest +int gcry_md_is_enabled (gcry_md_hd_t a, int algo); +/* Return true if the digest object A is allocated in "secure" memory. */ +int gcry_md_is_secure (gcry_md_hd_t a); +/* Retrieve various information about the object H. */ +gcry_error_t gcry_md_info (gcry_md_hd_t h, int what, void *buffer, +/* Retrieve various information about the algorithm ALGO. */ +gcry_error_t gcry_md_algo_info (int algo, int what, void *buffer, +/* Map the digest algorithm id ALGO to a string representation of the + algorithm name. For unknown algorithms this function returns +const char *gcry_md_algo_name (int algo) _GCRY_GCC_ATTR_PURE; +/* Map the algorithm NAME to a digest algorithm Id. Return 0 if + the algorithm name is not known. */ +int gcry_md_map_name (const char* name) _GCRY_GCC_ATTR_PURE; +/* For use with the HMAC feature, the set MAC key to the KEY of +gcry_error_t gcry_md_setkey (gcry_md_hd_t hd, const void *key, size_t keylen); +/* Start or stop debugging for digest handle HD; i.e. create a file + named dbgmd-<n>.<suffix> while hashing. If SUFFIX is NULL, + debugging stops and the file will be closed. */ +void gcry_md_debug (gcry_md_hd_t hd, const char *suffix); +/* Update the hash(s) of H with the character C. This is a buffered + version of the gcry_md_write function. */ +#define gcry_md_putc(h,c) \ + gcry_md_hd_t h__ = (h); \ + if( (h__)->bufpos == (h__)->bufsize ) \ + gcry_md_write( (h__), NULL, 0 ); \ + (h__)->buf[(h__)->bufpos++] = (c) & 0xff; \ +/* Finalize the digest calculation. This is not really needed because + gcry_md_read() does this implicitly. */ +#define gcry_md_final(a) \ + gcry_md_ctl ((a), GCRYCTL_FINALIZE, NULL, 0) +/* Return 0 if the algorithm A is available for use. */ +#define gcry_md_test_algo(a) \ + gcry_md_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL ) +/* Return an DER encoded ASN.1 OID for the algorithm A in buffer B. N + must point to size_t variable with the available size of buffer B. + After return it will receive the actual size of the returned +#define gcry_md_get_asnoid(a,b,n) \ + gcry_md_algo_info((a), GCRYCTL_GET_ASNOID, (b), (n)) +/* Enable debugging for digest object A; i.e. create files named + dbgmd-<n>.<string> while hashing. B is a string used as the suffix + for the filename. This macro is deprecated, use gcry_md_debug. */ +#ifndef GCRYPT_NO_DEPRECATED +#define gcry_md_start_debug(a,b) \ + gcry_md_ctl( (a), GCRYCTL_START_DUMP, (b), 0 ) +/* Disable the debugging of A. This macro is deprecated, use +#define gcry_md_stop_debug(a,b) \ + gcry_md_ctl( (a), GCRYCTL_STOP_DUMP, (b), 0 ) +/* Get a list consisting of the IDs of the loaded message digest + modules. If LIST is zero, write the number of loaded message + digest modules to LIST_LENGTH and return. If LIST is non-zero, the + first *LIST_LENGTH algorithm IDs are stored in LIST, which must be + of according size. In case there are less message digest modules + than *LIST_LENGTH, *LIST_LENGTH is updated to the correct +gcry_error_t gcry_md_list (int *list, int *list_length); +/* Alternative interface for asymmetric cryptography. This interface +/* The algorithm IDs. */ +gcry_ac_id_t _GCRY_ATTR_INTERNAL; +typedef enum gcry_ac_key_type +gcry_ac_key_type_t _GCRY_ATTR_INTERNAL; +gcry_ac_em_t _GCRY_ATTR_INTERNAL; +/* Encryption and Signature schemes. */ +typedef enum gcry_ac_scheme +gcry_ac_scheme_t _GCRY_ATTR_INTERNAL; +#define GCRY_AC_FLAG_DEALLOC (1 << 0) +#define GCRY_AC_FLAG_COPY (1 << 1) +#define GCRY_AC_FLAG_NO_BLINDING (1 << 2) +/* This type represents a `data set'. */ +typedef struct gcry_ac_data *gcry_ac_data_t _GCRY_ATTR_INTERNAL; +/* This type represents a single `key', either a secret one or a +typedef struct gcry_ac_key *gcry_ac_key_t _GCRY_ATTR_INTERNAL; +/* This type represents a `key pair' containing a secret and a public +typedef struct gcry_ac_key_pair *gcry_ac_key_pair_t _GCRY_ATTR_INTERNAL; +/* This type represents a `handle' that is needed by functions + performing cryptographic operations. */ +typedef struct gcry_ac_handle *gcry_ac_handle_t _GCRY_ATTR_INTERNAL; +typedef gpg_error_t (*gcry_ac_data_read_cb_t) (void *opaque, + /* */ _GCRY_ATTR_INTERNAL; +typedef gpg_error_t (*gcry_ac_data_write_cb_t) (void *opaque, + /* */ _GCRY_ATTR_INTERNAL; +gcry_ac_io_mode_t _GCRY_ATTR_INTERNAL; +gcry_ac_io_type_t _GCRY_ATTR_INTERNAL; +typedef struct gcry_ac_io + /* This is an INTERNAL structure, do NOT use manually. */ + gcry_ac_io_mode_t mode _GCRY_ATTR_INTERNAL; + gcry_ac_io_type_t type _GCRY_ATTR_INTERNAL; + gcry_ac_data_read_cb_t cb; + gcry_ac_data_write_cb_t cb; + } io _GCRY_ATTR_INTERNAL; +gcry_ac_io_t _GCRY_ATTR_INTERNAL; +/* The caller of gcry_ac_key_pair_generate can provide one of these + structures in order to influence the key generation process in an + algorithm-specific way. */ +typedef struct gcry_ac_key_spec_rsa + gcry_mpi_t e; /* E to use. */ +} gcry_ac_key_spec_rsa_t _GCRY_ATTR_INTERNAL; +/* Structure used for passing data to the implementation of the + `EME-PKCS-V1_5' encoding method. */ +typedef struct gcry_ac_eme_pkcs_v1_5 +} gcry_ac_eme_pkcs_v1_5_t _GCRY_ATTR_INTERNAL; +typedef enum gcry_md_algos gcry_md_algo_t _GCRY_ATTR_INTERNAL; +/* Structure used for passing data to the implementation of the + `EMSA-PKCS-V1_5' encoding method. */ +typedef struct gcry_ac_emsa_pkcs_v1_5 +} gcry_ac_emsa_pkcs_v1_5_t _GCRY_ATTR_INTERNAL; +/* Structure used for passing data to the implementation of the + `SSA-PKCS-V1_5' signature scheme. */ +typedef struct gcry_ac_ssa_pkcs_v1_5 +} gcry_ac_ssa_pkcs_v1_5_t _GCRY_ATTR_INTERNAL; +#ifndef GCRYPT_NO_DEPRECATED +/* Returns a new, empty data set in DATA. */ +gcry_error_t gcry_ac_data_new (gcry_ac_data_t *data) + /* */ _GCRY_ATTR_INTERNAL; +/* Destroy the data set DATA. */ +void gcry_ac_data_destroy (gcry_ac_data_t data) + /* */ _GCRY_ATTR_INTERNAL; +/* Create a copy of the data set DATA and store it in DATA_CP. */ +gcry_error_t gcry_ac_data_copy (gcry_ac_data_t *data_cp, + /* */ _GCRY_ATTR_INTERNAL; +/* Return the number of named MPI values inside of the data set +unsigned int gcry_ac_data_length (gcry_ac_data_t data) + /* */ _GCRY_ATTR_INTERNAL; +/* Destroy any values contained in the data set DATA. */ +void gcry_ac_data_clear (gcry_ac_data_t data) + /* */ _GCRY_ATTR_INTERNAL; +/* Add the value MPI to DATA with the label NAME. If FLAGS contains + GCRY_AC_FLAG_DATA_COPY, the data set will contain copies of NAME + and MPI. If FLAGS contains GCRY_AC_FLAG_DATA_DEALLOC or + GCRY_AC_FLAG_DATA_COPY, the values contained in the data set will + be deallocated when they are to be removed from the data set. */ +gcry_error_t gcry_ac_data_set (gcry_ac_data_t data, unsigned int flags, + const char *name, gcry_mpi_t mpi) + /* */ _GCRY_ATTR_INTERNAL; +/* Store the value labelled with NAME found in DATA in MPI. If FLAGS + contains GCRY_AC_FLAG_COPY, store a copy of the MPI value contained + in the data set. MPI may be NULL. */ +gcry_error_t gcry_ac_data_get_name (gcry_ac_data_t data, unsigned int flags, + const char *name, gcry_mpi_t *mpi) + /* */ _GCRY_ATTR_INTERNAL; +/* Stores in NAME and MPI the named MPI value contained in the data + set DATA with the index IDX. If FLAGS contains GCRY_AC_FLAG_COPY, + store copies of the values contained in the data set. NAME or MPI +gcry_error_t gcry_ac_data_get_index (gcry_ac_data_t data, unsigned int flags, + const char **name, gcry_mpi_t *mpi) + /* */ _GCRY_ATTR_INTERNAL; +/* Convert the data set DATA into a new S-Expression, which is to be + stored in SEXP, according to the identifiers contained in +gcry_error_t gcry_ac_data_to_sexp (gcry_ac_data_t data, gcry_sexp_t *sexp, + const char **identifiers) + /* */ _GCRY_ATTR_INTERNAL; +/* Create a new data set, which is to be stored in DATA_SET, from the + S-Expression SEXP, according to the identifiers contained in +gcry_error_t gcry_ac_data_from_sexp (gcry_ac_data_t *data, gcry_sexp_t sexp, + const char **identifiers) + /* */ _GCRY_ATTR_INTERNAL; +/* Initialize AC_IO according to MODE, TYPE and the variable list of + arguments. The list of variable arguments to specify depends on +void gcry_ac_io_init (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode, + gcry_ac_io_type_t type, ...) + /* */ _GCRY_ATTR_INTERNAL; +/* Initialize AC_IO according to MODE, TYPE and the variable list of + arguments AP. The list of variable arguments to specify depends on +void gcry_ac_io_init_va (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode, + gcry_ac_io_type_t type, va_list ap) + /* */ _GCRY_ATTR_INTERNAL; +/* Create a new ac handle. */ +gcry_error_t gcry_ac_open (gcry_ac_handle_t *handle, + gcry_ac_id_t algorithm, unsigned int flags) + /* */ _GCRY_ATTR_INTERNAL; +/* Destroy an ac handle. */ +void gcry_ac_close (gcry_ac_handle_t handle) + /* */ _GCRY_ATTR_INTERNAL; +/* Initialize a key from a given data set. */ +gcry_error_t gcry_ac_key_init (gcry_ac_key_t *key, gcry_ac_handle_t handle, + gcry_ac_key_type_t type, gcry_ac_data_t data) + /* */ _GCRY_ATTR_INTERNAL; +/* Generates a new key pair via the handle HANDLE of NBITS bits and + stores it in KEY_PAIR. In case non-standard settings are wanted, a + pointer to a structure of type gcry_ac_key_spec_<algorithm>_t, + matching the selected algorithm, can be given as KEY_SPEC. + MISC_DATA is not used yet. */ +gcry_error_t gcry_ac_key_pair_generate (gcry_ac_handle_t handle, + unsigned int nbits, void *spec, + gcry_ac_key_pair_t *key_pair, + gcry_mpi_t **misc_data) + /* */ _GCRY_ATTR_INTERNAL; +/* Returns the key of type WHICH out of the key pair KEY_PAIR. */ +gcry_ac_key_t gcry_ac_key_pair_extract (gcry_ac_key_pair_t key_pair, + gcry_ac_key_type_t which) + /* */ _GCRY_ATTR_INTERNAL; +/* Returns the data set contained in the key KEY. */ +gcry_ac_data_t gcry_ac_key_data_get (gcry_ac_key_t key) + /* */ _GCRY_ATTR_INTERNAL; +/* Verifies that the key KEY is sane via HANDLE. */ +gcry_error_t gcry_ac_key_test (gcry_ac_handle_t handle, gcry_ac_key_t key) + /* */ _GCRY_ATTR_INTERNAL; +/* Stores the number of bits of the key KEY in NBITS via HANDLE. */ +gcry_error_t gcry_ac_key_get_nbits (gcry_ac_handle_t handle, + gcry_ac_key_t key, unsigned int *nbits) + /* */ _GCRY_ATTR_INTERNAL; +/* Writes the 20 byte long key grip of the key KEY to KEY_GRIP via +gcry_error_t gcry_ac_key_get_grip (gcry_ac_handle_t handle, gcry_ac_key_t key, + unsigned char *key_grip) + /* */ _GCRY_ATTR_INTERNAL; +void gcry_ac_key_destroy (gcry_ac_key_t key) + /* */ _GCRY_ATTR_INTERNAL; +/* Destroy a key pair. */ +void gcry_ac_key_pair_destroy (gcry_ac_key_pair_t key_pair) + /* */ _GCRY_ATTR_INTERNAL; +/* Encodes a message according to the encoding method METHOD. OPTIONS + must be a pointer to a method-specific structure +gcry_error_t gcry_ac_data_encode (gcry_ac_em_t method, + unsigned int flags, void *options, + gcry_ac_io_t *io_write) + /* */ _GCRY_ATTR_INTERNAL; +/* Decodes a message according to the encoding method METHOD. OPTIONS + must be a pointer to a method-specific structure +gcry_error_t gcry_ac_data_decode (gcry_ac_em_t method, + unsigned int flags, void *options, + gcry_ac_io_t *io_write) + /* */ _GCRY_ATTR_INTERNAL; +/* Encrypt the plain text MPI value DATA_PLAIN with the key KEY under + the control of the flags FLAGS and store the resulting data set + into DATA_ENCRYPTED. */ +gcry_error_t gcry_ac_data_encrypt (gcry_ac_handle_t handle, + gcry_ac_data_t *data_encrypted) + /* */ _GCRY_ATTR_INTERNAL; +/* Decrypt the decrypted data contained in the data set DATA_ENCRYPTED + with the key KEY under the control of the flags FLAGS and store the + resulting plain text MPI value in DATA_PLAIN. */ +gcry_error_t gcry_ac_data_decrypt (gcry_ac_handle_t handle, + gcry_mpi_t *data_plain, + gcry_ac_data_t data_encrypted) + /* */ _GCRY_ATTR_INTERNAL; +/* Sign the data contained in DATA with the key KEY and store the + resulting signature in the data set DATA_SIGNATURE. */ +gcry_error_t gcry_ac_data_sign (gcry_ac_handle_t handle, + gcry_ac_data_t *data_signature) + /* */ _GCRY_ATTR_INTERNAL; +/* Verify that the signature contained in the data set DATA_SIGNATURE + is indeed the result of signing the data contained in DATA with the + secret key belonging to the public key KEY. */ +gcry_error_t gcry_ac_data_verify (gcry_ac_handle_t handle, + gcry_ac_data_t data_signature) + /* */ _GCRY_ATTR_INTERNAL; +/* Encrypts the plain text readable from IO_MESSAGE through HANDLE + with the public key KEY according to SCHEME, FLAGS and OPTS. If + OPTS is not NULL, it has to be a pointer to a structure specific to + the chosen scheme (gcry_ac_es_*_t). The encrypted message is + written to IO_CIPHER. */ +gcry_error_t gcry_ac_data_encrypt_scheme (gcry_ac_handle_t handle, + gcry_ac_scheme_t scheme, + unsigned int flags, void *opts, + gcry_ac_io_t *io_message, + gcry_ac_io_t *io_cipher) + /* */ _GCRY_ATTR_INTERNAL; +/* Decrypts the cipher text readable from IO_CIPHER through HANDLE + with the secret key KEY according to SCHEME, @var{flags} and OPTS. + If OPTS is not NULL, it has to be a pointer to a structure specific + to the chosen scheme (gcry_ac_es_*_t). The decrypted message is + written to IO_MESSAGE. */ +gcry_error_t gcry_ac_data_decrypt_scheme (gcry_ac_handle_t handle, + gcry_ac_scheme_t scheme, + unsigned int flags, void *opts, + gcry_ac_io_t *io_cipher, + gcry_ac_io_t *io_message) + /* */ _GCRY_ATTR_INTERNAL; +/* Signs the message readable from IO_MESSAGE through HANDLE with the + secret key KEY according to SCHEME, FLAGS and OPTS. If OPTS is not + NULL, it has to be a pointer to a structure specific to the chosen + scheme (gcry_ac_ssa_*_t). The signature is written to +gcry_error_t gcry_ac_data_sign_scheme (gcry_ac_handle_t handle, + gcry_ac_scheme_t scheme, + unsigned int flags, void *opts, + gcry_ac_io_t *io_message, + gcry_ac_io_t *io_signature) + /* */ _GCRY_ATTR_INTERNAL; +/* Verifies through HANDLE that the signature readable from + IO_SIGNATURE is indeed the result of signing the message readable + from IO_MESSAGE with the secret key belonging to the public key KEY + according to SCHEME and OPTS. If OPTS is not NULL, it has to be an + anonymous structure (gcry_ac_ssa_*_t) specific to the chosen +gcry_error_t gcry_ac_data_verify_scheme (gcry_ac_handle_t handle, + gcry_ac_scheme_t scheme, + unsigned int flags, void *opts, + gcry_ac_io_t *io_message, + gcry_ac_io_t *io_signature) + /* */ _GCRY_ATTR_INTERNAL; +/* Store the textual representation of the algorithm whose id is given + in ALGORITHM in NAME. This function is deprecated; use +gcry_error_t gcry_ac_id_to_name (gcry_ac_id_t algorithm, + /* */ _GCRY_GCC_ATTR_DEPRECATED; +/* Store the numeric ID of the algorithm whose textual representation + is contained in NAME in ALGORITHM. This function is deprecated; + use gcry_pk_map_name. */ +gcry_error_t gcry_ac_name_to_id (const char *name, + gcry_ac_id_t *algorithm) + /* */ _GCRY_GCC_ATTR_DEPRECATED; +#endif /*GCRYPT_NO_DEPRECATED*/ +/****************************** + * Key Derivation Functions * + ******************************/ +/* Algorithm IDs for the KDFs. */ + GCRY_KDF_SIMPLE_S2K = 16, + GCRY_KDF_SALTED_S2K = 17, + GCRY_KDF_ITERSALTED_S2K = 19, +/* Derive a key from a passphrase. */ +gpg_error_t gcry_kdf_derive (const void *passphrase, size_t passphraselen, + const void *salt, size_t saltlen, + unsigned long iterations, + size_t keysize, void *keybuffer); +/************************************ + * Random Generating Functions * + ************************************/ +/* The possible values for the random quality. The rule of thumb is + to use STRONG for session keys and VERY_STRONG for key material. + WEAK is usually an alias for STRONG and should not be used anymore + (except with gcry_mpi_randomize); use gcry_create_nonce instead. */ +typedef enum gcry_random_level + GCRY_STRONG_RANDOM = 1, + GCRY_VERY_STRONG_RANDOM = 2 +/* Fill BUFFER with LENGTH bytes of random, using random numbers of +void gcry_randomize (void *buffer, size_t length, + enum gcry_random_level level); +/* Add the external random from BUFFER with LENGTH bytes into the + pool. QUALITY should either be -1 for unknown or in the range of 0 +gcry_error_t gcry_random_add_bytes (const void *buffer, size_t length, +/* If random numbers are used in an application, this macro should be + called from time to time so that new stuff gets added to the + internal pool of the RNG. */ +#define gcry_fast_random_poll() gcry_control (GCRYCTL_FAST_POLL, NULL) +/* Return NBYTES of allocated random using a random numbers of quality +void *gcry_random_bytes (size_t nbytes, enum gcry_random_level level) +/* Return NBYTES of allocated random using a random numbers of quality + LEVEL. The random numbers are created returned in "secure" +void *gcry_random_bytes_secure (size_t nbytes, enum gcry_random_level level) +/* Set the big integer W to a random value of NBITS using a random + generator with quality LEVEL. Note that by using a level of + GCRY_WEAK_RANDOM gcry_create_nonce is used internally. */ +void gcry_mpi_randomize (gcry_mpi_t w, + unsigned int nbits, enum gcry_random_level level); +/* Create an unpredicable nonce of LENGTH bytes in BUFFER. */ +void gcry_create_nonce (void *buffer, size_t length); +/*******************************/ +/* Prime Number Functions */ +/*******************************/ +/* Mode values passed to a gcry_prime_check_func_t. */ +#define GCRY_PRIME_CHECK_AT_FINISH 0 +#define GCRY_PRIME_CHECK_AT_GOT_PRIME 1 +#define GCRY_PRIME_CHECK_AT_MAYBE_PRIME 2 +/* The function should return 1 if the operation shall continue, 0 to + reject the prime candidate. */ +typedef int (*gcry_prime_check_func_t) (void *arg, int mode, +/* Flags for gcry_prime_generate(): */ +/* Allocate prime numbers and factors in secure memory. */ +#define GCRY_PRIME_FLAG_SECRET (1 << 0) +/* Make sure that at least one prime factor is of size +#define GCRY_PRIME_FLAG_SPECIAL_FACTOR (1 << 1) +/* Generate a new prime number of PRIME_BITS bits and store it in + PRIME. If FACTOR_BITS is non-zero, one of the prime factors of + (prime - 1) / 2 must be FACTOR_BITS bits long. If FACTORS is + non-zero, allocate a new, NULL-terminated array holding the prime + factors and store it in FACTORS. FLAGS might be used to influence + the prime number generation process. */ +gcry_error_t gcry_prime_generate (gcry_mpi_t *prime, + unsigned int prime_bits, + unsigned int factor_bits, + gcry_prime_check_func_t cb_func, + gcry_random_level_t random_level, +/* Find a generator for PRIME where the factorization of (prime-1) is + in the NULL terminated array FACTORS. Return the generator as a + newly allocated MPI in R_G. If START_G is not NULL, use this as + teh start for the search. */ +gcry_error_t gcry_prime_group_generator (gcry_mpi_t *r_g, +/* Convenience function to release the FACTORS array. */ +void gcry_prime_release_factors (gcry_mpi_t *factors); +/* Check wether the number X is prime. */ +gcry_error_t gcry_prime_check (gcry_mpi_t x, unsigned int flags); +/************************************ + * Miscellaneous Stuff * + ************************************/ +/* Log levels used by the internal logging facility. */ + GCRY_LOG_CONT = 0, /* (Continue the last log line.) */ +/* Type for progress handlers. */ +typedef void (*gcry_handler_progress_t) (void *, const char *, int, int, int); +/* Type for memory allocation handlers. */ +typedef void *(*gcry_handler_alloc_t) (size_t n); +/* Type for secure memory check handlers. */ +typedef int (*gcry_handler_secure_check_t) (const void *); +/* Type for memory reallocation handlers. */ +typedef void *(*gcry_handler_realloc_t) (void *p, size_t n); +/* Type for memory free handlers. */ +typedef void (*gcry_handler_free_t) (void *); +/* Type for out-of-memory handlers. */ +typedef int (*gcry_handler_no_mem_t) (void *, size_t, unsigned int); +/* Type for fatal error handlers. */ +typedef void (*gcry_handler_error_t) (void *, int, const char *); +/* Type for logging handlers. */ +typedef void (*gcry_handler_log_t) (void *, int, const char *, va_list); +/* Certain operations can provide progress information. This function + is used to register a handler for retrieving these information. */ +void gcry_set_progress_handler (gcry_handler_progress_t cb, void *cb_data); +/* Register a custom memory allocation functions. */ +void gcry_set_allocation_handler ( + gcry_handler_alloc_t func_alloc, + gcry_handler_alloc_t func_alloc_secure, + gcry_handler_secure_check_t func_secure_check, + gcry_handler_realloc_t func_realloc, + gcry_handler_free_t func_free); +/* Register a function used instead of the internal out of memory +void gcry_set_outofcore_handler (gcry_handler_no_mem_t h, void *opaque); +/* Register a function used instead of the internal fatal error +void gcry_set_fatalerror_handler (gcry_handler_error_t fnc, void *opaque); +/* Register a function used instead of the internal logging +void gcry_set_log_handler (gcry_handler_log_t f, void *opaque); +/* Reserved for future use. */ +void gcry_set_gettext_handler (const char *(*f)(const char*)); +/* Libgcrypt uses its own memory allocation. It is important to use + gcry_free () to release memory allocated by libgcrypt. */ +void *gcry_malloc (size_t n) _GCRY_GCC_ATTR_MALLOC; +void *gcry_calloc (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC; +void *gcry_malloc_secure (size_t n) _GCRY_GCC_ATTR_MALLOC; +void *gcry_calloc_secure (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC; +void *gcry_realloc (void *a, size_t n); +char *gcry_strdup (const char *string) _GCRY_GCC_ATTR_MALLOC; +void *gcry_xmalloc (size_t n) _GCRY_GCC_ATTR_MALLOC; +void *gcry_xcalloc (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC; +void *gcry_xmalloc_secure (size_t n) _GCRY_GCC_ATTR_MALLOC; +void *gcry_xcalloc_secure (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC; +void *gcry_xrealloc (void *a, size_t n); +char *gcry_xstrdup (const char * a) _GCRY_GCC_ATTR_MALLOC; +void gcry_free (void *a); +/* Return true if A is allocated in "secure" memory. */ +int gcry_is_secure (const void *a) _GCRY_GCC_ATTR_PURE; +/* Return true if Libgcrypt is in FIPS mode. */ +#define gcry_fips_mode_active() !!gcry_control (GCRYCTL_FIPS_MODE_P, 0) +/* Include support for Libgcrypt modules. */ +#include <gcrypt-module.h> +#if 0 /* (Keep Emacsens' auto-indent happy.) */ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libgcrypt.framework/Versions/1.5.0/Resources/English.lproj/InfoPlist.strings Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,3 @@
+/* Localized versions of Info.plist keys */ +CFBundleName = "libgcrypt"; Binary file Frameworks/libgcrypt.framework/Versions/1.5.0/Resources/Info.plist has changed
Binary file Frameworks/libgcrypt.framework/Versions/1.5.0/libgcrypt has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libgcrypt.framework/Versions/Current Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,1 @@
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libgcrypt.framework/libgcrypt Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,1 @@
+Versions/1.5.0/libgcrypt \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libgpgerror.framework/Headers Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,1 @@
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libgpgerror.framework/Resources Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,1 @@
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libgpgerror.framework/Versions/1.10/Headers/gpg-error.h Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,678 @@
+/* Output of mkheader.awk. DO NOT EDIT. -*- buffer-read-only: t -*- */ +/* gpg-error.h - Public interface to libgpg-error. + Copyright (C) 2003, 2004, 2010 g10 Code GmbH + This file is part of libgpg-error. + libgpg-error is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + libgpg-error is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public + License along with this program; if not, see <http://www.gnu.org/licenses/>. +#define GPG_ERR_INLINE __inline__ +#elif __STDC_VERSION__ >= 199901L +#define GPG_ERR_INLINE inline +#if 0 /* just to make Emacs auto-indent happy */ +#endif /* __cplusplus */ +/* The GnuPG project consists of many components. Error codes are + exchanged between all components. The common error codes and their + user-presentable descriptions are kept into a shared library to + allow adding new error codes and components without recompiling any + of the other components. The interface will not change in a + backward incompatible way. + An error code together with an error source build up an error + value. As the error value is been passed from one component to + another, it preserver the information about the source and nature + A component of the GnuPG project can define the following macros to + tune the behaviour of the library: + GPG_ERR_SOURCE_DEFAULT: Define to an error source of type + gpg_err_source_t to make that source the default for gpg_error(). + Otherwise GPG_ERR_SOURCE_UNKNOWN is used as default. + GPG_ERR_ENABLE_GETTEXT_MACROS: Define to provide macros to map the + internal gettext API to standard names. This has only an effect on +/* The error source type gpg_err_source_t. + Where as the Poo out of a welle small + Taketh his firste springing and his sours. +/* Only use free slots, never change or reorder the existing + GPG_ERR_SOURCE_UNKNOWN = 0, + GPG_ERR_SOURCE_GCRYPT = 1, + GPG_ERR_SOURCE_GPG = 2, + GPG_ERR_SOURCE_GPGSM = 3, + GPG_ERR_SOURCE_GPGAGENT = 4, + GPG_ERR_SOURCE_PINENTRY = 5, + GPG_ERR_SOURCE_SCD = 6, + GPG_ERR_SOURCE_GPGME = 7, + GPG_ERR_SOURCE_KEYBOX = 8, + GPG_ERR_SOURCE_KSBA = 9, + GPG_ERR_SOURCE_DIRMNGR = 10, + GPG_ERR_SOURCE_GSTI = 11, + GPG_ERR_SOURCE_GPA = 12, + GPG_ERR_SOURCE_KLEO = 13, + GPG_ERR_SOURCE_G13 = 14, + GPG_ERR_SOURCE_ANY = 31, + GPG_ERR_SOURCE_USER_1 = 32, + GPG_ERR_SOURCE_USER_2 = 33, + GPG_ERR_SOURCE_USER_3 = 34, + GPG_ERR_SOURCE_USER_4 = 35, + /* This is one more than the largest allowed entry. */ + GPG_ERR_SOURCE_DIM = 128 +/* The error code type gpg_err_code_t. */ +/* Only use free slots, never change or reorder the existing + GPG_ERR_UNKNOWN_PACKET = 2, + GPG_ERR_UNKNOWN_VERSION = 3, + GPG_ERR_PUBKEY_ALGO = 4, + GPG_ERR_DIGEST_ALGO = 5, + GPG_ERR_BAD_PUBKEY = 6, + GPG_ERR_BAD_SECKEY = 7, + GPG_ERR_BAD_SIGNATURE = 8, + GPG_ERR_BAD_PASSPHRASE = 11, + GPG_ERR_CIPHER_ALGO = 12, + GPG_ERR_KEYRING_OPEN = 13, + GPG_ERR_INV_PACKET = 14, + GPG_ERR_INV_ARMOR = 15, + GPG_ERR_NO_USER_ID = 16, + GPG_ERR_NO_SECKEY = 17, + GPG_ERR_WRONG_SECKEY = 18, + GPG_ERR_COMPR_ALGO = 20, + GPG_ERR_NO_ENCODING_METHOD = 22, + GPG_ERR_NO_ENCRYPTION_SCHEME = 23, + GPG_ERR_NO_SIGNATURE_SCHEME = 24, + GPG_ERR_NOT_FOUND = 27, + GPG_ERR_VALUE_NOT_FOUND = 28, + GPG_ERR_INV_PASSPHRASE = 31, + GPG_ERR_SIG_CLASS = 32, + GPG_ERR_RESOURCE_LIMIT = 33, + GPG_ERR_INV_KEYRING = 34, + GPG_ERR_INV_USER_ID = 37, + GPG_ERR_UNEXPECTED = 38, + GPG_ERR_TIME_CONFLICT = 39, + GPG_ERR_KEYSERVER = 40, + GPG_ERR_WRONG_PUBKEY_ALGO = 41, + GPG_ERR_TRIBUTE_TO_D_A = 42, + GPG_ERR_INV_KEYLEN = 44, + GPG_ERR_UNKNOWN_HOST = 49, + GPG_ERR_SELFTEST_FAILED = 50, + GPG_ERR_NOT_ENCRYPTED = 51, + GPG_ERR_NOT_PROCESSED = 52, + GPG_ERR_UNUSABLE_PUBKEY = 53, + GPG_ERR_UNUSABLE_SECKEY = 54, + GPG_ERR_INV_VALUE = 55, + GPG_ERR_BAD_CERT_CHAIN = 56, + GPG_ERR_MISSING_CERT = 57, + GPG_ERR_NOT_SUPPORTED = 60, + GPG_ERR_EOF_GCRYPT = 64, + GPG_ERR_TOO_SHORT = 66, + GPG_ERR_TOO_LARGE = 67, + GPG_ERR_NOT_IMPLEMENTED = 69, + GPG_ERR_INV_CIPHER_MODE = 71, + GPG_ERR_INV_HANDLE = 73, + GPG_ERR_TRUNCATED = 74, + GPG_ERR_INCOMPLETE_LINE = 75, + GPG_ERR_INV_RESPONSE = 76, + GPG_ERR_ASSUAN_SERVER_FAULT = 80, + GPG_ERR_INV_SESSION_KEY = 82, + GPG_ERR_UNSUPPORTED_ALGORITHM = 84, + GPG_ERR_NO_PIN_ENTRY = 85, + GPG_ERR_PIN_ENTRY = 86, + GPG_ERR_INV_PARAMETER = 90, + GPG_ERR_WRONG_CARD = 91, + GPG_ERR_NO_DIRMNGR = 92, + GPG_ERR_CERT_REVOKED = 94, + GPG_ERR_NO_CRL_KNOWN = 95, + GPG_ERR_CRL_TOO_OLD = 96, + GPG_ERR_LINE_TOO_LONG = 97, + GPG_ERR_NOT_TRUSTED = 98, + GPG_ERR_BAD_CA_CERT = 100, + GPG_ERR_CERT_EXPIRED = 101, + GPG_ERR_CERT_TOO_YOUNG = 102, + GPG_ERR_UNSUPPORTED_CERT = 103, + GPG_ERR_UNKNOWN_SEXP = 104, + GPG_ERR_UNSUPPORTED_PROTECTION = 105, + GPG_ERR_CORRUPTED_PROTECTION = 106, + GPG_ERR_AMBIGUOUS_NAME = 107, + GPG_ERR_CARD_RESET = 109, + GPG_ERR_CARD_REMOVED = 110, + GPG_ERR_INV_CARD = 111, + GPG_ERR_CARD_NOT_PRESENT = 112, + GPG_ERR_NO_PKCS15_APP = 113, + GPG_ERR_NOT_CONFIRMED = 114, + GPG_ERR_CONFIGURATION = 115, + GPG_ERR_NO_POLICY_MATCH = 116, + GPG_ERR_INV_INDEX = 117, + GPG_ERR_NO_SCDAEMON = 119, + GPG_ERR_SCDAEMON = 120, + GPG_ERR_UNSUPPORTED_PROTOCOL = 121, + GPG_ERR_BAD_PIN_METHOD = 122, + GPG_ERR_CARD_NOT_INITIALIZED = 123, + GPG_ERR_UNSUPPORTED_OPERATION = 124, + GPG_ERR_WRONG_KEY_USAGE = 125, + GPG_ERR_NOTHING_FOUND = 126, + GPG_ERR_WRONG_BLOB_TYPE = 127, + GPG_ERR_MISSING_VALUE = 128, + GPG_ERR_HARDWARE = 129, + GPG_ERR_PIN_BLOCKED = 130, + GPG_ERR_USE_CONDITIONS = 131, + GPG_ERR_PIN_NOT_SYNCED = 132, + GPG_ERR_ELEMENT_NOT_FOUND = 136, + GPG_ERR_IDENTIFIER_NOT_FOUND = 137, + GPG_ERR_INV_LENGTH = 139, + GPG_ERR_INV_KEYINFO = 140, + GPG_ERR_UNEXPECTED_TAG = 141, + GPG_ERR_NOT_DER_ENCODED = 142, + GPG_ERR_NO_CMS_OBJ = 143, + GPG_ERR_INV_CMS_OBJ = 144, + GPG_ERR_UNKNOWN_CMS_OBJ = 145, + GPG_ERR_UNSUPPORTED_CMS_OBJ = 146, + GPG_ERR_UNSUPPORTED_ENCODING = 147, + GPG_ERR_UNSUPPORTED_CMS_VERSION = 148, + GPG_ERR_UNKNOWN_ALGORITHM = 149, + GPG_ERR_INV_ENGINE = 150, + GPG_ERR_PUBKEY_NOT_TRUSTED = 151, + GPG_ERR_DECRYPT_FAILED = 152, + GPG_ERR_KEY_EXPIRED = 153, + GPG_ERR_SIG_EXPIRED = 154, + GPG_ERR_ENCODING_PROBLEM = 155, + GPG_ERR_INV_STATE = 156, + GPG_ERR_DUP_VALUE = 157, + GPG_ERR_MISSING_ACTION = 158, + GPG_ERR_MODULE_NOT_FOUND = 159, + GPG_ERR_INV_OID_STRING = 160, + GPG_ERR_INV_TIME = 161, + GPG_ERR_INV_CRL_OBJ = 162, + GPG_ERR_UNSUPPORTED_CRL_VERSION = 163, + GPG_ERR_INV_CERT_OBJ = 164, + GPG_ERR_UNKNOWN_NAME = 165, + GPG_ERR_LOCALE_PROBLEM = 166, + GPG_ERR_NOT_LOCKED = 167, + GPG_ERR_PROTOCOL_VIOLATION = 168, + GPG_ERR_INV_REQUEST = 170, + GPG_ERR_UNKNOWN_EXTN = 171, + GPG_ERR_UNKNOWN_CRIT_EXTN = 172, + GPG_ERR_UNKNOWN_OPTION = 174, + GPG_ERR_UNKNOWN_COMMAND = 175, + GPG_ERR_NOT_OPERATIONAL = 176, + GPG_ERR_NO_PASSPHRASE = 177, + GPG_ERR_NOT_ENABLED = 179, + GPG_ERR_NO_ENGINE = 180, + GPG_ERR_MISSING_KEY = 181, + GPG_ERR_TOO_MANY = 182, + GPG_ERR_LIMIT_REACHED = 183, + GPG_ERR_NOT_INITIALIZED = 184, + GPG_ERR_MISSING_ISSUER_CERT = 185, + GPG_ERR_FULLY_CANCELED = 198, + GPG_ERR_UNFINISHED = 199, + GPG_ERR_BUFFER_TOO_SHORT = 200, + GPG_ERR_SEXP_INV_LEN_SPEC = 201, + GPG_ERR_SEXP_STRING_TOO_LONG = 202, + GPG_ERR_SEXP_UNMATCHED_PAREN = 203, + GPG_ERR_SEXP_NOT_CANONICAL = 204, + GPG_ERR_SEXP_BAD_CHARACTER = 205, + GPG_ERR_SEXP_BAD_QUOTATION = 206, + GPG_ERR_SEXP_ZERO_PREFIX = 207, + GPG_ERR_SEXP_NESTED_DH = 208, + GPG_ERR_SEXP_UNMATCHED_DH = 209, + GPG_ERR_SEXP_UNEXPECTED_PUNC = 210, + GPG_ERR_SEXP_BAD_HEX_CHAR = 211, + GPG_ERR_SEXP_ODD_HEX_NUMBERS = 212, + GPG_ERR_SEXP_BAD_OCT_CHAR = 213, + GPG_ERR_ASS_GENERAL = 257, + GPG_ERR_ASS_ACCEPT_FAILED = 258, + GPG_ERR_ASS_CONNECT_FAILED = 259, + GPG_ERR_ASS_INV_RESPONSE = 260, + GPG_ERR_ASS_INV_VALUE = 261, + GPG_ERR_ASS_INCOMPLETE_LINE = 262, + GPG_ERR_ASS_LINE_TOO_LONG = 263, + GPG_ERR_ASS_NESTED_COMMANDS = 264, + GPG_ERR_ASS_NO_DATA_CB = 265, + GPG_ERR_ASS_NO_INQUIRE_CB = 266, + GPG_ERR_ASS_NOT_A_SERVER = 267, + GPG_ERR_ASS_NOT_A_CLIENT = 268, + GPG_ERR_ASS_SERVER_START = 269, + GPG_ERR_ASS_READ_ERROR = 270, + GPG_ERR_ASS_WRITE_ERROR = 271, + GPG_ERR_ASS_TOO_MUCH_DATA = 273, + GPG_ERR_ASS_UNEXPECTED_CMD = 274, + GPG_ERR_ASS_UNKNOWN_CMD = 275, + GPG_ERR_ASS_SYNTAX = 276, + GPG_ERR_ASS_CANCELED = 277, + GPG_ERR_ASS_NO_INPUT = 278, + GPG_ERR_ASS_NO_OUTPUT = 279, + GPG_ERR_ASS_PARAMETER = 280, + GPG_ERR_ASS_UNKNOWN_INQUIRE = 281, + GPG_ERR_USER_10 = 1033, + GPG_ERR_USER_11 = 1034, + GPG_ERR_USER_12 = 1035, + GPG_ERR_USER_13 = 1036, + GPG_ERR_USER_14 = 1037, + GPG_ERR_USER_15 = 1038, + GPG_ERR_USER_16 = 1039, + GPG_ERR_MISSING_ERRNO = 16381, + GPG_ERR_UNKNOWN_ERRNO = 16382, + /* The following error codes are used to map system errors. */ +#define GPG_ERR_SYSTEM_ERROR (1 << 15) + GPG_ERR_E2BIG = GPG_ERR_SYSTEM_ERROR | 0, + GPG_ERR_EACCES = GPG_ERR_SYSTEM_ERROR | 1, + GPG_ERR_EADDRINUSE = GPG_ERR_SYSTEM_ERROR | 2, + GPG_ERR_EADDRNOTAVAIL = GPG_ERR_SYSTEM_ERROR | 3, + GPG_ERR_EADV = GPG_ERR_SYSTEM_ERROR | 4, + GPG_ERR_EAFNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 5, + GPG_ERR_EAGAIN = GPG_ERR_SYSTEM_ERROR | 6, + GPG_ERR_EALREADY = GPG_ERR_SYSTEM_ERROR | 7, + GPG_ERR_EAUTH = GPG_ERR_SYSTEM_ERROR | 8, + GPG_ERR_EBACKGROUND = GPG_ERR_SYSTEM_ERROR | 9, + GPG_ERR_EBADE = GPG_ERR_SYSTEM_ERROR | 10, + GPG_ERR_EBADF = GPG_ERR_SYSTEM_ERROR | 11, + GPG_ERR_EBADFD = GPG_ERR_SYSTEM_ERROR | 12, + GPG_ERR_EBADMSG = GPG_ERR_SYSTEM_ERROR | 13, + GPG_ERR_EBADR = GPG_ERR_SYSTEM_ERROR | 14, + GPG_ERR_EBADRPC = GPG_ERR_SYSTEM_ERROR | 15, + GPG_ERR_EBADRQC = GPG_ERR_SYSTEM_ERROR | 16, + GPG_ERR_EBADSLT = GPG_ERR_SYSTEM_ERROR | 17, + GPG_ERR_EBFONT = GPG_ERR_SYSTEM_ERROR | 18, + GPG_ERR_EBUSY = GPG_ERR_SYSTEM_ERROR | 19, + GPG_ERR_ECANCELED = GPG_ERR_SYSTEM_ERROR | 20, + GPG_ERR_ECHILD = GPG_ERR_SYSTEM_ERROR | 21, + GPG_ERR_ECHRNG = GPG_ERR_SYSTEM_ERROR | 22, + GPG_ERR_ECOMM = GPG_ERR_SYSTEM_ERROR | 23, + GPG_ERR_ECONNABORTED = GPG_ERR_SYSTEM_ERROR | 24, + GPG_ERR_ECONNREFUSED = GPG_ERR_SYSTEM_ERROR | 25, + GPG_ERR_ECONNRESET = GPG_ERR_SYSTEM_ERROR | 26, + GPG_ERR_ED = GPG_ERR_SYSTEM_ERROR | 27, + GPG_ERR_EDEADLK = GPG_ERR_SYSTEM_ERROR | 28, + GPG_ERR_EDEADLOCK = GPG_ERR_SYSTEM_ERROR | 29, + GPG_ERR_EDESTADDRREQ = GPG_ERR_SYSTEM_ERROR | 30, + GPG_ERR_EDIED = GPG_ERR_SYSTEM_ERROR | 31, + GPG_ERR_EDOM = GPG_ERR_SYSTEM_ERROR | 32, + GPG_ERR_EDOTDOT = GPG_ERR_SYSTEM_ERROR | 33, + GPG_ERR_EDQUOT = GPG_ERR_SYSTEM_ERROR | 34, + GPG_ERR_EEXIST = GPG_ERR_SYSTEM_ERROR | 35, + GPG_ERR_EFAULT = GPG_ERR_SYSTEM_ERROR | 36, + GPG_ERR_EFBIG = GPG_ERR_SYSTEM_ERROR | 37, + GPG_ERR_EFTYPE = GPG_ERR_SYSTEM_ERROR | 38, + GPG_ERR_EGRATUITOUS = GPG_ERR_SYSTEM_ERROR | 39, + GPG_ERR_EGREGIOUS = GPG_ERR_SYSTEM_ERROR | 40, + GPG_ERR_EHOSTDOWN = GPG_ERR_SYSTEM_ERROR | 41, + GPG_ERR_EHOSTUNREACH = GPG_ERR_SYSTEM_ERROR | 42, + GPG_ERR_EIDRM = GPG_ERR_SYSTEM_ERROR | 43, + GPG_ERR_EIEIO = GPG_ERR_SYSTEM_ERROR | 44, + GPG_ERR_EILSEQ = GPG_ERR_SYSTEM_ERROR | 45, + GPG_ERR_EINPROGRESS = GPG_ERR_SYSTEM_ERROR | 46, + GPG_ERR_EINTR = GPG_ERR_SYSTEM_ERROR | 47, + GPG_ERR_EINVAL = GPG_ERR_SYSTEM_ERROR | 48, + GPG_ERR_EIO = GPG_ERR_SYSTEM_ERROR | 49, + GPG_ERR_EISCONN = GPG_ERR_SYSTEM_ERROR | 50, + GPG_ERR_EISDIR = GPG_ERR_SYSTEM_ERROR | 51, + GPG_ERR_EISNAM = GPG_ERR_SYSTEM_ERROR | 52, + GPG_ERR_EL2HLT = GPG_ERR_SYSTEM_ERROR | 53, + GPG_ERR_EL2NSYNC = GPG_ERR_SYSTEM_ERROR | 54, + GPG_ERR_EL3HLT = GPG_ERR_SYSTEM_ERROR | 55, + GPG_ERR_EL3RST = GPG_ERR_SYSTEM_ERROR | 56, + GPG_ERR_ELIBACC = GPG_ERR_SYSTEM_ERROR | 57, + GPG_ERR_ELIBBAD = GPG_ERR_SYSTEM_ERROR | 58, + GPG_ERR_ELIBEXEC = GPG_ERR_SYSTEM_ERROR | 59, + GPG_ERR_ELIBMAX = GPG_ERR_SYSTEM_ERROR | 60, + GPG_ERR_ELIBSCN = GPG_ERR_SYSTEM_ERROR | 61, + GPG_ERR_ELNRNG = GPG_ERR_SYSTEM_ERROR | 62, + GPG_ERR_ELOOP = GPG_ERR_SYSTEM_ERROR | 63, + GPG_ERR_EMEDIUMTYPE = GPG_ERR_SYSTEM_ERROR | 64, + GPG_ERR_EMFILE = GPG_ERR_SYSTEM_ERROR | 65, + GPG_ERR_EMLINK = GPG_ERR_SYSTEM_ERROR | 66, + GPG_ERR_EMSGSIZE = GPG_ERR_SYSTEM_ERROR | 67, + GPG_ERR_EMULTIHOP = GPG_ERR_SYSTEM_ERROR | 68, + GPG_ERR_ENAMETOOLONG = GPG_ERR_SYSTEM_ERROR | 69, + GPG_ERR_ENAVAIL = GPG_ERR_SYSTEM_ERROR | 70, + GPG_ERR_ENEEDAUTH = GPG_ERR_SYSTEM_ERROR | 71, + GPG_ERR_ENETDOWN = GPG_ERR_SYSTEM_ERROR | 72, + GPG_ERR_ENETRESET = GPG_ERR_SYSTEM_ERROR | 73, + GPG_ERR_ENETUNREACH = GPG_ERR_SYSTEM_ERROR | 74, + GPG_ERR_ENFILE = GPG_ERR_SYSTEM_ERROR | 75, + GPG_ERR_ENOANO = GPG_ERR_SYSTEM_ERROR | 76, + GPG_ERR_ENOBUFS = GPG_ERR_SYSTEM_ERROR | 77, + GPG_ERR_ENOCSI = GPG_ERR_SYSTEM_ERROR | 78, + GPG_ERR_ENODATA = GPG_ERR_SYSTEM_ERROR | 79, + GPG_ERR_ENODEV = GPG_ERR_SYSTEM_ERROR | 80, + GPG_ERR_ENOENT = GPG_ERR_SYSTEM_ERROR | 81, + GPG_ERR_ENOEXEC = GPG_ERR_SYSTEM_ERROR | 82, + GPG_ERR_ENOLCK = GPG_ERR_SYSTEM_ERROR | 83, + GPG_ERR_ENOLINK = GPG_ERR_SYSTEM_ERROR | 84, + GPG_ERR_ENOMEDIUM = GPG_ERR_SYSTEM_ERROR | 85, + GPG_ERR_ENOMEM = GPG_ERR_SYSTEM_ERROR | 86, + GPG_ERR_ENOMSG = GPG_ERR_SYSTEM_ERROR | 87, + GPG_ERR_ENONET = GPG_ERR_SYSTEM_ERROR | 88, + GPG_ERR_ENOPKG = GPG_ERR_SYSTEM_ERROR | 89, + GPG_ERR_ENOPROTOOPT = GPG_ERR_SYSTEM_ERROR | 90, + GPG_ERR_ENOSPC = GPG_ERR_SYSTEM_ERROR | 91, + GPG_ERR_ENOSR = GPG_ERR_SYSTEM_ERROR | 92, + GPG_ERR_ENOSTR = GPG_ERR_SYSTEM_ERROR | 93, + GPG_ERR_ENOSYS = GPG_ERR_SYSTEM_ERROR | 94, + GPG_ERR_ENOTBLK = GPG_ERR_SYSTEM_ERROR | 95, + GPG_ERR_ENOTCONN = GPG_ERR_SYSTEM_ERROR | 96, + GPG_ERR_ENOTDIR = GPG_ERR_SYSTEM_ERROR | 97, + GPG_ERR_ENOTEMPTY = GPG_ERR_SYSTEM_ERROR | 98, + GPG_ERR_ENOTNAM = GPG_ERR_SYSTEM_ERROR | 99, + GPG_ERR_ENOTSOCK = GPG_ERR_SYSTEM_ERROR | 100, + GPG_ERR_ENOTSUP = GPG_ERR_SYSTEM_ERROR | 101, + GPG_ERR_ENOTTY = GPG_ERR_SYSTEM_ERROR | 102, + GPG_ERR_ENOTUNIQ = GPG_ERR_SYSTEM_ERROR | 103, + GPG_ERR_ENXIO = GPG_ERR_SYSTEM_ERROR | 104, + GPG_ERR_EOPNOTSUPP = GPG_ERR_SYSTEM_ERROR | 105, + GPG_ERR_EOVERFLOW = GPG_ERR_SYSTEM_ERROR | 106, + GPG_ERR_EPERM = GPG_ERR_SYSTEM_ERROR | 107, + GPG_ERR_EPFNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 108, + GPG_ERR_EPIPE = GPG_ERR_SYSTEM_ERROR | 109, + GPG_ERR_EPROCLIM = GPG_ERR_SYSTEM_ERROR | 110, + GPG_ERR_EPROCUNAVAIL = GPG_ERR_SYSTEM_ERROR | 111, + GPG_ERR_EPROGMISMATCH = GPG_ERR_SYSTEM_ERROR | 112, + GPG_ERR_EPROGUNAVAIL = GPG_ERR_SYSTEM_ERROR | 113, + GPG_ERR_EPROTO = GPG_ERR_SYSTEM_ERROR | 114, + GPG_ERR_EPROTONOSUPPORT = GPG_ERR_SYSTEM_ERROR | 115, + GPG_ERR_EPROTOTYPE = GPG_ERR_SYSTEM_ERROR | 116, + GPG_ERR_ERANGE = GPG_ERR_SYSTEM_ERROR | 117, + GPG_ERR_EREMCHG = GPG_ERR_SYSTEM_ERROR | 118, + GPG_ERR_EREMOTE = GPG_ERR_SYSTEM_ERROR | 119, + GPG_ERR_EREMOTEIO = GPG_ERR_SYSTEM_ERROR | 120, + GPG_ERR_ERESTART = GPG_ERR_SYSTEM_ERROR | 121, + GPG_ERR_EROFS = GPG_ERR_SYSTEM_ERROR | 122, + GPG_ERR_ERPCMISMATCH = GPG_ERR_SYSTEM_ERROR | 123, + GPG_ERR_ESHUTDOWN = GPG_ERR_SYSTEM_ERROR | 124, + GPG_ERR_ESOCKTNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 125, + GPG_ERR_ESPIPE = GPG_ERR_SYSTEM_ERROR | 126, + GPG_ERR_ESRCH = GPG_ERR_SYSTEM_ERROR | 127, + GPG_ERR_ESRMNT = GPG_ERR_SYSTEM_ERROR | 128, + GPG_ERR_ESTALE = GPG_ERR_SYSTEM_ERROR | 129, + GPG_ERR_ESTRPIPE = GPG_ERR_SYSTEM_ERROR | 130, + GPG_ERR_ETIME = GPG_ERR_SYSTEM_ERROR | 131, + GPG_ERR_ETIMEDOUT = GPG_ERR_SYSTEM_ERROR | 132, + GPG_ERR_ETOOMANYREFS = GPG_ERR_SYSTEM_ERROR | 133, + GPG_ERR_ETXTBSY = GPG_ERR_SYSTEM_ERROR | 134, + GPG_ERR_EUCLEAN = GPG_ERR_SYSTEM_ERROR | 135, + GPG_ERR_EUNATCH = GPG_ERR_SYSTEM_ERROR | 136, + GPG_ERR_EUSERS = GPG_ERR_SYSTEM_ERROR | 137, + GPG_ERR_EWOULDBLOCK = GPG_ERR_SYSTEM_ERROR | 138, + GPG_ERR_EXDEV = GPG_ERR_SYSTEM_ERROR | 139, + GPG_ERR_EXFULL = GPG_ERR_SYSTEM_ERROR | 140, + /* This is one more than the largest allowed entry. */ + GPG_ERR_CODE_DIM = 65536 +/* The error value type gpg_error_t. */ +/* We would really like to use bit-fields in a struct, but using + structs as return values can cause binary compatibility issues, in + particular if you want to do it effeciently (also see + -freg-struct-return option to GCC). */ +typedef unsigned int gpg_error_t; +/* We use the lowest 16 bits of gpg_error_t for error codes. The 16th + bit indicates system errors. */ +#define GPG_ERR_CODE_MASK (GPG_ERR_CODE_DIM - 1) +/* Bits 17 to 24 are reserved. */ +/* We use the upper 7 bits of gpg_error_t for error sources. */ +#define GPG_ERR_SOURCE_MASK (GPG_ERR_SOURCE_DIM - 1) +#define GPG_ERR_SOURCE_SHIFT 24 +/* The highest bit is reserved. It shouldn't be used to prevent + potential negative numbers when transmitting error values as +#undef _GPG_ERR_HAVE_CONSTRUCTOR +#define _GPG_ERR_GCC_VERSION (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100 \ +#if _GPG_ERR_GCC_VERSION > 30100 +#define _GPG_ERR_CONSTRUCTOR __attribute__ ((__constructor__)) +#define _GPG_ERR_HAVE_CONSTRUCTOR +#ifndef _GPG_ERR_CONSTRUCTOR +#define _GPG_ERR_CONSTRUCTOR +/* Initialization function. */ +/* Initialize the library. This function should be run early. */ +gpg_error_t gpg_err_init (void) _GPG_ERR_CONSTRUCTOR; +/* If this is defined, the library is already initialized by the + constructor and does not need to be initialized explicitely. */ +#undef GPG_ERR_INITIALIZED +#ifdef _GPG_ERR_HAVE_CONSTRUCTOR +#define GPG_ERR_INITIALIZED 1 +/* See the source on how to use the deinit function; it is usually not +void gpg_err_deinit (int mode); +/* Constructor and accessor functions. */ +/* Construct an error value from an error code and source. Within a + subsystem, use gpg_error. */ +static GPG_ERR_INLINE gpg_error_t +gpg_err_make (gpg_err_source_t source, gpg_err_code_t code) + return code == GPG_ERR_NO_ERROR ? GPG_ERR_NO_ERROR + : (((source & GPG_ERR_SOURCE_MASK) << GPG_ERR_SOURCE_SHIFT) + | (code & GPG_ERR_CODE_MASK)); +/* The user should define GPG_ERR_SOURCE_DEFAULT before including this + file to specify a default source for gpg_error. */ +#ifndef GPG_ERR_SOURCE_DEFAULT +#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_UNKNOWN +static GPG_ERR_INLINE gpg_error_t +gpg_error (gpg_err_code_t code) + return gpg_err_make (GPG_ERR_SOURCE_DEFAULT, code); +/* Retrieve the error code from an error value. */ +static GPG_ERR_INLINE gpg_err_code_t +gpg_err_code (gpg_error_t err) + return (gpg_err_code_t) (err & GPG_ERR_CODE_MASK); +/* Retrieve the error source from an error value. */ +static GPG_ERR_INLINE gpg_err_source_t +gpg_err_source (gpg_error_t err) + return (gpg_err_source_t) ((err >> GPG_ERR_SOURCE_SHIFT) + & GPG_ERR_SOURCE_MASK); +/* Return a pointer to a string containing a description of the error + code in the error value ERR. This function is not thread-safe. */ +const char *gpg_strerror (gpg_error_t err); +/* Return the error string for ERR in the user-supplied buffer BUF of + size BUFLEN. This function is, in contrast to gpg_strerror, + thread-safe if a thread-safe strerror_r() function is provided by + the system. If the function succeeds, 0 is returned and BUF + contains the string describing the error. If the buffer was not + large enough, ERANGE is returned and BUF contains as much of the + beginning of the error string as fits into the buffer. */ +int gpg_strerror_r (gpg_error_t err, char *buf, size_t buflen); +/* Return a pointer to a string containing a description of the error + source in the error value ERR. */ +const char *gpg_strsource (gpg_error_t err); +/* Mapping of system errors (errno). */ +/* Retrieve the error code for the system error ERR. This returns + GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report +gpg_err_code_t gpg_err_code_from_errno (int err); +/* Retrieve the system error for the error code CODE. This returns 0 + if CODE is not a system error code. */ +int gpg_err_code_to_errno (gpg_err_code_t code); +/* Retrieve the error code directly from the ERRNO variable. This + returns GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped + (report this) and GPG_ERR_MISSING_ERRNO if ERRNO has the value 0. */ +gpg_err_code_t gpg_err_code_from_syserror (void); +/* Set the ERRNO variable. This function is the preferred way to set + ERRNO due to peculiarities on WindowsCE. */ +void gpg_err_set_errno (int err); +/* Self-documenting convenience functions. */ +static GPG_ERR_INLINE gpg_error_t +gpg_err_make_from_errno (gpg_err_source_t source, int err) + return gpg_err_make (source, gpg_err_code_from_errno (err)); +static GPG_ERR_INLINE gpg_error_t +gpg_error_from_errno (int err) + return gpg_error (gpg_err_code_from_errno (err)); +static GPG_ERR_INLINE gpg_error_t +gpg_error_from_syserror (void) + return gpg_error (gpg_err_code_from_syserror ()); +#endif /* GPG_ERROR_H */ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libgpgerror.framework/Versions/1.10/Resources/English.lproj/InfoPlist.strings Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,3 @@
+/* Localized versions of Info.plist keys */ +CFBundleName = "libgpgerror"; Binary file Frameworks/libgpgerror.framework/Versions/1.10/Resources/Info.plist has changed
Binary file Frameworks/libgpgerror.framework/Versions/1.10/libgpgerror has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libgpgerror.framework/Versions/Current Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,1 @@
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libgpgerror.framework/libgpgerror Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,1 @@
+Versions/1.10/libgpgerror \ No newline at end of file
--- a/Frameworks/libotr.framework/Headers Thu Sep 06 00:17:15 2012 +0200
+++ b/Frameworks/libotr.framework/Headers Thu Sep 06 21:09:12 2012 +0200
@@ -1,1 +1,1 @@
\ No newline at end of file
\ No newline at end of file
--- a/Frameworks/libotr.framework/Resources Thu Sep 06 00:17:15 2012 +0200
+++ b/Frameworks/libotr.framework/Resources Thu Sep 06 21:09:12 2012 +0200
@@ -1,1 +1,1 @@
-Versions/2.2.0/Resources
\ No newline at end of file
+Versions/3.2.1/Resources \ No newline at end of file
--- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/auth.h Thu Sep 06 00:17:15 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
- * Off-the-Record Messaging library
- * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- OTRL_AUTHSTATE_AWAITING_DHKEY,
- OTRL_AUTHSTATE_AWAITING_REVEALSIG,
- OTRL_AUTHSTATE_AWAITING_SIG,
- OTRL_AUTHSTATE_V1_SETUP
- OtrlAuthState authstate; /* Our state */
- DH_keypair our_dh; /* Our D-H key */
- unsigned int our_keyid; /* ...and its keyid */
- unsigned char *encgx; /* The encrypted value of g^x */
- size_t encgx_len; /* ...and its length */
- unsigned char r[16]; /* The encryption key */
- unsigned char hashgx[32]; /* SHA256(g^x) */
- gcry_mpi_t their_pub; /* Their D-H public key */
- unsigned int their_keyid; /* ...and its keyid */
- gcry_cipher_hd_t enc_c, enc_cp; /* c and c' encryption keys */
- gcry_md_hd_t mac_m1, mac_m1p; /* m1 and m1' MAC keys */
- gcry_md_hd_t mac_m2, mac_m2p; /* m2 and m2' MAC keys */
- unsigned char their_fingerprint[20]; /* The fingerprint of their
- long-term signing key */
- int initiated; /* Did we initiate this
- unsigned int protocol_version; /* The protocol version number
- used to authenticate. */
- unsigned char secure_session_id[20]; /* The secure session id */
- size_t secure_session_id_len; /* And its actual length,
- which may be either 20 (for
- OtrlSessionIdHalf session_id_half; /* Which half of the session
- id gets shown in bold */
- char *lastauthmsg; /* The last auth message
- (base-64 encoded) we sent,
- * Initialize the fields of an OtrlAuthInfo (already allocated).
-void otrl_auth_new(OtrlAuthInfo *auth);
- * Clear the fields of an OtrlAuthInfo (but leave it allocated).
-void otrl_auth_clear(OtrlAuthInfo *auth);
- * Start a fresh AKE (version 2) using the given OtrlAuthInfo. Generate
- * a fresh DH keypair to use. If no error is returned, the message to
- * transmit will be contained in auth->lastauthmsg.
-gcry_error_t otrl_auth_start_v2(OtrlAuthInfo *auth);
- * Handle an incoming D-H Commit Message. If no error is returned, the
- * message to send will be left in auth->lastauthmsg. Generate a fresh
-gcry_error_t otrl_auth_handle_commit(OtrlAuthInfo *auth,
- const char *commitmsg);
- * Handle an incoming D-H Key Message. If no error is returned, and
- * *havemsgp is 1, the message to sent will be left in auth->lastauthmsg.
- * Use the given private authentication key to sign messages.
-gcry_error_t otrl_auth_handle_key(OtrlAuthInfo *auth, const char *keymsg,
- int *havemsgp, OtrlPrivKey *privkey);
- * Handle an incoming Reveal Signature Message. If no error is
- * returned, and *havemsgp is 1, the message to be sent will be left in
- * auth->lastauthmsg. Use the given private authentication key to sign
- * messages. Call the auth_succeeded callback if authentication is
-gcry_error_t otrl_auth_handle_revealsig(OtrlAuthInfo *auth,
- const char *revealmsg, int *havemsgp, OtrlPrivKey *privkey,
- gcry_error_t (*auth_succeeded)(const OtrlAuthInfo *auth, void *asdata),
- * Handle an incoming Signature Message. If no error is returned, and
- * *havemsgp is 1, the message to be sent will be left in
- * auth->lastauthmsg. Call the auth_succeeded callback if
- * authentication is successful.
-gcry_error_t otrl_auth_handle_signature(OtrlAuthInfo *auth,
- const char *sigmsg, int *havemsgp,
- gcry_error_t (*auth_succeeded)(const OtrlAuthInfo *auth, void *asdata),
- * Start a fresh AKE (version 1) using the given OtrlAuthInfo. If
- * our_dh is NULL, generate a fresh DH keypair to use. Otherwise, use a
- * copy of the one passed (with the given keyid). Use the given private
- * key to sign the message. If no error is returned, the message to
- * transmit will be contained in auth->lastauthmsg.
-gcry_error_t otrl_auth_start_v1(OtrlAuthInfo *auth, DH_keypair *our_dh,
- unsigned int our_keyid, OtrlPrivKey *privkey);
- * Handle an incoming v1 Key Exchange Message. If no error is returned,
- * and *havemsgp is 1, the message to be sent will be left in
- * auth->lastauthmsg. Use the given private authentication key to sign
- * messages. Call the auth_secceeded callback if authentication is
- * successful. If non-NULL, use a copy of the given D-H keypair, with
-gcry_error_t otrl_auth_handle_v1_key_exchange(OtrlAuthInfo *auth,
- const char *keyexchmsg, int *havemsgp, OtrlPrivKey *privkey,
- DH_keypair *our_dh, unsigned int our_keyid,
- gcry_error_t (*auth_succeeded)(const OtrlAuthInfo *auth, void *asdata),
--- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/b64.h Thu Sep 06 00:17:15 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
- * Off-the-Record Messaging library
- * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * base64 encode data. Insert no linebreaks or whitespace.
- * The buffer base64data must contain at least ((datalen+2)/3)*4 bytes of
- * space. This function will return the number of bytes actually used.
-size_t otrl_base64_encode(char *base64data, const unsigned char *data,
- * base64 decode data. Skip non-base64 chars, and terminate at the
- * first '=', or the end of the buffer.
- * The buffer data must contain at least (base64len / 4) * 3 bytes of
- * space. This function will return the number of bytes actually used.
-size_t otrl_base64_decode(unsigned char *data, const char *base64data,
- * Base64-encode a block of data, stick "?OTR:" and "." around it, and
- * return the result, or NULL in the event of a memory error.
-char *otrl_base64_otr_encode(const unsigned char *buf, size_t buflen);
- * Base64-decode the portion of the given message between "?OTR:" and
- * ".". Set *bufp to the decoded data, and set *lenp to its length.
- * The caller must free() the result. Return 0 on success, -1 on a
- * memory error, or -2 on invalid input.
-int otrl_base64_otr_decode(const char *msg, unsigned char **bufp,
--- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/context.h Thu Sep 06 00:17:15 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,179 +0,0 @@
- * Off-the-Record Messaging library
- * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- OTRL_MSGSTATE_PLAINTEXT, /* Not yet started an encrypted
- OTRL_MSGSTATE_ENCRYPTED, /* Currently in an encrypted
- OTRL_MSGSTATE_FINISHED /* The remote side has sent us a
- notification that he has ended
- his end of the encrypted
- conversation; prevent any
- further messages from being
-typedef struct s_fingerprint {
- struct s_fingerprint *next; /* The next fingerprint in the list */
- struct s_fingerprint **tous; /* A pointer to the pointer to us */
- unsigned char *fingerprint; /* The fingerprint, or NULL */
- struct context *context; /* The context to which we belong */
- char *trust; /* The trust level of the fingerprint */
-typedef struct context {
- struct context * next; /* Linked list pointer */
- struct context ** tous; /* A pointer to the pointer to us */
- char * username; /* The user this context is for */
- char * accountname; /* The username is relative to
- char * protocol; /* ... and this protocol */
- char *fragment; /* The part of the fragmented message
- size_t fragment_len; /* The length of fragment */
- unsigned short fragment_n; /* The total number of fragments
- unsigned short fragment_k; /* The highest fragment number
- we've seen so far for this
- OtrlMessageState msgstate; /* The state of message disposition
- OtrlAuthInfo auth; /* The state of ongoing
- authentication with this user */
- Fingerprint fingerprint_root; /* The root of a linked list of
- Fingerprints entries */
- Fingerprint *active_fingerprint; /* Which fingerprint is in use now?
- A pointer into the above list */
- unsigned int their_keyid; /* current keyid used by other side;
- this is set to 0 if we get a
- OTRL_TLV_DISCONNECTED message from
- gcry_mpi_t their_y; /* Y[their_keyid] (their DH pubkey) */
- gcry_mpi_t their_old_y; /* Y[their_keyid-1] (their prev DH
- unsigned int our_keyid; /* current keyid used by us */
- DH_keypair our_dh_key; /* DH key[our_keyid] */
- DH_keypair our_old_dh_key; /* DH key[our_keyid-1] */
- DH_sesskeys sesskeys[2][2]; /* sesskeys[i][j] are the session keys
- derived from DH key[our_keyid-i]
- and mpi Y[their_keyid-j] */
- unsigned char sessionid[20]; /* The sessionid and bold half */
- size_t sessionid_len; /* determined when this private */
- OtrlSessionIdHalf sessionid_half; /* connection was established. */
- unsigned int protocol_version; /* The version of OTR in use */
- unsigned char *preshared_secret; /* A secret you share with this
- size_t preshared_secret_len; /* The length of the above secret. */
- /* saved mac keys to be revealed later */
- unsigned int numsavedkeys;
- unsigned char *saved_mac_keys;
- /* generation number: increment every time we go private, and never
- * reset to 0 (unless we remove the context entirely) */
- unsigned int generation;
- time_t lastsent; /* The last time a Data Message was sent */
- char *lastmessage; /* The plaintext of the last Data Message sent */
- int may_retransmit; /* Is the last message eligible for
- } otr_offer; /* Has this correspondent repsponded to our
- /* Application data to be associated with this context */
- /* A function to free the above data when we forget this context */
- void (*app_data_free)(void *);
- OtrlSMState *smstate; /* The state of the current
- socialist millionaires exchange */
-/* Look up a connection context by name/account/protocol from the given
- * OtrlUserState. If add_if_missing is true, allocate and return a new
- * context if one does not currently exist. In that event, call
- * add_app_data(data, context) so that app_data and app_data_free can be
- * filled in by the application, and set *addedp to 1. */
-ConnContext * otrl_context_find(OtrlUserState us, const char *user,
- const char *accountname, const char *protocol, int add_if_missing,
- void (*add_app_data)(void *data, ConnContext *context), void *data);
-/* Find a fingerprint in a given context, perhaps adding it if not
-Fingerprint *otrl_context_find_fingerprint(ConnContext *context,
- unsigned char fingerprint[20], int add_if_missing, int *addedp);
-/* Set the trust level for a given fingerprint */
-void otrl_context_set_trust(Fingerprint *fprint, const char *trust);
-/* Set the preshared secret for a given fingerprint. Note that this
- * currently only stores the secret in the ConnContext structure, but
- * doesn't yet do anything with it. */
-void otrl_context_set_preshared_secret(ConnContext *context,
- const unsigned char *secret, size_t secret_len);
-/* Force a context into the OTRL_MSGSTATE_FINISHED state. */
-void otrl_context_force_finished(ConnContext *context);
-/* Force a context into the OTRL_MSGSTATE_PLAINTEXT state. */
-void otrl_context_force_plaintext(ConnContext *context);
-/* Forget a fingerprint (so long as it's not the active one. If it's a
- * fingerprint_root, forget the whole context (as long as
- * and_maybe_context is set, and it's PLAINTEXT). Also, if it's not
- * the fingerprint_root, but it's the only fingerprint, and we're
- * PLAINTEXT, forget the whole context if and_maybe_context is set. */
-void otrl_context_forget_fingerprint(Fingerprint *fprint,
- int and_maybe_context);
-/* Forget a whole context, so long as it's PLAINTEXT. */
-void otrl_context_forget(ConnContext *context);
-/* Forget all the contexts in a given OtrlUserState. */
-void otrl_context_forget_all(OtrlUserState us);
--- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/dh.h Thu Sep 06 00:17:15 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
- * Off-the-Record Messaging library
- * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#define DH1536_GROUP_ID 5
-/* Which half of the secure session id should be shown in bold? */
- OTRL_SESSIONID_FIRST_HALF_BOLD,
- OTRL_SESSIONID_SECOND_HALF_BOLD
- unsigned char sendctr[16];
- unsigned char rcvctr[16];
- gcry_cipher_hd_t sendenc;
- gcry_cipher_hd_t rcvenc;
- unsigned char sendmackey[20];
- unsigned char rcvmackey[20];
- * Call this once, at plugin load time. It sets up the modulus and
-void otrl_dh_init(void);
- * Initialize the fields of a DH keypair.
-void otrl_dh_keypair_init(DH_keypair *kp);
-void otrl_dh_keypair_copy(DH_keypair *dst, const DH_keypair *src);
- * Deallocate the contents of a DH_keypair (but not the DH_keypair
-void otrl_dh_keypair_free(DH_keypair *kp);
- * Generate a DH keypair for a specified group.
-gcry_error_t otrl_dh_gen_keypair(unsigned int groupid, DH_keypair *kp);
- * Construct session keys from a DH keypair and someone else's public
-gcry_error_t otrl_dh_session(DH_sesskeys *sess, const DH_keypair *kp,
- * Compute the secure session id, two encryption keys, and four MAC keys
- * given our DH key and their DH public key.
-gcry_error_t otrl_dh_compute_v2_auth_keys(const DH_keypair *our_dh,
- gcry_mpi_t their_pub, unsigned char *sessionid, size_t *sessionidlenp,
- gcry_cipher_hd_t *enc_c, gcry_cipher_hd_t *enc_cp,
- gcry_md_hd_t *mac_m1, gcry_md_hd_t *mac_m1p,
- gcry_md_hd_t *mac_m2, gcry_md_hd_t *mac_m2p);
- * Compute the secure session id, given our DH key and their DH public
-gcry_error_t otrl_dh_compute_v1_session_id(const DH_keypair *our_dh,
- gcry_mpi_t their_pub, unsigned char *sessionid, size_t *sessionidlenp,
- OtrlSessionIdHalf *halfp);
- * Deallocate the contents of a DH_sesskeys (but not the DH_sesskeys
-void otrl_dh_session_free(DH_sesskeys *sess);
- * Blank out the contents of a DH_sesskeys (without releasing it)
-void otrl_dh_session_blank(DH_sesskeys *sess);
-/* Increment the top half of a counter block */
-void otrl_dh_incctr(unsigned char *ctr);
-/* Compare two counter values (8 bytes each). Return 0 if ctr1 == ctr2,
- * < 0 if ctr1 < ctr2 (as unsigned 64-bit values), > 0 if ctr1 > ctr2. */
-int otrl_dh_cmpctr(const unsigned char *ctr1, const unsigned char *ctr2);
--- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/gcrypt-module.h Thu Sep 06 00:17:15 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,233 +0,0 @@
-/* gcrypt-module.h - GNU Cryptographic Library Interface
- Copyright (C) 2003, 2007 Free Software Foundation, Inc.
- This file is part of Libgcrypt.
- Libgcrypt is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
- Libgcrypt is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
- This file contains the necessary declarations/definitions for
- working with Libgcrypt modules.
-#ifndef _GCRYPT_MODULE_H
-#define _GCRYPT_MODULE_H
-#if 0 /* keep Emacsens's auto-indent happy */
-/* The interfaces using the module system reserve a certain range of
- IDs for application use. These IDs are not valid within Libgcrypt
- but Libgcrypt makes sure never to allocate such a module ID. */
-#define GCRY_MODULE_ID_USER 1024
-#define GCRY_MODULE_ID_USER_LAST 4095
-/* This type represents a `module'. */
-typedef struct gcry_module *gcry_module_t;
-/* Check that the library fulfills the version requirement. */
-/* Type for the cipher_setkey function. */
-typedef gcry_err_code_t (*gcry_cipher_setkey_t) (void *c,
- const unsigned char *key,
-/* Type for the cipher_encrypt function. */
-typedef void (*gcry_cipher_encrypt_t) (void *c,
- const unsigned char *inbuf);
-/* Type for the cipher_decrypt function. */
-typedef void (*gcry_cipher_decrypt_t) (void *c,
- const unsigned char *inbuf);
-/* Type for the cipher_stencrypt function. */
-typedef void (*gcry_cipher_stencrypt_t) (void *c,
- const unsigned char *inbuf,
-/* Type for the cipher_stdecrypt function. */
-typedef void (*gcry_cipher_stdecrypt_t) (void *c,
- const unsigned char *inbuf,
-typedef struct gcry_cipher_oid_spec
-} gcry_cipher_oid_spec_t;
-/* Module specification structure for ciphers. */
-typedef struct gcry_cipher_spec
- gcry_cipher_oid_spec_t *oids;
- gcry_cipher_setkey_t setkey;
- gcry_cipher_encrypt_t encrypt;
- gcry_cipher_decrypt_t decrypt;
- gcry_cipher_stencrypt_t stencrypt;
- gcry_cipher_stdecrypt_t stdecrypt;
-/* Register a new cipher module whose specification can be found in
- CIPHER. On success, a new algorithm ID is stored in ALGORITHM_ID
- and a pointer representing this module is stored in MODULE. */
-gcry_error_t gcry_cipher_register (gcry_cipher_spec_t *cipher,
- gcry_module_t *module);
-/* Unregister the cipher identified by MODULE, which must have been
- registered with gcry_cipher_register. */
-void gcry_cipher_unregister (gcry_module_t module);
-/* ********************** */
-/* Type for the pk_generate function. */
-typedef gcry_err_code_t (*gcry_pk_generate_t) (int algo,
- gcry_mpi_t **retfactors);
-/* Type for the pk_check_secret_key function. */
-typedef gcry_err_code_t (*gcry_pk_check_secret_key_t) (int algo,
-/* Type for the pk_encrypt function. */
-typedef gcry_err_code_t (*gcry_pk_encrypt_t) (int algo,
-/* Type for the pk_decrypt function. */
-typedef gcry_err_code_t (*gcry_pk_decrypt_t) (int algo,
-/* Type for the pk_sign function. */
-typedef gcry_err_code_t (*gcry_pk_sign_t) (int algo,
-/* Type for the pk_verify function. */
-typedef gcry_err_code_t (*gcry_pk_verify_t) (int algo,
- int (*cmp) (void *, gcry_mpi_t),
-/* Type for the pk_get_nbits function. */
-typedef unsigned (*gcry_pk_get_nbits_t) (int algo, gcry_mpi_t *pkey);
-/* Module specification structure for message digests. */
-typedef struct gcry_pk_spec
- const char *elements_pkey;
- const char *elements_skey;
- const char *elements_enc;
- const char *elements_sig;
- const char *elements_grip;
- gcry_pk_generate_t generate;
- gcry_pk_check_secret_key_t check_secret_key;
- gcry_pk_encrypt_t encrypt;
- gcry_pk_decrypt_t decrypt;
- gcry_pk_verify_t verify;
- gcry_pk_get_nbits_t get_nbits;
-/* Register a new pubkey module whose specification can be found in
- PUBKEY. On success, a new algorithm ID is stored in ALGORITHM_ID
- and a pointer representhing this module is stored in MODULE. */
-gcry_error_t gcry_pk_register (gcry_pk_spec_t *pubkey,
- unsigned int *algorithm_id,
- gcry_module_t *module);
-/* Unregister the pubkey identified by ID, which must have been
- registered with gcry_pk_register. */
-void gcry_pk_unregister (gcry_module_t module);
-/* ********************** */
-/* Type for the md_init function. */
-typedef void (*gcry_md_init_t) (void *c);
-/* Type for the md_write function. */
-typedef void (*gcry_md_write_t) (void *c, const void *buf, size_t nbytes);
-/* Type for the md_final function. */
-typedef void (*gcry_md_final_t) (void *c);
-/* Type for the md_read function. */
-typedef unsigned char *(*gcry_md_read_t) (void *c);
-typedef struct gcry_md_oid_spec
-/* Module specification structure for message digests. */
-typedef struct gcry_md_spec
- gcry_md_oid_spec_t *oids;
- size_t contextsize; /* allocate this amount of context */
-/* Register a new digest module whose specification can be found in
- DIGEST. On success, a new algorithm ID is stored in ALGORITHM_ID
- and a pointer representhing this module is stored in MODULE. */
-gcry_error_t gcry_md_register (gcry_md_spec_t *digest,
- unsigned int *algorithm_id,
- gcry_module_t *module);
-/* Unregister the digest identified by ID, which must have been
- registered with gcry_digest_register. */
-void gcry_md_unregister (gcry_module_t module);
-#if 0 /* keep Emacsens's auto-indent happy */
--- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/gcrypt.h Thu Sep 06 00:17:15 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1831 +0,0 @@
-/* gcrypt.h - GNU Cryptographic Library Interface -*- c -*-
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006
- 2007, 2008, 2009 Free Software Foundation, Inc.
- This file is part of Libgcrypt.
- Libgcrypt is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
- Libgcrypt is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
- File: src/gcrypt.h. Generated from gcrypt.h.in by configure. */
-#if defined _WIN32 || defined __WIN32__
-# include <sys/socket.h>
-typedef socklen_t gcry_socklen_t;
-/* This is required for error code compatibility. */
-#define _GCRY_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GCRYPT
-#if 0 /* (Keep Emacsens' auto-indent happy.) */
-/* The version of this header should match the one of the library. It
- should not be used by a program because gcry_check_version() should
- return the same version. The purpose of this macro is to let
- autoconf (using the AM_PATH_GCRYPT macro) check that this header
- matches the installed library. */
-#define GCRYPT_VERSION "1.4.4"
-/* Internal: We can't use the convenience macros for the multi
- precision integer functions when building this library. */
-#ifdef _GCRYPT_IN_LIBGCRYPT
-#ifndef GCRYPT_NO_MPI_MACROS
-#define GCRYPT_NO_MPI_MACROS 1
-/* We want to use gcc attributes when possible. Warning: Don't use
- these macros in your programs: As indicated by the leading
- underscore they are subject to change without notice. */
-#define _GCRY_GCC_VERSION (__GNUC__ * 10000 \
- + __GNUC_MINOR__ * 100 \
-#if _GCRY_GCC_VERSION >= 30100
-#define _GCRY_GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__))
-#if _GCRY_GCC_VERSION >= 29600
-#define _GCRY_GCC_ATTR_PURE __attribute__ ((__pure__))
-#if _GCRY_GCC_VERSION >= 30200
-#define _GCRY_GCC_ATTR_MALLOC __attribute__ ((__malloc__))
-#ifndef _GCRY_GCC_ATTR_DEPRECATED
-#define _GCRY_GCC_ATTR_DEPRECATED
-#ifndef _GCRY_GCC_ATTR_PURE
-#define _GCRY_GCC_ATTR_PURE
-#ifndef _GCRY_GCC_ATTR_MALLOC
-#define _GCRY_GCC_ATTR_MALLOC
-/* Some members in a public type should only be used internally.
- There is no "internal" attribute, so we abuse the deprecated
- attribute to discourage external use. */
-#ifdef _GCRYPT_IN_LIBGCRYPT
-#define _GCRY_ATTR_INTERNAL
-#define _GCRY_ATTR_INTERNAL _GCRY_GCC_ATTR_DEPRECATED
-/* Wrappers for the libgpg-error library. */
-typedef gpg_error_t gcry_error_t;
-typedef gpg_err_code_t gcry_err_code_t;
-typedef gpg_err_source_t gcry_err_source_t;
-static GPG_ERR_INLINE gcry_error_t
-gcry_err_make (gcry_err_source_t source, gcry_err_code_t code)
- return gpg_err_make (source, code);
-/* The user can define GPG_ERR_SOURCE_DEFAULT before including this
- file to specify a default source for gpg_error. */
-#ifndef GCRY_ERR_SOURCE_DEFAULT
-#define GCRY_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_USER_1
-static GPG_ERR_INLINE gcry_error_t
-gcry_error (gcry_err_code_t code)
- return gcry_err_make (GCRY_ERR_SOURCE_DEFAULT, code);
-static GPG_ERR_INLINE gcry_err_code_t
-gcry_err_code (gcry_error_t err)
- return gpg_err_code (err);
-static GPG_ERR_INLINE gcry_err_source_t
-gcry_err_source (gcry_error_t err)
- return gpg_err_source (err);
-/* Return a pointer to a string containing a description of the error
- code in the error value ERR. */
-const char *gcry_strerror (gcry_error_t err);
-/* Return a pointer to a string containing a description of the error
- source in the error value ERR. */
-const char *gcry_strsource (gcry_error_t err);
-/* Retrieve the error code for the system error ERR. This returns
- GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
-gcry_err_code_t gcry_err_code_from_errno (int err);
-/* Retrieve the system error for the error code CODE. This returns 0
- if CODE is not a system error code. */
-int gcry_err_code_to_errno (gcry_err_code_t code);
-/* Return an error value with the error source SOURCE and the system
-gcry_error_t gcry_err_make_from_errno (gcry_err_source_t source, int err);
-/* Return an error value with the system error ERR. */
-gcry_err_code_t gcry_error_from_errno (int err);
-/* This enum is deprecated; it is only declared for the sake of
- complete API compatibility. */
- _GCRY_THREAD_OPTION_DUMMY
- } _GCRY_GCC_ATTR_DEPRECATED;
-/* Constants defining the thread model to use. Used with the OPTION
- field of the struct gcry_thread_cbs. */
-#define GCRY_THREAD_OPTION_DEFAULT 0
-#define GCRY_THREAD_OPTION_USER 1
-#define GCRY_THREAD_OPTION_PTH 2
-#define GCRY_THREAD_OPTION_PTHREAD 3
-/* The version number encoded in the OPTION field of the struct
-#define GCRY_THREAD_OPTION_VERSION 0
-/* Wrapper for struct ath_ops. */
- /* The OPTION field encodes the thread model and the version number
- Bits 7 - 0 are used for the thread model
- Bits 15 - 8 are used for the version number.
- int (*mutex_init) (void **priv);
- int (*mutex_destroy) (void **priv);
- int (*mutex_lock) (void **priv);
- int (*mutex_unlock) (void **priv);
- ssize_t (*read) (int fd, void *buf, size_t nbytes);
- ssize_t (*write) (int fd, const void *buf, size_t nbytes);
- ssize_t (*select) (int nfd, void *rset, void *wset, void *eset,
- struct timeval *timeout);
- ssize_t (*waitpid) (pid_t pid, int *status, int options);
- int (*accept) (int s, void *addr, int *length_ptr);
- int (*connect) (int s, void *addr, gcry_socklen_t length);
- int (*sendmsg) (int s, const void *msg, int flags);
- int (*recvmsg) (int s, void *msg, int flags);
- ssize_t (*select) (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
- struct timeval *timeout);
- ssize_t (*waitpid) (pid_t pid, int *status, int options);
- int (*accept) (int s, struct sockaddr *addr, gcry_socklen_t *length_ptr);
- int (*connect) (int s, struct sockaddr *addr, gcry_socklen_t length);
- int (*sendmsg) (int s, const struct msghdr *msg, int flags);
- int (*recvmsg) (int s, struct msghdr *msg, int flags);
-# define _GCRY_THREAD_OPTION_PTH_IMPL_NET \
-static ssize_t gcry_pth_select (int nfd, void *rset, void *wset, \
- void *eset, struct timeval *timeout) \
- { return pth_select (nfd, rset, wset, eset, timeout); } \
-static ssize_t gcry_pth_waitpid (pid_t pid, int *status, int options) \
- { return pth_waitpid (pid, status, options); } \
-static int gcry_pth_accept (int s, void *addr, \
- gcry_socklen_t *length_ptr) \
- { return pth_accept (s, addr, length_ptr); } \
-static int gcry_pth_connect (int s, void *addr, \
- gcry_socklen_t length) \
- { return pth_connect (s, addr, length); }
-# define _GCRY_THREAD_OPTION_PTH_IMPL_NET \
-static ssize_t gcry_pth_select (int nfd, fd_set *rset, fd_set *wset, \
- fd_set *eset, struct timeval *timeout) \
- { return pth_select (nfd, rset, wset, eset, timeout); } \
-static ssize_t gcry_pth_waitpid (pid_t pid, int *status, int options) \
- { return pth_waitpid (pid, status, options); } \
-static int gcry_pth_accept (int s, struct sockaddr *addr, \
- gcry_socklen_t *length_ptr) \
- { return pth_accept (s, addr, length_ptr); } \
-static int gcry_pth_connect (int s, struct sockaddr *addr, \
- gcry_socklen_t length) \
- { return pth_connect (s, addr, length); }
-#define GCRY_THREAD_OPTION_PTH_IMPL \
-static int gcry_pth_init (void) \
-{ return (pth_init () == FALSE) ? errno : 0; } \
-static int gcry_pth_mutex_init (void **priv) \
- pth_mutex_t *lock = malloc (sizeof (pth_mutex_t)); \
- err = pth_mutex_init (lock); \
-static int gcry_pth_mutex_destroy (void **lock) \
- { /* GNU Pth has no destructor function. */ free (*lock); return 0; } \
-static int gcry_pth_mutex_lock (void **lock) \
- { return ((pth_mutex_acquire (*lock, 0, NULL)) == FALSE) \
-static int gcry_pth_mutex_unlock (void **lock) \
- { return ((pth_mutex_release (*lock)) == FALSE) \
-static ssize_t gcry_pth_read (int fd, void *buf, size_t nbytes) \
- { return pth_read (fd, buf, nbytes); } \
-static ssize_t gcry_pth_write (int fd, const void *buf, size_t nbytes) \
- { return pth_write (fd, buf, nbytes); } \
-_GCRY_THREAD_OPTION_PTH_IMPL_NET \
-/* Note: GNU Pth is missing pth_sendmsg and pth_recvmsg. */ \
-static struct gcry_thread_cbs gcry_threads_pth = { \
- (GCRY_THREAD_OPTION_PTH | (GCRY_THREAD_OPTION_VERSION << 8)), \
- gcry_pth_init, gcry_pth_mutex_init, gcry_pth_mutex_destroy, \
- gcry_pth_mutex_lock, gcry_pth_mutex_unlock, gcry_pth_read, gcry_pth_write, \
- gcry_pth_select, gcry_pth_waitpid, gcry_pth_accept, gcry_pth_connect, \
-#define GCRY_THREAD_OPTION_PTHREAD_IMPL \
-static int gcry_pthread_mutex_init (void **priv) \
- pthread_mutex_t *lock = (pthread_mutex_t*)malloc (sizeof (pthread_mutex_t));\
- err = pthread_mutex_init (lock, NULL); \
-static int gcry_pthread_mutex_destroy (void **lock) \
- { int err = pthread_mutex_destroy ((pthread_mutex_t*)*lock); \
- free (*lock); return err; } \
-static int gcry_pthread_mutex_lock (void **lock) \
- { return pthread_mutex_lock ((pthread_mutex_t*)*lock); } \
-static int gcry_pthread_mutex_unlock (void **lock) \
- { return pthread_mutex_unlock ((pthread_mutex_t*)*lock); } \
-static struct gcry_thread_cbs gcry_threads_pthread = { \
- (GCRY_THREAD_OPTION_PTHREAD | (GCRY_THREAD_OPTION_VERSION << 8)), \
- NULL, gcry_pthread_mutex_init, gcry_pthread_mutex_destroy, \
- gcry_pthread_mutex_lock, gcry_pthread_mutex_unlock, \
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
-/* The data object used to hold a multi precision integer. */
-typedef struct gcry_mpi *gcry_mpi_t;
-#ifndef GCRYPT_NO_DEPRECATED
-typedef struct gcry_mpi *GCRY_MPI _GCRY_GCC_ATTR_DEPRECATED;
-typedef struct gcry_mpi *GcryMPI _GCRY_GCC_ATTR_DEPRECATED;
-/* Check that the library fulfills the version requirement. */
-const char *gcry_check_version (const char *req_version);
-/* Codes for function dispatchers. */
-/* Codes used with the gcry_control function. */
- GCRYCTL_RESET = 4, /* e.g. for MDs */
- GCRYCTL_GET_KEYLEN = 6,
- GCRYCTL_GET_BLKLEN = 7,
- GCRYCTL_GET_ASNOID = 10,
- GCRYCTL_ENABLE_ALGO = 11,
- GCRYCTL_DISABLE_ALGO = 12,
- GCRYCTL_DUMP_RANDOM_STATS = 13,
- GCRYCTL_DUMP_SECMEM_STATS = 14,
- GCRYCTL_GET_ALGO_NPKEY = 15,
- GCRYCTL_GET_ALGO_NSKEY = 16,
- GCRYCTL_GET_ALGO_NSIGN = 17,
- GCRYCTL_GET_ALGO_NENCR = 18,
- GCRYCTL_SET_VERBOSITY = 19,
- GCRYCTL_SET_DEBUG_FLAGS = 20,
- GCRYCTL_CLEAR_DEBUG_FLAGS = 21,
- GCRYCTL_USE_SECURE_RNDPOOL= 22,
- GCRYCTL_DUMP_MEMORY_STATS = 23,
- GCRYCTL_INIT_SECMEM = 24,
- GCRYCTL_TERM_SECMEM = 25,
- GCRYCTL_DISABLE_SECMEM_WARN = 27,
- GCRYCTL_SUSPEND_SECMEM_WARN = 28,
- GCRYCTL_RESUME_SECMEM_WARN = 29,
- GCRYCTL_DROP_PRIVS = 30,
- GCRYCTL_ENABLE_M_GUARD = 31,
- GCRYCTL_START_DUMP = 32,
- GCRYCTL_STOP_DUMP = 33,
- GCRYCTL_GET_ALGO_USAGE = 34,
- GCRYCTL_IS_ALGO_ENABLED = 35,
- GCRYCTL_DISABLE_INTERNAL_LOCKING = 36,
- GCRYCTL_DISABLE_SECMEM = 37,
- GCRYCTL_INITIALIZATION_FINISHED = 38,
- GCRYCTL_INITIALIZATION_FINISHED_P = 39,
- GCRYCTL_ANY_INITIALIZATION_P = 40,
- GCRYCTL_SET_CBC_CTS = 41,
- GCRYCTL_SET_CBC_MAC = 42,
- GCRYCTL_ENABLE_QUICK_RANDOM = 44,
- GCRYCTL_SET_RANDOM_SEED_FILE = 45,
- GCRYCTL_UPDATE_RANDOM_SEED_FILE = 46,
- GCRYCTL_SET_THREAD_CBS = 47,
- GCRYCTL_FAST_POLL = 48,
- GCRYCTL_SET_RANDOM_DAEMON_SOCKET = 49,
- GCRYCTL_USE_RANDOM_DAEMON = 50,
- GCRYCTL_FAKED_RANDOM_P = 51,
- GCRYCTL_SET_RNDEGD_SOCKET = 52,
- GCRYCTL_PRINT_CONFIG = 53,
- GCRYCTL_OPERATIONAL_P = 54,
- GCRYCTL_FIPS_MODE_P = 55,
- GCRYCTL_FORCE_FIPS_MODE = 56,
- /* Note: 58 .. 62 are used internally. */
-/* Perform various operations defined by CMD. */
-gcry_error_t gcry_control (enum gcry_ctl_cmds CMD, ...);
-/* S-expression management. */
-/* The object to represent an S-expression as used with the public key
-typedef struct gcry_sexp *gcry_sexp_t;
-#ifndef GCRYPT_NO_DEPRECATED
-typedef struct gcry_sexp *GCRY_SEXP _GCRY_GCC_ATTR_DEPRECATED;
-typedef struct gcry_sexp *GcrySexp _GCRY_GCC_ATTR_DEPRECATED;
-/* The possible values for the S-expression format. */
- GCRYSEXP_FMT_DEFAULT = 0,
- GCRYSEXP_FMT_CANON = 1,
- GCRYSEXP_FMT_BASE64 = 2,
- GCRYSEXP_FMT_ADVANCED = 3
-/* Create an new S-expression object from BUFFER of size LENGTH and
- return it in RETSEXP. With AUTODETECT set to 0 the data in BUFFER
- is expected to be in canonized format. */
-gcry_error_t gcry_sexp_new (gcry_sexp_t *retsexp,
- const void *buffer, size_t length,
- /* Same as gcry_sexp_new but allows to pass a FREEFNC which has the
- effect to transfer ownership of BUFFER to the created object. */
-gcry_error_t gcry_sexp_create (gcry_sexp_t *retsexp,
- void *buffer, size_t length,
- int autodetect, void (*freefnc) (void *));
-/* Scan BUFFER and return a new S-expression object in RETSEXP. This
- function expects a printf like string in BUFFER. */
-gcry_error_t gcry_sexp_sscan (gcry_sexp_t *retsexp, size_t *erroff,
- const char *buffer, size_t length);
-/* Same as gcry_sexp_sscan but expects a string in FORMAT and can thus
- only be used for certain encodings. */
-gcry_error_t gcry_sexp_build (gcry_sexp_t *retsexp, size_t *erroff,
- const char *format, ...);
-/* Like gcry_sexp_build, but uses an array instead of variable
-gcry_error_t gcry_sexp_build_array (gcry_sexp_t *retsexp, size_t *erroff,
- const char *format, void **arg_list);
-/* Release the S-expression object SEXP */
-void gcry_sexp_release (gcry_sexp_t sexp);
-/* Calculate the length of an canonized S-expresion in BUFFER and
- check for a valid encoding. */
-size_t gcry_sexp_canon_len (const unsigned char *buffer, size_t length,
- size_t *erroff, gcry_error_t *errcode);
-/* Copies the S-expression object SEXP into BUFFER using the format
-size_t gcry_sexp_sprint (gcry_sexp_t sexp, int mode, void *buffer,
-/* Dumps the S-expression object A in a format suitable for debugging
- to Libgcrypt's logging stream. */
-void gcry_sexp_dump (const gcry_sexp_t a);
-gcry_sexp_t gcry_sexp_cons (const gcry_sexp_t a, const gcry_sexp_t b);
-gcry_sexp_t gcry_sexp_alist (const gcry_sexp_t *array);
-gcry_sexp_t gcry_sexp_vlist (const gcry_sexp_t a, ...);
-gcry_sexp_t gcry_sexp_append (const gcry_sexp_t a, const gcry_sexp_t n);
-gcry_sexp_t gcry_sexp_prepend (const gcry_sexp_t a, const gcry_sexp_t n);
-/* Scan the S-expression for a sublist with a type (the car of the
- list) matching the string TOKEN. If TOKLEN is not 0, the token is
- assumed to be raw memory of this length. The function returns a
- newly allocated S-expression consisting of the found sublist or
- `NULL' when not found. */
-gcry_sexp_t gcry_sexp_find_token (gcry_sexp_t list,
- const char *tok, size_t toklen);
-/* Return the length of the LIST. For a valid S-expression this
- should be at least 1. */
-int gcry_sexp_length (const gcry_sexp_t list);
-/* Create and return a new S-expression from the element with index
- NUMBER in LIST. Note that the first element has the index 0. If
- there is no such element, `NULL' is returned. */
-gcry_sexp_t gcry_sexp_nth (const gcry_sexp_t list, int number);
-/* Create and return a new S-expression from the first element in
- LIST; this called the "type" and should always exist and be a
- string. `NULL' is returned in case of a problem. */
-gcry_sexp_t gcry_sexp_car (const gcry_sexp_t list);
-/* Create and return a new list form all elements except for the first
- one. Note, that this function may return an invalid S-expression
- because it is not guaranteed, that the type exists and is a string.
- However, for parsing a complex S-expression it might be useful for
- intermediate lists. Returns `NULL' on error. */
-gcry_sexp_t gcry_sexp_cdr (const gcry_sexp_t list);
-gcry_sexp_t gcry_sexp_cadr (const gcry_sexp_t list);
-/* This function is used to get data from a LIST. A pointer to the
- actual data with index NUMBER is returned and the length of this
- data will be stored to DATALEN. If there is no data at the given
- index or the index represents another list, `NULL' is returned.
- *Note:* The returned pointer is valid as long as LIST is not
- modified or released. */
-const char *gcry_sexp_nth_data (const gcry_sexp_t list, int number,
-/* This function is used to get and convert data from a LIST. The
- data is assumed to be a Nul terminated string. The caller must
- release the returned value using `gcry_free'. If there is no data
- at the given index, the index represents a list or the value can't
- be converted to a string, `NULL' is returned. */
-char *gcry_sexp_nth_string (gcry_sexp_t list, int number);
-/* This function is used to get and convert data from a LIST. This
- data is assumed to be an MPI stored in the format described by
- MPIFMT and returned as a standard Libgcrypt MPI. The caller must
- release this returned value using `gcry_mpi_release'. If there is
- no data at the given index, the index represents a list or the
- value can't be converted to an MPI, `NULL' is returned. */
-gcry_mpi_t gcry_sexp_nth_mpi (gcry_sexp_t list, int number, int mpifmt);
-/*******************************************
- * Multi Precision Integer Functions *
- *******************************************/
-/* Different formats of external big integer representation. */
- GCRYMPI_FMT_STD = 1, /* Twos complement stored without length. */
- GCRYMPI_FMT_PGP = 2, /* As used by OpenPGP (unsigned only). */
- GCRYMPI_FMT_SSH = 3, /* As used by SSH (like STD but with length). */
- GCRYMPI_FMT_HEX = 4, /* Hex format. */
- GCRYMPI_FMT_USG = 5 /* Like STD but unsigned. */
-/* Flags used for creating big integers. */
- GCRYMPI_FLAG_SECURE = 1, /* Allocate the number in "secure" memory. */
- GCRYMPI_FLAG_OPAQUE = 2 /* The number is not a real one but just
- a way to store some bytes. This is
- useful for encrypted big integers. */
-/* Allocate a new big integer object, initialize it with 0 and
- initially allocate memory for a number of at least NBITS. */
-gcry_mpi_t gcry_mpi_new (unsigned int nbits);
-/* Same as gcry_mpi_new() but allocate in "secure" memory. */
-gcry_mpi_t gcry_mpi_snew (unsigned int nbits);
-/* Release the number A and free all associated resources. */
-void gcry_mpi_release (gcry_mpi_t a);
-/* Create a new number with the same value as A. */
-gcry_mpi_t gcry_mpi_copy (const gcry_mpi_t a);
-/* Store the big integer value U in W. */
-gcry_mpi_t gcry_mpi_set (gcry_mpi_t w, const gcry_mpi_t u);
-/* Store the unsigned integer value U in W. */
-gcry_mpi_t gcry_mpi_set_ui (gcry_mpi_t w, unsigned long u);
-/* Swap the values of A and B. */
-void gcry_mpi_swap (gcry_mpi_t a, gcry_mpi_t b);
-/* Compare the big integer number U and V returning 0 for equality, a
- positive value for U > V and a negative for U < V. */
-int gcry_mpi_cmp (const gcry_mpi_t u, const gcry_mpi_t v);
-/* Compare the big integer number U with the unsigned integer V
- returning 0 for equality, a positive value for U > V and a negative
-int gcry_mpi_cmp_ui (const gcry_mpi_t u, unsigned long v);
-/* Convert the external representation of an integer stored in BUFFER
- with a length of BUFLEN into a newly create MPI returned in
- RET_MPI. If NSCANNED is not NULL, it will receive the number of
- bytes actually scanned after a successful operation. */
-gcry_error_t gcry_mpi_scan (gcry_mpi_t *ret_mpi, enum gcry_mpi_format format,
- const void *buffer, size_t buflen,
-/* Convert the big integer A into the external representation
- described by FORMAT and store it in the provided BUFFER which has
- been allocated by the user with a size of BUFLEN bytes. NWRITTEN
- receives the actual length of the external representation unless it
- has been passed as NULL. */
-gcry_error_t gcry_mpi_print (enum gcry_mpi_format format,
- unsigned char *buffer, size_t buflen,
-/* Convert the big integer A int the external representation described
- by FORMAT and store it in a newly allocated buffer which address
- will be put into BUFFER. NWRITTEN receives the actual lengths of the
- external representation. */
-gcry_error_t gcry_mpi_aprint (enum gcry_mpi_format format,
- unsigned char **buffer, size_t *nwritten,
-/* Dump the value of A in a format suitable for debugging to
- Libgcrypt's logging stream. Note that one leading space but no
- trailing space or linefeed will be printed. It is okay to pass
-void gcry_mpi_dump (const gcry_mpi_t a);
-void gcry_mpi_add (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v);
-/* W = U + V. V is an unsigned integer. */
-void gcry_mpi_add_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v);
-void gcry_mpi_addm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m);
-void gcry_mpi_sub (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v);
-/* W = U - V. V is an unsigned integer. */
-void gcry_mpi_sub_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v );
-void gcry_mpi_subm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m);
-void gcry_mpi_mul (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v);
-/* W = U * V. V is an unsigned integer. */
-void gcry_mpi_mul_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v );
-void gcry_mpi_mulm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m);
-/* W = U * (2 ^ CNT). */
-void gcry_mpi_mul_2exp (gcry_mpi_t w, gcry_mpi_t u, unsigned long cnt);
-/* Q = DIVIDEND / DIVISOR, R = DIVIDEND % DIVISOR,
- Q or R may be passed as NULL. ROUND should be negative or 0. */
-void gcry_mpi_div (gcry_mpi_t q, gcry_mpi_t r,
- gcry_mpi_t dividend, gcry_mpi_t divisor, int round);
-/* R = DIVIDEND % DIVISOR */
-void gcry_mpi_mod (gcry_mpi_t r, gcry_mpi_t dividend, gcry_mpi_t divisor);
-void gcry_mpi_powm (gcry_mpi_t w,
- const gcry_mpi_t b, const gcry_mpi_t e,
-/* Set G to the greatest common divisor of A and B.
- Return true if the G is 1. */
-int gcry_mpi_gcd (gcry_mpi_t g, gcry_mpi_t a, gcry_mpi_t b);
-/* Set X to the multiplicative inverse of A mod M.
- Return true if the value exists. */
-int gcry_mpi_invm (gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t m);
-/* Return the number of bits required to represent A. */
-unsigned int gcry_mpi_get_nbits (gcry_mpi_t a);
-/* Return true when bit number N (counting from 0) is set in A. */
-int gcry_mpi_test_bit (gcry_mpi_t a, unsigned int n);
-/* Set bit number N in A. */
-void gcry_mpi_set_bit (gcry_mpi_t a, unsigned int n);
-/* Clear bit number N in A. */
-void gcry_mpi_clear_bit (gcry_mpi_t a, unsigned int n);
-/* Set bit number N in A and clear all bits greater than N. */
-void gcry_mpi_set_highbit (gcry_mpi_t a, unsigned int n);
-/* Clear bit number N in A and all bits greater than N. */
-void gcry_mpi_clear_highbit (gcry_mpi_t a, unsigned int n);
-/* Shift the value of A by N bits to the right and store the result in X. */
-void gcry_mpi_rshift (gcry_mpi_t x, gcry_mpi_t a, unsigned int n);
-/* Shift the value of A by N bits to the left and store the result in X. */
-void gcry_mpi_lshift (gcry_mpi_t x, gcry_mpi_t a, unsigned int n);
-/* Store NBITS of the value P points to in A and mark A as an opaque
- value. WARNING: Never use an opaque MPI for anything thing else then
- gcry_mpi_release, gcry_mpi_get_opaque. */
-gcry_mpi_t gcry_mpi_set_opaque (gcry_mpi_t a, void *p, unsigned int nbits);
-/* Return a pointer to an opaque value stored in A and return its size
- in NBITS. Note that the returned pointer is still owned by A and
- that the function should never be used for an non-opaque MPI. */
-void *gcry_mpi_get_opaque (gcry_mpi_t a, unsigned int *nbits);
-/* Set the FLAG for the big integer A. Currently only the flag
- GCRYMPI_FLAG_SECURE is allowed to convert A into an big intger
- stored in "secure" memory. */
-void gcry_mpi_set_flag (gcry_mpi_t a, enum gcry_mpi_flag flag);
-/* Clear FLAG for the big integer A. Note that this function is
- currently useless as no flags are allowed. */
-void gcry_mpi_clear_flag (gcry_mpi_t a, enum gcry_mpi_flag flag);
-/* Return true when the FLAG is set for A. */
-int gcry_mpi_get_flag (gcry_mpi_t a, enum gcry_mpi_flag flag);
-/* Unless the GCRYPT_NO_MPI_MACROS is used, provide a couple of
- convenience macros for the big integer functions. */
-#ifndef GCRYPT_NO_MPI_MACROS
-#define mpi_new(n) gcry_mpi_new( (n) )
-#define mpi_secure_new( n ) gcry_mpi_snew( (n) )
-#define mpi_release(a) \
- gcry_mpi_release ((a)); \
-#define mpi_copy( a ) gcry_mpi_copy( (a) )
-#define mpi_set( w, u) gcry_mpi_set( (w), (u) )
-#define mpi_set_ui( w, u) gcry_mpi_set_ui( (w), (u) )
-#define mpi_cmp( u, v ) gcry_mpi_cmp( (u), (v) )
-#define mpi_cmp_ui( u, v ) gcry_mpi_cmp_ui( (u), (v) )
-#define mpi_add_ui(w,u,v) gcry_mpi_add_ui((w),(u),(v))
-#define mpi_add(w,u,v) gcry_mpi_add ((w),(u),(v))
-#define mpi_addm(w,u,v,m) gcry_mpi_addm ((w),(u),(v),(m))
-#define mpi_sub_ui(w,u,v) gcry_mpi_sub_ui ((w),(u),(v))
-#define mpi_sub(w,u,v) gcry_mpi_sub ((w),(u),(v))
-#define mpi_subm(w,u,v,m) gcry_mpi_subm ((w),(u),(v),(m))
-#define mpi_mul_ui(w,u,v) gcry_mpi_mul_ui ((w),(u),(v))
-#define mpi_mul_2exp(w,u,v) gcry_mpi_mul_2exp ((w),(u),(v))
-#define mpi_mul(w,u,v) gcry_mpi_mul ((w),(u),(v))
-#define mpi_mulm(w,u,v,m) gcry_mpi_mulm ((w),(u),(v),(m))
-#define mpi_powm(w,b,e,m) gcry_mpi_powm ( (w), (b), (e), (m) )
-#define mpi_tdiv(q,r,a,m) gcry_mpi_div ( (q), (r), (a), (m), 0)
-#define mpi_fdiv(q,r,a,m) gcry_mpi_div ( (q), (r), (a), (m), -1)
-#define mpi_mod(r,a,m) gcry_mpi_mod ((r), (a), (m))
-#define mpi_gcd(g,a,b) gcry_mpi_gcd ( (g), (a), (b) )
-#define mpi_invm(g,a,b) gcry_mpi_invm ( (g), (a), (b) )
-#define mpi_get_nbits(a) gcry_mpi_get_nbits ((a))
-#define mpi_test_bit(a,b) gcry_mpi_test_bit ((a),(b))
-#define mpi_set_bit(a,b) gcry_mpi_set_bit ((a),(b))
-#define mpi_set_highbit(a,b) gcry_mpi_set_highbit ((a),(b))
-#define mpi_clear_bit(a,b) gcry_mpi_clear_bit ((a),(b))
-#define mpi_clear_highbit(a,b) gcry_mpi_clear_highbit ((a),(b))
-#define mpi_rshift(a,b,c) gcry_mpi_rshift ((a),(b),(c))
-#define mpi_lshift(a,b,c) gcry_mpi_lshift ((a),(b),(c))
-#define mpi_set_opaque(a,b,c) gcry_mpi_set_opaque( (a), (b), (c) )
-#define mpi_get_opaque(a,b) gcry_mpi_get_opaque( (a), (b) )
-#endif /* GCRYPT_NO_MPI_MACROS */
-/************************************
- * Symmetric Cipher Functions *
- ************************************/
-/* The data object used to hold a handle to an encryption object. */
-struct gcry_cipher_handle;
-typedef struct gcry_cipher_handle *gcry_cipher_hd_t;
-#ifndef GCRYPT_NO_DEPRECATED
-typedef struct gcry_cipher_handle *GCRY_CIPHER_HD _GCRY_GCC_ATTR_DEPRECATED;
-typedef struct gcry_cipher_handle *GcryCipherHd _GCRY_GCC_ATTR_DEPRECATED;
-/* All symmetric encryption algorithms are identified by their IDs.
- More IDs may be registered at runtime. */
- GCRY_CIPHER_BLOWFISH = 4,
- GCRY_CIPHER_SAFER_SK128 = 5,
- GCRY_CIPHER_DES_SK = 6,
- GCRY_CIPHER_AES192 = 8,
- GCRY_CIPHER_AES256 = 9,
- GCRY_CIPHER_TWOFISH = 10,
- /* Other cipher numbers are above 300 for OpenPGP reasons. */
- GCRY_CIPHER_ARCFOUR = 301, /* Fully compatible with RSA's RC4 (tm). */
- GCRY_CIPHER_DES = 302, /* Yes, this is single key 56 bit DES. */
- GCRY_CIPHER_TWOFISH128 = 303,
- GCRY_CIPHER_SERPENT128 = 304,
- GCRY_CIPHER_SERPENT192 = 305,
- GCRY_CIPHER_SERPENT256 = 306,
- GCRY_CIPHER_RFC2268_40 = 307, /* Ron's Cipher 2 (40 bit). */
- GCRY_CIPHER_RFC2268_128 = 308, /* Ron's Cipher 2 (128 bit). */
- GCRY_CIPHER_SEED = 309, /* 128 bit cipher described in RFC4269. */
- GCRY_CIPHER_CAMELLIA128 = 310,
- GCRY_CIPHER_CAMELLIA192 = 311,
- GCRY_CIPHER_CAMELLIA256 = 312
-/* The Rijndael algorithm is basically AES, so provide some macros. */
-#define GCRY_CIPHER_AES128 GCRY_CIPHER_AES
-#define GCRY_CIPHER_RIJNDAEL GCRY_CIPHER_AES
-#define GCRY_CIPHER_RIJNDAEL128 GCRY_CIPHER_AES128
-#define GCRY_CIPHER_RIJNDAEL192 GCRY_CIPHER_AES192
-#define GCRY_CIPHER_RIJNDAEL256 GCRY_CIPHER_AES256
-/* The supported encryption modes. Note that not all of them are
- supported for each algorithm. */
- GCRY_CIPHER_MODE_NONE = 0, /* Not yet specified. */
- GCRY_CIPHER_MODE_ECB = 1, /* Electronic codebook. */
- GCRY_CIPHER_MODE_CFB = 2, /* Cipher feedback. */
- GCRY_CIPHER_MODE_CBC = 3, /* Cipher block chaining. */
- GCRY_CIPHER_MODE_STREAM = 4, /* Used with stream ciphers. */
- GCRY_CIPHER_MODE_OFB = 5, /* Outer feedback. */
- GCRY_CIPHER_MODE_CTR = 6 /* Counter. */
-/* Flags used with the open function. */
- GCRY_CIPHER_SECURE = 1, /* Allocate in secure memory. */
- GCRY_CIPHER_ENABLE_SYNC = 2, /* Enable CFB sync mode. */
- GCRY_CIPHER_CBC_CTS = 4, /* Enable CBC cipher text stealing (CTS). */
- GCRY_CIPHER_CBC_MAC = 8 /* Enable CBC message auth. code (MAC). */
-/* Create a handle for algorithm ALGO to be used in MODE. FLAGS may
- be given as an bitwise OR of the gcry_cipher_flags values. */
-gcry_error_t gcry_cipher_open (gcry_cipher_hd_t *handle,
- int algo, int mode, unsigned int flags);
-/* Close the cioher handle H and release all resource. */
-void gcry_cipher_close (gcry_cipher_hd_t h);
-/* Perform various operations on the cipher object H. */
-gcry_error_t gcry_cipher_ctl (gcry_cipher_hd_t h, int cmd, void *buffer,
-/* Retrieve various information about the cipher object H. */
-gcry_error_t gcry_cipher_info (gcry_cipher_hd_t h, int what, void *buffer,
-/* Retrieve various information about the cipher algorithm ALGO. */
-gcry_error_t gcry_cipher_algo_info (int algo, int what, void *buffer,
-/* Map the cipher algorithm whose ID is contained in ALGORITHM to a
- string representation of the algorithm name. For unknown algorithm
- IDs this function returns "?". */
-const char *gcry_cipher_algo_name (int algorithm) _GCRY_GCC_ATTR_PURE;
-/* Map the algorithm name NAME to an cipher algorithm ID. Return 0 if
- the algorithm name is not known. */
-int gcry_cipher_map_name (const char *name) _GCRY_GCC_ATTR_PURE;
-/* Given an ASN.1 object identifier in standard IETF dotted decimal
- format in STRING, return the encryption mode associated with that
- OID or 0 if not known or applicable. */
-int gcry_cipher_mode_from_oid (const char *string) _GCRY_GCC_ATTR_PURE;
-/* Encrypt the plaintext of size INLEN in IN using the cipher handle H
- into the buffer OUT which has an allocated length of OUTSIZE. For
- most algorithms it is possible to pass NULL for in and 0 for INLEN
- and do a in-place decryption of the data provided in OUT. */
-gcry_error_t gcry_cipher_encrypt (gcry_cipher_hd_t h,
- void *out, size_t outsize,
- const void *in, size_t inlen);
-/* The counterpart to gcry_cipher_encrypt. */
-gcry_error_t gcry_cipher_decrypt (gcry_cipher_hd_t h,
- void *out, size_t outsize,
- const void *in, size_t inlen);
-/* Set KEY of length KEYLEN for the cipher handle HD. */
-gcry_error_t gcry_cipher_setkey (gcry_cipher_hd_t hd,
- const void *key, size_t keylen);
-/* Set initialization vector IV of length IVLEN for the cipher handle HD. */
-gcry_error_t gcry_cipher_setiv (gcry_cipher_hd_t hd,
- const void *iv, size_t ivlen);
-/* Reset the handle to the state after open. */
-#define gcry_cipher_reset(h) gcry_cipher_ctl ((h), GCRYCTL_RESET, NULL, 0)
-/* Perform the OpenPGP sync operation if this is enabled for the
-#define gcry_cipher_sync(h) gcry_cipher_ctl( (h), GCRYCTL_CFB_SYNC, NULL, 0)
-/* Enable or disable CTS in future calls to gcry_encrypt(). CBC mode only. */
-#define gcry_cipher_cts(h,on) gcry_cipher_ctl( (h), GCRYCTL_SET_CBC_CTS, \
-/* Set counter for CTR mode. (CTR,CTRLEN) must denote a buffer of
- block size length, or (NULL,0) to set the CTR to the all-zero block. */
-gpg_error_t gcry_cipher_setctr (gcry_cipher_hd_t hd,
- const void *ctr, size_t ctrlen);
-/* Retrieved the key length used with algorithm A. */
-size_t gcry_cipher_get_algo_keylen (int algo);
-/* Retrieve the block length used with algorithm A. */
-size_t gcry_cipher_get_algo_blklen (int algo);
-/* Return 0 if the algorithm A is available for use. */
-#define gcry_cipher_test_algo(a) \
- gcry_cipher_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL )
-/* Get a list consisting of the IDs of the loaded cipher modules. If
- LIST is zero, write the number of loaded cipher modules to
- LIST_LENGTH and return. If LIST is non-zero, the first
- *LIST_LENGTH algorithm IDs are stored in LIST, which must be of
- according size. In case there are less cipher modules than
- *LIST_LENGTH, *LIST_LENGTH is updated to the correct number. */
-gcry_error_t gcry_cipher_list (int *list, int *list_length);
-/************************************
- * Asymmetric Cipher Functions *
- ************************************/
-/* The algorithms and their IDs we support. */
- GCRY_PK_RSA_E = 2, /* (deprecated) */
- GCRY_PK_RSA_S = 3, /* (deprecated) */
-/* Flags describing usage capabilities of a PK algorithm. */
-#define GCRY_PK_USAGE_SIGN 1 /* Good for signatures. */
-#define GCRY_PK_USAGE_ENCR 2 /* Good for encryption. */
-#define GCRY_PK_USAGE_CERT 4 /* Good to certify other keys. */
-#define GCRY_PK_USAGE_AUTH 8 /* Good for authentication. */
-#define GCRY_PK_USAGE_UNKN 128 /* Unknown usage flag. */
-/* Encrypt the DATA using the public key PKEY and store the result as
- a newly created S-expression at RESULT. */
-gcry_error_t gcry_pk_encrypt (gcry_sexp_t *result,
- gcry_sexp_t data, gcry_sexp_t pkey);
-/* Decrypt the DATA using the private key SKEY and store the result as
- a newly created S-expression at RESULT. */
-gcry_error_t gcry_pk_decrypt (gcry_sexp_t *result,
- gcry_sexp_t data, gcry_sexp_t skey);
-/* Sign the DATA using the private key SKEY and store the result as
- a newly created S-expression at RESULT. */
-gcry_error_t gcry_pk_sign (gcry_sexp_t *result,
- gcry_sexp_t data, gcry_sexp_t skey);
-/* Check the signature SIGVAL on DATA using the public key PKEY. */
-gcry_error_t gcry_pk_verify (gcry_sexp_t sigval,
- gcry_sexp_t data, gcry_sexp_t pkey);
-/* Check that private KEY is sane. */
-gcry_error_t gcry_pk_testkey (gcry_sexp_t key);
-/* Generate a new key pair according to the parameters given in
- S_PARMS. The new key pair is returned in as an S-expression in
-gcry_error_t gcry_pk_genkey (gcry_sexp_t *r_key, gcry_sexp_t s_parms);
-/* Catch all function for miscellaneous operations. */
-gcry_error_t gcry_pk_ctl (int cmd, void *buffer, size_t buflen);
-/* Retrieve information about the public key algorithm ALGO. */
-gcry_error_t gcry_pk_algo_info (int algo, int what,
- void *buffer, size_t *nbytes);
-/* Map the public key algorithm whose ID is contained in ALGORITHM to
- a string representation of the algorithm name. For unknown
- algorithm IDs this functions returns "?". */
-const char *gcry_pk_algo_name (int algorithm) _GCRY_GCC_ATTR_PURE;
-/* Map the algorithm NAME to a public key algorithm Id. Return 0 if
- the algorithm name is not known. */
-int gcry_pk_map_name (const char* name) _GCRY_GCC_ATTR_PURE;
-/* Return what is commonly referred as the key length for the given
- public or private KEY. */
-unsigned int gcry_pk_get_nbits (gcry_sexp_t key) _GCRY_GCC_ATTR_PURE;
-/* Please note that keygrip is still experimental and should not be
- used without contacting the author. */
-unsigned char *gcry_pk_get_keygrip (gcry_sexp_t key, unsigned char *array);
-/* Return 0 if the public key algorithm A is available for use. */
-#define gcry_pk_test_algo(a) \
- gcry_pk_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL )
-/* Get a list consisting of the IDs of the loaded pubkey modules. If
- LIST is zero, write the number of loaded pubkey modules to
- LIST_LENGTH and return. If LIST is non-zero, the first
- *LIST_LENGTH algorithm IDs are stored in LIST, which must be of
- according size. In case there are less pubkey modules than
- *LIST_LENGTH, *LIST_LENGTH is updated to the correct number. */
-gcry_error_t gcry_pk_list (int *list, int *list_length);
-/************************************
- * Cryptograhic Hash Functions *
- ************************************/
-/* Algorithm IDs for the hash functions we know about. Not all of them
- GCRY_MD_TIGER = 6, /* TIGER/192. */
- GCRY_MD_HAVAL = 7, /* HAVAL, 5 pass, 160 bit. */
- GCRY_MD_CRC32_RFC1510 = 303,
- GCRY_MD_CRC24_RFC2440 = 304,
- GCRY_MD_WHIRLPOOL = 305
-/* Flags used with the open function. */
- GCRY_MD_FLAG_SECURE = 1, /* Allocate all buffers in "secure" memory. */
- GCRY_MD_FLAG_HMAC = 2 /* Make an HMAC out of this algorithm. */
-/* (Forward declaration.) */
-/* This object is used to hold a handle to a message digest object.
- This structure is private - only to be used by the public gcry_md_*
-typedef struct gcry_md_handle
- struct gcry_md_context *ctx;
- /* Buffer management. */
-/* Compatibility types, do not use them. */
-#ifndef GCRYPT_NO_DEPRECATED
-typedef struct gcry_md_handle *GCRY_MD_HD _GCRY_GCC_ATTR_DEPRECATED;
-typedef struct gcry_md_handle *GcryMDHd _GCRY_GCC_ATTR_DEPRECATED;
-/* Create a message digest object for algorithm ALGO. FLAGS may be
- given as an bitwise OR of the gcry_md_flags values. ALGO may be
- given as 0 if the algorithms to be used are later set using
-gcry_error_t gcry_md_open (gcry_md_hd_t *h, int algo, unsigned int flags);
-/* Release the message digest object HD. */
-void gcry_md_close (gcry_md_hd_t hd);
-/* Add the message digest algorithm ALGO to the digest object HD. */
-gcry_error_t gcry_md_enable (gcry_md_hd_t hd, int algo);
-/* Create a new digest object as an exact copy of the object HD. */
-gcry_error_t gcry_md_copy (gcry_md_hd_t *bhd, gcry_md_hd_t ahd);
-/* Reset the digest object HD to its initial state. */
-void gcry_md_reset (gcry_md_hd_t hd);
-/* Perform various operations on the digest object HD. */
-gcry_error_t gcry_md_ctl (gcry_md_hd_t hd, int cmd,
- void *buffer, size_t buflen);
-/* Pass LENGTH bytes of data in BUFFER to the digest object HD so that
- it can update the digest values. This is the actual hash
-void gcry_md_write (gcry_md_hd_t hd, const void *buffer, size_t length);
-/* Read out the final digest from HD return the digest value for
-unsigned char *gcry_md_read (gcry_md_hd_t hd, int algo);
-/* Convenience function to calculate the hash from the data in BUFFER
- of size LENGTH using the algorithm ALGO avoiding the creating of a
- hash object. The hash is returned in the caller provided buffer
- DIGEST which must be large enough to hold the digest of the given
-void gcry_md_hash_buffer (int algo, void *digest,
- const void *buffer, size_t length);
-/* Retrieve the algorithm used with HD. This does not work reliable
- if more than one algorithm is enabled in HD. */
-int gcry_md_get_algo (gcry_md_hd_t hd);
-/* Retrieve the length in bytes of the digest yielded by algorithm
-unsigned int gcry_md_get_algo_dlen (int algo);
-/* Return true if the the algorithm ALGO is enabled in the digest
-int gcry_md_is_enabled (gcry_md_hd_t a, int algo);
-/* Return true if the digest object A is allocated in "secure" memory. */
-int gcry_md_is_secure (gcry_md_hd_t a);
-/* Retrieve various information about the object H. */
-gcry_error_t gcry_md_info (gcry_md_hd_t h, int what, void *buffer,
-/* Retrieve various information about the algorithm ALGO. */
-gcry_error_t gcry_md_algo_info (int algo, int what, void *buffer,
-/* Map the digest algorithm id ALGO to a string representation of the
- algorithm name. For unknown algorithms this function returns
-const char *gcry_md_algo_name (int algo) _GCRY_GCC_ATTR_PURE;
-/* Map the algorithm NAME to a digest algorithm Id. Return 0 if
- the algorithm name is not known. */
-int gcry_md_map_name (const char* name) _GCRY_GCC_ATTR_PURE;
-/* For use with the HMAC feature, the set MAC key to the KEY of
-gcry_error_t gcry_md_setkey (gcry_md_hd_t hd, const void *key, size_t keylen);
-/* Start or stop debugging for digest handle HD; i.e. create a file
- named dbgmd-<n>.<suffix> while hashing. If SUFFIX is NULL,
- debugging stops and the file will be closed. */
-void gcry_md_debug (gcry_md_hd_t hd, const char *suffix);
-/* Update the hash(s) of H with the character C. This is a buffered
- version of the gcry_md_write function. */
-#define gcry_md_putc(h,c) \
- gcry_md_hd_t h__ = (h); \
- if( (h__)->bufpos == (h__)->bufsize ) \
- gcry_md_write( (h__), NULL, 0 ); \
- (h__)->buf[(h__)->bufpos++] = (c) & 0xff; \
-/* Finalize the digest calculation. This is not really needed because
- gcry_md_read() does this implicitly. */
-#define gcry_md_final(a) \
- gcry_md_ctl ((a), GCRYCTL_FINALIZE, NULL, 0)
-/* Return 0 if the algorithm A is available for use. */
-#define gcry_md_test_algo(a) \
- gcry_md_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL )
-/* Return an DER encoded ASN.1 OID for the algorithm A in buffer B. N
- must point to size_t variable with the available size of buffer B.
- After return it will receive the actual size of the returned
-#define gcry_md_get_asnoid(a,b,n) \
- gcry_md_algo_info((a), GCRYCTL_GET_ASNOID, (b), (n))
-/* Enable debugging for digest object A; i.e. create files named
- dbgmd-<n>.<string> while hashing. B is a string used as the suffix
- for the filename. This macro is deprecated, use gcry_md_debug. */
-#ifndef GCRYPT_NO_DEPRECATED
-#define gcry_md_start_debug(a,b) \
- gcry_md_ctl( (a), GCRYCTL_START_DUMP, (b), 0 )
-/* Disable the debugging of A. This macro is deprecated, use
-#define gcry_md_stop_debug(a,b) \
- gcry_md_ctl( (a), GCRYCTL_STOP_DUMP, (b), 0 )
-/* Get a list consisting of the IDs of the loaded message digest
- modules. If LIST is zero, write the number of loaded message
- digest modules to LIST_LENGTH and return. If LIST is non-zero, the
- first *LIST_LENGTH algorithm IDs are stored in LIST, which must be
- of according size. In case there are less message digest modules
- than *LIST_LENGTH, *LIST_LENGTH is updated to the correct
-gcry_error_t gcry_md_list (int *list, int *list_length);
-/* Alternative interface for asymmetric cryptography. This interface
-/* The algorithm IDs. */
-typedef enum gcry_ac_key_type
-/* Encryption and Signature schemes. */
-typedef enum gcry_ac_scheme
-#define GCRY_AC_FLAG_DEALLOC (1 << 0)
-#define GCRY_AC_FLAG_COPY (1 << 1)
-#define GCRY_AC_FLAG_NO_BLINDING (1 << 2)
-/* This type represents a `data set'. */
-typedef struct gcry_ac_data *gcry_ac_data_t;
-/* This type represents a single `key', either a secret one or a
-typedef struct gcry_ac_key *gcry_ac_key_t;
-/* This type represents a `key pair' containing a secret and a public
-typedef struct gcry_ac_key_pair *gcry_ac_key_pair_t;
-/* This type represents a `handle' that is needed by functions
- performing cryptographic operations. */
-typedef struct gcry_ac_handle *gcry_ac_handle_t;
-typedef gpg_error_t (*gcry_ac_data_read_cb_t) (void *opaque,
-typedef gpg_error_t (*gcry_ac_data_write_cb_t) (void *opaque,
-typedef struct gcry_ac_io
- /* This is an INTERNAL structure, do NOT use manually. */
- gcry_ac_io_mode_t mode _GCRY_ATTR_INTERNAL;
- gcry_ac_io_type_t type _GCRY_ATTR_INTERNAL;
- gcry_ac_data_read_cb_t cb;
- gcry_ac_data_write_cb_t cb;
- } io _GCRY_ATTR_INTERNAL;
-/* The caller of gcry_ac_key_pair_generate can provide one of these
- structures in order to influence the key generation process in an
- algorithm-specific way. */
-typedef struct gcry_ac_key_spec_rsa
- gcry_mpi_t e; /* E to use. */
-} gcry_ac_key_spec_rsa_t;
-/* Structure used for passing data to the implementation of the
- `EME-PKCS-V1_5' encoding method. */
-typedef struct gcry_ac_eme_pkcs_v1_5
-} gcry_ac_eme_pkcs_v1_5_t;
-typedef enum gcry_md_algos gcry_md_algo_t;
-/* Structure used for passing data to the implementation of the
- `EMSA-PKCS-V1_5' encoding method. */
-typedef struct gcry_ac_emsa_pkcs_v1_5
-} gcry_ac_emsa_pkcs_v1_5_t;
-/* Structure used for passing data to the implementation of the
- `SSA-PKCS-V1_5' signature scheme. */
-typedef struct gcry_ac_ssa_pkcs_v1_5
-} gcry_ac_ssa_pkcs_v1_5_t;
-/* Returns a new, empty data set in DATA. */
-gcry_error_t gcry_ac_data_new (gcry_ac_data_t *data);
-/* Destroy the data set DATA. */
-void gcry_ac_data_destroy (gcry_ac_data_t data);
-/* Create a copy of the data set DATA and store it in DATA_CP. */
-gcry_error_t gcry_ac_data_copy (gcry_ac_data_t *data_cp,
-/* Return the number of named MPI values inside of the data set
-unsigned int gcry_ac_data_length (gcry_ac_data_t data);
-/* Destroy any values contained in the data set DATA. */
-void gcry_ac_data_clear (gcry_ac_data_t data);
-/* Add the value MPI to DATA with the label NAME. If FLAGS contains
- GCRY_AC_FLAG_DATA_COPY, the data set will contain copies of NAME
- and MPI. If FLAGS contains GCRY_AC_FLAG_DATA_DEALLOC or
- GCRY_AC_FLAG_DATA_COPY, the values contained in the data set will
- be deallocated when they are to be removed from the data set. */
-gcry_error_t gcry_ac_data_set (gcry_ac_data_t data, unsigned int flags,
- const char *name, gcry_mpi_t mpi);
-/* Store the value labelled with NAME found in DATA in MPI. If FLAGS
- contains GCRY_AC_FLAG_COPY, store a copy of the MPI value contained
- in the data set. MPI may be NULL. */
-gcry_error_t gcry_ac_data_get_name (gcry_ac_data_t data, unsigned int flags,
- const char *name, gcry_mpi_t *mpi);
-/* Stores in NAME and MPI the named MPI value contained in the data
- set DATA with the index IDX. If FLAGS contains GCRY_AC_FLAG_COPY,
- store copies of the values contained in the data set. NAME or MPI
-gcry_error_t gcry_ac_data_get_index (gcry_ac_data_t data, unsigned int flags,
- const char **name, gcry_mpi_t *mpi);
-/* Convert the data set DATA into a new S-Expression, which is to be
- stored in SEXP, according to the identifiers contained in
-gcry_error_t gcry_ac_data_to_sexp (gcry_ac_data_t data, gcry_sexp_t *sexp,
- const char **identifiers);
-/* Create a new data set, which is to be stored in DATA_SET, from the
- S-Expression SEXP, according to the identifiers contained in
-gcry_error_t gcry_ac_data_from_sexp (gcry_ac_data_t *data, gcry_sexp_t sexp,
- const char **identifiers);
-/* Initialize AC_IO according to MODE, TYPE and the variable list of
- arguments. The list of variable arguments to specify depends on
-void gcry_ac_io_init (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode,
- gcry_ac_io_type_t type, ...);
-/* Initialize AC_IO according to MODE, TYPE and the variable list of
- arguments AP. The list of variable arguments to specify depends on
-void gcry_ac_io_init_va (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode,
- gcry_ac_io_type_t type, va_list ap);
-/* Create a new ac handle. */
-gcry_error_t gcry_ac_open (gcry_ac_handle_t *handle,
- gcry_ac_id_t algorithm, unsigned int flags);
-/* Destroy an ac handle. */
-void gcry_ac_close (gcry_ac_handle_t handle);
-/* Initialize a key from a given data set. */
-gcry_error_t gcry_ac_key_init (gcry_ac_key_t *key, gcry_ac_handle_t handle,
- gcry_ac_key_type_t type, gcry_ac_data_t data);
-/* Generates a new key pair via the handle HANDLE of NBITS bits and
- stores it in KEY_PAIR. In case non-standard settings are wanted, a
- pointer to a structure of type gcry_ac_key_spec_<algorithm>_t,
- matching the selected algorithm, can be given as KEY_SPEC.
- MISC_DATA is not used yet. */
-gcry_error_t gcry_ac_key_pair_generate (gcry_ac_handle_t handle,
- unsigned int nbits, void *spec,
- gcry_ac_key_pair_t *key_pair,
- gcry_mpi_t **misc_data);
-/* Returns the key of type WHICH out of the key pair KEY_PAIR. */
-gcry_ac_key_t gcry_ac_key_pair_extract (gcry_ac_key_pair_t key_pair,
- gcry_ac_key_type_t which);
-/* Returns the data set contained in the key KEY. */
-gcry_ac_data_t gcry_ac_key_data_get (gcry_ac_key_t key);
-/* Verifies that the key KEY is sane via HANDLE. */
-gcry_error_t gcry_ac_key_test (gcry_ac_handle_t handle, gcry_ac_key_t key);
-/* Stores the number of bits of the key KEY in NBITS via HANDLE. */
-gcry_error_t gcry_ac_key_get_nbits (gcry_ac_handle_t handle,
- gcry_ac_key_t key, unsigned int *nbits);
-/* Writes the 20 byte long key grip of the key KEY to KEY_GRIP via
-gcry_error_t gcry_ac_key_get_grip (gcry_ac_handle_t handle, gcry_ac_key_t key,
- unsigned char *key_grip);
-void gcry_ac_key_destroy (gcry_ac_key_t key);
-/* Destroy a key pair. */
-void gcry_ac_key_pair_destroy (gcry_ac_key_pair_t key_pair);
-/* Encodes a message according to the encoding method METHOD. OPTIONS
- must be a pointer to a method-specific structure
-gcry_error_t gcry_ac_data_encode (gcry_ac_em_t method,
- unsigned int flags, void *options,
- gcry_ac_io_t *io_write);
-/* Decodes a message according to the encoding method METHOD. OPTIONS
- must be a pointer to a method-specific structure
-gcry_error_t gcry_ac_data_decode (gcry_ac_em_t method,
- unsigned int flags, void *options,
- gcry_ac_io_t *io_write);
-/* Encrypt the plain text MPI value DATA_PLAIN with the key KEY under
- the control of the flags FLAGS and store the resulting data set
- into DATA_ENCRYPTED. */
-gcry_error_t gcry_ac_data_encrypt (gcry_ac_handle_t handle,
- gcry_ac_data_t *data_encrypted);
-/* Decrypt the decrypted data contained in the data set DATA_ENCRYPTED
- with the key KEY under the control of the flags FLAGS and store the
- resulting plain text MPI value in DATA_PLAIN. */
-gcry_error_t gcry_ac_data_decrypt (gcry_ac_handle_t handle,
- gcry_mpi_t *data_plain,
- gcry_ac_data_t data_encrypted);
-/* Sign the data contained in DATA with the key KEY and store the
- resulting signature in the data set DATA_SIGNATURE. */
-gcry_error_t gcry_ac_data_sign (gcry_ac_handle_t handle,
- gcry_ac_data_t *data_signature);
-/* Verify that the signature contained in the data set DATA_SIGNATURE
- is indeed the result of signing the data contained in DATA with the
- secret key belonging to the public key KEY. */
-gcry_error_t gcry_ac_data_verify (gcry_ac_handle_t handle,
- gcry_ac_data_t data_signature);
-/* Encrypts the plain text readable from IO_MESSAGE through HANDLE
- with the public key KEY according to SCHEME, FLAGS and OPTS. If
- OPTS is not NULL, it has to be a pointer to a structure specific to
- the chosen scheme (gcry_ac_es_*_t). The encrypted message is
- written to IO_CIPHER. */
-gcry_error_t gcry_ac_data_encrypt_scheme (gcry_ac_handle_t handle,
- gcry_ac_scheme_t scheme,
- unsigned int flags, void *opts,
- gcry_ac_io_t *io_message,
- gcry_ac_io_t *io_cipher);
-/* Decrypts the cipher text readable from IO_CIPHER through HANDLE
- with the secret key KEY according to SCHEME, @var{flags} and OPTS.
- If OPTS is not NULL, it has to be a pointer to a structure specific
- to the chosen scheme (gcry_ac_es_*_t). The decrypted message is
- written to IO_MESSAGE. */
-gcry_error_t gcry_ac_data_decrypt_scheme (gcry_ac_handle_t handle,
- gcry_ac_scheme_t scheme,
- unsigned int flags, void *opts,
- gcry_ac_io_t *io_cipher,
- gcry_ac_io_t *io_message);
-/* Signs the message readable from IO_MESSAGE through HANDLE with the
- secret key KEY according to SCHEME, FLAGS and OPTS. If OPTS is not
- NULL, it has to be a pointer to a structure specific to the chosen
- scheme (gcry_ac_ssa_*_t). The signature is written to
-gcry_error_t gcry_ac_data_sign_scheme (gcry_ac_handle_t handle,
- gcry_ac_scheme_t scheme,
- unsigned int flags, void *opts,
- gcry_ac_io_t *io_message,
- gcry_ac_io_t *io_signature);
-/* Verifies through HANDLE that the signature readable from
- IO_SIGNATURE is indeed the result of signing the message readable
- from IO_MESSAGE with the secret key belonging to the public key KEY
- according to SCHEME and OPTS. If OPTS is not NULL, it has to be an
- anonymous structure (gcry_ac_ssa_*_t) specific to the chosen
-gcry_error_t gcry_ac_data_verify_scheme (gcry_ac_handle_t handle,
- gcry_ac_scheme_t scheme,
- unsigned int flags, void *opts,
- gcry_ac_io_t *io_message,
- gcry_ac_io_t *io_signature);
-/* Store the textual representation of the algorithm whose id is given
- in ALGORITHM in NAME. This function is deprecated; use
-#ifndef GCRYPT_NO_DEPRECATED
-gcry_error_t gcry_ac_id_to_name (gcry_ac_id_t algorithm,
- /* */ _GCRY_GCC_ATTR_DEPRECATED;
-/* Store the numeric ID of the algorithm whose textual representation
- is contained in NAME in ALGORITHM. This function is deprecated;
- use gcry_pk_map_name. */
-gcry_error_t gcry_ac_name_to_id (const char *name,
- gcry_ac_id_t *algorithm)
- /* */ _GCRY_GCC_ATTR_DEPRECATED;
-/************************************
- * Random Generating Functions *
- ************************************/
-/* The possible values for the random quality. The rule of thumb is
- to use STRONG for session keys and VERY_STRONG for key material.
- WEAK is usually an alias for STRONG and should not be used anymore
- (except with gcry_mpi_randomize); use gcry_create_nonce instead. */
-typedef enum gcry_random_level
- GCRY_STRONG_RANDOM = 1,
- GCRY_VERY_STRONG_RANDOM = 2
-/* Fill BUFFER with LENGTH bytes of random, using random numbers of
-void gcry_randomize (void *buffer, size_t length,
- enum gcry_random_level level);
-/* Add the external random from BUFFER with LENGTH bytes into the
- pool. QUALITY should either be -1 for unknown or in the range of 0
-gcry_error_t gcry_random_add_bytes (const void *buffer, size_t length,
-/* If random numbers are used in an application, this macro should be
- called from time to time so that new stuff gets added to the
- internal pool of the RNG. */
-#define gcry_fast_random_poll() gcry_control (GCRYCTL_FAST_POLL, NULL)
-/* Return NBYTES of allocated random using a random numbers of quality
-void *gcry_random_bytes (size_t nbytes, enum gcry_random_level level)
-/* Return NBYTES of allocated random using a random numbers of quality
- LEVEL. The random numbers are created returned in "secure"
-void *gcry_random_bytes_secure (size_t nbytes, enum gcry_random_level level)
-/* Set the big integer W to a random value of NBITS using a random
- generator with quality LEVEL. Note that by using a level of
- GCRY_WEAK_RANDOM gcry_create_nonce is used internally. */
-void gcry_mpi_randomize (gcry_mpi_t w,
- unsigned int nbits, enum gcry_random_level level);
-/* Create an unpredicable nonce of LENGTH bytes in BUFFER. */
-void gcry_create_nonce (void *buffer, size_t length);
-/*******************************/
-/* Prime Number Functions */
-/*******************************/
-/* Mode values passed to a gcry_prime_check_func_t. */
-#define GCRY_PRIME_CHECK_AT_FINISH 0
-#define GCRY_PRIME_CHECK_AT_GOT_PRIME 1
-#define GCRY_PRIME_CHECK_AT_MAYBE_PRIME 2
-/* The function should return 1 if the operation shall continue, 0 to
- reject the prime candidate. */
-typedef int (*gcry_prime_check_func_t) (void *arg, int mode,
-/* Flags for gcry_prime_generate(): */
-/* Allocate prime numbers and factors in secure memory. */
-#define GCRY_PRIME_FLAG_SECRET (1 << 0)
-/* Make sure that at least one prime factor is of size
-#define GCRY_PRIME_FLAG_SPECIAL_FACTOR (1 << 1)
-/* Generate a new prime number of PRIME_BITS bits and store it in
- PRIME. If FACTOR_BITS is non-zero, one of the prime factors of
- (prime - 1) / 2 must be FACTOR_BITS bits long. If FACTORS is
- non-zero, allocate a new, NULL-terminated array holding the prime
- factors and store it in FACTORS. FLAGS might be used to influence
- the prime number generation process. */
-gcry_error_t gcry_prime_generate (gcry_mpi_t *prime,
- unsigned int prime_bits,
- unsigned int factor_bits,
- gcry_prime_check_func_t cb_func,
- gcry_random_level_t random_level,
-/* Find a generator for PRIME where the factorization of (prime-1) is
- in the NULL terminated array FACTORS. Return the generator as a
- newly allocated MPI in R_G. If START_G is not NULL, use this as
- teh start for the search. */
-gcry_error_t gcry_prime_group_generator (gcry_mpi_t *r_g,
-/* Convenience function to release the FACTORS array. */
-void gcry_prime_release_factors (gcry_mpi_t *factors);
-/* Check wether the number X is prime. */
-gcry_error_t gcry_prime_check (gcry_mpi_t x, unsigned int flags);
-/************************************
- * Miscellaneous Stuff *
- ************************************/
-/* Log levels used by the internal logging facility. */
- GCRY_LOG_CONT = 0, /* (Continue the last log line.) */
-/* Type for progress handlers. */
-typedef void (*gcry_handler_progress_t) (void *, const char *, int, int, int);
-/* Type for memory allocation handlers. */
-typedef void *(*gcry_handler_alloc_t) (size_t n);
-/* Type for secure memory check handlers. */
-typedef int (*gcry_handler_secure_check_t) (const void *);
-/* Type for memory reallocation handlers. */
-typedef void *(*gcry_handler_realloc_t) (void *p, size_t n);
-/* Type for memory free handlers. */
-typedef void (*gcry_handler_free_t) (void *);
-/* Type for out-of-memory handlers. */
-typedef int (*gcry_handler_no_mem_t) (void *, size_t, unsigned int);
-/* Type for fatal error handlers. */
-typedef void (*gcry_handler_error_t) (void *, int, const char *);
-/* Type for logging handlers. */
-typedef void (*gcry_handler_log_t) (void *, int, const char *, va_list);
-/* Certain operations can provide progress information. This function
- is used to register a handler for retrieving these information. */
-void gcry_set_progress_handler (gcry_handler_progress_t cb, void *cb_data);
-/* Register a custom memory allocation functions. */
-void gcry_set_allocation_handler (
- gcry_handler_alloc_t func_alloc,
- gcry_handler_alloc_t func_alloc_secure,
- gcry_handler_secure_check_t func_secure_check,
- gcry_handler_realloc_t func_realloc,
- gcry_handler_free_t func_free);
-/* Register a function used instead of the internal out of memory
-void gcry_set_outofcore_handler (gcry_handler_no_mem_t h, void *opaque);
-/* Register a function used instead of the internal fatal error
-void gcry_set_fatalerror_handler (gcry_handler_error_t fnc, void *opaque);
-/* Register a function used instead of the internal logging
-void gcry_set_log_handler (gcry_handler_log_t f, void *opaque);
-/* Reserved for future use. */
-void gcry_set_gettext_handler (const char *(*f)(const char*));
-/* Libgcrypt uses its own memory allocation. It is important to use
- gcry_free () to release memory allocated by libgcrypt. */
-void *gcry_malloc (size_t n) _GCRY_GCC_ATTR_MALLOC;
-void *gcry_calloc (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC;
-void *gcry_malloc_secure (size_t n) _GCRY_GCC_ATTR_MALLOC;
-void *gcry_calloc_secure (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC;
-void *gcry_realloc (void *a, size_t n);
-char *gcry_strdup (const char *string) _GCRY_GCC_ATTR_MALLOC;
-void *gcry_xmalloc (size_t n) _GCRY_GCC_ATTR_MALLOC;
-void *gcry_xcalloc (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC;
-void *gcry_xmalloc_secure (size_t n) _GCRY_GCC_ATTR_MALLOC;
-void *gcry_xcalloc_secure (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC;
-void *gcry_xrealloc (void *a, size_t n);
-char *gcry_xstrdup (const char * a) _GCRY_GCC_ATTR_MALLOC;
-void gcry_free (void *a);
-/* Return true if A is allocated in "secure" memory. */
-int gcry_is_secure (const void *a) _GCRY_GCC_ATTR_PURE;
-/* Return true if Libgcrypt is in FIPS mode. */
-#define gcry_fips_mode_active() !!gcry_control (GCRYCTL_FIPS_MODE_P, 0)
-/* Include support for Libgcrypt modules. */
-#include <gcrypt-module.h>
-#if 0 /* (Keep Emacsens' auto-indent happy.) */
--- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/gpg-error.h Thu Sep 06 00:17:15 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,654 +0,0 @@
-/* Output of mkheader.awk. DO NOT EDIT. */
-/* gpg-error.h - Public interface to libgpg-error.
- Copyright (C) 2003, 2004 g10 Code GmbH
- This file is part of libgpg-error.
- libgpg-error is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License
- as published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
- libgpg-error is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License along with libgpg-error; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-#define GPG_ERR_INLINE __inline__
-#elif __STDC_VERSION__ >= 199901L
-#define GPG_ERR_INLINE inline
-#if 0 /* just to make Emacs auto-indent happy */
-#endif /* __cplusplus */
-/* The GnuPG project consists of many components. Error codes are
- exchanged between all components. The common error codes and their
- user-presentable descriptions are kept into a shared library to
- allow adding new error codes and components without recompiling any
- of the other components. The interface will not change in a
- backward incompatible way.
- An error code together with an error source build up an error
- value. As the error value is been passed from one component to
- another, it preserver the information about the source and nature
- A component of the GnuPG project can define the following macro to
- tune the behaviour of the library:
- GPG_ERR_SOURCE_DEFAULT: Define to an error source of type
- gpg_err_source_t to make that source the default for gpg_error().
- Otherwise GPG_ERR_SOURCE_UNKNOWN is used as default. */
-/* The error source type gpg_err_source_t.
- Where as the Poo out of a welle small
- Taketh his firste springing and his sours.
-/* Only use free slots, never change or reorder the existing
- GPG_ERR_SOURCE_UNKNOWN = 0,
- GPG_ERR_SOURCE_GCRYPT = 1,
- GPG_ERR_SOURCE_GPG = 2,
- GPG_ERR_SOURCE_GPGSM = 3,
- GPG_ERR_SOURCE_GPGAGENT = 4,
- GPG_ERR_SOURCE_PINENTRY = 5,
- GPG_ERR_SOURCE_SCD = 6,
- GPG_ERR_SOURCE_GPGME = 7,
- GPG_ERR_SOURCE_KEYBOX = 8,
- GPG_ERR_SOURCE_KSBA = 9,
- GPG_ERR_SOURCE_DIRMNGR = 10,
- GPG_ERR_SOURCE_GSTI = 11,
- GPG_ERR_SOURCE_GPA = 12,
- GPG_ERR_SOURCE_KLEO = 13,
- GPG_ERR_SOURCE_ANY = 31,
- GPG_ERR_SOURCE_USER_1 = 32,
- GPG_ERR_SOURCE_USER_2 = 33,
- GPG_ERR_SOURCE_USER_3 = 34,
- GPG_ERR_SOURCE_USER_4 = 35,
- /* This is one more than the largest allowed entry. */
- GPG_ERR_SOURCE_DIM = 256
-/* The error code type gpg_err_code_t. */
-/* Only use free slots, never change or reorder the existing
- GPG_ERR_UNKNOWN_PACKET = 2,
- GPG_ERR_UNKNOWN_VERSION = 3,
- GPG_ERR_PUBKEY_ALGO = 4,
- GPG_ERR_DIGEST_ALGO = 5,
- GPG_ERR_BAD_PUBKEY = 6,
- GPG_ERR_BAD_SECKEY = 7,
- GPG_ERR_BAD_SIGNATURE = 8,
- GPG_ERR_BAD_PASSPHRASE = 11,
- GPG_ERR_CIPHER_ALGO = 12,
- GPG_ERR_KEYRING_OPEN = 13,
- GPG_ERR_INV_PACKET = 14,
- GPG_ERR_INV_ARMOR = 15,
- GPG_ERR_NO_USER_ID = 16,
- GPG_ERR_NO_SECKEY = 17,
- GPG_ERR_WRONG_SECKEY = 18,
- GPG_ERR_COMPR_ALGO = 20,
- GPG_ERR_NO_ENCODING_METHOD = 22,
- GPG_ERR_NO_ENCRYPTION_SCHEME = 23,
- GPG_ERR_NO_SIGNATURE_SCHEME = 24,
- GPG_ERR_NOT_FOUND = 27,
- GPG_ERR_VALUE_NOT_FOUND = 28,
- GPG_ERR_INV_PASSPHRASE = 31,
- GPG_ERR_SIG_CLASS = 32,
- GPG_ERR_RESOURCE_LIMIT = 33,
- GPG_ERR_INV_KEYRING = 34,
- GPG_ERR_INV_USER_ID = 37,
- GPG_ERR_UNEXPECTED = 38,
- GPG_ERR_TIME_CONFLICT = 39,
- GPG_ERR_KEYSERVER = 40,
- GPG_ERR_WRONG_PUBKEY_ALGO = 41,
- GPG_ERR_TRIBUTE_TO_D_A = 42,
- GPG_ERR_INV_KEYLEN = 44,
- GPG_ERR_UNKNOWN_HOST = 49,
- GPG_ERR_SELFTEST_FAILED = 50,
- GPG_ERR_NOT_ENCRYPTED = 51,
- GPG_ERR_NOT_PROCESSED = 52,
- GPG_ERR_UNUSABLE_PUBKEY = 53,
- GPG_ERR_UNUSABLE_SECKEY = 54,
- GPG_ERR_INV_VALUE = 55,
- GPG_ERR_BAD_CERT_CHAIN = 56,
- GPG_ERR_MISSING_CERT = 57,
- GPG_ERR_NOT_SUPPORTED = 60,
- GPG_ERR_EOF_GCRYPT = 64,
- GPG_ERR_TOO_SHORT = 66,
- GPG_ERR_TOO_LARGE = 67,
- GPG_ERR_NOT_IMPLEMENTED = 69,
- GPG_ERR_INV_CIPHER_MODE = 71,
- GPG_ERR_INV_HANDLE = 73,
- GPG_ERR_TRUNCATED = 74,
- GPG_ERR_INCOMPLETE_LINE = 75,
- GPG_ERR_INV_RESPONSE = 76,
- GPG_ERR_ASSUAN_SERVER_FAULT = 80,
- GPG_ERR_INV_SESSION_KEY = 82,
- GPG_ERR_UNSUPPORTED_ALGORITHM = 84,
- GPG_ERR_NO_PIN_ENTRY = 85,
- GPG_ERR_PIN_ENTRY = 86,
- GPG_ERR_INV_PARAMETER = 90,
- GPG_ERR_WRONG_CARD = 91,
- GPG_ERR_NO_DIRMNGR = 92,
- GPG_ERR_CERT_REVOKED = 94,
- GPG_ERR_NO_CRL_KNOWN = 95,
- GPG_ERR_CRL_TOO_OLD = 96,
- GPG_ERR_LINE_TOO_LONG = 97,
- GPG_ERR_NOT_TRUSTED = 98,
- GPG_ERR_BAD_CA_CERT = 100,
- GPG_ERR_CERT_EXPIRED = 101,
- GPG_ERR_CERT_TOO_YOUNG = 102,
- GPG_ERR_UNSUPPORTED_CERT = 103,
- GPG_ERR_UNKNOWN_SEXP = 104,
- GPG_ERR_UNSUPPORTED_PROTECTION = 105,
- GPG_ERR_CORRUPTED_PROTECTION = 106,
- GPG_ERR_AMBIGUOUS_NAME = 107,
- GPG_ERR_CARD_RESET = 109,
- GPG_ERR_CARD_REMOVED = 110,
- GPG_ERR_INV_CARD = 111,
- GPG_ERR_CARD_NOT_PRESENT = 112,
- GPG_ERR_NO_PKCS15_APP = 113,
- GPG_ERR_NOT_CONFIRMED = 114,
- GPG_ERR_CONFIGURATION = 115,
- GPG_ERR_NO_POLICY_MATCH = 116,
- GPG_ERR_INV_INDEX = 117,
- GPG_ERR_NO_SCDAEMON = 119,
- GPG_ERR_SCDAEMON = 120,
- GPG_ERR_UNSUPPORTED_PROTOCOL = 121,
- GPG_ERR_BAD_PIN_METHOD = 122,
- GPG_ERR_CARD_NOT_INITIALIZED = 123,
- GPG_ERR_UNSUPPORTED_OPERATION = 124,
- GPG_ERR_WRONG_KEY_USAGE = 125,
- GPG_ERR_NOTHING_FOUND = 126,
- GPG_ERR_WRONG_BLOB_TYPE = 127,
- GPG_ERR_MISSING_VALUE = 128,
- GPG_ERR_HARDWARE = 129,
- GPG_ERR_PIN_BLOCKED = 130,
- GPG_ERR_USE_CONDITIONS = 131,
- GPG_ERR_PIN_NOT_SYNCED = 132,
- GPG_ERR_ELEMENT_NOT_FOUND = 136,
- GPG_ERR_IDENTIFIER_NOT_FOUND = 137,
- GPG_ERR_INV_LENGTH = 139,
- GPG_ERR_INV_KEYINFO = 140,
- GPG_ERR_UNEXPECTED_TAG = 141,
- GPG_ERR_NOT_DER_ENCODED = 142,
- GPG_ERR_NO_CMS_OBJ = 143,
- GPG_ERR_INV_CMS_OBJ = 144,
- GPG_ERR_UNKNOWN_CMS_OBJ = 145,
- GPG_ERR_UNSUPPORTED_CMS_OBJ = 146,
- GPG_ERR_UNSUPPORTED_ENCODING = 147,
- GPG_ERR_UNSUPPORTED_CMS_VERSION = 148,
- GPG_ERR_UNKNOWN_ALGORITHM = 149,
- GPG_ERR_INV_ENGINE = 150,
- GPG_ERR_PUBKEY_NOT_TRUSTED = 151,
- GPG_ERR_DECRYPT_FAILED = 152,
- GPG_ERR_KEY_EXPIRED = 153,
- GPG_ERR_SIG_EXPIRED = 154,
- GPG_ERR_ENCODING_PROBLEM = 155,
- GPG_ERR_INV_STATE = 156,
- GPG_ERR_DUP_VALUE = 157,
- GPG_ERR_MISSING_ACTION = 158,
- GPG_ERR_MODULE_NOT_FOUND = 159,
- GPG_ERR_INV_OID_STRING = 160,
- GPG_ERR_INV_TIME = 161,
- GPG_ERR_INV_CRL_OBJ = 162,
- GPG_ERR_UNSUPPORTED_CRL_VERSION = 163,
- GPG_ERR_INV_CERT_OBJ = 164,
- GPG_ERR_UNKNOWN_NAME = 165,
- GPG_ERR_LOCALE_PROBLEM = 166,
- GPG_ERR_NOT_LOCKED = 167,
- GPG_ERR_PROTOCOL_VIOLATION = 168,
- GPG_ERR_INV_REQUEST = 170,
- GPG_ERR_UNKNOWN_EXTN = 171,
- GPG_ERR_UNKNOWN_CRIT_EXTN = 172,
- GPG_ERR_UNKNOWN_OPTION = 174,
- GPG_ERR_UNKNOWN_COMMAND = 175,
- GPG_ERR_NOT_OPERATIONAL = 176,
- GPG_ERR_NO_PASSPHRASE = 177,
- GPG_ERR_UNFINISHED = 199,
- GPG_ERR_BUFFER_TOO_SHORT = 200,
- GPG_ERR_SEXP_INV_LEN_SPEC = 201,
- GPG_ERR_SEXP_STRING_TOO_LONG = 202,
- GPG_ERR_SEXP_UNMATCHED_PAREN = 203,
- GPG_ERR_SEXP_NOT_CANONICAL = 204,
- GPG_ERR_SEXP_BAD_CHARACTER = 205,
- GPG_ERR_SEXP_BAD_QUOTATION = 206,
- GPG_ERR_SEXP_ZERO_PREFIX = 207,
- GPG_ERR_SEXP_NESTED_DH = 208,
- GPG_ERR_SEXP_UNMATCHED_DH = 209,
- GPG_ERR_SEXP_UNEXPECTED_PUNC = 210,
- GPG_ERR_SEXP_BAD_HEX_CHAR = 211,
- GPG_ERR_SEXP_ODD_HEX_NUMBERS = 212,
- GPG_ERR_SEXP_BAD_OCT_CHAR = 213,
- GPG_ERR_ASS_GENERAL = 257,
- GPG_ERR_ASS_ACCEPT_FAILED = 258,
- GPG_ERR_ASS_CONNECT_FAILED = 259,
- GPG_ERR_ASS_INV_RESPONSE = 260,
- GPG_ERR_ASS_INV_VALUE = 261,
- GPG_ERR_ASS_INCOMPLETE_LINE = 262,
- GPG_ERR_ASS_LINE_TOO_LONG = 263,
- GPG_ERR_ASS_NESTED_COMMANDS = 264,
- GPG_ERR_ASS_NO_DATA_CB = 265,
- GPG_ERR_ASS_NO_INQUIRE_CB = 266,
- GPG_ERR_ASS_NOT_A_SERVER = 267,
- GPG_ERR_ASS_NOT_A_CLIENT = 268,
- GPG_ERR_ASS_SERVER_START = 269,
- GPG_ERR_ASS_READ_ERROR = 270,
- GPG_ERR_ASS_WRITE_ERROR = 271,
- GPG_ERR_ASS_TOO_MUCH_DATA = 273,
- GPG_ERR_ASS_UNEXPECTED_CMD = 274,
- GPG_ERR_ASS_UNKNOWN_CMD = 275,
- GPG_ERR_ASS_SYNTAX = 276,
- GPG_ERR_ASS_CANCELED = 277,
- GPG_ERR_ASS_NO_INPUT = 278,
- GPG_ERR_ASS_NO_OUTPUT = 279,
- GPG_ERR_ASS_PARAMETER = 280,
- GPG_ERR_ASS_UNKNOWN_INQUIRE = 281,
- GPG_ERR_USER_10 = 1033,
- GPG_ERR_USER_11 = 1034,
- GPG_ERR_USER_12 = 1035,
- GPG_ERR_USER_13 = 1036,
- GPG_ERR_USER_14 = 1037,
- GPG_ERR_USER_15 = 1038,
- GPG_ERR_USER_16 = 1039,
- GPG_ERR_MISSING_ERRNO = 16381,
- GPG_ERR_UNKNOWN_ERRNO = 16382,
- /* The following error codes are used to map system errors. */
-#define GPG_ERR_SYSTEM_ERROR (1 << 15)
- GPG_ERR_E2BIG = GPG_ERR_SYSTEM_ERROR | 0,
- GPG_ERR_EACCES = GPG_ERR_SYSTEM_ERROR | 1,
- GPG_ERR_EADDRINUSE = GPG_ERR_SYSTEM_ERROR | 2,
- GPG_ERR_EADDRNOTAVAIL = GPG_ERR_SYSTEM_ERROR | 3,
- GPG_ERR_EADV = GPG_ERR_SYSTEM_ERROR | 4,
- GPG_ERR_EAFNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 5,
- GPG_ERR_EAGAIN = GPG_ERR_SYSTEM_ERROR | 6,
- GPG_ERR_EALREADY = GPG_ERR_SYSTEM_ERROR | 7,
- GPG_ERR_EAUTH = GPG_ERR_SYSTEM_ERROR | 8,
- GPG_ERR_EBACKGROUND = GPG_ERR_SYSTEM_ERROR | 9,
- GPG_ERR_EBADE = GPG_ERR_SYSTEM_ERROR | 10,
- GPG_ERR_EBADF = GPG_ERR_SYSTEM_ERROR | 11,
- GPG_ERR_EBADFD = GPG_ERR_SYSTEM_ERROR | 12,
- GPG_ERR_EBADMSG = GPG_ERR_SYSTEM_ERROR | 13,
- GPG_ERR_EBADR = GPG_ERR_SYSTEM_ERROR | 14,
- GPG_ERR_EBADRPC = GPG_ERR_SYSTEM_ERROR | 15,
- GPG_ERR_EBADRQC = GPG_ERR_SYSTEM_ERROR | 16,
- GPG_ERR_EBADSLT = GPG_ERR_SYSTEM_ERROR | 17,
- GPG_ERR_EBFONT = GPG_ERR_SYSTEM_ERROR | 18,
- GPG_ERR_EBUSY = GPG_ERR_SYSTEM_ERROR | 19,
- GPG_ERR_ECANCELED = GPG_ERR_SYSTEM_ERROR | 20,
- GPG_ERR_ECHILD = GPG_ERR_SYSTEM_ERROR | 21,
- GPG_ERR_ECHRNG = GPG_ERR_SYSTEM_ERROR | 22,
- GPG_ERR_ECOMM = GPG_ERR_SYSTEM_ERROR | 23,
- GPG_ERR_ECONNABORTED = GPG_ERR_SYSTEM_ERROR | 24,
- GPG_ERR_ECONNREFUSED = GPG_ERR_SYSTEM_ERROR | 25,
- GPG_ERR_ECONNRESET = GPG_ERR_SYSTEM_ERROR | 26,
- GPG_ERR_ED = GPG_ERR_SYSTEM_ERROR | 27,
- GPG_ERR_EDEADLK = GPG_ERR_SYSTEM_ERROR | 28,
- GPG_ERR_EDEADLOCK = GPG_ERR_SYSTEM_ERROR | 29,
- GPG_ERR_EDESTADDRREQ = GPG_ERR_SYSTEM_ERROR | 30,
- GPG_ERR_EDIED = GPG_ERR_SYSTEM_ERROR | 31,
- GPG_ERR_EDOM = GPG_ERR_SYSTEM_ERROR | 32,
- GPG_ERR_EDOTDOT = GPG_ERR_SYSTEM_ERROR | 33,
- GPG_ERR_EDQUOT = GPG_ERR_SYSTEM_ERROR | 34,
- GPG_ERR_EEXIST = GPG_ERR_SYSTEM_ERROR | 35,
- GPG_ERR_EFAULT = GPG_ERR_SYSTEM_ERROR | 36,
- GPG_ERR_EFBIG = GPG_ERR_SYSTEM_ERROR | 37,
- GPG_ERR_EFTYPE = GPG_ERR_SYSTEM_ERROR | 38,
- GPG_ERR_EGRATUITOUS = GPG_ERR_SYSTEM_ERROR | 39,
- GPG_ERR_EGREGIOUS = GPG_ERR_SYSTEM_ERROR | 40,
- GPG_ERR_EHOSTDOWN = GPG_ERR_SYSTEM_ERROR | 41,
- GPG_ERR_EHOSTUNREACH = GPG_ERR_SYSTEM_ERROR | 42,
- GPG_ERR_EIDRM = GPG_ERR_SYSTEM_ERROR | 43,
- GPG_ERR_EIEIO = GPG_ERR_SYSTEM_ERROR | 44,
- GPG_ERR_EILSEQ = GPG_ERR_SYSTEM_ERROR | 45,
- GPG_ERR_EINPROGRESS = GPG_ERR_SYSTEM_ERROR | 46,
- GPG_ERR_EINTR = GPG_ERR_SYSTEM_ERROR | 47,
- GPG_ERR_EINVAL = GPG_ERR_SYSTEM_ERROR | 48,
- GPG_ERR_EIO = GPG_ERR_SYSTEM_ERROR | 49,
- GPG_ERR_EISCONN = GPG_ERR_SYSTEM_ERROR | 50,
- GPG_ERR_EISDIR = GPG_ERR_SYSTEM_ERROR | 51,
- GPG_ERR_EISNAM = GPG_ERR_SYSTEM_ERROR | 52,
- GPG_ERR_EL2HLT = GPG_ERR_SYSTEM_ERROR | 53,
- GPG_ERR_EL2NSYNC = GPG_ERR_SYSTEM_ERROR | 54,
- GPG_ERR_EL3HLT = GPG_ERR_SYSTEM_ERROR | 55,
- GPG_ERR_EL3RST = GPG_ERR_SYSTEM_ERROR | 56,
- GPG_ERR_ELIBACC = GPG_ERR_SYSTEM_ERROR | 57,
- GPG_ERR_ELIBBAD = GPG_ERR_SYSTEM_ERROR | 58,
- GPG_ERR_ELIBEXEC = GPG_ERR_SYSTEM_ERROR | 59,
- GPG_ERR_ELIBMAX = GPG_ERR_SYSTEM_ERROR | 60,
- GPG_ERR_ELIBSCN = GPG_ERR_SYSTEM_ERROR | 61,
- GPG_ERR_ELNRNG = GPG_ERR_SYSTEM_ERROR | 62,
- GPG_ERR_ELOOP = GPG_ERR_SYSTEM_ERROR | 63,
- GPG_ERR_EMEDIUMTYPE = GPG_ERR_SYSTEM_ERROR | 64,
- GPG_ERR_EMFILE = GPG_ERR_SYSTEM_ERROR | 65,
- GPG_ERR_EMLINK = GPG_ERR_SYSTEM_ERROR | 66,
- GPG_ERR_EMSGSIZE = GPG_ERR_SYSTEM_ERROR | 67,
- GPG_ERR_EMULTIHOP = GPG_ERR_SYSTEM_ERROR | 68,
- GPG_ERR_ENAMETOOLONG = GPG_ERR_SYSTEM_ERROR | 69,
- GPG_ERR_ENAVAIL = GPG_ERR_SYSTEM_ERROR | 70,
- GPG_ERR_ENEEDAUTH = GPG_ERR_SYSTEM_ERROR | 71,
- GPG_ERR_ENETDOWN = GPG_ERR_SYSTEM_ERROR | 72,
- GPG_ERR_ENETRESET = GPG_ERR_SYSTEM_ERROR | 73,
- GPG_ERR_ENETUNREACH = GPG_ERR_SYSTEM_ERROR | 74,
- GPG_ERR_ENFILE = GPG_ERR_SYSTEM_ERROR | 75,
- GPG_ERR_ENOANO = GPG_ERR_SYSTEM_ERROR | 76,
- GPG_ERR_ENOBUFS = GPG_ERR_SYSTEM_ERROR | 77,
- GPG_ERR_ENOCSI = GPG_ERR_SYSTEM_ERROR | 78,
- GPG_ERR_ENODATA = GPG_ERR_SYSTEM_ERROR | 79,
- GPG_ERR_ENODEV = GPG_ERR_SYSTEM_ERROR | 80,
- GPG_ERR_ENOENT = GPG_ERR_SYSTEM_ERROR | 81,
- GPG_ERR_ENOEXEC = GPG_ERR_SYSTEM_ERROR | 82,
- GPG_ERR_ENOLCK = GPG_ERR_SYSTEM_ERROR | 83,
- GPG_ERR_ENOLINK = GPG_ERR_SYSTEM_ERROR | 84,
- GPG_ERR_ENOMEDIUM = GPG_ERR_SYSTEM_ERROR | 85,
- GPG_ERR_ENOMEM = GPG_ERR_SYSTEM_ERROR | 86,
- GPG_ERR_ENOMSG = GPG_ERR_SYSTEM_ERROR | 87,
- GPG_ERR_ENONET = GPG_ERR_SYSTEM_ERROR | 88,
- GPG_ERR_ENOPKG = GPG_ERR_SYSTEM_ERROR | 89,
- GPG_ERR_ENOPROTOOPT = GPG_ERR_SYSTEM_ERROR | 90,
- GPG_ERR_ENOSPC = GPG_ERR_SYSTEM_ERROR | 91,
- GPG_ERR_ENOSR = GPG_ERR_SYSTEM_ERROR | 92,
- GPG_ERR_ENOSTR = GPG_ERR_SYSTEM_ERROR | 93,
- GPG_ERR_ENOSYS = GPG_ERR_SYSTEM_ERROR | 94,
- GPG_ERR_ENOTBLK = GPG_ERR_SYSTEM_ERROR | 95,
- GPG_ERR_ENOTCONN = GPG_ERR_SYSTEM_ERROR | 96,
- GPG_ERR_ENOTDIR = GPG_ERR_SYSTEM_ERROR | 97,
- GPG_ERR_ENOTEMPTY = GPG_ERR_SYSTEM_ERROR | 98,
- GPG_ERR_ENOTNAM = GPG_ERR_SYSTEM_ERROR | 99,
- GPG_ERR_ENOTSOCK = GPG_ERR_SYSTEM_ERROR | 100,
- GPG_ERR_ENOTSUP = GPG_ERR_SYSTEM_ERROR | 101,
- GPG_ERR_ENOTTY = GPG_ERR_SYSTEM_ERROR | 102,
- GPG_ERR_ENOTUNIQ = GPG_ERR_SYSTEM_ERROR | 103,
- GPG_ERR_ENXIO = GPG_ERR_SYSTEM_ERROR | 104,
- GPG_ERR_EOPNOTSUPP = GPG_ERR_SYSTEM_ERROR | 105,
- GPG_ERR_EOVERFLOW = GPG_ERR_SYSTEM_ERROR | 106,
- GPG_ERR_EPERM = GPG_ERR_SYSTEM_ERROR | 107,
- GPG_ERR_EPFNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 108,
- GPG_ERR_EPIPE = GPG_ERR_SYSTEM_ERROR | 109,
- GPG_ERR_EPROCLIM = GPG_ERR_SYSTEM_ERROR | 110,
- GPG_ERR_EPROCUNAVAIL = GPG_ERR_SYSTEM_ERROR | 111,
- GPG_ERR_EPROGMISMATCH = GPG_ERR_SYSTEM_ERROR | 112,
- GPG_ERR_EPROGUNAVAIL = GPG_ERR_SYSTEM_ERROR | 113,
- GPG_ERR_EPROTO = GPG_ERR_SYSTEM_ERROR | 114,
- GPG_ERR_EPROTONOSUPPORT = GPG_ERR_SYSTEM_ERROR | 115,
- GPG_ERR_EPROTOTYPE = GPG_ERR_SYSTEM_ERROR | 116,
- GPG_ERR_ERANGE = GPG_ERR_SYSTEM_ERROR | 117,
- GPG_ERR_EREMCHG = GPG_ERR_SYSTEM_ERROR | 118,
- GPG_ERR_EREMOTE = GPG_ERR_SYSTEM_ERROR | 119,
- GPG_ERR_EREMOTEIO = GPG_ERR_SYSTEM_ERROR | 120,
- GPG_ERR_ERESTART = GPG_ERR_SYSTEM_ERROR | 121,
- GPG_ERR_EROFS = GPG_ERR_SYSTEM_ERROR | 122,
- GPG_ERR_ERPCMISMATCH = GPG_ERR_SYSTEM_ERROR | 123,
- GPG_ERR_ESHUTDOWN = GPG_ERR_SYSTEM_ERROR | 124,
- GPG_ERR_ESOCKTNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 125,
- GPG_ERR_ESPIPE = GPG_ERR_SYSTEM_ERROR | 126,
- GPG_ERR_ESRCH = GPG_ERR_SYSTEM_ERROR | 127,
- GPG_ERR_ESRMNT = GPG_ERR_SYSTEM_ERROR | 128,
- GPG_ERR_ESTALE = GPG_ERR_SYSTEM_ERROR | 129,
- GPG_ERR_ESTRPIPE = GPG_ERR_SYSTEM_ERROR | 130,
- GPG_ERR_ETIME = GPG_ERR_SYSTEM_ERROR | 131,
- GPG_ERR_ETIMEDOUT = GPG_ERR_SYSTEM_ERROR | 132,
- GPG_ERR_ETOOMANYREFS = GPG_ERR_SYSTEM_ERROR | 133,
- GPG_ERR_ETXTBSY = GPG_ERR_SYSTEM_ERROR | 134,
- GPG_ERR_EUCLEAN = GPG_ERR_SYSTEM_ERROR | 135,
- GPG_ERR_EUNATCH = GPG_ERR_SYSTEM_ERROR | 136,
- GPG_ERR_EUSERS = GPG_ERR_SYSTEM_ERROR | 137,
- GPG_ERR_EWOULDBLOCK = GPG_ERR_SYSTEM_ERROR | 138,
- GPG_ERR_EXDEV = GPG_ERR_SYSTEM_ERROR | 139,
- GPG_ERR_EXFULL = GPG_ERR_SYSTEM_ERROR | 140,
- /* This is one more than the largest allowed entry. */
- GPG_ERR_CODE_DIM = 65536
-/* The error value type gpg_error_t. */
-/* We would really like to use bit-fields in a struct, but using
- structs as return values can cause binary compatibility issues, in
- particular if you want to do it effeciently (also see
- -freg-struct-return option to GCC). */
-typedef unsigned int gpg_error_t;
-/* We use the lowest 16 bits of gpg_error_t for error codes. The 16th
- bit indicates system errors. */
-#define GPG_ERR_CODE_MASK (GPG_ERR_CODE_DIM - 1)
-/* Bits 17 to 24 are reserved. */
-/* We use the upper 8 bits of gpg_error_t for error sources. */
-#define GPG_ERR_SOURCE_MASK (GPG_ERR_SOURCE_DIM - 1)
-#define GPG_ERR_SOURCE_SHIFT 24
-#undef _GPG_ERR_HAVE_CONSTRUCTOR
-#define _GPG_ERR_GCC_VERSION (__GNUC__ * 10000 \
- + __GNUC_MINOR__ * 100 \
-#if _GPG_ERR_GCC_VERSION > 30100
-#define _GPG_ERR_CONSTRUCTOR __attribute__ ((__constructor__))
-#define _GPG_ERR_HAVE_CONSTRUCTOR
-#ifndef _GPG_ERR_CONSTRUCTOR
-#define _GPG_ERR_CONSTRUCTOR
-/* Initialization function. */
-/* Initialize the library. This function should be run early. */
-gpg_error_t gpg_err_init (void) _GPG_ERR_CONSTRUCTOR;
-/* If this is defined, the library is already initialized by the
- constructor and does not need to be initialized explicitely. */
-#undef GPG_ERR_INITIALIZED
-#ifdef _GPG_ERR_HAVE_CONSTRUCTOR
-#define GPG_ERR_INITIALIZED 1
-/* Constructor and accessor functions. */
-/* Construct an error value from an error code and source. Within a
- subsystem, use gpg_error. */
-static GPG_ERR_INLINE gpg_error_t
-gpg_err_make (gpg_err_source_t source, gpg_err_code_t code)
- return code == GPG_ERR_NO_ERROR ? GPG_ERR_NO_ERROR
- : (((source & GPG_ERR_SOURCE_MASK) << GPG_ERR_SOURCE_SHIFT)
- | (code & GPG_ERR_CODE_MASK));
-/* The user should define GPG_ERR_SOURCE_DEFAULT before including this
- file to specify a default source for gpg_error. */
-#ifndef GPG_ERR_SOURCE_DEFAULT
-#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_UNKNOWN
-static GPG_ERR_INLINE gpg_error_t
-gpg_error (gpg_err_code_t code)
- return gpg_err_make (GPG_ERR_SOURCE_DEFAULT, code);
-/* Retrieve the error code from an error value. */
-static GPG_ERR_INLINE gpg_err_code_t
-gpg_err_code (gpg_error_t err)
- return (gpg_err_code_t) (err & GPG_ERR_CODE_MASK);
-/* Retrieve the error source from an error value. */
-static GPG_ERR_INLINE gpg_err_source_t
-gpg_err_source (gpg_error_t err)
- return (gpg_err_source_t) ((err >> GPG_ERR_SOURCE_SHIFT)
- & GPG_ERR_SOURCE_MASK);
-/* Return a pointer to a string containing a description of the error
- code in the error value ERR. This function is not thread-safe. */
-const char *gpg_strerror (gpg_error_t err);
-/* Return the error string for ERR in the user-supplied buffer BUF of
- size BUFLEN. This function is, in contrast to gpg_strerror,
- thread-safe if a thread-safe strerror_r() function is provided by
- the system. If the function succeeds, 0 is returned and BUF
- contains the string describing the error. If the buffer was not
- large enough, ERANGE is returned and BUF contains as much of the
- beginning of the error string as fits into the buffer. */
-int gpg_strerror_r (gpg_error_t err, char *buf, size_t buflen);
-/* Return a pointer to a string containing a description of the error
- source in the error value ERR. */
-const char *gpg_strsource (gpg_error_t err);
-/* Mapping of system errors (errno). */
-/* Retrieve the error code for the system error ERR. This returns
- GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
-gpg_err_code_t gpg_err_code_from_errno (int err);
-/* Retrieve the system error for the error code CODE. This returns 0
- if CODE is not a system error code. */
-int gpg_err_code_to_errno (gpg_err_code_t code);
-/* Retrieve the error code directly from the ERRNO variable. This
- returns GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped
- (report this) and GPG_ERR_MISSING_ERRNO if ERRNO has the value 0. */
-gpg_err_code_t gpg_err_code_from_syserror (void);
-/* Self-documenting convenience functions. */
-static GPG_ERR_INLINE gpg_error_t
-gpg_err_make_from_errno (gpg_err_source_t source, int err)
- return gpg_err_make (source, gpg_err_code_from_errno (err));
-static GPG_ERR_INLINE gpg_error_t
-gpg_error_from_errno (int err)
- return gpg_error (gpg_err_code_from_errno (err));
-static GPG_ERR_INLINE gpg_error_t
-gpg_error_from_syserror (void)
- return gpg_error (gpg_err_code_from_syserror ());
-#endif /* GPG_ERROR_H */
--- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/mem.h Thu Sep 06 00:17:15 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
- * Off-the-Record Messaging library
- * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-void otrl_mem_init(void);
--- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/message.h Thu Sep 06 00:17:15 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,210 +0,0 @@
- * Off-the-Record Messaging library
- * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-typedef struct s_OtrlMessageAppOps {
- /* Return the OTR policy for the given context. */
- OtrlPolicy (*policy)(void *opdata, ConnContext *context);
- /* Create a private key for the given accountname/protocol if
- void (*create_privkey)(void *opdata, const char *accountname,
- /* Report whether you think the given user is online. Return 1 if
- * you think he is, 0 if you think he isn't, -1 if you're not sure.
- * If you return 1, messages such as heartbeats or other
- * notifications may be sent to the user, which could result in "not
- * logged in" errors if you're wrong. */
- int (*is_logged_in)(void *opdata, const char *accountname,
- const char *protocol, const char *recipient);
- /* Send the given IM to the given recipient from the given
- * accountname/protocol. */
- void (*inject_message)(void *opdata, const char *accountname,
- const char *protocol, const char *recipient, const char *message);
- /* Display a notification message for a particular accountname /
- * protocol / username conversation. */
- void (*notify)(void *opdata, OtrlNotifyLevel level,
- const char *accountname, const char *protocol,
- const char *username, const char *title,
- const char *primary, const char *secondary);
- /* Display an OTR control message for a particular accountname /
- * protocol / username conversation. Return 0 if you are able to
- * successfully display it. If you return non-0 (or if this
- * function is NULL), the control message will be displayed inline,
- * as a received message, or else by using the above notify()
- int (*display_otr_message)(void *opdata, const char *accountname,
- const char *protocol, const char *username, const char *msg);
- /* When the list of ConnContexts changes (including a change in
- * state), this is called so the UI can be updated. */
- void (*update_context_list)(void *opdata);
- /* Return a newly allocated string containing a human-friendly name
- * for the given protocol id */
- const char *(*protocol_name)(void *opdata, const char *protocol);
- /* Deallocate a string allocated by protocol_name */
- void (*protocol_name_free)(void *opdata, const char *protocol_name);
- /* A new fingerprint for the given user has been received. */
- void (*new_fingerprint)(void *opdata, OtrlUserState us,
- const char *accountname, const char *protocol,
- const char *username, unsigned char fingerprint[20]);
- /* The list of known fingerprints has changed. Write them to disk. */
- void (*write_fingerprints)(void *opdata);
- /* A ConnContext has entered a secure state. */
- void (*gone_secure)(void *opdata, ConnContext *context);
- /* A ConnContext has left a secure state. */
- void (*gone_insecure)(void *opdata, ConnContext *context);
- /* We have completed an authentication, using the D-H keys we
- * already knew. is_reply indicates whether we initiated the AKE. */
- void (*still_secure)(void *opdata, ConnContext *context, int is_reply);
- /* Log a message. The passed message will end in "\n". */
- void (*log_message)(void *opdata, const char *message);
- /* Find the maximum message size supported by this protocol. */
- int (*max_message_size)(void *opdata, ConnContext *context);
- /* Return a newly allocated string containing a human-friendly
- * representation for the given account */
- const char *(*account_name)(void *opdata, const char *account,
- /* Deallocate a string returned by account_name */
- void (*account_name_free)(void *opdata, const char *account_name);
-/* Deallocate a message allocated by other otrl_message_* routines. */
-void otrl_message_free(char *message);
-/* Handle a message about to be sent to the network. It is safe to pass
- * all messages about to be sent to this routine. add_appdata is a
- * function that will be called in the event that a new ConnContext is
- * created. It will be passed the data that you supplied, as well as a
- * pointer to the new ConnContext. You can use this to add
- * application-specific information to the ConnContext using the
- * "context->app" field, for example. If you don't need to do this, you
- * can pass NULL for the last two arguments of otrl_message_sending.
- * tlvs is a chain of OtrlTLVs to append to the private message. It is
- * usually correct to just pass NULL here.
- * If this routine returns non-zero, then the library tried to encrypt
- * the message, but for some reason failed. DO NOT send the message in
- * the clear in that case.
- * If *messagep gets set by the call to something non-NULL, then you
- * should replace your message with the contents of *messagep, and
- * send that instead. Call otrl_message_free(*messagep) when you're
-gcry_error_t otrl_message_sending(OtrlUserState us,
- const OtrlMessageAppOps *ops,
- void *opdata, const char *accountname, const char *protocol,
- const char *recipient, const char *message, OtrlTLV *tlvs,
- void (*add_appdata)(void *data, ConnContext *context),
-/* Handle a message just received from the network. It is safe to pass
- * all received messages to this routine. add_appdata is a function
- * that will be called in the event that a new ConnContext is created.
- * It will be passed the data that you supplied, as well as
- * a pointer to the new ConnContext. You can use this to add
- * application-specific information to the ConnContext using the
- * "context->app" field, for example. If you don't need to do this, you
- * can pass NULL for the last two arguments of otrl_message_receiving.
- * If otrl_message_receiving returns 1, then the message you received
- * was an internal protocol message, and no message should be delivered
- * If it returns 0, then check if *messagep was set to non-NULL. If
- * so, replace the received message with the contents of *messagep, and
- * deliver that to the user instead. You must call
- * otrl_message_free(*messagep) when you're done with it. If tlvsp is
- * non-NULL, *tlvsp will be set to a chain of any TLVs that were
- * transmitted along with this message. You must call
- * otrl_tlv_free(*tlvsp) when you're done with those.
- * If otrl_message_receiving returns 0 and *messagep is NULL, then this
- * was an ordinary, non-OTR message, which should just be delivered to
- * the user without modification. */
-int otrl_message_receiving(OtrlUserState us, const OtrlMessageAppOps *ops,
- void *opdata, const char *accountname, const char *protocol,
- const char *sender, const char *message, char **newmessagep,
- void (*add_appdata)(void *data, ConnContext *context),
-/* Send a message to the network, fragmenting first if necessary.
- * All messages to be sent to the network should go through this
- * method immediately before they are sent, ie after encryption. */
-gcry_error_t otrl_message_fragment_and_send(const OtrlMessageAppOps *ops,
- void *opdata, ConnContext *context, const char *message,
- OtrlFragmentPolicy fragPolicy, char **returnFragment);
-/* Put a connection into the PLAINTEXT state, first sending the
- * other side a notice that we're doing so if we're currently ENCRYPTED,
- * and we think he's logged in. */
-void otrl_message_disconnect(OtrlUserState us, const OtrlMessageAppOps *ops,
- void *opdata, const char *accountname, const char *protocol,
-/* Initiate the Socialist Millionaires' Protocol */
-void otrl_message_initiate_smp(OtrlUserState us, const OtrlMessageAppOps *ops,
- void *opdata, ConnContext *context, const unsigned char *secret,
-/* Initiate the Socialist Millionaires' Protocol and send a prompt
- * question to the buddy */
-void otrl_message_initiate_smp_q(OtrlUserState us,
- const OtrlMessageAppOps *ops, void *opdata, ConnContext *context,
- const char *question, const unsigned char *secret, size_t secretlen);
-/* Respond to a buddy initiating the Socialist Millionaires' Protocol */
-void otrl_message_respond_smp(OtrlUserState us, const OtrlMessageAppOps *ops,
- void *opdata, ConnContext *context, const unsigned char *secret,
-/* Abort the SMP. Called when an unexpected SMP message breaks the
-void otrl_message_abort_smp(OtrlUserState us, const OtrlMessageAppOps *ops,
- void *opdata, ConnContext *context);
--- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/privkey-t.h Thu Sep 06 00:17:15 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
- * Off-the-Record Messaging library
- * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-typedef struct s_OtrlPrivKey {
- struct s_OtrlPrivKey *next;
- struct s_OtrlPrivKey **tous;
- unsigned short pubkey_type;
- unsigned char *pubkey_data;
-#define OTRL_PUBKEY_TYPE_DSA 0x0000
--- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/privkey.h Thu Sep 06 00:17:15 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
- * Off-the-Record Messaging library
- * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-/* Convert a 20-byte hash value to a 45-byte human-readable value */
-void otrl_privkey_hash_to_human(char human[45], const unsigned char hash[20]);
-/* Calculate a human-readable hash of our DSA public key. Return it in
- * the passed fingerprint buffer. Return NULL on error, or a pointer to
- * the given buffer on success. */
-char *otrl_privkey_fingerprint(OtrlUserState us, char fingerprint[45],
- const char *accountname, const char *protocol);
-/* Calculate a raw hash of our DSA public key. Return it in the passed
- * fingerprint buffer. Return NULL on error, or a pointer to the given
- * buffer on success. */
-unsigned char *otrl_privkey_fingerprint_raw(OtrlUserState us,
- unsigned char hash[20], const char *accountname, const char *protocol);
-/* Read a sets of private DSA keys from a file on disk into the given
-gcry_error_t otrl_privkey_read(OtrlUserState us, const char *filename);
-/* Read a sets of private DSA keys from a FILE* into the given
- * OtrlUserState. The FILE* must be open for reading. */
-gcry_error_t otrl_privkey_read_FILEp(OtrlUserState us, FILE *privf);
-/* Generate a private DSA key for a given account, storing it into a
- * file on disk, and loading it into the given OtrlUserState. Overwrite any
- * previously generated keys for that account in that OtrlUserState. */
-gcry_error_t otrl_privkey_generate(OtrlUserState us, const char *filename,
- const char *accountname, const char *protocol);
-/* Generate a private DSA key for a given account, storing it into a
- * FILE*, and loading it into the given OtrlUserState. Overwrite any
- * previously generated keys for that account in that OtrlUserState.
- * The FILE* must be open for reading and writing. */
-gcry_error_t otrl_privkey_generate_FILEp(OtrlUserState us, FILE *privf,
- const char *accountname, const char *protocol);
-/* Read the fingerprint store from a file on disk into the given
- * OtrlUserState. Use add_app_data to add application data to each
- * ConnContext so created. */
-gcry_error_t otrl_privkey_read_fingerprints(OtrlUserState us,
- void (*add_app_data)(void *data, ConnContext *context),
-/* Read the fingerprint store from a FILE* into the given
- * OtrlUserState. Use add_app_data to add application data to each
- * ConnContext so created. The FILE* must be open for reading. */
-gcry_error_t otrl_privkey_read_fingerprints_FILEp(OtrlUserState us,
- void (*add_app_data)(void *data, ConnContext *context),
-/* Write the fingerprint store from a given OtrlUserState to a file on disk. */
-gcry_error_t otrl_privkey_write_fingerprints(OtrlUserState us,
-/* Write the fingerprint store from a given OtrlUserState to a FILE*.
- * The FILE* must be open for writing. */
-gcry_error_t otrl_privkey_write_fingerprints_FILEp(OtrlUserState us,
-/* Fetch the private key from the given OtrlUserState associated with
-OtrlPrivKey *otrl_privkey_find(OtrlUserState us, const char *accountname,
-/* Forget a private key */
-void otrl_privkey_forget(OtrlPrivKey *privkey);
-/* Forget all private keys in a given OtrlUserState. */
-void otrl_privkey_forget_all(OtrlUserState us);
-/* Sign data using a private key. The data must be small enough to be
- * signed (i.e. already hashed, if necessary). The signature will be
- * returned in *sigp, which the caller must free(). Its length will be
- * returned in *siglenp. */
-gcry_error_t otrl_privkey_sign(unsigned char **sigp, size_t *siglenp,
- OtrlPrivKey *privkey, const unsigned char *data, size_t len);
-/* Verify a signature on data using a public key. The data must be
- * small enough to be signed (i.e. already hashed, if necessary). */
-gcry_error_t otrl_privkey_verify(const unsigned char *sigbuf, size_t siglen,
- unsigned short pubkey_type, gcry_sexp_t pubs,
- const unsigned char *data, size_t len);
--- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/proto.h Thu Sep 06 00:17:15 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
- * Off-the-Record Messaging library
- * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-/* If we ever see this sequence in a plaintext message, we'll assume the
- * other side speaks OTR, and try to establish a connection. */
-#define OTRL_MESSAGE_TAG_BASE " \t \t\t\t\t \t \t \t "
-/* The following must each be of length 8 */
-#define OTRL_MESSAGE_TAG_V1 " \t \t \t "
-#define OTRL_MESSAGE_TAG_V2 " \t\t \t "
-/* The possible flags contained in a Data Message */
-#define OTRL_MSGFLAGS_IGNORE_UNREADABLE 0x01
-typedef unsigned int OtrlPolicy;
-#define OTRL_POLICY_ALLOW_V1 0x01
-#define OTRL_POLICY_ALLOW_V2 0x02
-#define OTRL_POLICY_REQUIRE_ENCRYPTION 0x04
-#define OTRL_POLICY_SEND_WHITESPACE_TAG 0x08
-#define OTRL_POLICY_WHITESPACE_START_AKE 0x10
-#define OTRL_POLICY_ERROR_START_AKE 0x20
-#define OTRL_POLICY_VERSION_MASK (OTRL_POLICY_ALLOW_V1 | OTRL_POLICY_ALLOW_V2)
-/* For v1 compatibility */
-#define OTRL_POLICY_NEVER 0x00
-#define OTRL_POLICY_OPPORTUNISTIC \
- ( OTRL_POLICY_ALLOW_V1 | \
- OTRL_POLICY_ALLOW_V2 | \
- OTRL_POLICY_SEND_WHITESPACE_TAG | \
- OTRL_POLICY_WHITESPACE_START_AKE | \
- OTRL_POLICY_ERROR_START_AKE )
-#define OTRL_POLICY_MANUAL \
- ( OTRL_POLICY_ALLOW_V1 | \
-#define OTRL_POLICY_ALWAYS \
- ( OTRL_POLICY_ALLOW_V1 | \
- OTRL_POLICY_ALLOW_V2 | \
- OTRL_POLICY_REQUIRE_ENCRYPTION | \
- OTRL_POLICY_WHITESPACE_START_AKE | \
- OTRL_POLICY_ERROR_START_AKE )
-#define OTRL_POLICY_DEFAULT OTRL_POLICY_OPPORTUNISTIC
- OTRL_MSGTYPE_TAGGEDPLAINTEXT,
- OTRL_MSGTYPE_DH_COMMIT,
- OTRL_MSGTYPE_REVEALSIG,
- OTRL_MSGTYPE_SIGNATURE,
- OTRL_MSGTYPE_V1_KEYEXCH,
- OTRL_FRAGMENT_UNFRAGMENTED,
- OTRL_FRAGMENT_INCOMPLETE,
- OTRL_FRAGMENT_SEND_ALL,
- OTRL_FRAGMENT_SEND_ALL_BUT_FIRST,
- OTRL_FRAGMENT_SEND_ALL_BUT_LAST
-/* Initialize the OTR library. Pass the version of the API you are
-void otrl_init(unsigned int ver_major, unsigned int ver_minor,
-#define OTRL_INIT do { \
- otrl_init(OTRL_VERSION_MAJOR, OTRL_VERSION_MINOR, OTRL_VERSION_SUB); \
-/* Return a pointer to a static string containing the version number of
-const char *otrl_version(void);
-/* Return a pointer to a newly-allocated OTR query message, customized
- * with our name. The caller should free() the result when he's done
-char *otrl_proto_default_query_msg(const char *ourname, OtrlPolicy policy);
-/* Return the best version of OTR support by both sides, given an OTR
- * Query Message and the local policy. */
-unsigned int otrl_proto_query_bestversion(const char *querymsg,
-/* Locate any whitespace tag in this message, and return the best
- * version of OTR support on both sides. Set *starttagp and *endtagp to
- * the start and end of the located tag, so that it can be snipped out. */
-unsigned int otrl_proto_whitespace_bestversion(const char *msg,
- const char **starttagp, const char **endtagp, OtrlPolicy policy);
-/* Return the Message type of the given message. */
-OtrlMessageType otrl_proto_message_type(const char *message);
-/* Create an OTR Data message. Pass the plaintext as msg, and an
- * optional chain of TLVs. A newly-allocated string will be returned in
-gcry_error_t otrl_proto_create_data(char **encmessagep, ConnContext *context,
- const char *msg, const OtrlTLV *tlvs, unsigned char flags);
-/* Extract the flags from an otherwise unreadable Data Message. */
-gcry_error_t otrl_proto_data_read_flags(const char *datamsg,
- unsigned char *flagsp);
-/* Accept an OTR Data Message in datamsg. Decrypt it and put the
- * plaintext into *plaintextp, and any TLVs into tlvsp. Put any
- * received flags into *flagsp (if non-NULL). */
-gcry_error_t otrl_proto_accept_data(char **plaintextp, OtrlTLV **tlvsp,
- ConnContext *context, const char *datamsg, unsigned char *flagsp);
-/* Accumulate a potential fragment into the current context. */
-OtrlFragmentResult otrl_proto_fragment_accumulate(char **unfragmessagep,
- ConnContext *context, const char *msg);
-gcry_error_t otrl_proto_fragment_create(int mms, int fragment_count,
- char ***fragments, const char *message);
-void otrl_proto_fragment_free(char ***fragments, unsigned short arraylen);
--- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/serial.h Thu Sep 06 00:17:15 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
- * Off-the-Record Messaging library
- * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#define debug_data(t,b,l) do { const unsigned char *data = (b); size_t i; \
- fprintf(stderr, "%s: ", (t)); \
- fprintf(stderr, "%02x", data[i]); \
- fprintf(stderr, "\n"); \
-#define debug_int(t,b) do { const unsigned char *data = (b); \
- (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; \
- fprintf(stderr, "%s: %u (0x%x)\n", (t), v, v); \
-#define debug_data(t,b,l)
-#define write_int(x) do { \
- bufp[0] = ((x) >> 24) & 0xff; \
- bufp[1] = ((x) >> 16) & 0xff; \
- bufp[2] = ((x) >> 8) & 0xff; \
- bufp[3] = (x) & 0xff; \
- bufp += 4; lenp -= 4; \
-#define write_mpi(x,nx,dx) do { \
- gcry_mpi_print(format, bufp, lenp, NULL, (x)); \
- debug_data((dx), bufp, (nx)); \
- bufp += (nx); lenp -= (nx); \
-#define require_len(l) do { \
- if (lenp < (l)) goto invval; \
-#define read_int(x) do { \
- (x) = (bufp[0] << 24) | (bufp[1] << 16) | (bufp[2] << 8) | bufp[3]; \
- bufp += 4; lenp -= 4; \
-#define read_mpi(x) do { \
- gcry_mpi_scan(&(x), GCRYMPI_FMT_USG, bufp, mpilen, NULL); \
- (x) = gcry_mpi_set_ui(NULL, 0); \
- bufp += mpilen; lenp -= mpilen; \
--- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/sm.h Thu Sep 06 00:17:15 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
- * Off-the-Record Messaging library
- * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#define SM_HASH_ALGORITHM GCRY_MD_SHA256
-#define SM_DIGEST_SIZE 32
- OTRL_SMP_PROG_OK = 0, /* All is going fine so far */
- OTRL_SMP_PROG_CHEATED = -2, /* Some verification failed */
- OTRL_SMP_PROG_FAILED = -1, /* The secrets didn't match */
- OTRL_SMP_PROG_SUCCEEDED = 1 /* The SMP completed successfully */
- gcry_mpi_t secret, x2, x3, g1, g2, g3, g3o, p, q, pab, qab;
- NextExpectedSMP nextExpected;
- int received_question; /* 1 if we received a question in an SMP1Q TLV */
- OtrlSMProgState sm_prog_state;
-typedef OtrlSMState OtrlSMAliceState;
-typedef OtrlSMState OtrlSMBobState;
- * Call this once, at plugin load time. It sets up the modulus and
-void otrl_sm_init(void);
- * Initialize the fields of a SM state.
-void otrl_sm_state_new(OtrlSMState *smst);
- * Initialize the fields of a SM state. Called the first time that
- * a user begins an SMP session.
-void otrl_sm_state_init(OtrlSMState *smst);
- * Deallocate the contents of a OtrlSMState (but not the OtrlSMState
-void otrl_sm_state_free(OtrlSMState *smst);
-gcry_error_t otrl_sm_step1(OtrlSMAliceState *astate, const unsigned char* secret, int secretlen, unsigned char** output, int* outputlen);
-gcry_error_t otrl_sm_step2a(OtrlSMBobState *bstate, const unsigned char* input, const int inputlen, int received_question);
-gcry_error_t otrl_sm_step2b(OtrlSMBobState *bstate, const unsigned char* secret, int secretlen, unsigned char **output, int* outputlen);
-gcry_error_t otrl_sm_step3(OtrlSMAliceState *astate, const unsigned char* input, const int inputlen, unsigned char **output, int* outputlen);
-gcry_error_t otrl_sm_step4(OtrlSMBobState *bstate, const unsigned char* input, const int inputlen, unsigned char **output, int* outputlen);
-gcry_error_t otrl_sm_step5(OtrlSMAliceState *astate, const unsigned char* input, const int inputlen);
--- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/tlv.h Thu Sep 06 00:17:15 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
- * Off-the-Record Messaging library
- * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-typedef struct s_OtrlTLV {
- struct s_OtrlTLV *next;
-/* This is just padding for the encrypted message, and should be ignored. */
-#define OTRL_TLV_PADDING 0x0000
-/* The sender has thrown away his OTR session keys with you */
-#define OTRL_TLV_DISCONNECTED 0x0001
-/* The message contains a step in the Socialist Millionaires' Protocol. */
-#define OTRL_TLV_SMP1 0x0002
-#define OTRL_TLV_SMP2 0x0003
-#define OTRL_TLV_SMP3 0x0004
-#define OTRL_TLV_SMP4 0x0005
-#define OTRL_TLV_SMP_ABORT 0x0006
-/* Like OTRL_TLV_SMP1, but there's a question for the buddy at the
-#define OTRL_TLV_SMP1Q 0x0007
-/* Make a single TLV, copying the supplied data */
-OtrlTLV *otrl_tlv_new(unsigned short type, unsigned short len,
- const unsigned char *data);
-/* Construct a chain of TLVs from the given data */
-OtrlTLV *otrl_tlv_parse(const unsigned char *serialized, size_t seriallen);
-/* Deallocate a chain of TLVs */
-void otrl_tlv_free(OtrlTLV *tlv);
-/* Find the serialized length of a chain of TLVs */
-size_t otrl_tlv_seriallen(const OtrlTLV *tlv);
-/* Serialize a chain of TLVs. The supplied buffer must already be large
-void otrl_tlv_serialize(unsigned char *buf, const OtrlTLV *tlv);
-/* Return the first TLV with the given type in the chain, or NULL if one
- * isn't found. (The tlvs argument isn't const because the return type
- * needs to be non-const.) */
-OtrlTLV *otrl_tlv_find(OtrlTLV *tlvs, unsigned short type);
--- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/userstate.h Thu Sep 06 00:17:15 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
- * Off-the-Record Messaging library
- * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-typedef struct s_OtrlUserState* OtrlUserState;
-struct s_OtrlUserState {
- ConnContext *context_root;
- OtrlPrivKey *privkey_root;
-/* Create a new OtrlUserState. Most clients will only need one of
- * these. A OtrlUserState encapsulates the list of known fingerprints
- * and the list of private keys; if you have separate files for these
- * things for (say) different users, use different OtrlUserStates. If
- * you've got only one user, with multiple accounts all stored together
- * in the same fingerprint store and privkey store files, use just one
-OtrlUserState otrl_userstate_create(void);
-/* Free a OtrlUserState */
-void otrl_userstate_free(OtrlUserState us);
--- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/version.h Thu Sep 06 00:17:15 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
- * Off-the-Record Messaging library
- * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#define OTRL_VERSION "3.2.0"
-#define OTRL_VERSION_MAJOR 3
-#define OTRL_VERSION_MINOR 2
-#define OTRL_VERSION_SUB 0
--- a/Frameworks/libotr.framework/Versions/2.2.0/Resources/English.lproj/InfoPlist.strings Thu Sep 06 00:17:15 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-/* Localized versions of Info.plist keys */
-CFBundleName = "libotr";
--- a/Frameworks/libotr.framework/Versions/2.2.0/Resources/Info.plist Thu Sep 06 00:17:15 2012 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
- <key>CFBundleDevelopmentRegion</key>
- <string>English</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <key>CFBundlePackageType</key>
- <key>CFBundleSignature</key>
- <key>CFBundleVersion</key>
- <key>CFBundleIdentifier</key>
- <string>im.adium.libotr</string>
Binary file Frameworks/libotr.framework/Versions/2.2.0/libotr has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libotr.framework/Versions/3.2.1/Headers/auth.h Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,157 @@
+ * Off-the-Record Messaging library + * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov + * This library is free software; you can redistribute it and/or + * modify it under the terms of version 2.1 of the GNU Lesser General + * Public License as published by the Free Software Foundation. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + OTRL_AUTHSTATE_AWAITING_DHKEY, + OTRL_AUTHSTATE_AWAITING_REVEALSIG, + OTRL_AUTHSTATE_AWAITING_SIG, + OTRL_AUTHSTATE_V1_SETUP + OtrlAuthState authstate; /* Our state */ + DH_keypair our_dh; /* Our D-H key */ + unsigned int our_keyid; /* ...and its keyid */ + unsigned char *encgx; /* The encrypted value of g^x */ + size_t encgx_len; /* ...and its length */ + unsigned char r[16]; /* The encryption key */ + unsigned char hashgx[32]; /* SHA256(g^x) */ + gcry_mpi_t their_pub; /* Their D-H public key */ + unsigned int their_keyid; /* ...and its keyid */ + gcry_cipher_hd_t enc_c, enc_cp; /* c and c' encryption keys */ + gcry_md_hd_t mac_m1, mac_m1p; /* m1 and m1' MAC keys */ + gcry_md_hd_t mac_m2, mac_m2p; /* m2 and m2' MAC keys */ + unsigned char their_fingerprint[20]; /* The fingerprint of their + long-term signing key */ + int initiated; /* Did we initiate this + unsigned int protocol_version; /* The protocol version number + used to authenticate. */ + unsigned char secure_session_id[20]; /* The secure session id */ + size_t secure_session_id_len; /* And its actual length, + which may be either 20 (for + OtrlSessionIdHalf session_id_half; /* Which half of the session + id gets shown in bold */ + char *lastauthmsg; /* The last auth message + (base-64 encoded) we sent, + * Initialize the fields of an OtrlAuthInfo (already allocated). +void otrl_auth_new(OtrlAuthInfo *auth); + * Clear the fields of an OtrlAuthInfo (but leave it allocated). +void otrl_auth_clear(OtrlAuthInfo *auth); + * Start a fresh AKE (version 2) using the given OtrlAuthInfo. Generate + * a fresh DH keypair to use. If no error is returned, the message to + * transmit will be contained in auth->lastauthmsg. +gcry_error_t otrl_auth_start_v2(OtrlAuthInfo *auth); + * Handle an incoming D-H Commit Message. If no error is returned, the + * message to send will be left in auth->lastauthmsg. Generate a fresh +gcry_error_t otrl_auth_handle_commit(OtrlAuthInfo *auth, + const char *commitmsg); + * Handle an incoming D-H Key Message. If no error is returned, and + * *havemsgp is 1, the message to sent will be left in auth->lastauthmsg. + * Use the given private authentication key to sign messages. +gcry_error_t otrl_auth_handle_key(OtrlAuthInfo *auth, const char *keymsg, + int *havemsgp, OtrlPrivKey *privkey); + * Handle an incoming Reveal Signature Message. If no error is + * returned, and *havemsgp is 1, the message to be sent will be left in + * auth->lastauthmsg. Use the given private authentication key to sign + * messages. Call the auth_succeeded callback if authentication is +gcry_error_t otrl_auth_handle_revealsig(OtrlAuthInfo *auth, + const char *revealmsg, int *havemsgp, OtrlPrivKey *privkey, + gcry_error_t (*auth_succeeded)(const OtrlAuthInfo *auth, void *asdata), + * Handle an incoming Signature Message. If no error is returned, and + * *havemsgp is 1, the message to be sent will be left in + * auth->lastauthmsg. Call the auth_succeeded callback if + * authentication is successful. +gcry_error_t otrl_auth_handle_signature(OtrlAuthInfo *auth, + const char *sigmsg, int *havemsgp, + gcry_error_t (*auth_succeeded)(const OtrlAuthInfo *auth, void *asdata), + * Start a fresh AKE (version 1) using the given OtrlAuthInfo. If + * our_dh is NULL, generate a fresh DH keypair to use. Otherwise, use a + * copy of the one passed (with the given keyid). Use the given private + * key to sign the message. If no error is returned, the message to + * transmit will be contained in auth->lastauthmsg. +gcry_error_t otrl_auth_start_v1(OtrlAuthInfo *auth, DH_keypair *our_dh, + unsigned int our_keyid, OtrlPrivKey *privkey); + * Handle an incoming v1 Key Exchange Message. If no error is returned, + * and *havemsgp is 1, the message to be sent will be left in + * auth->lastauthmsg. Use the given private authentication key to sign + * messages. Call the auth_secceeded callback if authentication is + * successful. If non-NULL, use a copy of the given D-H keypair, with +gcry_error_t otrl_auth_handle_v1_key_exchange(OtrlAuthInfo *auth, + const char *keyexchmsg, int *havemsgp, OtrlPrivKey *privkey, + DH_keypair *our_dh, unsigned int our_keyid, + gcry_error_t (*auth_succeeded)(const OtrlAuthInfo *auth, void *asdata), --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libotr.framework/Versions/3.2.1/Headers/b64.h Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,71 @@
+ * Off-the-Record Messaging library + * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov + * This library is free software; you can redistribute it and/or + * modify it under the terms of version 2.1 of the GNU Lesser General + * Public License as published by the Free Software Foundation. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/* Base64 encodes blocks of this many bytes: */ +#define OTRL_B64_DECODED_LEN 3 +/* into blocks of this many bytes: */ +#define OTRL_B64_ENCODED_LEN 4 +/* An encoded block of length encoded_len can turn into a maximum of + * this many decoded bytes: */ +#define OTRL_B64_MAX_DECODED_SIZE(encoded_len) \ + (((encoded_len + OTRL_B64_ENCODED_LEN - 1) / OTRL_B64_ENCODED_LEN) \ + * OTRL_B64_DECODED_LEN) + * base64 encode data. Insert no linebreaks or whitespace. + * The buffer base64data must contain at least ((datalen+2)/3)*4 bytes of + * space. This function will return the number of bytes actually used. +size_t otrl_base64_encode(char *base64data, const unsigned char *data, + * base64 decode data. Skip non-base64 chars, and terminate at the + * first '=', or the end of the buffer. + * The buffer data must contain at least ((base64len+3) / 4) * 3 bytes + * of space. This function will return the number of bytes actually +size_t otrl_base64_decode(unsigned char *data, const char *base64data, + * Base64-encode a block of data, stick "?OTR:" and "." around it, and + * return the result, or NULL in the event of a memory error. +char *otrl_base64_otr_encode(const unsigned char *buf, size_t buflen); + * Base64-decode the portion of the given message between "?OTR:" and + * ".". Set *bufp to the decoded data, and set *lenp to its length. + * The caller must free() the result. Return 0 on success, -1 on a + * memory error, or -2 on invalid input. +int otrl_base64_otr_decode(const char *msg, unsigned char **bufp, --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libotr.framework/Versions/3.2.1/Headers/context.h Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,179 @@
+ * Off-the-Record Messaging library + * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov + * This library is free software; you can redistribute it and/or + * modify it under the terms of version 2.1 of the GNU Lesser General + * Public License as published by the Free Software Foundation. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + OTRL_MSGSTATE_PLAINTEXT, /* Not yet started an encrypted + OTRL_MSGSTATE_ENCRYPTED, /* Currently in an encrypted + OTRL_MSGSTATE_FINISHED /* The remote side has sent us a + notification that he has ended + his end of the encrypted + conversation; prevent any + further messages from being +typedef struct s_fingerprint { + struct s_fingerprint *next; /* The next fingerprint in the list */ + struct s_fingerprint **tous; /* A pointer to the pointer to us */ + unsigned char *fingerprint; /* The fingerprint, or NULL */ + struct context *context; /* The context to which we belong */ + char *trust; /* The trust level of the fingerprint */ +typedef struct context { + struct context * next; /* Linked list pointer */ + struct context ** tous; /* A pointer to the pointer to us */ + char * username; /* The user this context is for */ + char * accountname; /* The username is relative to + char * protocol; /* ... and this protocol */ + char *fragment; /* The part of the fragmented message + size_t fragment_len; /* The length of fragment */ + unsigned short fragment_n; /* The total number of fragments + unsigned short fragment_k; /* The highest fragment number + we've seen so far for this + OtrlMessageState msgstate; /* The state of message disposition + OtrlAuthInfo auth; /* The state of ongoing + authentication with this user */ + Fingerprint fingerprint_root; /* The root of a linked list of + Fingerprints entries */ + Fingerprint *active_fingerprint; /* Which fingerprint is in use now? + A pointer into the above list */ + unsigned int their_keyid; /* current keyid used by other side; + this is set to 0 if we get a + OTRL_TLV_DISCONNECTED message from + gcry_mpi_t their_y; /* Y[their_keyid] (their DH pubkey) */ + gcry_mpi_t their_old_y; /* Y[their_keyid-1] (their prev DH + unsigned int our_keyid; /* current keyid used by us */ + DH_keypair our_dh_key; /* DH key[our_keyid] */ + DH_keypair our_old_dh_key; /* DH key[our_keyid-1] */ + DH_sesskeys sesskeys[2][2]; /* sesskeys[i][j] are the session keys + derived from DH key[our_keyid-i] + and mpi Y[their_keyid-j] */ + unsigned char sessionid[20]; /* The sessionid and bold half */ + size_t sessionid_len; /* determined when this private */ + OtrlSessionIdHalf sessionid_half; /* connection was established. */ + unsigned int protocol_version; /* The version of OTR in use */ + unsigned char *preshared_secret; /* A secret you share with this + size_t preshared_secret_len; /* The length of the above secret. */ + /* saved mac keys to be revealed later */ + unsigned int numsavedkeys; + unsigned char *saved_mac_keys; + /* generation number: increment every time we go private, and never + * reset to 0 (unless we remove the context entirely) */ + unsigned int generation; + time_t lastsent; /* The last time a Data Message was sent */ + char *lastmessage; /* The plaintext of the last Data Message sent */ + int may_retransmit; /* Is the last message eligible for + } otr_offer; /* Has this correspondent repsponded to our + /* Application data to be associated with this context */ + /* A function to free the above data when we forget this context */ + void (*app_data_free)(void *); + OtrlSMState *smstate; /* The state of the current + socialist millionaires exchange */ +/* Look up a connection context by name/account/protocol from the given + * OtrlUserState. If add_if_missing is true, allocate and return a new + * context if one does not currently exist. In that event, call + * add_app_data(data, context) so that app_data and app_data_free can be + * filled in by the application, and set *addedp to 1. */ +ConnContext * otrl_context_find(OtrlUserState us, const char *user, + const char *accountname, const char *protocol, int add_if_missing, + void (*add_app_data)(void *data, ConnContext *context), void *data); +/* Find a fingerprint in a given context, perhaps adding it if not +Fingerprint *otrl_context_find_fingerprint(ConnContext *context, + unsigned char fingerprint[20], int add_if_missing, int *addedp); +/* Set the trust level for a given fingerprint */ +void otrl_context_set_trust(Fingerprint *fprint, const char *trust); +/* Set the preshared secret for a given fingerprint. Note that this + * currently only stores the secret in the ConnContext structure, but + * doesn't yet do anything with it. */ +void otrl_context_set_preshared_secret(ConnContext *context, + const unsigned char *secret, size_t secret_len); +/* Force a context into the OTRL_MSGSTATE_FINISHED state. */ +void otrl_context_force_finished(ConnContext *context); +/* Force a context into the OTRL_MSGSTATE_PLAINTEXT state. */ +void otrl_context_force_plaintext(ConnContext *context); +/* Forget a fingerprint (so long as it's not the active one. If it's a + * fingerprint_root, forget the whole context (as long as + * and_maybe_context is set, and it's PLAINTEXT). Also, if it's not + * the fingerprint_root, but it's the only fingerprint, and we're + * PLAINTEXT, forget the whole context if and_maybe_context is set. */ +void otrl_context_forget_fingerprint(Fingerprint *fprint, + int and_maybe_context); +/* Forget a whole context, so long as it's PLAINTEXT. */ +void otrl_context_forget(ConnContext *context); +/* Forget all the contexts in a given OtrlUserState. */ +void otrl_context_forget_all(OtrlUserState us); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libotr.framework/Versions/3.2.1/Headers/dh.h Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,119 @@
+ * Off-the-Record Messaging library + * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov + * This library is free software; you can redistribute it and/or + * modify it under the terms of version 2.1 of the GNU Lesser General + * Public License as published by the Free Software Foundation. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#define DH1536_GROUP_ID 5 +/* Which half of the secure session id should be shown in bold? */ + OTRL_SESSIONID_FIRST_HALF_BOLD, + OTRL_SESSIONID_SECOND_HALF_BOLD + unsigned char sendctr[16]; + unsigned char rcvctr[16]; + gcry_cipher_hd_t sendenc; + gcry_cipher_hd_t rcvenc; + unsigned char sendmackey[20]; + unsigned char rcvmackey[20]; + * Call this once, at plugin load time. It sets up the modulus and +void otrl_dh_init(void); + * Initialize the fields of a DH keypair. +void otrl_dh_keypair_init(DH_keypair *kp); +void otrl_dh_keypair_copy(DH_keypair *dst, const DH_keypair *src); + * Deallocate the contents of a DH_keypair (but not the DH_keypair +void otrl_dh_keypair_free(DH_keypair *kp); + * Generate a DH keypair for a specified group. +gcry_error_t otrl_dh_gen_keypair(unsigned int groupid, DH_keypair *kp); + * Construct session keys from a DH keypair and someone else's public +gcry_error_t otrl_dh_session(DH_sesskeys *sess, const DH_keypair *kp, + * Compute the secure session id, two encryption keys, and four MAC keys + * given our DH key and their DH public key. +gcry_error_t otrl_dh_compute_v2_auth_keys(const DH_keypair *our_dh, + gcry_mpi_t their_pub, unsigned char *sessionid, size_t *sessionidlenp, + gcry_cipher_hd_t *enc_c, gcry_cipher_hd_t *enc_cp, + gcry_md_hd_t *mac_m1, gcry_md_hd_t *mac_m1p, + gcry_md_hd_t *mac_m2, gcry_md_hd_t *mac_m2p); + * Compute the secure session id, given our DH key and their DH public +gcry_error_t otrl_dh_compute_v1_session_id(const DH_keypair *our_dh, + gcry_mpi_t their_pub, unsigned char *sessionid, size_t *sessionidlenp, + OtrlSessionIdHalf *halfp); + * Deallocate the contents of a DH_sesskeys (but not the DH_sesskeys +void otrl_dh_session_free(DH_sesskeys *sess); + * Blank out the contents of a DH_sesskeys (without releasing it) +void otrl_dh_session_blank(DH_sesskeys *sess); +/* Increment the top half of a counter block */ +void otrl_dh_incctr(unsigned char *ctr); +/* Compare two counter values (8 bytes each). Return 0 if ctr1 == ctr2, + * < 0 if ctr1 < ctr2 (as unsigned 64-bit values), > 0 if ctr1 > ctr2. */ +int otrl_dh_cmpctr(const unsigned char *ctr1, const unsigned char *ctr2); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libotr.framework/Versions/3.2.1/Headers/mem.h Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,25 @@
+ * Off-the-Record Messaging library + * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov + * This library is free software; you can redistribute it and/or + * modify it under the terms of version 2.1 of the GNU Lesser General + * Public License as published by the Free Software Foundation. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +void otrl_mem_init(void); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libotr.framework/Versions/3.2.1/Headers/message.h Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,210 @@
+ * Off-the-Record Messaging library + * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov + * This library is free software; you can redistribute it and/or + * modify it under the terms of version 2.1 of the GNU Lesser General + * Public License as published by the Free Software Foundation. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +typedef struct s_OtrlMessageAppOps { + /* Return the OTR policy for the given context. */ + OtrlPolicy (*policy)(void *opdata, ConnContext *context); + /* Create a private key for the given accountname/protocol if + void (*create_privkey)(void *opdata, const char *accountname, + /* Report whether you think the given user is online. Return 1 if + * you think he is, 0 if you think he isn't, -1 if you're not sure. + * If you return 1, messages such as heartbeats or other + * notifications may be sent to the user, which could result in "not + * logged in" errors if you're wrong. */ + int (*is_logged_in)(void *opdata, const char *accountname, + const char *protocol, const char *recipient); + /* Send the given IM to the given recipient from the given + * accountname/protocol. */ + void (*inject_message)(void *opdata, const char *accountname, + const char *protocol, const char *recipient, const char *message); + /* Display a notification message for a particular accountname / + * protocol / username conversation. */ + void (*notify)(void *opdata, OtrlNotifyLevel level, + const char *accountname, const char *protocol, + const char *username, const char *title, + const char *primary, const char *secondary); + /* Display an OTR control message for a particular accountname / + * protocol / username conversation. Return 0 if you are able to + * successfully display it. If you return non-0 (or if this + * function is NULL), the control message will be displayed inline, + * as a received message, or else by using the above notify() + int (*display_otr_message)(void *opdata, const char *accountname, + const char *protocol, const char *username, const char *msg); + /* When the list of ConnContexts changes (including a change in + * state), this is called so the UI can be updated. */ + void (*update_context_list)(void *opdata); + /* Return a newly allocated string containing a human-friendly name + * for the given protocol id */ + const char *(*protocol_name)(void *opdata, const char *protocol); + /* Deallocate a string allocated by protocol_name */ + void (*protocol_name_free)(void *opdata, const char *protocol_name); + /* A new fingerprint for the given user has been received. */ + void (*new_fingerprint)(void *opdata, OtrlUserState us, + const char *accountname, const char *protocol, + const char *username, unsigned char fingerprint[20]); + /* The list of known fingerprints has changed. Write them to disk. */ + void (*write_fingerprints)(void *opdata); + /* A ConnContext has entered a secure state. */ + void (*gone_secure)(void *opdata, ConnContext *context); + /* A ConnContext has left a secure state. */ + void (*gone_insecure)(void *opdata, ConnContext *context); + /* We have completed an authentication, using the D-H keys we + * already knew. is_reply indicates whether we initiated the AKE. */ + void (*still_secure)(void *opdata, ConnContext *context, int is_reply); + /* Log a message. The passed message will end in "\n". */ + void (*log_message)(void *opdata, const char *message); + /* Find the maximum message size supported by this protocol. */ + int (*max_message_size)(void *opdata, ConnContext *context); + /* Return a newly allocated string containing a human-friendly + * representation for the given account */ + const char *(*account_name)(void *opdata, const char *account, + /* Deallocate a string returned by account_name */ + void (*account_name_free)(void *opdata, const char *account_name); +/* Deallocate a message allocated by other otrl_message_* routines. */ +void otrl_message_free(char *message); +/* Handle a message about to be sent to the network. It is safe to pass + * all messages about to be sent to this routine. add_appdata is a + * function that will be called in the event that a new ConnContext is + * created. It will be passed the data that you supplied, as well as a + * pointer to the new ConnContext. You can use this to add + * application-specific information to the ConnContext using the + * "context->app" field, for example. If you don't need to do this, you + * can pass NULL for the last two arguments of otrl_message_sending. + * tlvs is a chain of OtrlTLVs to append to the private message. It is + * usually correct to just pass NULL here. + * If this routine returns non-zero, then the library tried to encrypt + * the message, but for some reason failed. DO NOT send the message in + * the clear in that case. + * If *messagep gets set by the call to something non-NULL, then you + * should replace your message with the contents of *messagep, and + * send that instead. Call otrl_message_free(*messagep) when you're +gcry_error_t otrl_message_sending(OtrlUserState us, + const OtrlMessageAppOps *ops, + void *opdata, const char *accountname, const char *protocol, + const char *recipient, const char *message, OtrlTLV *tlvs, + void (*add_appdata)(void *data, ConnContext *context), +/* Handle a message just received from the network. It is safe to pass + * all received messages to this routine. add_appdata is a function + * that will be called in the event that a new ConnContext is created. + * It will be passed the data that you supplied, as well as + * a pointer to the new ConnContext. You can use this to add + * application-specific information to the ConnContext using the + * "context->app" field, for example. If you don't need to do this, you + * can pass NULL for the last two arguments of otrl_message_receiving. + * If otrl_message_receiving returns 1, then the message you received + * was an internal protocol message, and no message should be delivered + * If it returns 0, then check if *messagep was set to non-NULL. If + * so, replace the received message with the contents of *messagep, and + * deliver that to the user instead. You must call + * otrl_message_free(*messagep) when you're done with it. If tlvsp is + * non-NULL, *tlvsp will be set to a chain of any TLVs that were + * transmitted along with this message. You must call + * otrl_tlv_free(*tlvsp) when you're done with those. + * If otrl_message_receiving returns 0 and *messagep is NULL, then this + * was an ordinary, non-OTR message, which should just be delivered to + * the user without modification. */ +int otrl_message_receiving(OtrlUserState us, const OtrlMessageAppOps *ops, + void *opdata, const char *accountname, const char *protocol, + const char *sender, const char *message, char **newmessagep, + void (*add_appdata)(void *data, ConnContext *context), +/* Send a message to the network, fragmenting first if necessary. + * All messages to be sent to the network should go through this + * method immediately before they are sent, ie after encryption. */ +gcry_error_t otrl_message_fragment_and_send(const OtrlMessageAppOps *ops, + void *opdata, ConnContext *context, const char *message, + OtrlFragmentPolicy fragPolicy, char **returnFragment); +/* Put a connection into the PLAINTEXT state, first sending the + * other side a notice that we're doing so if we're currently ENCRYPTED, + * and we think he's logged in. */ +void otrl_message_disconnect(OtrlUserState us, const OtrlMessageAppOps *ops, + void *opdata, const char *accountname, const char *protocol, +/* Initiate the Socialist Millionaires' Protocol */ +void otrl_message_initiate_smp(OtrlUserState us, const OtrlMessageAppOps *ops, + void *opdata, ConnContext *context, const unsigned char *secret, +/* Initiate the Socialist Millionaires' Protocol and send a prompt + * question to the buddy */ +void otrl_message_initiate_smp_q(OtrlUserState us, + const OtrlMessageAppOps *ops, void *opdata, ConnContext *context, + const char *question, const unsigned char *secret, size_t secretlen); +/* Respond to a buddy initiating the Socialist Millionaires' Protocol */ +void otrl_message_respond_smp(OtrlUserState us, const OtrlMessageAppOps *ops, + void *opdata, ConnContext *context, const unsigned char *secret, +/* Abort the SMP. Called when an unexpected SMP message breaks the +void otrl_message_abort_smp(OtrlUserState us, const OtrlMessageAppOps *ops, + void *opdata, ConnContext *context); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libotr.framework/Versions/3.2.1/Headers/privkey-t.h Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,39 @@
+ * Off-the-Record Messaging library + * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov + * This library is free software; you can redistribute it and/or + * modify it under the terms of version 2.1 of the GNU Lesser General + * Public License as published by the Free Software Foundation. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +typedef struct s_OtrlPrivKey { + struct s_OtrlPrivKey *next; + struct s_OtrlPrivKey **tous; + unsigned short pubkey_type; + unsigned char *pubkey_data; +#define OTRL_PUBKEY_TYPE_DSA 0x0000 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libotr.framework/Versions/3.2.1/Headers/privkey.h Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,112 @@
+ * Off-the-Record Messaging library + * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov + * This library is free software; you can redistribute it and/or + * modify it under the terms of version 2.1 of the GNU Lesser General + * Public License as published by the Free Software Foundation. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/* Convert a 20-byte hash value to a 45-byte human-readable value */ +void otrl_privkey_hash_to_human(char human[45], const unsigned char hash[20]); +/* Calculate a human-readable hash of our DSA public key. Return it in + * the passed fingerprint buffer. Return NULL on error, or a pointer to + * the given buffer on success. */ +char *otrl_privkey_fingerprint(OtrlUserState us, char fingerprint[45], + const char *accountname, const char *protocol); +/* Calculate a raw hash of our DSA public key. Return it in the passed + * fingerprint buffer. Return NULL on error, or a pointer to the given + * buffer on success. */ +unsigned char *otrl_privkey_fingerprint_raw(OtrlUserState us, + unsigned char hash[20], const char *accountname, const char *protocol); +/* Read a sets of private DSA keys from a file on disk into the given +gcry_error_t otrl_privkey_read(OtrlUserState us, const char *filename); +/* Read a sets of private DSA keys from a FILE* into the given + * OtrlUserState. The FILE* must be open for reading. */ +gcry_error_t otrl_privkey_read_FILEp(OtrlUserState us, FILE *privf); +/* Generate a private DSA key for a given account, storing it into a + * file on disk, and loading it into the given OtrlUserState. Overwrite any + * previously generated keys for that account in that OtrlUserState. */ +gcry_error_t otrl_privkey_generate(OtrlUserState us, const char *filename, + const char *accountname, const char *protocol); +/* Generate a private DSA key for a given account, storing it into a + * FILE*, and loading it into the given OtrlUserState. Overwrite any + * previously generated keys for that account in that OtrlUserState. + * The FILE* must be open for reading and writing. */ +gcry_error_t otrl_privkey_generate_FILEp(OtrlUserState us, FILE *privf, + const char *accountname, const char *protocol); +/* Read the fingerprint store from a file on disk into the given + * OtrlUserState. Use add_app_data to add application data to each + * ConnContext so created. */ +gcry_error_t otrl_privkey_read_fingerprints(OtrlUserState us, + void (*add_app_data)(void *data, ConnContext *context), +/* Read the fingerprint store from a FILE* into the given + * OtrlUserState. Use add_app_data to add application data to each + * ConnContext so created. The FILE* must be open for reading. */ +gcry_error_t otrl_privkey_read_fingerprints_FILEp(OtrlUserState us, + void (*add_app_data)(void *data, ConnContext *context), +/* Write the fingerprint store from a given OtrlUserState to a file on disk. */ +gcry_error_t otrl_privkey_write_fingerprints(OtrlUserState us, +/* Write the fingerprint store from a given OtrlUserState to a FILE*. + * The FILE* must be open for writing. */ +gcry_error_t otrl_privkey_write_fingerprints_FILEp(OtrlUserState us, +/* Fetch the private key from the given OtrlUserState associated with +OtrlPrivKey *otrl_privkey_find(OtrlUserState us, const char *accountname, +/* Forget a private key */ +void otrl_privkey_forget(OtrlPrivKey *privkey); +/* Forget all private keys in a given OtrlUserState. */ +void otrl_privkey_forget_all(OtrlUserState us); +/* Sign data using a private key. The data must be small enough to be + * signed (i.e. already hashed, if necessary). The signature will be + * returned in *sigp, which the caller must free(). Its length will be + * returned in *siglenp. */ +gcry_error_t otrl_privkey_sign(unsigned char **sigp, size_t *siglenp, + OtrlPrivKey *privkey, const unsigned char *data, size_t len); +/* Verify a signature on data using a public key. The data must be + * small enough to be signed (i.e. already hashed, if necessary). */ +gcry_error_t otrl_privkey_verify(const unsigned char *sigbuf, size_t siglen, + unsigned short pubkey_type, gcry_sexp_t pubs, + const unsigned char *data, size_t len); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libotr.framework/Versions/3.2.1/Headers/proto.h Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,150 @@
+ * Off-the-Record Messaging library + * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov + * This library is free software; you can redistribute it and/or + * modify it under the terms of version 2.1 of the GNU Lesser General + * Public License as published by the Free Software Foundation. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/* If we ever see this sequence in a plaintext message, we'll assume the + * other side speaks OTR, and try to establish a connection. */ +#define OTRL_MESSAGE_TAG_BASE " \t \t\t\t\t \t \t \t " +/* The following must each be of length 8 */ +#define OTRL_MESSAGE_TAG_V1 " \t \t \t " +#define OTRL_MESSAGE_TAG_V2 " \t\t \t " +/* The possible flags contained in a Data Message */ +#define OTRL_MSGFLAGS_IGNORE_UNREADABLE 0x01 +typedef unsigned int OtrlPolicy; +#define OTRL_POLICY_ALLOW_V1 0x01 +#define OTRL_POLICY_ALLOW_V2 0x02 +#define OTRL_POLICY_REQUIRE_ENCRYPTION 0x04 +#define OTRL_POLICY_SEND_WHITESPACE_TAG 0x08 +#define OTRL_POLICY_WHITESPACE_START_AKE 0x10 +#define OTRL_POLICY_ERROR_START_AKE 0x20 +#define OTRL_POLICY_VERSION_MASK (OTRL_POLICY_ALLOW_V1 | OTRL_POLICY_ALLOW_V2) +/* For v1 compatibility */ +#define OTRL_POLICY_NEVER 0x00 +#define OTRL_POLICY_OPPORTUNISTIC \ + ( OTRL_POLICY_ALLOW_V1 | \ + OTRL_POLICY_ALLOW_V2 | \ + OTRL_POLICY_SEND_WHITESPACE_TAG | \ + OTRL_POLICY_WHITESPACE_START_AKE | \ + OTRL_POLICY_ERROR_START_AKE ) +#define OTRL_POLICY_MANUAL \ + ( OTRL_POLICY_ALLOW_V1 | \ +#define OTRL_POLICY_ALWAYS \ + ( OTRL_POLICY_ALLOW_V1 | \ + OTRL_POLICY_ALLOW_V2 | \ + OTRL_POLICY_REQUIRE_ENCRYPTION | \ + OTRL_POLICY_WHITESPACE_START_AKE | \ + OTRL_POLICY_ERROR_START_AKE ) +#define OTRL_POLICY_DEFAULT OTRL_POLICY_OPPORTUNISTIC + OTRL_MSGTYPE_TAGGEDPLAINTEXT, + OTRL_MSGTYPE_DH_COMMIT, + OTRL_MSGTYPE_REVEALSIG, + OTRL_MSGTYPE_SIGNATURE, + OTRL_MSGTYPE_V1_KEYEXCH, + OTRL_FRAGMENT_UNFRAGMENTED, + OTRL_FRAGMENT_INCOMPLETE, + OTRL_FRAGMENT_SEND_ALL, + OTRL_FRAGMENT_SEND_ALL_BUT_FIRST, + OTRL_FRAGMENT_SEND_ALL_BUT_LAST +/* Initialize the OTR library. Pass the version of the API you are +void otrl_init(unsigned int ver_major, unsigned int ver_minor, +#define OTRL_INIT do { \ + otrl_init(OTRL_VERSION_MAJOR, OTRL_VERSION_MINOR, OTRL_VERSION_SUB); \ +/* Return a pointer to a static string containing the version number of +const char *otrl_version(void); +/* Return a pointer to a newly-allocated OTR query message, customized + * with our name. The caller should free() the result when he's done +char *otrl_proto_default_query_msg(const char *ourname, OtrlPolicy policy); +/* Return the best version of OTR support by both sides, given an OTR + * Query Message and the local policy. */ +unsigned int otrl_proto_query_bestversion(const char *querymsg, +/* Locate any whitespace tag in this message, and return the best + * version of OTR support on both sides. Set *starttagp and *endtagp to + * the start and end of the located tag, so that it can be snipped out. */ +unsigned int otrl_proto_whitespace_bestversion(const char *msg, + const char **starttagp, const char **endtagp, OtrlPolicy policy); +/* Return the Message type of the given message. */ +OtrlMessageType otrl_proto_message_type(const char *message); +/* Create an OTR Data message. Pass the plaintext as msg, and an + * optional chain of TLVs. A newly-allocated string will be returned in +gcry_error_t otrl_proto_create_data(char **encmessagep, ConnContext *context, + const char *msg, const OtrlTLV *tlvs, unsigned char flags); +/* Extract the flags from an otherwise unreadable Data Message. */ +gcry_error_t otrl_proto_data_read_flags(const char *datamsg, + unsigned char *flagsp); +/* Accept an OTR Data Message in datamsg. Decrypt it and put the + * plaintext into *plaintextp, and any TLVs into tlvsp. Put any + * received flags into *flagsp (if non-NULL). */ +gcry_error_t otrl_proto_accept_data(char **plaintextp, OtrlTLV **tlvsp, + ConnContext *context, const char *datamsg, unsigned char *flagsp); +/* Accumulate a potential fragment into the current context. */ +OtrlFragmentResult otrl_proto_fragment_accumulate(char **unfragmessagep, + ConnContext *context, const char *msg); +gcry_error_t otrl_proto_fragment_create(int mms, int fragment_count, + char ***fragments, const char *message); +void otrl_proto_fragment_free(char ***fragments, unsigned short arraylen); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libotr.framework/Versions/3.2.1/Headers/serial.h Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,85 @@
+ * Off-the-Record Messaging library + * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov + * This library is free software; you can redistribute it and/or + * modify it under the terms of version 2.1 of the GNU Lesser General + * Public License as published by the Free Software Foundation. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#define debug_data(t,b,l) do { const unsigned char *data = (b); size_t i; \ + fprintf(stderr, "%s: ", (t)); \ + fprintf(stderr, "%02x", data[i]); \ + fprintf(stderr, "\n"); \ +#define debug_int(t,b) do { const unsigned char *data = (b); \ + (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; \ + fprintf(stderr, "%s: %u (0x%x)\n", (t), v, v); \ +#define debug_data(t,b,l) +#define write_int(x) do { \ + bufp[0] = ((x) >> 24) & 0xff; \ + bufp[1] = ((x) >> 16) & 0xff; \ + bufp[2] = ((x) >> 8) & 0xff; \ + bufp[3] = (x) & 0xff; \ + bufp += 4; lenp -= 4; \ +#define write_mpi(x,nx,dx) do { \ + gcry_mpi_print(format, bufp, lenp, NULL, (x)); \ + debug_data((dx), bufp, (nx)); \ + bufp += (nx); lenp -= (nx); \ +#define require_len(l) do { \ + if (lenp < (l)) goto invval; \ +#define read_int(x) do { \ + (x) = (bufp[0] << 24) | (bufp[1] << 16) | (bufp[2] << 8) | bufp[3]; \ + bufp += 4; lenp -= 4; \ +#define read_mpi(x) do { \ + gcry_mpi_scan(&(x), GCRYMPI_FMT_USG, bufp, mpilen, NULL); \ + (x) = gcry_mpi_set_ui(NULL, 0); \ + bufp += mpilen; lenp -= mpilen; \ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libotr.framework/Versions/3.2.1/Headers/sm.h Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,83 @@
+ * Off-the-Record Messaging library + * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov + * This library is free software; you can redistribute it and/or + * modify it under the terms of version 2.1 of the GNU Lesser General + * Public License as published by the Free Software Foundation. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#define SM_HASH_ALGORITHM GCRY_MD_SHA256 +#define SM_DIGEST_SIZE 32 + OTRL_SMP_PROG_OK = 0, /* All is going fine so far */ + OTRL_SMP_PROG_CHEATED = -2, /* Some verification failed */ + OTRL_SMP_PROG_FAILED = -1, /* The secrets didn't match */ + OTRL_SMP_PROG_SUCCEEDED = 1 /* The SMP completed successfully */ + gcry_mpi_t secret, x2, x3, g1, g2, g3, g3o, p, q, pab, qab; + NextExpectedSMP nextExpected; + int received_question; /* 1 if we received a question in an SMP1Q TLV */ + OtrlSMProgState sm_prog_state; +typedef OtrlSMState OtrlSMAliceState; +typedef OtrlSMState OtrlSMBobState; + * Call this once, at plugin load time. It sets up the modulus and +void otrl_sm_init(void); + * Initialize the fields of a SM state. +void otrl_sm_state_new(OtrlSMState *smst); + * Initialize the fields of a SM state. Called the first time that + * a user begins an SMP session. +void otrl_sm_state_init(OtrlSMState *smst); + * Deallocate the contents of a OtrlSMState (but not the OtrlSMState +void otrl_sm_state_free(OtrlSMState *smst); +gcry_error_t otrl_sm_step1(OtrlSMAliceState *astate, const unsigned char* secret, int secretlen, unsigned char** output, int* outputlen); +gcry_error_t otrl_sm_step2a(OtrlSMBobState *bstate, const unsigned char* input, const int inputlen, int received_question); +gcry_error_t otrl_sm_step2b(OtrlSMBobState *bstate, const unsigned char* secret, int secretlen, unsigned char **output, int* outputlen); +gcry_error_t otrl_sm_step3(OtrlSMAliceState *astate, const unsigned char* input, const int inputlen, unsigned char **output, int* outputlen); +gcry_error_t otrl_sm_step4(OtrlSMBobState *bstate, const unsigned char* input, const int inputlen, unsigned char **output, int* outputlen); +gcry_error_t otrl_sm_step5(OtrlSMAliceState *astate, const unsigned char* input, const int inputlen); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libotr.framework/Versions/3.2.1/Headers/tlv.h Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,70 @@
+ * Off-the-Record Messaging library + * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov + * This library is free software; you can redistribute it and/or + * modify it under the terms of version 2.1 of the GNU Lesser General + * Public License as published by the Free Software Foundation. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +typedef struct s_OtrlTLV { + struct s_OtrlTLV *next; +/* This is just padding for the encrypted message, and should be ignored. */ +#define OTRL_TLV_PADDING 0x0000 +/* The sender has thrown away his OTR session keys with you */ +#define OTRL_TLV_DISCONNECTED 0x0001 +/* The message contains a step in the Socialist Millionaires' Protocol. */ +#define OTRL_TLV_SMP1 0x0002 +#define OTRL_TLV_SMP2 0x0003 +#define OTRL_TLV_SMP3 0x0004 +#define OTRL_TLV_SMP4 0x0005 +#define OTRL_TLV_SMP_ABORT 0x0006 +/* Like OTRL_TLV_SMP1, but there's a question for the buddy at the +#define OTRL_TLV_SMP1Q 0x0007 +/* Make a single TLV, copying the supplied data */ +OtrlTLV *otrl_tlv_new(unsigned short type, unsigned short len, + const unsigned char *data); +/* Construct a chain of TLVs from the given data */ +OtrlTLV *otrl_tlv_parse(const unsigned char *serialized, size_t seriallen); +/* Deallocate a chain of TLVs */ +void otrl_tlv_free(OtrlTLV *tlv); +/* Find the serialized length of a chain of TLVs */ +size_t otrl_tlv_seriallen(const OtrlTLV *tlv); +/* Serialize a chain of TLVs. The supplied buffer must already be large +void otrl_tlv_serialize(unsigned char *buf, const OtrlTLV *tlv); +/* Return the first TLV with the given type in the chain, or NULL if one + * isn't found. (The tlvs argument isn't const because the return type + * needs to be non-const.) */ +OtrlTLV *otrl_tlv_find(OtrlTLV *tlvs, unsigned short type); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libotr.framework/Versions/3.2.1/Headers/userstate.h Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,45 @@
+ * Off-the-Record Messaging library + * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov + * This library is free software; you can redistribute it and/or + * modify it under the terms of version 2.1 of the GNU Lesser General + * Public License as published by the Free Software Foundation. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +typedef struct s_OtrlUserState* OtrlUserState; +struct s_OtrlUserState { + ConnContext *context_root; + OtrlPrivKey *privkey_root; +/* Create a new OtrlUserState. Most clients will only need one of + * these. A OtrlUserState encapsulates the list of known fingerprints + * and the list of private keys; if you have separate files for these + * things for (say) different users, use different OtrlUserStates. If + * you've got only one user, with multiple accounts all stored together + * in the same fingerprint store and privkey store files, use just one +OtrlUserState otrl_userstate_create(void); +/* Free a OtrlUserState */ +void otrl_userstate_free(OtrlUserState us); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libotr.framework/Versions/3.2.1/Headers/version.h Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,29 @@
+ * Off-the-Record Messaging library + * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov + * This library is free software; you can redistribute it and/or + * modify it under the terms of version 2.1 of the GNU Lesser General + * Public License as published by the Free Software Foundation. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#define OTRL_VERSION "3.2.1" +#define OTRL_VERSION_MAJOR 3 +#define OTRL_VERSION_MINOR 2 +#define OTRL_VERSION_SUB 1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libotr.framework/Versions/3.2.1/Resources/English.lproj/InfoPlist.strings Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,3 @@
+/* Localized versions of Info.plist keys */ +CFBundleName = "libotr"; --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/libotr.framework/Versions/3.2.1/Resources/Info.plist Thu Sep 06 21:09:12 2012 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleInfoDictionaryVersion</key> + <key>CFBundlePackageType</key> + <key>CFBundleSignature</key> + <key>CFBundleVersion</key> + <key>CFBundleIdentifier</key> + <string>im.adium.libotr</string> Binary file Frameworks/libotr.framework/Versions/3.2.1/libotr has changed
--- a/Frameworks/libotr.framework/Versions/Current Thu Sep 06 00:17:15 2012 +0200
+++ b/Frameworks/libotr.framework/Versions/Current Thu Sep 06 21:09:12 2012 +0200
@@ -1,1 +1,1 @@
\ No newline at end of file
\ No newline at end of file
--- a/Frameworks/libotr.framework/libotr Thu Sep 06 00:17:15 2012 +0200
+++ b/Frameworks/libotr.framework/libotr Thu Sep 06 21:09:12 2012 +0200
@@ -1,1 +1,1 @@
\ No newline at end of file
\ No newline at end of file
--- a/Plugins/Purple Service/adiumPurpleSignals.m Thu Sep 06 00:17:15 2012 +0200
+++ b/Plugins/Purple Service/adiumPurpleSignals.m Thu Sep 06 21:09:12 2012 +0200
@@ -276,6 +276,9 @@
for (ll = l; ll; ll = ll->next) {
void *value = g_hash_table_lookup(data, key);
+ if (!key || !value) continue; NSString *keyString = [NSString stringWithUTF8String:key];
NSString *valueString = [NSString stringWithUTF8String:value];
if ([valueString integerValue]) {
--- a/xcconfigs/Adium.xcconfig Thu Sep 06 00:17:15 2012 +0200
+++ b/xcconfigs/Adium.xcconfig Thu Sep 06 21:09:12 2012 +0200
@@ -1,5 +1,7 @@
HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "$(SRCROOT)/Frameworks/libotr.framework/Headers"
HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_3 = "$(SRCROOT)/Frameworks/libglib.framework/Headers"
+HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_6 = "$(SRCROOT)/Frameworks/libgcrypt.framework/Headers" +HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_7 = "$(SRCROOT)/Frameworks/libgpgerror.framework/Headers" FRAMEWORK_SEARCH_PATHS = $(inherited)
INFOPLIST_OTHER_PREPROCESSOR_FLAGS = -C
@@ -7,6 +9,6 @@
INFOPLIST_FILE = Plists/Info.plist
INFOPLIST_PREFIX_HEADER = $(TARGET_BUILD_DIR)/include/PlistMacros.h
LD_RUNPATH_SEARCH_PATHS = @executable_path/../Frameworks
-HEADER_SEARCH_PATHS = $(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_2) $(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_3) $(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_4)
+HEADER_SEARCH_PATHS = $(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_2) $(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_3) $(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_4) $(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_6) $(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_7) OTHER_LDFLAGS[arch=i386] = -framework QuickTime
OTHER_LDFLAGS[arch=x86_64] = -framework QTKit