Updated libotr to 3.2.1, fixing a security vulnerability.
This was all built using Homebrew (https://github.com/xnyhps/homebrew). It seems before libgcrypt and libgpg-error were linked statically into libotr, these are now separate frameworks.
Fixes #16122
1.1 --- a/Adium.xcodeproj/project.pbxproj Wed Sep 05 23:24:55 2012 +0200
1.2 +++ b/Adium.xcodeproj/project.pbxproj Thu Sep 06 18:49:22 2012 +0200
1.3 @@ -1390,6 +1390,10 @@
1.4 6EC1684F06C170A000F9FAD3 /* DCInviteToChatWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6EC1684A06C170A000F9FAD3 /* DCInviteToChatWindowController.m */; };
1.5 6EC1685006C170A000F9FAD3 /* InviteToChatWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = 6EC1684B06C170A000F9FAD3 /* InviteToChatWindow.nib */; };
1.6 766ABAB61306D1020049FFB7 /* AIUnreadMessagesTooltip.m in Sources */ = {isa = PBXBuildFile; fileRef = 766ABAB51306D1020049FFB7 /* AIUnreadMessagesTooltip.m */; };
1.7 + 76731DE215F90538007728C3 /* libgcrypt.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76731DE015F90538007728C3 /* libgcrypt.framework */; };
1.8 + 76731DE315F90538007728C3 /* libgpgerror.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76731DE115F90538007728C3 /* libgpgerror.framework */; };
1.9 + 76731DE415F9057F007728C3 /* libgcrypt.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 76731DE015F90538007728C3 /* libgcrypt.framework */; };
1.10 + 76731DE515F90582007728C3 /* libgpgerror.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 76731DE115F90538007728C3 /* libgpgerror.framework */; };
1.11 76889DEB12D3CA17007AEF00 /* get-info.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 76889DEA12D3CA17007AEF00 /* get-info.tiff */; };
1.12 76889DEF12D3CA40007AEF00 /* Personal.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 76889DEE12D3CA40007AEF00 /* Personal.tiff */; };
1.13 76C1AF9C125A906A00D269A9 /* AIAdiumURLProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 76C1AF9B125A906A00D269A9 /* AIAdiumURLProtocol.m */; };
1.14 @@ -1642,6 +1646,8 @@
1.15 11EE1CD50CDD01120097F246 /* libpurple.framework in Copy Frameworks */,
1.16 EE5754ED0B3D7A7A00100989 /* Sparkle.framework in Copy Frameworks */,
1.17 377ED0220AE95D7D00CB7BDF /* PSMTabBarControl.framework in Copy Frameworks */,
1.18 + 76731DE515F90582007728C3 /* libgpgerror.framework in Copy Frameworks */,
1.19 + 76731DE415F9057F007728C3 /* libgcrypt.framework in Copy Frameworks */,
1.20 9E1E1E270A96770C00E16DFC /* LMX.framework in Copy Frameworks */,
1.21 9719C92F1530EE4800217FBE /* FriBidi.framework in Copy Frameworks */,
1.22 9719C9301530EE4800217FBE /* ShortcutRecorder.framework in Copy Frameworks */,
1.23 @@ -4522,6 +4528,8 @@
1.24 6FB330A40C7235BF00B001A8 /* EKEzvOutgoingFileTransfer.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = EKEzvOutgoingFileTransfer.m; path = Plugins/Bonjour/libezv/Classes/EKEzvOutgoingFileTransfer.m; sourceTree = SOURCE_ROOT; };
1.25 766ABAB41306D1020049FFB7 /* AIUnreadMessagesTooltip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIUnreadMessagesTooltip.h; path = Source/AIUnreadMessagesTooltip.h; sourceTree = "<group>"; };
1.26 766ABAB51306D1020049FFB7 /* AIUnreadMessagesTooltip.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIUnreadMessagesTooltip.m; path = Source/AIUnreadMessagesTooltip.m; sourceTree = "<group>"; };
1.27 + 76731DE015F90538007728C3 /* libgcrypt.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = libgcrypt.framework; path = Frameworks/libgcrypt.framework; sourceTree = "<group>"; };
1.28 + 76731DE115F90538007728C3 /* libgpgerror.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = libgpgerror.framework; path = Frameworks/libgpgerror.framework; sourceTree = "<group>"; };
1.29 76889DEA12D3CA17007AEF00 /* get-info.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = "get-info.tiff"; path = "Resources/get-info.tiff"; sourceTree = "<group>"; };
1.30 76889DEE12D3CA40007AEF00 /* Personal.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = Personal.tiff; path = Resources/Personal.tiff; sourceTree = "<group>"; };
1.31 76C1AF9A125A906A00D269A9 /* AIAdiumURLProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIAdiumURLProtocol.h; path = "Plugins/WebKit Message View/AIAdiumURLProtocol.h"; sourceTree = "<group>"; };
1.32 @@ -4872,6 +4880,8 @@
1.33 34C846AF101E515900140B4B /* QTKit.framework in Frameworks */,
1.34 9719C92C1530EDF700217FBE /* FriBidi.framework in Frameworks */,
1.35 9719C92E1530EE0C00217FBE /* ShortcutRecorder.framework in Frameworks */,
1.36 + 76731DE215F90538007728C3 /* libgcrypt.framework in Frameworks */,
1.37 + 76731DE315F90538007728C3 /* libgpgerror.framework in Frameworks */,
1.38 );
1.39 runOnlyForDeploymentPostprocessing = 0;
1.40 };
1.41 @@ -8227,6 +8237,8 @@
1.42 979AA6A914D59EF3008730DF /* Others */ = {
1.43 isa = PBXGroup;
1.44 children = (
1.45 + 76731DE015F90538007728C3 /* libgcrypt.framework */,
1.46 + 76731DE115F90538007728C3 /* libgpgerror.framework */,
1.47 3496A8E707CE6CA30055BBAB /* AutoHyperlinks.framework.xcodeproj */,
1.48 9719C92B1530EDF700217FBE /* FriBidi.framework */,
1.49 7E9A8CB2104DEBC400F210CC /* Growl.framework */,
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/Frameworks/libgcrypt.framework/Headers Thu Sep 06 18:49:22 2012 +0200
2.3 @@ -0,0 +1,1 @@
2.4 +Versions/1.5.0/Headers
2.5 \ No newline at end of file
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/Frameworks/libgcrypt.framework/Resources Thu Sep 06 18:49:22 2012 +0200
3.3 @@ -0,0 +1,1 @@
3.4 +Versions/1.5.0/Resources
3.5 \ No newline at end of file
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/Frameworks/libgcrypt.framework/Versions/1.5.0/Headers/gcrypt-module.h Thu Sep 06 18:49:22 2012 +0200
4.3 @@ -0,0 +1,240 @@
4.4 +/* gcrypt-module.h - GNU Cryptographic Library Interface
4.5 + Copyright (C) 2003, 2007 Free Software Foundation, Inc.
4.6 +
4.7 + This file is part of Libgcrypt.
4.8 +
4.9 + Libgcrypt is free software; you can redistribute it and/or modify
4.10 + it under the terms of the GNU Lesser General Public License as
4.11 + published by the Free Software Foundation; either version 2.1 of
4.12 + the License, or (at your option) any later version.
4.13 +
4.14 + Libgcrypt is distributed in the hope that it will be useful,
4.15 + but WITHOUT ANY WARRANTY; without even the implied warranty of
4.16 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.17 + GNU Lesser General Public License for more details.
4.18 +
4.19 + You should have received a copy of the GNU Lesser General Public
4.20 + License along with this program; if not, see <http://www.gnu.org/licenses/>.
4.21 + */
4.22 +
4.23 +/*
4.24 + This file contains the necessary declarations/definitions for
4.25 + working with Libgcrypt modules.
4.26 + */
4.27 +
4.28 +#ifndef _GCRYPT_MODULE_H
4.29 +#define _GCRYPT_MODULE_H
4.30 +
4.31 +#ifdef __cplusplus
4.32 +extern "C" {
4.33 +#if 0 /* keep Emacsens's auto-indent happy */
4.34 +}
4.35 +#endif
4.36 +#endif
4.37 +
4.38 +/* The interfaces using the module system reserve a certain range of
4.39 + IDs for application use. These IDs are not valid within Libgcrypt
4.40 + but Libgcrypt makes sure never to allocate such a module ID. */
4.41 +#define GCRY_MODULE_ID_USER 1024
4.42 +#define GCRY_MODULE_ID_USER_LAST 4095
4.43 +
4.44 +
4.45 +/* This type represents a `module'. */
4.46 +typedef struct gcry_module *gcry_module_t;
4.47 +
4.48 +/* Check that the library fulfills the version requirement. */
4.49 +
4.50 +/* Type for the cipher_setkey function. */
4.51 +typedef gcry_err_code_t (*gcry_cipher_setkey_t) (void *c,
4.52 + const unsigned char *key,
4.53 + unsigned keylen);
4.54 +
4.55 +/* Type for the cipher_encrypt function. */
4.56 +typedef void (*gcry_cipher_encrypt_t) (void *c,
4.57 + unsigned char *outbuf,
4.58 + const unsigned char *inbuf);
4.59 +
4.60 +/* Type for the cipher_decrypt function. */
4.61 +typedef void (*gcry_cipher_decrypt_t) (void *c,
4.62 + unsigned char *outbuf,
4.63 + const unsigned char *inbuf);
4.64 +
4.65 +/* Type for the cipher_stencrypt function. */
4.66 +typedef void (*gcry_cipher_stencrypt_t) (void *c,
4.67 + unsigned char *outbuf,
4.68 + const unsigned char *inbuf,
4.69 + unsigned int n);
4.70 +
4.71 +/* Type for the cipher_stdecrypt function. */
4.72 +typedef void (*gcry_cipher_stdecrypt_t) (void *c,
4.73 + unsigned char *outbuf,
4.74 + const unsigned char *inbuf,
4.75 + unsigned int n);
4.76 +
4.77 +typedef struct gcry_cipher_oid_spec
4.78 +{
4.79 + const char *oid;
4.80 + int mode;
4.81 +} gcry_cipher_oid_spec_t;
4.82 +
4.83 +/* Module specification structure for ciphers. */
4.84 +typedef struct gcry_cipher_spec
4.85 +{
4.86 + const char *name;
4.87 + const char **aliases;
4.88 + gcry_cipher_oid_spec_t *oids;
4.89 + size_t blocksize;
4.90 + size_t keylen;
4.91 + size_t contextsize;
4.92 + gcry_cipher_setkey_t setkey;
4.93 + gcry_cipher_encrypt_t encrypt;
4.94 + gcry_cipher_decrypt_t decrypt;
4.95 + gcry_cipher_stencrypt_t stencrypt;
4.96 + gcry_cipher_stdecrypt_t stdecrypt;
4.97 +} gcry_cipher_spec_t;
4.98 +
4.99 +/* Register a new cipher module whose specification can be found in
4.100 + CIPHER. On success, a new algorithm ID is stored in ALGORITHM_ID
4.101 + and a pointer representing this module is stored in MODULE. */
4.102 +gcry_error_t gcry_cipher_register (gcry_cipher_spec_t *cipher,
4.103 + int *algorithm_id,
4.104 + gcry_module_t *module)
4.105 + /* */ _GCRY_ATTR_INTERNAL;
4.106 +
4.107 +
4.108 +/* Unregister the cipher identified by MODULE, which must have been
4.109 + registered with gcry_cipher_register. */
4.110 +void gcry_cipher_unregister (gcry_module_t module)
4.111 + /* */ _GCRY_ATTR_INTERNAL;
4.112 +
4.113 +/* ********************** */
4.114 +
4.115 +/* Type for the pk_generate function. */
4.116 +typedef gcry_err_code_t (*gcry_pk_generate_t) (int algo,
4.117 + unsigned int nbits,
4.118 + unsigned long use_e,
4.119 + gcry_mpi_t *skey,
4.120 + gcry_mpi_t **retfactors);
4.121 +
4.122 +/* Type for the pk_check_secret_key function. */
4.123 +typedef gcry_err_code_t (*gcry_pk_check_secret_key_t) (int algo,
4.124 + gcry_mpi_t *skey);
4.125 +
4.126 +/* Type for the pk_encrypt function. */
4.127 +typedef gcry_err_code_t (*gcry_pk_encrypt_t) (int algo,
4.128 + gcry_mpi_t *resarr,
4.129 + gcry_mpi_t data,
4.130 + gcry_mpi_t *pkey,
4.131 + int flags);
4.132 +
4.133 +/* Type for the pk_decrypt function. */
4.134 +typedef gcry_err_code_t (*gcry_pk_decrypt_t) (int algo,
4.135 + gcry_mpi_t *result,
4.136 + gcry_mpi_t *data,
4.137 + gcry_mpi_t *skey,
4.138 + int flags);
4.139 +
4.140 +/* Type for the pk_sign function. */
4.141 +typedef gcry_err_code_t (*gcry_pk_sign_t) (int algo,
4.142 + gcry_mpi_t *resarr,
4.143 + gcry_mpi_t data,
4.144 + gcry_mpi_t *skey);
4.145 +
4.146 +/* Type for the pk_verify function. */
4.147 +typedef gcry_err_code_t (*gcry_pk_verify_t) (int algo,
4.148 + gcry_mpi_t hash,
4.149 + gcry_mpi_t *data,
4.150 + gcry_mpi_t *pkey,
4.151 + int (*cmp) (void *, gcry_mpi_t),
4.152 + void *opaquev);
4.153 +
4.154 +/* Type for the pk_get_nbits function. */
4.155 +typedef unsigned (*gcry_pk_get_nbits_t) (int algo, gcry_mpi_t *pkey);
4.156 +
4.157 +/* Module specification structure for message digests. */
4.158 +typedef struct gcry_pk_spec
4.159 +{
4.160 + const char *name;
4.161 + const char **aliases;
4.162 + const char *elements_pkey;
4.163 + const char *elements_skey;
4.164 + const char *elements_enc;
4.165 + const char *elements_sig;
4.166 + const char *elements_grip;
4.167 + int use;
4.168 + gcry_pk_generate_t generate;
4.169 + gcry_pk_check_secret_key_t check_secret_key;
4.170 + gcry_pk_encrypt_t encrypt;
4.171 + gcry_pk_decrypt_t decrypt;
4.172 + gcry_pk_sign_t sign;
4.173 + gcry_pk_verify_t verify;
4.174 + gcry_pk_get_nbits_t get_nbits;
4.175 +} gcry_pk_spec_t;
4.176 +
4.177 +/* Register a new pubkey module whose specification can be found in
4.178 + PUBKEY. On success, a new algorithm ID is stored in ALGORITHM_ID
4.179 + and a pointer representhing this module is stored in MODULE. */
4.180 +gcry_error_t gcry_pk_register (gcry_pk_spec_t *pubkey,
4.181 + unsigned int *algorithm_id,
4.182 + gcry_module_t *module)
4.183 + /* */ _GCRY_ATTR_INTERNAL;
4.184 +
4.185 +/* Unregister the pubkey identified by ID, which must have been
4.186 + registered with gcry_pk_register. */
4.187 +void gcry_pk_unregister (gcry_module_t module)
4.188 + /* */ _GCRY_ATTR_INTERNAL;
4.189 +
4.190 +/* ********************** */
4.191 +
4.192 +/* Type for the md_init function. */
4.193 +typedef void (*gcry_md_init_t) (void *c);
4.194 +
4.195 +/* Type for the md_write function. */
4.196 +typedef void (*gcry_md_write_t) (void *c, const void *buf, size_t nbytes);
4.197 +
4.198 +/* Type for the md_final function. */
4.199 +typedef void (*gcry_md_final_t) (void *c);
4.200 +
4.201 +/* Type for the md_read function. */
4.202 +typedef unsigned char *(*gcry_md_read_t) (void *c);
4.203 +
4.204 +typedef struct gcry_md_oid_spec
4.205 +{
4.206 + const char *oidstring;
4.207 +} gcry_md_oid_spec_t;
4.208 +
4.209 +/* Module specification structure for message digests. */
4.210 +typedef struct gcry_md_spec
4.211 +{
4.212 + const char *name;
4.213 + unsigned char *asnoid;
4.214 + int asnlen;
4.215 + gcry_md_oid_spec_t *oids;
4.216 + int mdlen;
4.217 + gcry_md_init_t init;
4.218 + gcry_md_write_t write;
4.219 + gcry_md_final_t final;
4.220 + gcry_md_read_t read;
4.221 + size_t contextsize; /* allocate this amount of context */
4.222 +} gcry_md_spec_t;
4.223 +
4.224 +/* Register a new digest module whose specification can be found in
4.225 + DIGEST. On success, a new algorithm ID is stored in ALGORITHM_ID
4.226 + and a pointer representhing this module is stored in MODULE. */
4.227 +gcry_error_t gcry_md_register (gcry_md_spec_t *digest,
4.228 + unsigned int *algorithm_id,
4.229 + gcry_module_t *module)
4.230 + /* */ _GCRY_ATTR_INTERNAL;
4.231 +
4.232 +/* Unregister the digest identified by ID, which must have been
4.233 + registered with gcry_digest_register. */
4.234 +void gcry_md_unregister (gcry_module_t module)
4.235 + /* */ _GCRY_ATTR_INTERNAL;
4.236 +
4.237 +#if 0 /* keep Emacsens's auto-indent happy */
4.238 +{
4.239 +#endif
4.240 +#ifdef __cplusplus
4.241 +}
4.242 +#endif
4.243 +#endif
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/Frameworks/libgcrypt.framework/Versions/1.5.0/Headers/gcrypt.h Thu Sep 06 18:49:22 2012 +0200
5.3 @@ -0,0 +1,1915 @@
5.4 +/* gcrypt.h - GNU Cryptographic Library Interface -*- c -*-
5.5 + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006
5.6 + 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
5.7 +
5.8 + This file is part of Libgcrypt.
5.9 +
5.10 + Libgcrypt is free software; you can redistribute it and/or modify
5.11 + it under the terms of the GNU Lesser General Public License as
5.12 + published by the Free Software Foundation; either version 2.1 of
5.13 + the License, or (at your option) any later version.
5.14 +
5.15 + Libgcrypt is distributed in the hope that it will be useful,
5.16 + but WITHOUT ANY WARRANTY; without even the implied warranty of
5.17 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5.18 + GNU Lesser General Public License for more details.
5.19 +
5.20 + You should have received a copy of the GNU Lesser General Public
5.21 + License along with this program; if not, see <http://www.gnu.org/licenses/>.
5.22 +
5.23 + File: src/gcrypt.h. Generated from gcrypt.h.in by configure. */
5.24 +
5.25 +#ifndef _GCRYPT_H
5.26 +#define _GCRYPT_H
5.27 +
5.28 +#include <stdlib.h>
5.29 +#include <stdarg.h>
5.30 +#include <string.h>
5.31 +
5.32 +#include <gpg-error.h>
5.33 +
5.34 +#include <sys/types.h>
5.35 +
5.36 +#if defined _WIN32 || defined __WIN32__
5.37 +# include <winsock2.h>
5.38 +# include <ws2tcpip.h>
5.39 +# include <time.h>
5.40 +# ifndef __GNUC__
5.41 + typedef long ssize_t;
5.42 + typedef int pid_t;
5.43 +# endif /*!__GNUC__*/
5.44 +#else
5.45 +# include <sys/socket.h>
5.46 +# include <sys/time.h>
5.47 +# include <sys/select.h>
5.48 +#endif /*!_WIN32*/
5.49 +
5.50 +typedef socklen_t gcry_socklen_t;
5.51 +
5.52 +/* This is required for error code compatibility. */
5.53 +#define _GCRY_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GCRYPT
5.54 +
5.55 +#ifdef __cplusplus
5.56 +extern "C" {
5.57 +#if 0 /* (Keep Emacsens' auto-indent happy.) */
5.58 +}
5.59 +#endif
5.60 +#endif
5.61 +
5.62 +/* The version of this header should match the one of the library. It
5.63 + should not be used by a program because gcry_check_version() should
5.64 + return the same version. The purpose of this macro is to let
5.65 + autoconf (using the AM_PATH_GCRYPT macro) check that this header
5.66 + matches the installed library. */
5.67 +#define GCRYPT_VERSION "1.5.0"
5.68 +
5.69 +/* Internal: We can't use the convenience macros for the multi
5.70 + precision integer functions when building this library. */
5.71 +#ifdef _GCRYPT_IN_LIBGCRYPT
5.72 +#ifndef GCRYPT_NO_MPI_MACROS
5.73 +#define GCRYPT_NO_MPI_MACROS 1
5.74 +#endif
5.75 +#endif
5.76 +
5.77 +/* We want to use gcc attributes when possible. Warning: Don't use
5.78 + these macros in your programs: As indicated by the leading
5.79 + underscore they are subject to change without notice. */
5.80 +#ifdef __GNUC__
5.81 +
5.82 +#define _GCRY_GCC_VERSION (__GNUC__ * 10000 \
5.83 + + __GNUC_MINOR__ * 100 \
5.84 + + __GNUC_PATCHLEVEL__)
5.85 +
5.86 +#if _GCRY_GCC_VERSION >= 30100
5.87 +#define _GCRY_GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__))
5.88 +#endif
5.89 +
5.90 +#if _GCRY_GCC_VERSION >= 29600
5.91 +#define _GCRY_GCC_ATTR_PURE __attribute__ ((__pure__))
5.92 +#endif
5.93 +
5.94 +#if _GCRY_GCC_VERSION >= 30200
5.95 +#define _GCRY_GCC_ATTR_MALLOC __attribute__ ((__malloc__))
5.96 +#endif
5.97 +
5.98 +#endif /*__GNUC__*/
5.99 +
5.100 +#ifndef _GCRY_GCC_ATTR_DEPRECATED
5.101 +#define _GCRY_GCC_ATTR_DEPRECATED
5.102 +#endif
5.103 +#ifndef _GCRY_GCC_ATTR_PURE
5.104 +#define _GCRY_GCC_ATTR_PURE
5.105 +#endif
5.106 +#ifndef _GCRY_GCC_ATTR_MALLOC
5.107 +#define _GCRY_GCC_ATTR_MALLOC
5.108 +#endif
5.109 +
5.110 +/* Make up an attribute to mark functions and types as deprecated but
5.111 + allow internal use by Libgcrypt. */
5.112 +#ifdef _GCRYPT_IN_LIBGCRYPT
5.113 +#define _GCRY_ATTR_INTERNAL
5.114 +#else
5.115 +#define _GCRY_ATTR_INTERNAL _GCRY_GCC_ATTR_DEPRECATED
5.116 +#endif
5.117 +
5.118 +/* Wrappers for the libgpg-error library. */
5.119 +
5.120 +typedef gpg_error_t gcry_error_t;
5.121 +typedef gpg_err_code_t gcry_err_code_t;
5.122 +typedef gpg_err_source_t gcry_err_source_t;
5.123 +
5.124 +static GPG_ERR_INLINE gcry_error_t
5.125 +gcry_err_make (gcry_err_source_t source, gcry_err_code_t code)
5.126 +{
5.127 + return gpg_err_make (source, code);
5.128 +}
5.129 +
5.130 +/* The user can define GPG_ERR_SOURCE_DEFAULT before including this
5.131 + file to specify a default source for gpg_error. */
5.132 +#ifndef GCRY_ERR_SOURCE_DEFAULT
5.133 +#define GCRY_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_USER_1
5.134 +#endif
5.135 +
5.136 +static GPG_ERR_INLINE gcry_error_t
5.137 +gcry_error (gcry_err_code_t code)
5.138 +{
5.139 + return gcry_err_make (GCRY_ERR_SOURCE_DEFAULT, code);
5.140 +}
5.141 +
5.142 +static GPG_ERR_INLINE gcry_err_code_t
5.143 +gcry_err_code (gcry_error_t err)
5.144 +{
5.145 + return gpg_err_code (err);
5.146 +}
5.147 +
5.148 +
5.149 +static GPG_ERR_INLINE gcry_err_source_t
5.150 +gcry_err_source (gcry_error_t err)
5.151 +{
5.152 + return gpg_err_source (err);
5.153 +}
5.154 +
5.155 +/* Return a pointer to a string containing a description of the error
5.156 + code in the error value ERR. */
5.157 +const char *gcry_strerror (gcry_error_t err);
5.158 +
5.159 +/* Return a pointer to a string containing a description of the error
5.160 + source in the error value ERR. */
5.161 +const char *gcry_strsource (gcry_error_t err);
5.162 +
5.163 +/* Retrieve the error code for the system error ERR. This returns
5.164 + GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
5.165 + this). */
5.166 +gcry_err_code_t gcry_err_code_from_errno (int err);
5.167 +
5.168 +/* Retrieve the system error for the error code CODE. This returns 0
5.169 + if CODE is not a system error code. */
5.170 +int gcry_err_code_to_errno (gcry_err_code_t code);
5.171 +
5.172 +/* Return an error value with the error source SOURCE and the system
5.173 + error ERR. */
5.174 +gcry_error_t gcry_err_make_from_errno (gcry_err_source_t source, int err);
5.175 +
5.176 +/* Return an error value with the system error ERR. */
5.177 +gcry_err_code_t gcry_error_from_errno (int err);
5.178 +
5.179 +
5.180 +/* This enum is deprecated; it is only declared for the sake of
5.181 + complete API compatibility. */
5.182 +enum gcry_thread_option
5.183 + {
5.184 + _GCRY_THREAD_OPTION_DUMMY
5.185 + } _GCRY_GCC_ATTR_DEPRECATED;
5.186 +
5.187 +
5.188 +/* Constants defining the thread model to use. Used with the OPTION
5.189 + field of the struct gcry_thread_cbs. */
5.190 +#define GCRY_THREAD_OPTION_DEFAULT 0
5.191 +#define GCRY_THREAD_OPTION_USER 1
5.192 +#define GCRY_THREAD_OPTION_PTH 2
5.193 +#define GCRY_THREAD_OPTION_PTHREAD 3
5.194 +
5.195 +/* The version number encoded in the OPTION field of the struct
5.196 + gcry_thread_cbs. */
5.197 +#define GCRY_THREAD_OPTION_VERSION 0
5.198 +
5.199 +/* Wrapper for struct ath_ops. */
5.200 +struct gcry_thread_cbs
5.201 +{
5.202 + /* The OPTION field encodes the thread model and the version number
5.203 + of this structure.
5.204 + Bits 7 - 0 are used for the thread model
5.205 + Bits 15 - 8 are used for the version number.
5.206 + */
5.207 + unsigned int option;
5.208 +
5.209 + int (*init) (void);
5.210 + int (*mutex_init) (void **priv);
5.211 + int (*mutex_destroy) (void **priv);
5.212 + int (*mutex_lock) (void **priv);
5.213 + int (*mutex_unlock) (void **priv);
5.214 + ssize_t (*read) (int fd, void *buf, size_t nbytes);
5.215 + ssize_t (*write) (int fd, const void *buf, size_t nbytes);
5.216 +#ifdef _WIN32
5.217 + ssize_t (*select) (int nfd, void *rset, void *wset, void *eset,
5.218 + struct timeval *timeout);
5.219 + ssize_t (*waitpid) (pid_t pid, int *status, int options);
5.220 + int (*accept) (int s, void *addr, int *length_ptr);
5.221 + int (*connect) (int s, void *addr, gcry_socklen_t length);
5.222 + int (*sendmsg) (int s, const void *msg, int flags);
5.223 + int (*recvmsg) (int s, void *msg, int flags);
5.224 +#else
5.225 + ssize_t (*select) (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
5.226 + struct timeval *timeout);
5.227 + ssize_t (*waitpid) (pid_t pid, int *status, int options);
5.228 + int (*accept) (int s, struct sockaddr *addr, gcry_socklen_t *length_ptr);
5.229 + int (*connect) (int s, struct sockaddr *addr, gcry_socklen_t length);
5.230 + int (*sendmsg) (int s, const struct msghdr *msg, int flags);
5.231 + int (*recvmsg) (int s, struct msghdr *msg, int flags);
5.232 +#endif
5.233 +};
5.234 +
5.235 +#ifdef _WIN32
5.236 +# define _GCRY_THREAD_OPTION_PTH_IMPL_NET \
5.237 +static ssize_t gcry_pth_select (int nfd, void *rset, void *wset, \
5.238 + void *eset, struct timeval *timeout) \
5.239 + { return pth_select (nfd, rset, wset, eset, timeout); } \
5.240 +static ssize_t gcry_pth_waitpid (pid_t pid, int *status, int options) \
5.241 + { return pth_waitpid (pid, status, options); } \
5.242 +static int gcry_pth_accept (int s, void *addr, \
5.243 + gcry_socklen_t *length_ptr) \
5.244 + { return pth_accept (s, addr, length_ptr); } \
5.245 +static int gcry_pth_connect (int s, void *addr, \
5.246 + gcry_socklen_t length) \
5.247 + { return pth_connect (s, addr, length); }
5.248 +#else /*!_WIN32*/
5.249 +# define _GCRY_THREAD_OPTION_PTH_IMPL_NET \
5.250 +static ssize_t gcry_pth_select (int nfd, fd_set *rset, fd_set *wset, \
5.251 + fd_set *eset, struct timeval *timeout) \
5.252 + { return pth_select (nfd, rset, wset, eset, timeout); } \
5.253 +static ssize_t gcry_pth_waitpid (pid_t pid, int *status, int options) \
5.254 + { return pth_waitpid (pid, status, options); } \
5.255 +static int gcry_pth_accept (int s, struct sockaddr *addr, \
5.256 + gcry_socklen_t *length_ptr) \
5.257 + { return pth_accept (s, addr, length_ptr); } \
5.258 +static int gcry_pth_connect (int s, struct sockaddr *addr, \
5.259 + gcry_socklen_t length) \
5.260 + { return pth_connect (s, addr, length); }
5.261 +#endif /*!_WIN32*/
5.262 +
5.263 +
5.264 +
5.265 +#define GCRY_THREAD_OPTION_PTH_IMPL \
5.266 +static int gcry_pth_init (void) \
5.267 +{ return (pth_init () == FALSE) ? errno : 0; } \
5.268 +static int gcry_pth_mutex_init (void **priv) \
5.269 +{ \
5.270 + int err = 0; \
5.271 + pth_mutex_t *lock = malloc (sizeof (pth_mutex_t)); \
5.272 + \
5.273 + if (!lock) \
5.274 + err = ENOMEM; \
5.275 + if (!err) \
5.276 + { \
5.277 + err = pth_mutex_init (lock); \
5.278 + if (err == FALSE) \
5.279 + err = errno; \
5.280 + else \
5.281 + err = 0; \
5.282 + if (err) \
5.283 + free (lock); \
5.284 + else \
5.285 + *priv = lock; \
5.286 + } \
5.287 + return err; \
5.288 +} \
5.289 +static int gcry_pth_mutex_destroy (void **lock) \
5.290 + { /* GNU Pth has no destructor function. */ free (*lock); return 0; } \
5.291 +static int gcry_pth_mutex_lock (void **lock) \
5.292 + { return ((pth_mutex_acquire (*lock, 0, NULL)) == FALSE) \
5.293 + ? errno : 0; } \
5.294 +static int gcry_pth_mutex_unlock (void **lock) \
5.295 + { return ((pth_mutex_release (*lock)) == FALSE) \
5.296 + ? errno : 0; } \
5.297 +static ssize_t gcry_pth_read (int fd, void *buf, size_t nbytes) \
5.298 + { return pth_read (fd, buf, nbytes); } \
5.299 +static ssize_t gcry_pth_write (int fd, const void *buf, size_t nbytes) \
5.300 + { return pth_write (fd, buf, nbytes); } \
5.301 +_GCRY_THREAD_OPTION_PTH_IMPL_NET \
5.302 + \
5.303 +/* Note: GNU Pth is missing pth_sendmsg and pth_recvmsg. */ \
5.304 +static struct gcry_thread_cbs gcry_threads_pth = { \
5.305 + (GCRY_THREAD_OPTION_PTH | (GCRY_THREAD_OPTION_VERSION << 8)), \
5.306 + gcry_pth_init, gcry_pth_mutex_init, gcry_pth_mutex_destroy, \
5.307 + gcry_pth_mutex_lock, gcry_pth_mutex_unlock, gcry_pth_read, gcry_pth_write, \
5.308 + gcry_pth_select, gcry_pth_waitpid, gcry_pth_accept, gcry_pth_connect, \
5.309 + NULL, NULL }
5.310 +
5.311 +
5.312 +#define GCRY_THREAD_OPTION_PTHREAD_IMPL \
5.313 +static int gcry_pthread_mutex_init (void **priv) \
5.314 +{ \
5.315 + int err = 0; \
5.316 + pthread_mutex_t *lock = (pthread_mutex_t*)malloc (sizeof (pthread_mutex_t));\
5.317 + \
5.318 + if (!lock) \
5.319 + err = ENOMEM; \
5.320 + if (!err) \
5.321 + { \
5.322 + err = pthread_mutex_init (lock, NULL); \
5.323 + if (err) \
5.324 + free (lock); \
5.325 + else \
5.326 + *priv = lock; \
5.327 + } \
5.328 + return err; \
5.329 +} \
5.330 +static int gcry_pthread_mutex_destroy (void **lock) \
5.331 + { int err = pthread_mutex_destroy ((pthread_mutex_t*)*lock); \
5.332 + free (*lock); return err; } \
5.333 +static int gcry_pthread_mutex_lock (void **lock) \
5.334 + { return pthread_mutex_lock ((pthread_mutex_t*)*lock); } \
5.335 +static int gcry_pthread_mutex_unlock (void **lock) \
5.336 + { return pthread_mutex_unlock ((pthread_mutex_t*)*lock); } \
5.337 + \
5.338 +static struct gcry_thread_cbs gcry_threads_pthread = { \
5.339 + (GCRY_THREAD_OPTION_PTHREAD | (GCRY_THREAD_OPTION_VERSION << 8)), \
5.340 + NULL, gcry_pthread_mutex_init, gcry_pthread_mutex_destroy, \
5.341 + gcry_pthread_mutex_lock, gcry_pthread_mutex_unlock, \
5.342 + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
5.343 +
5.344 +
5.345 +/* The data object used to hold a multi precision integer. */
5.346 +struct gcry_mpi;
5.347 +typedef struct gcry_mpi *gcry_mpi_t;
5.348 +
5.349 +#ifndef GCRYPT_NO_DEPRECATED
5.350 +typedef struct gcry_mpi *GCRY_MPI _GCRY_GCC_ATTR_DEPRECATED;
5.351 +typedef struct gcry_mpi *GcryMPI _GCRY_GCC_ATTR_DEPRECATED;
5.352 +#endif
5.353 +
5.354 +
5.355 +
5.356 +/* Check that the library fulfills the version requirement. */
5.357 +const char *gcry_check_version (const char *req_version);
5.358 +
5.359 +/* Codes for function dispatchers. */
5.360 +
5.361 +/* Codes used with the gcry_control function. */
5.362 +enum gcry_ctl_cmds
5.363 + {
5.364 + GCRYCTL_SET_KEY = 1,
5.365 + GCRYCTL_SET_IV = 2,
5.366 + GCRYCTL_CFB_SYNC = 3,
5.367 + GCRYCTL_RESET = 4, /* e.g. for MDs */
5.368 + GCRYCTL_FINALIZE = 5,
5.369 + GCRYCTL_GET_KEYLEN = 6,
5.370 + GCRYCTL_GET_BLKLEN = 7,
5.371 + GCRYCTL_TEST_ALGO = 8,
5.372 + GCRYCTL_IS_SECURE = 9,
5.373 + GCRYCTL_GET_ASNOID = 10,
5.374 + GCRYCTL_ENABLE_ALGO = 11,
5.375 + GCRYCTL_DISABLE_ALGO = 12,
5.376 + GCRYCTL_DUMP_RANDOM_STATS = 13,
5.377 + GCRYCTL_DUMP_SECMEM_STATS = 14,
5.378 + GCRYCTL_GET_ALGO_NPKEY = 15,
5.379 + GCRYCTL_GET_ALGO_NSKEY = 16,
5.380 + GCRYCTL_GET_ALGO_NSIGN = 17,
5.381 + GCRYCTL_GET_ALGO_NENCR = 18,
5.382 + GCRYCTL_SET_VERBOSITY = 19,
5.383 + GCRYCTL_SET_DEBUG_FLAGS = 20,
5.384 + GCRYCTL_CLEAR_DEBUG_FLAGS = 21,
5.385 + GCRYCTL_USE_SECURE_RNDPOOL= 22,
5.386 + GCRYCTL_DUMP_MEMORY_STATS = 23,
5.387 + GCRYCTL_INIT_SECMEM = 24,
5.388 + GCRYCTL_TERM_SECMEM = 25,
5.389 + GCRYCTL_DISABLE_SECMEM_WARN = 27,
5.390 + GCRYCTL_SUSPEND_SECMEM_WARN = 28,
5.391 + GCRYCTL_RESUME_SECMEM_WARN = 29,
5.392 + GCRYCTL_DROP_PRIVS = 30,
5.393 + GCRYCTL_ENABLE_M_GUARD = 31,
5.394 + GCRYCTL_START_DUMP = 32,
5.395 + GCRYCTL_STOP_DUMP = 33,
5.396 + GCRYCTL_GET_ALGO_USAGE = 34,
5.397 + GCRYCTL_IS_ALGO_ENABLED = 35,
5.398 + GCRYCTL_DISABLE_INTERNAL_LOCKING = 36,
5.399 + GCRYCTL_DISABLE_SECMEM = 37,
5.400 + GCRYCTL_INITIALIZATION_FINISHED = 38,
5.401 + GCRYCTL_INITIALIZATION_FINISHED_P = 39,
5.402 + GCRYCTL_ANY_INITIALIZATION_P = 40,
5.403 + GCRYCTL_SET_CBC_CTS = 41,
5.404 + GCRYCTL_SET_CBC_MAC = 42,
5.405 + GCRYCTL_SET_CTR = 43,
5.406 + GCRYCTL_ENABLE_QUICK_RANDOM = 44,
5.407 + GCRYCTL_SET_RANDOM_SEED_FILE = 45,
5.408 + GCRYCTL_UPDATE_RANDOM_SEED_FILE = 46,
5.409 + GCRYCTL_SET_THREAD_CBS = 47,
5.410 + GCRYCTL_FAST_POLL = 48,
5.411 + GCRYCTL_SET_RANDOM_DAEMON_SOCKET = 49,
5.412 + GCRYCTL_USE_RANDOM_DAEMON = 50,
5.413 + GCRYCTL_FAKED_RANDOM_P = 51,
5.414 + GCRYCTL_SET_RNDEGD_SOCKET = 52,
5.415 + GCRYCTL_PRINT_CONFIG = 53,
5.416 + GCRYCTL_OPERATIONAL_P = 54,
5.417 + GCRYCTL_FIPS_MODE_P = 55,
5.418 + GCRYCTL_FORCE_FIPS_MODE = 56,
5.419 + GCRYCTL_SELFTEST = 57,
5.420 + /* Note: 58 .. 62 are used internally. */
5.421 + GCRYCTL_DISABLE_HWF = 63
5.422 + };
5.423 +
5.424 +/* Perform various operations defined by CMD. */
5.425 +gcry_error_t gcry_control (enum gcry_ctl_cmds CMD, ...);
5.426 +
5.427 +
5.428 +/* S-expression management. */
5.429 +
5.430 +/* The object to represent an S-expression as used with the public key
5.431 + functions. */
5.432 +struct gcry_sexp;
5.433 +typedef struct gcry_sexp *gcry_sexp_t;
5.434 +
5.435 +#ifndef GCRYPT_NO_DEPRECATED
5.436 +typedef struct gcry_sexp *GCRY_SEXP _GCRY_GCC_ATTR_DEPRECATED;
5.437 +typedef struct gcry_sexp *GcrySexp _GCRY_GCC_ATTR_DEPRECATED;
5.438 +#endif
5.439 +
5.440 +/* The possible values for the S-expression format. */
5.441 +enum gcry_sexp_format
5.442 + {
5.443 + GCRYSEXP_FMT_DEFAULT = 0,
5.444 + GCRYSEXP_FMT_CANON = 1,
5.445 + GCRYSEXP_FMT_BASE64 = 2,
5.446 + GCRYSEXP_FMT_ADVANCED = 3
5.447 + };
5.448 +
5.449 +/* Create an new S-expression object from BUFFER of size LENGTH and
5.450 + return it in RETSEXP. With AUTODETECT set to 0 the data in BUFFER
5.451 + is expected to be in canonized format. */
5.452 +gcry_error_t gcry_sexp_new (gcry_sexp_t *retsexp,
5.453 + const void *buffer, size_t length,
5.454 + int autodetect);
5.455 +
5.456 + /* Same as gcry_sexp_new but allows to pass a FREEFNC which has the
5.457 + effect to transfer ownership of BUFFER to the created object. */
5.458 +gcry_error_t gcry_sexp_create (gcry_sexp_t *retsexp,
5.459 + void *buffer, size_t length,
5.460 + int autodetect, void (*freefnc) (void *));
5.461 +
5.462 +/* Scan BUFFER and return a new S-expression object in RETSEXP. This
5.463 + function expects a printf like string in BUFFER. */
5.464 +gcry_error_t gcry_sexp_sscan (gcry_sexp_t *retsexp, size_t *erroff,
5.465 + const char *buffer, size_t length);
5.466 +
5.467 +/* Same as gcry_sexp_sscan but expects a string in FORMAT and can thus
5.468 + only be used for certain encodings. */
5.469 +gcry_error_t gcry_sexp_build (gcry_sexp_t *retsexp, size_t *erroff,
5.470 + const char *format, ...);
5.471 +
5.472 +/* Like gcry_sexp_build, but uses an array instead of variable
5.473 + function arguments. */
5.474 +gcry_error_t gcry_sexp_build_array (gcry_sexp_t *retsexp, size_t *erroff,
5.475 + const char *format, void **arg_list);
5.476 +
5.477 +/* Release the S-expression object SEXP */
5.478 +void gcry_sexp_release (gcry_sexp_t sexp);
5.479 +
5.480 +/* Calculate the length of an canonized S-expresion in BUFFER and
5.481 + check for a valid encoding. */
5.482 +size_t gcry_sexp_canon_len (const unsigned char *buffer, size_t length,
5.483 + size_t *erroff, gcry_error_t *errcode);
5.484 +
5.485 +/* Copies the S-expression object SEXP into BUFFER using the format
5.486 + specified in MODE. */
5.487 +size_t gcry_sexp_sprint (gcry_sexp_t sexp, int mode, void *buffer,
5.488 + size_t maxlength);
5.489 +
5.490 +/* Dumps the S-expression object A in a format suitable for debugging
5.491 + to Libgcrypt's logging stream. */
5.492 +void gcry_sexp_dump (const gcry_sexp_t a);
5.493 +
5.494 +gcry_sexp_t gcry_sexp_cons (const gcry_sexp_t a, const gcry_sexp_t b);
5.495 +gcry_sexp_t gcry_sexp_alist (const gcry_sexp_t *array);
5.496 +gcry_sexp_t gcry_sexp_vlist (const gcry_sexp_t a, ...);
5.497 +gcry_sexp_t gcry_sexp_append (const gcry_sexp_t a, const gcry_sexp_t n);
5.498 +gcry_sexp_t gcry_sexp_prepend (const gcry_sexp_t a, const gcry_sexp_t n);
5.499 +
5.500 +/* Scan the S-expression for a sublist with a type (the car of the
5.501 + list) matching the string TOKEN. If TOKLEN is not 0, the token is
5.502 + assumed to be raw memory of this length. The function returns a
5.503 + newly allocated S-expression consisting of the found sublist or
5.504 + `NULL' when not found. */
5.505 +gcry_sexp_t gcry_sexp_find_token (gcry_sexp_t list,
5.506 + const char *tok, size_t toklen);
5.507 +/* Return the length of the LIST. For a valid S-expression this
5.508 + should be at least 1. */
5.509 +int gcry_sexp_length (const gcry_sexp_t list);
5.510 +
5.511 +/* Create and return a new S-expression from the element with index
5.512 + NUMBER in LIST. Note that the first element has the index 0. If
5.513 + there is no such element, `NULL' is returned. */
5.514 +gcry_sexp_t gcry_sexp_nth (const gcry_sexp_t list, int number);
5.515 +
5.516 +/* Create and return a new S-expression from the first element in
5.517 + LIST; this called the "type" and should always exist and be a
5.518 + string. `NULL' is returned in case of a problem. */
5.519 +gcry_sexp_t gcry_sexp_car (const gcry_sexp_t list);
5.520 +
5.521 +/* Create and return a new list form all elements except for the first
5.522 + one. Note, that this function may return an invalid S-expression
5.523 + because it is not guaranteed, that the type exists and is a string.
5.524 + However, for parsing a complex S-expression it might be useful for
5.525 + intermediate lists. Returns `NULL' on error. */
5.526 +gcry_sexp_t gcry_sexp_cdr (const gcry_sexp_t list);
5.527 +
5.528 +gcry_sexp_t gcry_sexp_cadr (const gcry_sexp_t list);
5.529 +
5.530 +
5.531 +/* This function is used to get data from a LIST. A pointer to the
5.532 + actual data with index NUMBER is returned and the length of this
5.533 + data will be stored to DATALEN. If there is no data at the given
5.534 + index or the index represents another list, `NULL' is returned.
5.535 + *Note:* The returned pointer is valid as long as LIST is not
5.536 + modified or released. */
5.537 +const char *gcry_sexp_nth_data (const gcry_sexp_t list, int number,
5.538 + size_t *datalen);
5.539 +
5.540 +/* This function is used to get and convert data from a LIST. The
5.541 + data is assumed to be a Nul terminated string. The caller must
5.542 + release the returned value using `gcry_free'. If there is no data
5.543 + at the given index, the index represents a list or the value can't
5.544 + be converted to a string, `NULL' is returned. */
5.545 +char *gcry_sexp_nth_string (gcry_sexp_t list, int number);
5.546 +
5.547 +/* This function is used to get and convert data from a LIST. This
5.548 + data is assumed to be an MPI stored in the format described by
5.549 + MPIFMT and returned as a standard Libgcrypt MPI. The caller must
5.550 + release this returned value using `gcry_mpi_release'. If there is
5.551 + no data at the given index, the index represents a list or the
5.552 + value can't be converted to an MPI, `NULL' is returned. */
5.553 +gcry_mpi_t gcry_sexp_nth_mpi (gcry_sexp_t list, int number, int mpifmt);
5.554 +
5.555 +
5.556 +
5.557 +/*******************************************
5.558 + * *
5.559 + * Multi Precision Integer Functions *
5.560 + * *
5.561 + *******************************************/
5.562 +
5.563 +/* Different formats of external big integer representation. */
5.564 +enum gcry_mpi_format
5.565 + {
5.566 + GCRYMPI_FMT_NONE= 0,
5.567 + GCRYMPI_FMT_STD = 1, /* Twos complement stored without length. */
5.568 + GCRYMPI_FMT_PGP = 2, /* As used by OpenPGP (unsigned only). */
5.569 + GCRYMPI_FMT_SSH = 3, /* As used by SSH (like STD but with length). */
5.570 + GCRYMPI_FMT_HEX = 4, /* Hex format. */
5.571 + GCRYMPI_FMT_USG = 5 /* Like STD but unsigned. */
5.572 + };
5.573 +
5.574 +/* Flags used for creating big integers. */
5.575 +enum gcry_mpi_flag
5.576 + {
5.577 + GCRYMPI_FLAG_SECURE = 1, /* Allocate the number in "secure" memory. */
5.578 + GCRYMPI_FLAG_OPAQUE = 2 /* The number is not a real one but just
5.579 + a way to store some bytes. This is
5.580 + useful for encrypted big integers. */
5.581 + };
5.582 +
5.583 +
5.584 +/* Allocate a new big integer object, initialize it with 0 and
5.585 + initially allocate memory for a number of at least NBITS. */
5.586 +gcry_mpi_t gcry_mpi_new (unsigned int nbits);
5.587 +
5.588 +/* Same as gcry_mpi_new() but allocate in "secure" memory. */
5.589 +gcry_mpi_t gcry_mpi_snew (unsigned int nbits);
5.590 +
5.591 +/* Release the number A and free all associated resources. */
5.592 +void gcry_mpi_release (gcry_mpi_t a);
5.593 +
5.594 +/* Create a new number with the same value as A. */
5.595 +gcry_mpi_t gcry_mpi_copy (const gcry_mpi_t a);
5.596 +
5.597 +/* Store the big integer value U in W. */
5.598 +gcry_mpi_t gcry_mpi_set (gcry_mpi_t w, const gcry_mpi_t u);
5.599 +
5.600 +/* Store the unsigned integer value U in W. */
5.601 +gcry_mpi_t gcry_mpi_set_ui (gcry_mpi_t w, unsigned long u);
5.602 +
5.603 +/* Swap the values of A and B. */
5.604 +void gcry_mpi_swap (gcry_mpi_t a, gcry_mpi_t b);
5.605 +
5.606 +/* Compare the big integer number U and V returning 0 for equality, a
5.607 + positive value for U > V and a negative for U < V. */
5.608 +int gcry_mpi_cmp (const gcry_mpi_t u, const gcry_mpi_t v);
5.609 +
5.610 +/* Compare the big integer number U with the unsigned integer V
5.611 + returning 0 for equality, a positive value for U > V and a negative
5.612 + for U < V. */
5.613 +int gcry_mpi_cmp_ui (const gcry_mpi_t u, unsigned long v);
5.614 +
5.615 +/* Convert the external representation of an integer stored in BUFFER
5.616 + with a length of BUFLEN into a newly create MPI returned in
5.617 + RET_MPI. If NSCANNED is not NULL, it will receive the number of
5.618 + bytes actually scanned after a successful operation. */
5.619 +gcry_error_t gcry_mpi_scan (gcry_mpi_t *ret_mpi, enum gcry_mpi_format format,
5.620 + const void *buffer, size_t buflen,
5.621 + size_t *nscanned);
5.622 +
5.623 +/* Convert the big integer A into the external representation
5.624 + described by FORMAT and store it in the provided BUFFER which has
5.625 + been allocated by the user with a size of BUFLEN bytes. NWRITTEN
5.626 + receives the actual length of the external representation unless it
5.627 + has been passed as NULL. */
5.628 +gcry_error_t gcry_mpi_print (enum gcry_mpi_format format,
5.629 + unsigned char *buffer, size_t buflen,
5.630 + size_t *nwritten,
5.631 + const gcry_mpi_t a);
5.632 +
5.633 +/* Convert the big integer A int the external representation described
5.634 + by FORMAT and store it in a newly allocated buffer which address
5.635 + will be put into BUFFER. NWRITTEN receives the actual lengths of the
5.636 + external representation. */
5.637 +gcry_error_t gcry_mpi_aprint (enum gcry_mpi_format format,
5.638 + unsigned char **buffer, size_t *nwritten,
5.639 + const gcry_mpi_t a);
5.640 +
5.641 +/* Dump the value of A in a format suitable for debugging to
5.642 + Libgcrypt's logging stream. Note that one leading space but no
5.643 + trailing space or linefeed will be printed. It is okay to pass
5.644 + NULL for A. */
5.645 +void gcry_mpi_dump (const gcry_mpi_t a);
5.646 +
5.647 +
5.648 +/* W = U + V. */
5.649 +void gcry_mpi_add (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v);
5.650 +
5.651 +/* W = U + V. V is an unsigned integer. */
5.652 +void gcry_mpi_add_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v);
5.653 +
5.654 +/* W = U + V mod M. */
5.655 +void gcry_mpi_addm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m);
5.656 +
5.657 +/* W = U - V. */
5.658 +void gcry_mpi_sub (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v);
5.659 +
5.660 +/* W = U - V. V is an unsigned integer. */
5.661 +void gcry_mpi_sub_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v );
5.662 +
5.663 +/* W = U - V mod M */
5.664 +void gcry_mpi_subm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m);
5.665 +
5.666 +/* W = U * V. */
5.667 +void gcry_mpi_mul (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v);
5.668 +
5.669 +/* W = U * V. V is an unsigned integer. */
5.670 +void gcry_mpi_mul_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v );
5.671 +
5.672 +/* W = U * V mod M. */
5.673 +void gcry_mpi_mulm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m);
5.674 +
5.675 +/* W = U * (2 ^ CNT). */
5.676 +void gcry_mpi_mul_2exp (gcry_mpi_t w, gcry_mpi_t u, unsigned long cnt);
5.677 +
5.678 +/* Q = DIVIDEND / DIVISOR, R = DIVIDEND % DIVISOR,
5.679 + Q or R may be passed as NULL. ROUND should be negative or 0. */
5.680 +void gcry_mpi_div (gcry_mpi_t q, gcry_mpi_t r,
5.681 + gcry_mpi_t dividend, gcry_mpi_t divisor, int round);
5.682 +
5.683 +/* R = DIVIDEND % DIVISOR */
5.684 +void gcry_mpi_mod (gcry_mpi_t r, gcry_mpi_t dividend, gcry_mpi_t divisor);
5.685 +
5.686 +/* W = B ^ E mod M. */
5.687 +void gcry_mpi_powm (gcry_mpi_t w,
5.688 + const gcry_mpi_t b, const gcry_mpi_t e,
5.689 + const gcry_mpi_t m);
5.690 +
5.691 +/* Set G to the greatest common divisor of A and B.
5.692 + Return true if the G is 1. */
5.693 +int gcry_mpi_gcd (gcry_mpi_t g, gcry_mpi_t a, gcry_mpi_t b);
5.694 +
5.695 +/* Set X to the multiplicative inverse of A mod M.
5.696 + Return true if the value exists. */
5.697 +int gcry_mpi_invm (gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t m);
5.698 +
5.699 +
5.700 +/* Return the number of bits required to represent A. */
5.701 +unsigned int gcry_mpi_get_nbits (gcry_mpi_t a);
5.702 +
5.703 +/* Return true when bit number N (counting from 0) is set in A. */
5.704 +int gcry_mpi_test_bit (gcry_mpi_t a, unsigned int n);
5.705 +
5.706 +/* Set bit number N in A. */
5.707 +void gcry_mpi_set_bit (gcry_mpi_t a, unsigned int n);
5.708 +
5.709 +/* Clear bit number N in A. */
5.710 +void gcry_mpi_clear_bit (gcry_mpi_t a, unsigned int n);
5.711 +
5.712 +/* Set bit number N in A and clear all bits greater than N. */
5.713 +void gcry_mpi_set_highbit (gcry_mpi_t a, unsigned int n);
5.714 +
5.715 +/* Clear bit number N in A and all bits greater than N. */
5.716 +void gcry_mpi_clear_highbit (gcry_mpi_t a, unsigned int n);
5.717 +
5.718 +/* Shift the value of A by N bits to the right and store the result in X. */
5.719 +void gcry_mpi_rshift (gcry_mpi_t x, gcry_mpi_t a, unsigned int n);
5.720 +
5.721 +/* Shift the value of A by N bits to the left and store the result in X. */
5.722 +void gcry_mpi_lshift (gcry_mpi_t x, gcry_mpi_t a, unsigned int n);
5.723 +
5.724 +/* Store NBITS of the value P points to in A and mark A as an opaque
5.725 + value. WARNING: Never use an opaque MPI for anything thing else then
5.726 + gcry_mpi_release, gcry_mpi_get_opaque. */
5.727 +gcry_mpi_t gcry_mpi_set_opaque (gcry_mpi_t a, void *p, unsigned int nbits);
5.728 +
5.729 +/* Return a pointer to an opaque value stored in A and return its size
5.730 + in NBITS. Note that the returned pointer is still owned by A and
5.731 + that the function should never be used for an non-opaque MPI. */
5.732 +void *gcry_mpi_get_opaque (gcry_mpi_t a, unsigned int *nbits);
5.733 +
5.734 +/* Set the FLAG for the big integer A. Currently only the flag
5.735 + GCRYMPI_FLAG_SECURE is allowed to convert A into an big intger
5.736 + stored in "secure" memory. */
5.737 +void gcry_mpi_set_flag (gcry_mpi_t a, enum gcry_mpi_flag flag);
5.738 +
5.739 +/* Clear FLAG for the big integer A. Note that this function is
5.740 + currently useless as no flags are allowed. */
5.741 +void gcry_mpi_clear_flag (gcry_mpi_t a, enum gcry_mpi_flag flag);
5.742 +
5.743 +/* Return true when the FLAG is set for A. */
5.744 +int gcry_mpi_get_flag (gcry_mpi_t a, enum gcry_mpi_flag flag);
5.745 +
5.746 +/* Unless the GCRYPT_NO_MPI_MACROS is used, provide a couple of
5.747 + convenience macros for the big integer functions. */
5.748 +#ifndef GCRYPT_NO_MPI_MACROS
5.749 +#define mpi_new(n) gcry_mpi_new( (n) )
5.750 +#define mpi_secure_new( n ) gcry_mpi_snew( (n) )
5.751 +#define mpi_release(a) \
5.752 + do \
5.753 + { \
5.754 + gcry_mpi_release ((a)); \
5.755 + (a) = NULL; \
5.756 + } \
5.757 + while (0)
5.758 +
5.759 +#define mpi_copy( a ) gcry_mpi_copy( (a) )
5.760 +#define mpi_set( w, u) gcry_mpi_set( (w), (u) )
5.761 +#define mpi_set_ui( w, u) gcry_mpi_set_ui( (w), (u) )
5.762 +#define mpi_cmp( u, v ) gcry_mpi_cmp( (u), (v) )
5.763 +#define mpi_cmp_ui( u, v ) gcry_mpi_cmp_ui( (u), (v) )
5.764 +
5.765 +#define mpi_add_ui(w,u,v) gcry_mpi_add_ui((w),(u),(v))
5.766 +#define mpi_add(w,u,v) gcry_mpi_add ((w),(u),(v))
5.767 +#define mpi_addm(w,u,v,m) gcry_mpi_addm ((w),(u),(v),(m))
5.768 +#define mpi_sub_ui(w,u,v) gcry_mpi_sub_ui ((w),(u),(v))
5.769 +#define mpi_sub(w,u,v) gcry_mpi_sub ((w),(u),(v))
5.770 +#define mpi_subm(w,u,v,m) gcry_mpi_subm ((w),(u),(v),(m))
5.771 +#define mpi_mul_ui(w,u,v) gcry_mpi_mul_ui ((w),(u),(v))
5.772 +#define mpi_mul_2exp(w,u,v) gcry_mpi_mul_2exp ((w),(u),(v))
5.773 +#define mpi_mul(w,u,v) gcry_mpi_mul ((w),(u),(v))
5.774 +#define mpi_mulm(w,u,v,m) gcry_mpi_mulm ((w),(u),(v),(m))
5.775 +#define mpi_powm(w,b,e,m) gcry_mpi_powm ( (w), (b), (e), (m) )
5.776 +#define mpi_tdiv(q,r,a,m) gcry_mpi_div ( (q), (r), (a), (m), 0)
5.777 +#define mpi_fdiv(q,r,a,m) gcry_mpi_div ( (q), (r), (a), (m), -1)
5.778 +#define mpi_mod(r,a,m) gcry_mpi_mod ((r), (a), (m))
5.779 +#define mpi_gcd(g,a,b) gcry_mpi_gcd ( (g), (a), (b) )
5.780 +#define mpi_invm(g,a,b) gcry_mpi_invm ( (g), (a), (b) )
5.781 +
5.782 +#define mpi_get_nbits(a) gcry_mpi_get_nbits ((a))
5.783 +#define mpi_test_bit(a,b) gcry_mpi_test_bit ((a),(b))
5.784 +#define mpi_set_bit(a,b) gcry_mpi_set_bit ((a),(b))
5.785 +#define mpi_set_highbit(a,b) gcry_mpi_set_highbit ((a),(b))
5.786 +#define mpi_clear_bit(a,b) gcry_mpi_clear_bit ((a),(b))
5.787 +#define mpi_clear_highbit(a,b) gcry_mpi_clear_highbit ((a),(b))
5.788 +#define mpi_rshift(a,b,c) gcry_mpi_rshift ((a),(b),(c))
5.789 +#define mpi_lshift(a,b,c) gcry_mpi_lshift ((a),(b),(c))
5.790 +
5.791 +#define mpi_set_opaque(a,b,c) gcry_mpi_set_opaque( (a), (b), (c) )
5.792 +#define mpi_get_opaque(a,b) gcry_mpi_get_opaque( (a), (b) )
5.793 +#endif /* GCRYPT_NO_MPI_MACROS */
5.794 +
5.795 +
5.796 +
5.797 +/************************************
5.798 + * *
5.799 + * Symmetric Cipher Functions *
5.800 + * *
5.801 + ************************************/
5.802 +
5.803 +/* The data object used to hold a handle to an encryption object. */
5.804 +struct gcry_cipher_handle;
5.805 +typedef struct gcry_cipher_handle *gcry_cipher_hd_t;
5.806 +
5.807 +#ifndef GCRYPT_NO_DEPRECATED
5.808 +typedef struct gcry_cipher_handle *GCRY_CIPHER_HD _GCRY_GCC_ATTR_DEPRECATED;
5.809 +typedef struct gcry_cipher_handle *GcryCipherHd _GCRY_GCC_ATTR_DEPRECATED;
5.810 +#endif
5.811 +
5.812 +/* All symmetric encryption algorithms are identified by their IDs.
5.813 + More IDs may be registered at runtime. */
5.814 +enum gcry_cipher_algos
5.815 + {
5.816 + GCRY_CIPHER_NONE = 0,
5.817 + GCRY_CIPHER_IDEA = 1,
5.818 + GCRY_CIPHER_3DES = 2,
5.819 + GCRY_CIPHER_CAST5 = 3,
5.820 + GCRY_CIPHER_BLOWFISH = 4,
5.821 + GCRY_CIPHER_SAFER_SK128 = 5,
5.822 + GCRY_CIPHER_DES_SK = 6,
5.823 + GCRY_CIPHER_AES = 7,
5.824 + GCRY_CIPHER_AES192 = 8,
5.825 + GCRY_CIPHER_AES256 = 9,
5.826 + GCRY_CIPHER_TWOFISH = 10,
5.827 +
5.828 + /* Other cipher numbers are above 300 for OpenPGP reasons. */
5.829 + GCRY_CIPHER_ARCFOUR = 301, /* Fully compatible with RSA's RC4 (tm). */
5.830 + GCRY_CIPHER_DES = 302, /* Yes, this is single key 56 bit DES. */
5.831 + GCRY_CIPHER_TWOFISH128 = 303,
5.832 + GCRY_CIPHER_SERPENT128 = 304,
5.833 + GCRY_CIPHER_SERPENT192 = 305,
5.834 + GCRY_CIPHER_SERPENT256 = 306,
5.835 + GCRY_CIPHER_RFC2268_40 = 307, /* Ron's Cipher 2 (40 bit). */
5.836 + GCRY_CIPHER_RFC2268_128 = 308, /* Ron's Cipher 2 (128 bit). */
5.837 + GCRY_CIPHER_SEED = 309, /* 128 bit cipher described in RFC4269. */
5.838 + GCRY_CIPHER_CAMELLIA128 = 310,
5.839 + GCRY_CIPHER_CAMELLIA192 = 311,
5.840 + GCRY_CIPHER_CAMELLIA256 = 312
5.841 + };
5.842 +
5.843 +/* The Rijndael algorithm is basically AES, so provide some macros. */
5.844 +#define GCRY_CIPHER_AES128 GCRY_CIPHER_AES
5.845 +#define GCRY_CIPHER_RIJNDAEL GCRY_CIPHER_AES
5.846 +#define GCRY_CIPHER_RIJNDAEL128 GCRY_CIPHER_AES128
5.847 +#define GCRY_CIPHER_RIJNDAEL192 GCRY_CIPHER_AES192
5.848 +#define GCRY_CIPHER_RIJNDAEL256 GCRY_CIPHER_AES256
5.849 +
5.850 +/* The supported encryption modes. Note that not all of them are
5.851 + supported for each algorithm. */
5.852 +enum gcry_cipher_modes
5.853 + {
5.854 + GCRY_CIPHER_MODE_NONE = 0, /* Not yet specified. */
5.855 + GCRY_CIPHER_MODE_ECB = 1, /* Electronic codebook. */
5.856 + GCRY_CIPHER_MODE_CFB = 2, /* Cipher feedback. */
5.857 + GCRY_CIPHER_MODE_CBC = 3, /* Cipher block chaining. */
5.858 + GCRY_CIPHER_MODE_STREAM = 4, /* Used with stream ciphers. */
5.859 + GCRY_CIPHER_MODE_OFB = 5, /* Outer feedback. */
5.860 + GCRY_CIPHER_MODE_CTR = 6, /* Counter. */
5.861 + GCRY_CIPHER_MODE_AESWRAP= 7 /* AES-WRAP algorithm. */
5.862 + };
5.863 +
5.864 +/* Flags used with the open function. */
5.865 +enum gcry_cipher_flags
5.866 + {
5.867 + GCRY_CIPHER_SECURE = 1, /* Allocate in secure memory. */
5.868 + GCRY_CIPHER_ENABLE_SYNC = 2, /* Enable CFB sync mode. */
5.869 + GCRY_CIPHER_CBC_CTS = 4, /* Enable CBC cipher text stealing (CTS). */
5.870 + GCRY_CIPHER_CBC_MAC = 8 /* Enable CBC message auth. code (MAC). */
5.871 + };
5.872 +
5.873 +
5.874 +/* Create a handle for algorithm ALGO to be used in MODE. FLAGS may
5.875 + be given as an bitwise OR of the gcry_cipher_flags values. */
5.876 +gcry_error_t gcry_cipher_open (gcry_cipher_hd_t *handle,
5.877 + int algo, int mode, unsigned int flags);
5.878 +
5.879 +/* Close the cioher handle H and release all resource. */
5.880 +void gcry_cipher_close (gcry_cipher_hd_t h);
5.881 +
5.882 +/* Perform various operations on the cipher object H. */
5.883 +gcry_error_t gcry_cipher_ctl (gcry_cipher_hd_t h, int cmd, void *buffer,
5.884 + size_t buflen);
5.885 +
5.886 +/* Retrieve various information about the cipher object H. */
5.887 +gcry_error_t gcry_cipher_info (gcry_cipher_hd_t h, int what, void *buffer,
5.888 + size_t *nbytes);
5.889 +
5.890 +/* Retrieve various information about the cipher algorithm ALGO. */
5.891 +gcry_error_t gcry_cipher_algo_info (int algo, int what, void *buffer,
5.892 + size_t *nbytes);
5.893 +
5.894 +/* Map the cipher algorithm whose ID is contained in ALGORITHM to a
5.895 + string representation of the algorithm name. For unknown algorithm
5.896 + IDs this function returns "?". */
5.897 +const char *gcry_cipher_algo_name (int algorithm) _GCRY_GCC_ATTR_PURE;
5.898 +
5.899 +/* Map the algorithm name NAME to an cipher algorithm ID. Return 0 if
5.900 + the algorithm name is not known. */
5.901 +int gcry_cipher_map_name (const char *name) _GCRY_GCC_ATTR_PURE;
5.902 +
5.903 +/* Given an ASN.1 object identifier in standard IETF dotted decimal
5.904 + format in STRING, return the encryption mode associated with that
5.905 + OID or 0 if not known or applicable. */
5.906 +int gcry_cipher_mode_from_oid (const char *string) _GCRY_GCC_ATTR_PURE;
5.907 +
5.908 +/* Encrypt the plaintext of size INLEN in IN using the cipher handle H
5.909 + into the buffer OUT which has an allocated length of OUTSIZE. For
5.910 + most algorithms it is possible to pass NULL for in and 0 for INLEN
5.911 + and do a in-place decryption of the data provided in OUT. */
5.912 +gcry_error_t gcry_cipher_encrypt (gcry_cipher_hd_t h,
5.913 + void *out, size_t outsize,
5.914 + const void *in, size_t inlen);
5.915 +
5.916 +/* The counterpart to gcry_cipher_encrypt. */
5.917 +gcry_error_t gcry_cipher_decrypt (gcry_cipher_hd_t h,
5.918 + void *out, size_t outsize,
5.919 + const void *in, size_t inlen);
5.920 +
5.921 +/* Set KEY of length KEYLEN bytes for the cipher handle HD. */
5.922 +gcry_error_t gcry_cipher_setkey (gcry_cipher_hd_t hd,
5.923 + const void *key, size_t keylen);
5.924 +
5.925 +
5.926 +/* Set initialization vector IV of length IVLEN for the cipher handle HD. */
5.927 +gcry_error_t gcry_cipher_setiv (gcry_cipher_hd_t hd,
5.928 + const void *iv, size_t ivlen);
5.929 +
5.930 +
5.931 +/* Reset the handle to the state after open. */
5.932 +#define gcry_cipher_reset(h) gcry_cipher_ctl ((h), GCRYCTL_RESET, NULL, 0)
5.933 +
5.934 +/* Perform the OpenPGP sync operation if this is enabled for the
5.935 + cipher handle H. */
5.936 +#define gcry_cipher_sync(h) gcry_cipher_ctl( (h), GCRYCTL_CFB_SYNC, NULL, 0)
5.937 +
5.938 +/* Enable or disable CTS in future calls to gcry_encrypt(). CBC mode only. */
5.939 +#define gcry_cipher_cts(h,on) gcry_cipher_ctl( (h), GCRYCTL_SET_CBC_CTS, \
5.940 + NULL, on )
5.941 +
5.942 +/* Set counter for CTR mode. (CTR,CTRLEN) must denote a buffer of
5.943 + block size length, or (NULL,0) to set the CTR to the all-zero block. */
5.944 +gpg_error_t gcry_cipher_setctr (gcry_cipher_hd_t hd,
5.945 + const void *ctr, size_t ctrlen);
5.946 +
5.947 +/* Retrieved the key length in bytes used with algorithm A. */
5.948 +size_t gcry_cipher_get_algo_keylen (int algo);
5.949 +
5.950 +/* Retrieve the block length in bytes used with algorithm A. */
5.951 +size_t gcry_cipher_get_algo_blklen (int algo);
5.952 +
5.953 +/* Return 0 if the algorithm A is available for use. */
5.954 +#define gcry_cipher_test_algo(a) \
5.955 + gcry_cipher_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL )
5.956 +
5.957 +/* Get a list consisting of the IDs of the loaded cipher modules. If
5.958 + LIST is zero, write the number of loaded cipher modules to
5.959 + LIST_LENGTH and return. If LIST is non-zero, the first
5.960 + *LIST_LENGTH algorithm IDs are stored in LIST, which must be of
5.961 + according size. In case there are less cipher modules than
5.962 + *LIST_LENGTH, *LIST_LENGTH is updated to the correct number. */
5.963 +gcry_error_t gcry_cipher_list (int *list, int *list_length);
5.964 +
5.965 +
5.966 +/************************************
5.967 + * *
5.968 + * Asymmetric Cipher Functions *
5.969 + * *
5.970 + ************************************/
5.971 +
5.972 +/* The algorithms and their IDs we support. */
5.973 +enum gcry_pk_algos
5.974 + {
5.975 + GCRY_PK_RSA = 1,
5.976 + GCRY_PK_RSA_E = 2, /* (deprecated) */
5.977 + GCRY_PK_RSA_S = 3, /* (deprecated) */
5.978 + GCRY_PK_ELG_E = 16,
5.979 + GCRY_PK_DSA = 17,
5.980 + GCRY_PK_ELG = 20,
5.981 + GCRY_PK_ECDSA = 301,
5.982 + GCRY_PK_ECDH = 302
5.983 + };
5.984 +
5.985 +/* Flags describing usage capabilities of a PK algorithm. */
5.986 +#define GCRY_PK_USAGE_SIGN 1 /* Good for signatures. */
5.987 +#define GCRY_PK_USAGE_ENCR 2 /* Good for encryption. */
5.988 +#define GCRY_PK_USAGE_CERT 4 /* Good to certify other keys. */
5.989 +#define GCRY_PK_USAGE_AUTH 8 /* Good for authentication. */
5.990 +#define GCRY_PK_USAGE_UNKN 128 /* Unknown usage flag. */
5.991 +
5.992 +/* Encrypt the DATA using the public key PKEY and store the result as
5.993 + a newly created S-expression at RESULT. */
5.994 +gcry_error_t gcry_pk_encrypt (gcry_sexp_t *result,
5.995 + gcry_sexp_t data, gcry_sexp_t pkey);
5.996 +
5.997 +/* Decrypt the DATA using the private key SKEY and store the result as
5.998 + a newly created S-expression at RESULT. */
5.999 +gcry_error_t gcry_pk_decrypt (gcry_sexp_t *result,
5.1000 + gcry_sexp_t data, gcry_sexp_t skey);
5.1001 +
5.1002 +/* Sign the DATA using the private key SKEY and store the result as
5.1003 + a newly created S-expression at RESULT. */
5.1004 +gcry_error_t gcry_pk_sign (gcry_sexp_t *result,
5.1005 + gcry_sexp_t data, gcry_sexp_t skey);
5.1006 +
5.1007 +/* Check the signature SIGVAL on DATA using the public key PKEY. */
5.1008 +gcry_error_t gcry_pk_verify (gcry_sexp_t sigval,
5.1009 + gcry_sexp_t data, gcry_sexp_t pkey);
5.1010 +
5.1011 +/* Check that private KEY is sane. */
5.1012 +gcry_error_t gcry_pk_testkey (gcry_sexp_t key);
5.1013 +
5.1014 +/* Generate a new key pair according to the parameters given in
5.1015 + S_PARMS. The new key pair is returned in as an S-expression in
5.1016 + R_KEY. */
5.1017 +gcry_error_t gcry_pk_genkey (gcry_sexp_t *r_key, gcry_sexp_t s_parms);
5.1018 +
5.1019 +/* Catch all function for miscellaneous operations. */
5.1020 +gcry_error_t gcry_pk_ctl (int cmd, void *buffer, size_t buflen);
5.1021 +
5.1022 +/* Retrieve information about the public key algorithm ALGO. */
5.1023 +gcry_error_t gcry_pk_algo_info (int algo, int what,
5.1024 + void *buffer, size_t *nbytes);
5.1025 +
5.1026 +/* Map the public key algorithm whose ID is contained in ALGORITHM to
5.1027 + a string representation of the algorithm name. For unknown
5.1028 + algorithm IDs this functions returns "?". */
5.1029 +const char *gcry_pk_algo_name (int algorithm) _GCRY_GCC_ATTR_PURE;
5.1030 +
5.1031 +/* Map the algorithm NAME to a public key algorithm Id. Return 0 if
5.1032 + the algorithm name is not known. */
5.1033 +int gcry_pk_map_name (const char* name) _GCRY_GCC_ATTR_PURE;
5.1034 +
5.1035 +/* Return what is commonly referred as the key length for the given
5.1036 + public or private KEY. */
5.1037 +unsigned int gcry_pk_get_nbits (gcry_sexp_t key) _GCRY_GCC_ATTR_PURE;
5.1038 +
5.1039 +/* Please note that keygrip is still experimental and should not be
5.1040 + used without contacting the author. */
5.1041 +unsigned char *gcry_pk_get_keygrip (gcry_sexp_t key, unsigned char *array);
5.1042 +
5.1043 +/* Return the name of the curve matching KEY. */
5.1044 +const char *gcry_pk_get_curve (gcry_sexp_t key, int iterator,
5.1045 + unsigned int *r_nbits);
5.1046 +
5.1047 +/* Return an S-expression with the parameters of the named ECC curve
5.1048 + NAME. ALGO must be set to an ECC algorithm. */
5.1049 +gcry_sexp_t gcry_pk_get_param (int algo, const char *name);
5.1050 +
5.1051 +/* Return 0 if the public key algorithm A is available for use. */
5.1052 +#define gcry_pk_test_algo(a) \
5.1053 + gcry_pk_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL )
5.1054 +
5.1055 +/* Get a list consisting of the IDs of the loaded pubkey modules. If
5.1056 + LIST is zero, write the number of loaded pubkey modules to
5.1057 + LIST_LENGTH and return. If LIST is non-zero, the first
5.1058 + *LIST_LENGTH algorithm IDs are stored in LIST, which must be of
5.1059 + according size. In case there are less pubkey modules than
5.1060 + *LIST_LENGTH, *LIST_LENGTH is updated to the correct number. */
5.1061 +gcry_error_t gcry_pk_list (int *list, int *list_length);
5.1062 +
5.1063 +
5.1064 +
5.1065 +/************************************
5.1066 + * *
5.1067 + * Cryptograhic Hash Functions *
5.1068 + * *
5.1069 + ************************************/
5.1070 +
5.1071 +/* Algorithm IDs for the hash functions we know about. Not all of them
5.1072 + are implemnted. */
5.1073 +enum gcry_md_algos
5.1074 + {
5.1075 + GCRY_MD_NONE = 0,
5.1076 + GCRY_MD_MD5 = 1,
5.1077 + GCRY_MD_SHA1 = 2,
5.1078 + GCRY_MD_RMD160 = 3,
5.1079 + GCRY_MD_MD2 = 5,
5.1080 + GCRY_MD_TIGER = 6, /* TIGER/192 as used by gpg <= 1.3.2. */
5.1081 + GCRY_MD_HAVAL = 7, /* HAVAL, 5 pass, 160 bit. */
5.1082 + GCRY_MD_SHA256 = 8,
5.1083 + GCRY_MD_SHA384 = 9,
5.1084 + GCRY_MD_SHA512 = 10,
5.1085 + GCRY_MD_SHA224 = 11,
5.1086 + GCRY_MD_MD4 = 301,
5.1087 + GCRY_MD_CRC32 = 302,
5.1088 + GCRY_MD_CRC32_RFC1510 = 303,
5.1089 + GCRY_MD_CRC24_RFC2440 = 304,
5.1090 + GCRY_MD_WHIRLPOOL = 305,
5.1091 + GCRY_MD_TIGER1 = 306, /* TIGER fixed. */
5.1092 + GCRY_MD_TIGER2 = 307 /* TIGER2 variant. */
5.1093 + };
5.1094 +
5.1095 +/* Flags used with the open function. */
5.1096 +enum gcry_md_flags
5.1097 + {
5.1098 + GCRY_MD_FLAG_SECURE = 1, /* Allocate all buffers in "secure" memory. */
5.1099 + GCRY_MD_FLAG_HMAC = 2 /* Make an HMAC out of this algorithm. */
5.1100 + };
5.1101 +
5.1102 +/* (Forward declaration.) */
5.1103 +struct gcry_md_context;
5.1104 +
5.1105 +/* This object is used to hold a handle to a message digest object.
5.1106 + This structure is private - only to be used by the public gcry_md_*
5.1107 + macros. */
5.1108 +typedef struct gcry_md_handle
5.1109 +{
5.1110 + /* Actual context. */
5.1111 + struct gcry_md_context *ctx;
5.1112 +
5.1113 + /* Buffer management. */
5.1114 + int bufpos;
5.1115 + int bufsize;
5.1116 + unsigned char buf[1];
5.1117 +} *gcry_md_hd_t;
5.1118 +
5.1119 +/* Compatibility types, do not use them. */
5.1120 +#ifndef GCRYPT_NO_DEPRECATED
5.1121 +typedef struct gcry_md_handle *GCRY_MD_HD _GCRY_GCC_ATTR_DEPRECATED;
5.1122 +typedef struct gcry_md_handle *GcryMDHd _GCRY_GCC_ATTR_DEPRECATED;
5.1123 +#endif
5.1124 +
5.1125 +/* Create a message digest object for algorithm ALGO. FLAGS may be
5.1126 + given as an bitwise OR of the gcry_md_flags values. ALGO may be
5.1127 + given as 0 if the algorithms to be used are later set using
5.1128 + gcry_md_enable. */
5.1129 +gcry_error_t gcry_md_open (gcry_md_hd_t *h, int algo, unsigned int flags);
5.1130 +
5.1131 +/* Release the message digest object HD. */
5.1132 +void gcry_md_close (gcry_md_hd_t hd);
5.1133 +
5.1134 +/* Add the message digest algorithm ALGO to the digest object HD. */
5.1135 +gcry_error_t gcry_md_enable (gcry_md_hd_t hd, int algo);
5.1136 +
5.1137 +/* Create a new digest object as an exact copy of the object HD. */
5.1138 +gcry_error_t gcry_md_copy (gcry_md_hd_t *bhd, gcry_md_hd_t ahd);
5.1139 +
5.1140 +/* Reset the digest object HD to its initial state. */
5.1141 +void gcry_md_reset (gcry_md_hd_t hd);
5.1142 +
5.1143 +/* Perform various operations on the digest object HD. */
5.1144 +gcry_error_t gcry_md_ctl (gcry_md_hd_t hd, int cmd,
5.1145 + void *buffer, size_t buflen);
5.1146 +
5.1147 +/* Pass LENGTH bytes of data in BUFFER to the digest object HD so that
5.1148 + it can update the digest values. This is the actual hash
5.1149 + function. */
5.1150 +void gcry_md_write (gcry_md_hd_t hd, const void *buffer, size_t length);
5.1151 +
5.1152 +/* Read out the final digest from HD return the digest value for
5.1153 + algorithm ALGO. */
5.1154 +unsigned char *gcry_md_read (gcry_md_hd_t hd, int algo);
5.1155 +
5.1156 +/* Convenience function to calculate the hash from the data in BUFFER
5.1157 + of size LENGTH using the algorithm ALGO avoiding the creating of a
5.1158 + hash object. The hash is returned in the caller provided buffer
5.1159 + DIGEST which must be large enough to hold the digest of the given
5.1160 + algorithm. */
5.1161 +void gcry_md_hash_buffer (int algo, void *digest,
5.1162 + const void *buffer, size_t length);
5.1163 +
5.1164 +/* Retrieve the algorithm used with HD. This does not work reliable
5.1165 + if more than one algorithm is enabled in HD. */
5.1166 +int gcry_md_get_algo (gcry_md_hd_t hd);
5.1167 +
5.1168 +/* Retrieve the length in bytes of the digest yielded by algorithm
5.1169 + ALGO. */
5.1170 +unsigned int gcry_md_get_algo_dlen (int algo);
5.1171 +
5.1172 +/* Return true if the the algorithm ALGO is enabled in the digest
5.1173 + object A. */
5.1174 +int gcry_md_is_enabled (gcry_md_hd_t a, int algo);
5.1175 +
5.1176 +/* Return true if the digest object A is allocated in "secure" memory. */
5.1177 +int gcry_md_is_secure (gcry_md_hd_t a);
5.1178 +
5.1179 +/* Retrieve various information about the object H. */
5.1180 +gcry_error_t gcry_md_info (gcry_md_hd_t h, int what, void *buffer,
5.1181 + size_t *nbytes);
5.1182 +
5.1183 +/* Retrieve various information about the algorithm ALGO. */
5.1184 +gcry_error_t gcry_md_algo_info (int algo, int what, void *buffer,
5.1185 + size_t *nbytes);
5.1186 +
5.1187 +/* Map the digest algorithm id ALGO to a string representation of the
5.1188 + algorithm name. For unknown algorithms this function returns
5.1189 + "?". */
5.1190 +const char *gcry_md_algo_name (int algo) _GCRY_GCC_ATTR_PURE;
5.1191 +
5.1192 +/* Map the algorithm NAME to a digest algorithm Id. Return 0 if
5.1193 + the algorithm name is not known. */
5.1194 +int gcry_md_map_name (const char* name) _GCRY_GCC_ATTR_PURE;
5.1195 +
5.1196 +/* For use with the HMAC feature, the set MAC key to the KEY of
5.1197 + KEYLEN bytes. */
5.1198 +gcry_error_t gcry_md_setkey (gcry_md_hd_t hd, const void *key, size_t keylen);
5.1199 +
5.1200 +/* Start or stop debugging for digest handle HD; i.e. create a file
5.1201 + named dbgmd-<n>.<suffix> while hashing. If SUFFIX is NULL,
5.1202 + debugging stops and the file will be closed. */
5.1203 +void gcry_md_debug (gcry_md_hd_t hd, const char *suffix);
5.1204 +
5.1205 +
5.1206 +/* Update the hash(s) of H with the character C. This is a buffered
5.1207 + version of the gcry_md_write function. */
5.1208 +#define gcry_md_putc(h,c) \
5.1209 + do { \
5.1210 + gcry_md_hd_t h__ = (h); \
5.1211 + if( (h__)->bufpos == (h__)->bufsize ) \
5.1212 + gcry_md_write( (h__), NULL, 0 ); \
5.1213 + (h__)->buf[(h__)->bufpos++] = (c) & 0xff; \
5.1214 + } while(0)
5.1215 +
5.1216 +/* Finalize the digest calculation. This is not really needed because
5.1217 + gcry_md_read() does this implicitly. */
5.1218 +#define gcry_md_final(a) \
5.1219 + gcry_md_ctl ((a), GCRYCTL_FINALIZE, NULL, 0)
5.1220 +
5.1221 +/* Return 0 if the algorithm A is available for use. */
5.1222 +#define gcry_md_test_algo(a) \
5.1223 + gcry_md_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL )
5.1224 +
5.1225 +/* Return an DER encoded ASN.1 OID for the algorithm A in buffer B. N
5.1226 + must point to size_t variable with the available size of buffer B.
5.1227 + After return it will receive the actual size of the returned
5.1228 + OID. */
5.1229 +#define gcry_md_get_asnoid(a,b,n) \
5.1230 + gcry_md_algo_info((a), GCRYCTL_GET_ASNOID, (b), (n))
5.1231 +
5.1232 +/* Enable debugging for digest object A; i.e. create files named
5.1233 + dbgmd-<n>.<string> while hashing. B is a string used as the suffix
5.1234 + for the filename. This macro is deprecated, use gcry_md_debug. */
5.1235 +#ifndef GCRYPT_NO_DEPRECATED
5.1236 +#define gcry_md_start_debug(a,b) \
5.1237 + gcry_md_ctl( (a), GCRYCTL_START_DUMP, (b), 0 )
5.1238 +
5.1239 +/* Disable the debugging of A. This macro is deprecated, use
5.1240 + gcry_md_debug. */
5.1241 +#define gcry_md_stop_debug(a,b) \
5.1242 + gcry_md_ctl( (a), GCRYCTL_STOP_DUMP, (b), 0 )
5.1243 +#endif
5.1244 +
5.1245 +/* Get a list consisting of the IDs of the loaded message digest
5.1246 + modules. If LIST is zero, write the number of loaded message
5.1247 + digest modules to LIST_LENGTH and return. If LIST is non-zero, the
5.1248 + first *LIST_LENGTH algorithm IDs are stored in LIST, which must be
5.1249 + of according size. In case there are less message digest modules
5.1250 + than *LIST_LENGTH, *LIST_LENGTH is updated to the correct
5.1251 + number. */
5.1252 +gcry_error_t gcry_md_list (int *list, int *list_length);
5.1253 +
5.1254 +
5.1255 +/* Alternative interface for asymmetric cryptography. This interface
5.1256 + is deprecated. */
5.1257 +
5.1258 +/* The algorithm IDs. */
5.1259 +typedef enum gcry_ac_id
5.1260 + {
5.1261 + GCRY_AC_RSA = 1,
5.1262 + GCRY_AC_DSA = 17,
5.1263 + GCRY_AC_ELG = 20,
5.1264 + GCRY_AC_ELG_E = 16
5.1265 + }
5.1266 +gcry_ac_id_t _GCRY_ATTR_INTERNAL;
5.1267 +
5.1268 +/* Key types. */
5.1269 +typedef enum gcry_ac_key_type
5.1270 + {
5.1271 + GCRY_AC_KEY_SECRET,
5.1272 + GCRY_AC_KEY_PUBLIC
5.1273 + }
5.1274 +gcry_ac_key_type_t _GCRY_ATTR_INTERNAL;
5.1275 +
5.1276 +/* Encoding methods. */
5.1277 +typedef enum gcry_ac_em
5.1278 + {
5.1279 + GCRY_AC_EME_PKCS_V1_5,
5.1280 + GCRY_AC_EMSA_PKCS_V1_5
5.1281 + }
5.1282 +gcry_ac_em_t _GCRY_ATTR_INTERNAL;
5.1283 +
5.1284 +/* Encryption and Signature schemes. */
5.1285 +typedef enum gcry_ac_scheme
5.1286 + {
5.1287 + GCRY_AC_ES_PKCS_V1_5,
5.1288 + GCRY_AC_SSA_PKCS_V1_5
5.1289 + }
5.1290 +gcry_ac_scheme_t _GCRY_ATTR_INTERNAL;
5.1291 +
5.1292 +/* AC data. */
5.1293 +#define GCRY_AC_FLAG_DEALLOC (1 << 0)
5.1294 +#define GCRY_AC_FLAG_COPY (1 << 1)
5.1295 +#define GCRY_AC_FLAG_NO_BLINDING (1 << 2)
5.1296 +
5.1297 +/* This type represents a `data set'. */
5.1298 +typedef struct gcry_ac_data *gcry_ac_data_t _GCRY_ATTR_INTERNAL;
5.1299 +
5.1300 +/* This type represents a single `key', either a secret one or a
5.1301 + public one. */
5.1302 +typedef struct gcry_ac_key *gcry_ac_key_t _GCRY_ATTR_INTERNAL;
5.1303 +
5.1304 +/* This type represents a `key pair' containing a secret and a public
5.1305 + key. */
5.1306 +typedef struct gcry_ac_key_pair *gcry_ac_key_pair_t _GCRY_ATTR_INTERNAL;
5.1307 +
5.1308 +/* This type represents a `handle' that is needed by functions
5.1309 + performing cryptographic operations. */
5.1310 +typedef struct gcry_ac_handle *gcry_ac_handle_t _GCRY_ATTR_INTERNAL;
5.1311 +
5.1312 +typedef gpg_error_t (*gcry_ac_data_read_cb_t) (void *opaque,
5.1313 + unsigned char *buffer,
5.1314 + size_t *buffer_n)
5.1315 + /* */ _GCRY_ATTR_INTERNAL;
5.1316 +
5.1317 +typedef gpg_error_t (*gcry_ac_data_write_cb_t) (void *opaque,
5.1318 + unsigned char *buffer,
5.1319 + size_t buffer_n)
5.1320 + /* */ _GCRY_ATTR_INTERNAL;
5.1321 +
5.1322 +typedef enum
5.1323 + {
5.1324 + GCRY_AC_IO_READABLE,
5.1325 + GCRY_AC_IO_WRITABLE
5.1326 + }
5.1327 +gcry_ac_io_mode_t _GCRY_ATTR_INTERNAL;
5.1328 +
5.1329 +typedef enum
5.1330 + {
5.1331 + GCRY_AC_IO_STRING,
5.1332 + GCRY_AC_IO_CALLBACK
5.1333 + }
5.1334 +gcry_ac_io_type_t _GCRY_ATTR_INTERNAL;
5.1335 +
5.1336 +typedef struct gcry_ac_io
5.1337 +{
5.1338 + /* This is an INTERNAL structure, do NOT use manually. */
5.1339 + gcry_ac_io_mode_t mode _GCRY_ATTR_INTERNAL;
5.1340 + gcry_ac_io_type_t type _GCRY_ATTR_INTERNAL;
5.1341 + union
5.1342 + {
5.1343 + union
5.1344 + {
5.1345 + struct
5.1346 + {
5.1347 + gcry_ac_data_read_cb_t cb;
5.1348 + void *opaque;
5.1349 + } callback;
5.1350 + struct
5.1351 + {
5.1352 + unsigned char *data;
5.1353 + size_t data_n;
5.1354 + } string;
5.1355 + void *opaque;
5.1356 + } readable;
5.1357 + union
5.1358 + {
5.1359 + struct
5.1360 + {
5.1361 + gcry_ac_data_write_cb_t cb;
5.1362 + void *opaque;
5.1363 + } callback;
5.1364 + struct
5.1365 + {
5.1366 + unsigned char **data;
5.1367 + size_t *data_n;
5.1368 + } string;
5.1369 + void *opaque;
5.1370 + } writable;
5.1371 + } io _GCRY_ATTR_INTERNAL;
5.1372 +}
5.1373 +gcry_ac_io_t _GCRY_ATTR_INTERNAL;
5.1374 +
5.1375 +/* The caller of gcry_ac_key_pair_generate can provide one of these
5.1376 + structures in order to influence the key generation process in an
5.1377 + algorithm-specific way. */
5.1378 +typedef struct gcry_ac_key_spec_rsa
5.1379 +{
5.1380 + gcry_mpi_t e; /* E to use. */
5.1381 +} gcry_ac_key_spec_rsa_t _GCRY_ATTR_INTERNAL;
5.1382 +
5.1383 +/* Structure used for passing data to the implementation of the
5.1384 + `EME-PKCS-V1_5' encoding method. */
5.1385 +typedef struct gcry_ac_eme_pkcs_v1_5
5.1386 +{
5.1387 + size_t key_size;
5.1388 +} gcry_ac_eme_pkcs_v1_5_t _GCRY_ATTR_INTERNAL;
5.1389 +
5.1390 +typedef enum gcry_md_algos gcry_md_algo_t _GCRY_ATTR_INTERNAL;
5.1391 +
5.1392 +/* Structure used for passing data to the implementation of the
5.1393 + `EMSA-PKCS-V1_5' encoding method. */
5.1394 +typedef struct gcry_ac_emsa_pkcs_v1_5
5.1395 +{
5.1396 + gcry_md_algo_t md;
5.1397 + size_t em_n;
5.1398 +} gcry_ac_emsa_pkcs_v1_5_t _GCRY_ATTR_INTERNAL;
5.1399 +
5.1400 +/* Structure used for passing data to the implementation of the
5.1401 + `SSA-PKCS-V1_5' signature scheme. */
5.1402 +typedef struct gcry_ac_ssa_pkcs_v1_5
5.1403 +{
5.1404 + gcry_md_algo_t md;
5.1405 +} gcry_ac_ssa_pkcs_v1_5_t _GCRY_ATTR_INTERNAL;
5.1406 +
5.1407 +
5.1408 +#ifndef GCRYPT_NO_DEPRECATED
5.1409 +/* Returns a new, empty data set in DATA. */
5.1410 +gcry_error_t gcry_ac_data_new (gcry_ac_data_t *data)
5.1411 + /* */ _GCRY_ATTR_INTERNAL;
5.1412 +
5.1413 +/* Destroy the data set DATA. */
5.1414 +void gcry_ac_data_destroy (gcry_ac_data_t data)
5.1415 + /* */ _GCRY_ATTR_INTERNAL;
5.1416 +
5.1417 +/* Create a copy of the data set DATA and store it in DATA_CP. */
5.1418 +gcry_error_t gcry_ac_data_copy (gcry_ac_data_t *data_cp,
5.1419 + gcry_ac_data_t data)
5.1420 + /* */ _GCRY_ATTR_INTERNAL;
5.1421 +
5.1422 +/* Return the number of named MPI values inside of the data set
5.1423 + DATA. */
5.1424 +unsigned int gcry_ac_data_length (gcry_ac_data_t data)
5.1425 + /* */ _GCRY_ATTR_INTERNAL;
5.1426 +
5.1427 +/* Destroy any values contained in the data set DATA. */
5.1428 +void gcry_ac_data_clear (gcry_ac_data_t data)
5.1429 + /* */ _GCRY_ATTR_INTERNAL;
5.1430 +
5.1431 +/* Add the value MPI to DATA with the label NAME. If FLAGS contains
5.1432 + GCRY_AC_FLAG_DATA_COPY, the data set will contain copies of NAME
5.1433 + and MPI. If FLAGS contains GCRY_AC_FLAG_DATA_DEALLOC or
5.1434 + GCRY_AC_FLAG_DATA_COPY, the values contained in the data set will
5.1435 + be deallocated when they are to be removed from the data set. */
5.1436 +gcry_error_t gcry_ac_data_set (gcry_ac_data_t data, unsigned int flags,
5.1437 + const char *name, gcry_mpi_t mpi)
5.1438 + /* */ _GCRY_ATTR_INTERNAL;
5.1439 +
5.1440 +/* Store the value labelled with NAME found in DATA in MPI. If FLAGS
5.1441 + contains GCRY_AC_FLAG_COPY, store a copy of the MPI value contained
5.1442 + in the data set. MPI may be NULL. */
5.1443 +gcry_error_t gcry_ac_data_get_name (gcry_ac_data_t data, unsigned int flags,
5.1444 + const char *name, gcry_mpi_t *mpi)
5.1445 + /* */ _GCRY_ATTR_INTERNAL;
5.1446 +
5.1447 +/* Stores in NAME and MPI the named MPI value contained in the data
5.1448 + set DATA with the index IDX. If FLAGS contains GCRY_AC_FLAG_COPY,
5.1449 + store copies of the values contained in the data set. NAME or MPI
5.1450 + may be NULL. */
5.1451 +gcry_error_t gcry_ac_data_get_index (gcry_ac_data_t data, unsigned int flags,
5.1452 + unsigned int idx,
5.1453 + const char **name, gcry_mpi_t *mpi)
5.1454 + /* */ _GCRY_ATTR_INTERNAL;
5.1455 +
5.1456 +/* Convert the data set DATA into a new S-Expression, which is to be
5.1457 + stored in SEXP, according to the identifiers contained in
5.1458 + IDENTIFIERS. */
5.1459 +gcry_error_t gcry_ac_data_to_sexp (gcry_ac_data_t data, gcry_sexp_t *sexp,
5.1460 + const char **identifiers)
5.1461 + /* */ _GCRY_ATTR_INTERNAL;
5.1462 +
5.1463 +/* Create a new data set, which is to be stored in DATA_SET, from the
5.1464 + S-Expression SEXP, according to the identifiers contained in
5.1465 + IDENTIFIERS. */
5.1466 +gcry_error_t gcry_ac_data_from_sexp (gcry_ac_data_t *data, gcry_sexp_t sexp,
5.1467 + const char **identifiers)
5.1468 + /* */ _GCRY_ATTR_INTERNAL;
5.1469 +
5.1470 +/* Initialize AC_IO according to MODE, TYPE and the variable list of
5.1471 + arguments. The list of variable arguments to specify depends on
5.1472 + the given TYPE. */
5.1473 +void gcry_ac_io_init (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode,
5.1474 + gcry_ac_io_type_t type, ...)
5.1475 + /* */ _GCRY_ATTR_INTERNAL;
5.1476 +
5.1477 +/* Initialize AC_IO according to MODE, TYPE and the variable list of
5.1478 + arguments AP. The list of variable arguments to specify depends on
5.1479 + the given TYPE. */
5.1480 +void gcry_ac_io_init_va (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode,
5.1481 + gcry_ac_io_type_t type, va_list ap)
5.1482 + /* */ _GCRY_ATTR_INTERNAL;
5.1483 +
5.1484 +/* Create a new ac handle. */
5.1485 +gcry_error_t gcry_ac_open (gcry_ac_handle_t *handle,
5.1486 + gcry_ac_id_t algorithm, unsigned int flags)
5.1487 + /* */ _GCRY_ATTR_INTERNAL;
5.1488 +
5.1489 +/* Destroy an ac handle. */
5.1490 +void gcry_ac_close (gcry_ac_handle_t handle)
5.1491 + /* */ _GCRY_ATTR_INTERNAL;
5.1492 +
5.1493 +/* Initialize a key from a given data set. */
5.1494 +gcry_error_t gcry_ac_key_init (gcry_ac_key_t *key, gcry_ac_handle_t handle,
5.1495 + gcry_ac_key_type_t type, gcry_ac_data_t data)
5.1496 + /* */ _GCRY_ATTR_INTERNAL;
5.1497 +
5.1498 +/* Generates a new key pair via the handle HANDLE of NBITS bits and
5.1499 + stores it in KEY_PAIR. In case non-standard settings are wanted, a
5.1500 + pointer to a structure of type gcry_ac_key_spec_<algorithm>_t,
5.1501 + matching the selected algorithm, can be given as KEY_SPEC.
5.1502 + MISC_DATA is not used yet. */
5.1503 +gcry_error_t gcry_ac_key_pair_generate (gcry_ac_handle_t handle,
5.1504 + unsigned int nbits, void *spec,
5.1505 + gcry_ac_key_pair_t *key_pair,
5.1506 + gcry_mpi_t **misc_data)
5.1507 + /* */ _GCRY_ATTR_INTERNAL;
5.1508 +
5.1509 +/* Returns the key of type WHICH out of the key pair KEY_PAIR. */
5.1510 +gcry_ac_key_t gcry_ac_key_pair_extract (gcry_ac_key_pair_t key_pair,
5.1511 + gcry_ac_key_type_t which)
5.1512 + /* */ _GCRY_ATTR_INTERNAL;
5.1513 +
5.1514 +/* Returns the data set contained in the key KEY. */
5.1515 +gcry_ac_data_t gcry_ac_key_data_get (gcry_ac_key_t key)
5.1516 + /* */ _GCRY_ATTR_INTERNAL;
5.1517 +
5.1518 +/* Verifies that the key KEY is sane via HANDLE. */
5.1519 +gcry_error_t gcry_ac_key_test (gcry_ac_handle_t handle, gcry_ac_key_t key)
5.1520 + /* */ _GCRY_ATTR_INTERNAL;
5.1521 +
5.1522 +/* Stores the number of bits of the key KEY in NBITS via HANDLE. */
5.1523 +gcry_error_t gcry_ac_key_get_nbits (gcry_ac_handle_t handle,
5.1524 + gcry_ac_key_t key, unsigned int *nbits)
5.1525 + /* */ _GCRY_ATTR_INTERNAL;
5.1526 +
5.1527 +/* Writes the 20 byte long key grip of the key KEY to KEY_GRIP via
5.1528 + HANDLE. */
5.1529 +gcry_error_t gcry_ac_key_get_grip (gcry_ac_handle_t handle, gcry_ac_key_t key,
5.1530 + unsigned char *key_grip)
5.1531 + /* */ _GCRY_ATTR_INTERNAL;
5.1532 +
5.1533 +/* Destroy a key. */
5.1534 +void gcry_ac_key_destroy (gcry_ac_key_t key)
5.1535 + /* */ _GCRY_ATTR_INTERNAL;
5.1536 +
5.1537 +/* Destroy a key pair. */
5.1538 +void gcry_ac_key_pair_destroy (gcry_ac_key_pair_t key_pair)
5.1539 + /* */ _GCRY_ATTR_INTERNAL;
5.1540 +
5.1541 +/* Encodes a message according to the encoding method METHOD. OPTIONS
5.1542 + must be a pointer to a method-specific structure
5.1543 + (gcry_ac_em*_t). */
5.1544 +gcry_error_t gcry_ac_data_encode (gcry_ac_em_t method,
5.1545 + unsigned int flags, void *options,
5.1546 + gcry_ac_io_t *io_read,
5.1547 + gcry_ac_io_t *io_write)
5.1548 + /* */ _GCRY_ATTR_INTERNAL;
5.1549 +
5.1550 +/* Decodes a message according to the encoding method METHOD. OPTIONS
5.1551 + must be a pointer to a method-specific structure
5.1552 + (gcry_ac_em*_t). */
5.1553 +gcry_error_t gcry_ac_data_decode (gcry_ac_em_t method,
5.1554 + unsigned int flags, void *options,
5.1555 + gcry_ac_io_t *io_read,
5.1556 + gcry_ac_io_t *io_write)
5.1557 + /* */ _GCRY_ATTR_INTERNAL;
5.1558 +
5.1559 +/* Encrypt the plain text MPI value DATA_PLAIN with the key KEY under
5.1560 + the control of the flags FLAGS and store the resulting data set
5.1561 + into DATA_ENCRYPTED. */
5.1562 +gcry_error_t gcry_ac_data_encrypt (gcry_ac_handle_t handle,
5.1563 + unsigned int flags,
5.1564 + gcry_ac_key_t key,
5.1565 + gcry_mpi_t data_plain,
5.1566 + gcry_ac_data_t *data_encrypted)
5.1567 + /* */ _GCRY_ATTR_INTERNAL;
5.1568 +
5.1569 +/* Decrypt the decrypted data contained in the data set DATA_ENCRYPTED
5.1570 + with the key KEY under the control of the flags FLAGS and store the
5.1571 + resulting plain text MPI value in DATA_PLAIN. */
5.1572 +gcry_error_t gcry_ac_data_decrypt (gcry_ac_handle_t handle,
5.1573 + unsigned int flags,
5.1574 + gcry_ac_key_t key,
5.1575 + gcry_mpi_t *data_plain,
5.1576 + gcry_ac_data_t data_encrypted)
5.1577 + /* */ _GCRY_ATTR_INTERNAL;
5.1578 +
5.1579 +/* Sign the data contained in DATA with the key KEY and store the
5.1580 + resulting signature in the data set DATA_SIGNATURE. */
5.1581 +gcry_error_t gcry_ac_data_sign (gcry_ac_handle_t handle,
5.1582 + gcry_ac_key_t key,
5.1583 + gcry_mpi_t data,
5.1584 + gcry_ac_data_t *data_signature)
5.1585 + /* */ _GCRY_ATTR_INTERNAL;
5.1586 +
5.1587 +/* Verify that the signature contained in the data set DATA_SIGNATURE
5.1588 + is indeed the result of signing the data contained in DATA with the
5.1589 + secret key belonging to the public key KEY. */
5.1590 +gcry_error_t gcry_ac_data_verify (gcry_ac_handle_t handle,
5.1591 + gcry_ac_key_t key,
5.1592 + gcry_mpi_t data,
5.1593 + gcry_ac_data_t data_signature)
5.1594 + /* */ _GCRY_ATTR_INTERNAL;
5.1595 +
5.1596 +/* Encrypts the plain text readable from IO_MESSAGE through HANDLE
5.1597 + with the public key KEY according to SCHEME, FLAGS and OPTS. If
5.1598 + OPTS is not NULL, it has to be a pointer to a structure specific to
5.1599 + the chosen scheme (gcry_ac_es_*_t). The encrypted message is
5.1600 + written to IO_CIPHER. */
5.1601 +gcry_error_t gcry_ac_data_encrypt_scheme (gcry_ac_handle_t handle,
5.1602 + gcry_ac_scheme_t scheme,
5.1603 + unsigned int flags, void *opts,
5.1604 + gcry_ac_key_t key,
5.1605 + gcry_ac_io_t *io_message,
5.1606 + gcry_ac_io_t *io_cipher)
5.1607 + /* */ _GCRY_ATTR_INTERNAL;
5.1608 +
5.1609 +/* Decrypts the cipher text readable from IO_CIPHER through HANDLE
5.1610 + with the secret key KEY according to SCHEME, @var{flags} and OPTS.
5.1611 + If OPTS is not NULL, it has to be a pointer to a structure specific
5.1612 + to the chosen scheme (gcry_ac_es_*_t). The decrypted message is
5.1613 + written to IO_MESSAGE. */
5.1614 +gcry_error_t gcry_ac_data_decrypt_scheme (gcry_ac_handle_t handle,
5.1615 + gcry_ac_scheme_t scheme,
5.1616 + unsigned int flags, void *opts,
5.1617 + gcry_ac_key_t key,
5.1618 + gcry_ac_io_t *io_cipher,
5.1619 + gcry_ac_io_t *io_message)
5.1620 + /* */ _GCRY_ATTR_INTERNAL;
5.1621 +
5.1622 +/* Signs the message readable from IO_MESSAGE through HANDLE with the
5.1623 + secret key KEY according to SCHEME, FLAGS and OPTS. If OPTS is not
5.1624 + NULL, it has to be a pointer to a structure specific to the chosen
5.1625 + scheme (gcry_ac_ssa_*_t). The signature is written to
5.1626 + IO_SIGNATURE. */
5.1627 +gcry_error_t gcry_ac_data_sign_scheme (gcry_ac_handle_t handle,
5.1628 + gcry_ac_scheme_t scheme,
5.1629 + unsigned int flags, void *opts,
5.1630 + gcry_ac_key_t key,
5.1631 + gcry_ac_io_t *io_message,
5.1632 + gcry_ac_io_t *io_signature)
5.1633 + /* */ _GCRY_ATTR_INTERNAL;
5.1634 +
5.1635 +/* Verifies through HANDLE that the signature readable from
5.1636 + IO_SIGNATURE is indeed the result of signing the message readable
5.1637 + from IO_MESSAGE with the secret key belonging to the public key KEY
5.1638 + according to SCHEME and OPTS. If OPTS is not NULL, it has to be an
5.1639 + anonymous structure (gcry_ac_ssa_*_t) specific to the chosen
5.1640 + scheme. */
5.1641 +gcry_error_t gcry_ac_data_verify_scheme (gcry_ac_handle_t handle,
5.1642 + gcry_ac_scheme_t scheme,
5.1643 + unsigned int flags, void *opts,
5.1644 + gcry_ac_key_t key,
5.1645 + gcry_ac_io_t *io_message,
5.1646 + gcry_ac_io_t *io_signature)
5.1647 + /* */ _GCRY_ATTR_INTERNAL;
5.1648 +
5.1649 +/* Store the textual representation of the algorithm whose id is given
5.1650 + in ALGORITHM in NAME. This function is deprecated; use
5.1651 + gcry_pk_algo_name. */
5.1652 +gcry_error_t gcry_ac_id_to_name (gcry_ac_id_t algorithm,
5.1653 + const char **name)
5.1654 + /* */ _GCRY_GCC_ATTR_DEPRECATED;
5.1655 +/* Store the numeric ID of the algorithm whose textual representation
5.1656 + is contained in NAME in ALGORITHM. This function is deprecated;
5.1657 + use gcry_pk_map_name. */
5.1658 +gcry_error_t gcry_ac_name_to_id (const char *name,
5.1659 + gcry_ac_id_t *algorithm)
5.1660 + /* */ _GCRY_GCC_ATTR_DEPRECATED;
5.1661 +#endif /*GCRYPT_NO_DEPRECATED*/
5.1662 +
5.1663 +
5.1664 +/******************************
5.1665 + * *
5.1666 + * Key Derivation Functions *
5.1667 + * *
5.1668 + ******************************/
5.1669 +
5.1670 +/* Algorithm IDs for the KDFs. */
5.1671 +enum gcry_kdf_algos
5.1672 + {
5.1673 + GCRY_KDF_NONE = 0,
5.1674 + GCRY_KDF_SIMPLE_S2K = 16,
5.1675 + GCRY_KDF_SALTED_S2K = 17,
5.1676 + GCRY_KDF_ITERSALTED_S2K = 19,
5.1677 + GCRY_KDF_PBKDF1 = 33,
5.1678 + GCRY_KDF_PBKDF2 = 34
5.1679 + };
5.1680 +
5.1681 +/* Derive a key from a passphrase. */
5.1682 +gpg_error_t gcry_kdf_derive (const void *passphrase, size_t passphraselen,
5.1683 + int algo, int subalgo,
5.1684 + const void *salt, size_t saltlen,
5.1685 + unsigned long iterations,
5.1686 + size_t keysize, void *keybuffer);
5.1687 +
5.1688 +
5.1689 +
5.1690 +
5.1691 +/************************************
5.1692 + * *
5.1693 + * Random Generating Functions *
5.1694 + * *
5.1695 + ************************************/
5.1696 +
5.1697 +/* The possible values for the random quality. The rule of thumb is
5.1698 + to use STRONG for session keys and VERY_STRONG for key material.
5.1699 + WEAK is usually an alias for STRONG and should not be used anymore
5.1700 + (except with gcry_mpi_randomize); use gcry_create_nonce instead. */
5.1701 +typedef enum gcry_random_level
5.1702 + {
5.1703 + GCRY_WEAK_RANDOM = 0,
5.1704 + GCRY_STRONG_RANDOM = 1,
5.1705 + GCRY_VERY_STRONG_RANDOM = 2
5.1706 + }
5.1707 +gcry_random_level_t;
5.1708 +
5.1709 +/* Fill BUFFER with LENGTH bytes of random, using random numbers of
5.1710 + quality LEVEL. */
5.1711 +void gcry_randomize (void *buffer, size_t length,
5.1712 + enum gcry_random_level level);
5.1713 +
5.1714 +/* Add the external random from BUFFER with LENGTH bytes into the
5.1715 + pool. QUALITY should either be -1 for unknown or in the range of 0
5.1716 + to 100 */
5.1717 +gcry_error_t gcry_random_add_bytes (const void *buffer, size_t length,
5.1718 + int quality);
5.1719 +
5.1720 +/* If random numbers are used in an application, this macro should be
5.1721 + called from time to time so that new stuff gets added to the
5.1722 + internal pool of the RNG. */
5.1723 +#define gcry_fast_random_poll() gcry_control (GCRYCTL_FAST_POLL, NULL)
5.1724 +
5.1725 +
5.1726 +/* Return NBYTES of allocated random using a random numbers of quality
5.1727 + LEVEL. */
5.1728 +void *gcry_random_bytes (size_t nbytes, enum gcry_random_level level)
5.1729 + _GCRY_GCC_ATTR_MALLOC;
5.1730 +
5.1731 +/* Return NBYTES of allocated random using a random numbers of quality
5.1732 + LEVEL. The random numbers are created returned in "secure"
5.1733 + memory. */
5.1734 +void *gcry_random_bytes_secure (size_t nbytes, enum gcry_random_level level)
5.1735 + _GCRY_GCC_ATTR_MALLOC;
5.1736 +
5.1737 +
5.1738 +/* Set the big integer W to a random value of NBITS using a random
5.1739 + generator with quality LEVEL. Note that by using a level of
5.1740 + GCRY_WEAK_RANDOM gcry_create_nonce is used internally. */
5.1741 +void gcry_mpi_randomize (gcry_mpi_t w,
5.1742 + unsigned int nbits, enum gcry_random_level level);
5.1743 +
5.1744 +
5.1745 +/* Create an unpredicable nonce of LENGTH bytes in BUFFER. */
5.1746 +void gcry_create_nonce (void *buffer, size_t length);
5.1747 +
5.1748 +
5.1749 +
5.1750 +
5.1751 +
5.1752 +/*******************************/
5.1753 +/* */
5.1754 +/* Prime Number Functions */
5.1755 +/* */
5.1756 +/*******************************/
5.1757 +
5.1758 +/* Mode values passed to a gcry_prime_check_func_t. */
5.1759 +#define GCRY_PRIME_CHECK_AT_FINISH 0
5.1760 +#define GCRY_PRIME_CHECK_AT_GOT_PRIME 1
5.1761 +#define GCRY_PRIME_CHECK_AT_MAYBE_PRIME 2
5.1762 +
5.1763 +/* The function should return 1 if the operation shall continue, 0 to
5.1764 + reject the prime candidate. */
5.1765 +typedef int (*gcry_prime_check_func_t) (void *arg, int mode,
5.1766 + gcry_mpi_t candidate);
5.1767 +
5.1768 +/* Flags for gcry_prime_generate(): */
5.1769 +
5.1770 +/* Allocate prime numbers and factors in secure memory. */
5.1771 +#define GCRY_PRIME_FLAG_SECRET (1 << 0)
5.1772 +
5.1773 +/* Make sure that at least one prime factor is of size
5.1774 + `FACTOR_BITS'. */
5.1775 +#define GCRY_PRIME_FLAG_SPECIAL_FACTOR (1 << 1)
5.1776 +
5.1777 +/* Generate a new prime number of PRIME_BITS bits and store it in
5.1778 + PRIME. If FACTOR_BITS is non-zero, one of the prime factors of
5.1779 + (prime - 1) / 2 must be FACTOR_BITS bits long. If FACTORS is
5.1780 + non-zero, allocate a new, NULL-terminated array holding the prime
5.1781 + factors and store it in FACTORS. FLAGS might be used to influence
5.1782 + the prime number generation process. */
5.1783 +gcry_error_t gcry_prime_generate (gcry_mpi_t *prime,
5.1784 + unsigned int prime_bits,
5.1785 + unsigned int factor_bits,
5.1786 + gcry_mpi_t **factors,
5.1787 + gcry_prime_check_func_t cb_func,
5.1788 + void *cb_arg,
5.1789 + gcry_random_level_t random_level,
5.1790 + unsigned int flags);
5.1791 +
5.1792 +/* Find a generator for PRIME where the factorization of (prime-1) is
5.1793 + in the NULL terminated array FACTORS. Return the generator as a
5.1794 + newly allocated MPI in R_G. If START_G is not NULL, use this as
5.1795 + teh start for the search. */
5.1796 +gcry_error_t gcry_prime_group_generator (gcry_mpi_t *r_g,
5.1797 + gcry_mpi_t prime,
5.1798 + gcry_mpi_t *factors,
5.1799 + gcry_mpi_t start_g);
5.1800 +
5.1801 +
5.1802 +/* Convenience function to release the FACTORS array. */
5.1803 +void gcry_prime_release_factors (gcry_mpi_t *factors);
5.1804 +
5.1805 +
5.1806 +/* Check wether the number X is prime. */
5.1807 +gcry_error_t gcry_prime_check (gcry_mpi_t x, unsigned int flags);
5.1808 +
5.1809 +
5.1810 +
5.1811 +/************************************
5.1812 + * *
5.1813 + * Miscellaneous Stuff *
5.1814 + * *
5.1815 + ************************************/
5.1816 +
5.1817 +/* Log levels used by the internal logging facility. */
5.1818 +enum gcry_log_levels
5.1819 + {
5.1820 + GCRY_LOG_CONT = 0, /* (Continue the last log line.) */
5.1821 + GCRY_LOG_INFO = 10,
5.1822 + GCRY_LOG_WARN = 20,
5.1823 + GCRY_LOG_ERROR = 30,
5.1824 + GCRY_LOG_FATAL = 40,
5.1825 + GCRY_LOG_BUG = 50,
5.1826 + GCRY_LOG_DEBUG = 100
5.1827 + };
5.1828 +
5.1829 +/* Type for progress handlers. */
5.1830 +typedef void (*gcry_handler_progress_t) (void *, const char *, int, int, int);
5.1831 +
5.1832 +/* Type for memory allocation handlers. */
5.1833 +typedef void *(*gcry_handler_alloc_t) (size_t n);
5.1834 +
5.1835 +/* Type for secure memory check handlers. */
5.1836 +typedef int (*gcry_handler_secure_check_t) (const void *);
5.1837 +
5.1838 +/* Type for memory reallocation handlers. */
5.1839 +typedef void *(*gcry_handler_realloc_t) (void *p, size_t n);
5.1840 +
5.1841 +/* Type for memory free handlers. */
5.1842 +typedef void (*gcry_handler_free_t) (void *);
5.1843 +
5.1844 +/* Type for out-of-memory handlers. */
5.1845 +typedef int (*gcry_handler_no_mem_t) (void *, size_t, unsigned int);
5.1846 +
5.1847 +/* Type for fatal error handlers. */
5.1848 +typedef void (*gcry_handler_error_t) (void *, int, const char *);
5.1849 +
5.1850 +/* Type for logging handlers. */
5.1851 +typedef void (*gcry_handler_log_t) (void *, int, const char *, va_list);
5.1852 +
5.1853 +/* Certain operations can provide progress information. This function
5.1854 + is used to register a handler for retrieving these information. */
5.1855 +void gcry_set_progress_handler (gcry_handler_progress_t cb, void *cb_data);
5.1856 +
5.1857 +
5.1858 +/* Register a custom memory allocation functions. */
5.1859 +void gcry_set_allocation_handler (
5.1860 + gcry_handler_alloc_t func_alloc,
5.1861 + gcry_handler_alloc_t func_alloc_secure,
5.1862 + gcry_handler_secure_check_t func_secure_check,
5.1863 + gcry_handler_realloc_t func_realloc,
5.1864 + gcry_handler_free_t func_free);
5.1865 +
5.1866 +/* Register a function used instead of the internal out of memory
5.1867 + handler. */
5.1868 +void gcry_set_outofcore_handler (gcry_handler_no_mem_t h, void *opaque);
5.1869 +
5.1870 +/* Register a function used instead of the internal fatal error
5.1871 + handler. */
5.1872 +void gcry_set_fatalerror_handler (gcry_handler_error_t fnc, void *opaque);
5.1873 +
5.1874 +/* Register a function used instead of the internal logging
5.1875 + facility. */
5.1876 +void gcry_set_log_handler (gcry_handler_log_t f, void *opaque);
5.1877 +
5.1878 +/* Reserved for future use. */
5.1879 +void gcry_set_gettext_handler (const char *(*f)(const char*));
5.1880 +
5.1881 +/* Libgcrypt uses its own memory allocation. It is important to use
5.1882 + gcry_free () to release memory allocated by libgcrypt. */
5.1883 +void *gcry_malloc (size_t n) _GCRY_GCC_ATTR_MALLOC;
5.1884 +void *gcry_calloc (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC;
5.1885 +void *gcry_malloc_secure (size_t n) _GCRY_GCC_ATTR_MALLOC;
5.1886 +void *gcry_calloc_secure (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC;
5.1887 +void *gcry_realloc (void *a, size_t n);
5.1888 +char *gcry_strdup (const char *string) _GCRY_GCC_ATTR_MALLOC;
5.1889 +void *gcry_xmalloc (size_t n) _GCRY_GCC_ATTR_MALLOC;
5.1890 +void *gcry_xcalloc (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC;
5.1891 +void *gcry_xmalloc_secure (size_t n) _GCRY_GCC_ATTR_MALLOC;
5.1892 +void *gcry_xcalloc_secure (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC;
5.1893 +void *gcry_xrealloc (void *a, size_t n);
5.1894 +char *gcry_xstrdup (const char * a) _GCRY_GCC_ATTR_MALLOC;
5.1895 +void gcry_free (void *a);
5.1896 +
5.1897 +/* Return true if A is allocated in "secure" memory. */
5.1898 +int gcry_is_secure (const void *a) _GCRY_GCC_ATTR_PURE;
5.1899 +
5.1900 +/* Return true if Libgcrypt is in FIPS mode. */
5.1901 +#define gcry_fips_mode_active() !!gcry_control (GCRYCTL_FIPS_MODE_P, 0)
5.1902 +
5.1903 +
5.1904 +/* Include support for Libgcrypt modules. */
5.1905 +#include <gcrypt-module.h>
5.1906 +
5.1907 +#if 0 /* (Keep Emacsens' auto-indent happy.) */
5.1908 +{
5.1909 +#endif
5.1910 +#ifdef __cplusplus
5.1911 +}
5.1912 +#endif
5.1913 +#endif /* _GCRYPT_H */
5.1914 +/*
5.1915 +Local Variables:
5.1916 +buffer-read-only: t
5.1917 +End:
5.1918 +*/
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/Frameworks/libgcrypt.framework/Versions/1.5.0/Resources/English.lproj/InfoPlist.strings Thu Sep 06 18:49:22 2012 +0200
6.3 @@ -0,0 +1,3 @@
6.4 +/* Localized versions of Info.plist keys */
6.5 +
6.6 +CFBundleName = "libgcrypt";
7.1 Binary file Frameworks/libgcrypt.framework/Versions/1.5.0/Resources/Info.plist has changed
8.1 Binary file Frameworks/libgcrypt.framework/Versions/1.5.0/libgcrypt has changed
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/Frameworks/libgcrypt.framework/Versions/Current Thu Sep 06 18:49:22 2012 +0200
9.3 @@ -0,0 +1,1 @@
9.4 +1.5.0
9.5 \ No newline at end of file
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/Frameworks/libgcrypt.framework/libgcrypt Thu Sep 06 18:49:22 2012 +0200
10.3 @@ -0,0 +1,1 @@
10.4 +Versions/1.5.0/libgcrypt
10.5 \ No newline at end of file
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/Frameworks/libgpgerror.framework/Headers Thu Sep 06 18:49:22 2012 +0200
11.3 @@ -0,0 +1,1 @@
11.4 +Versions/1.10/Headers
11.5 \ No newline at end of file
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/Frameworks/libgpgerror.framework/Resources Thu Sep 06 18:49:22 2012 +0200
12.3 @@ -0,0 +1,1 @@
12.4 +Versions/1.10/Resources
12.5 \ No newline at end of file
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/Frameworks/libgpgerror.framework/Versions/1.10/Headers/gpg-error.h Thu Sep 06 18:49:22 2012 +0200
13.3 @@ -0,0 +1,678 @@
13.4 +/* Output of mkheader.awk. DO NOT EDIT. -*- buffer-read-only: t -*- */
13.5 +
13.6 +/* gpg-error.h - Public interface to libgpg-error.
13.7 + Copyright (C) 2003, 2004, 2010 g10 Code GmbH
13.8 +
13.9 + This file is part of libgpg-error.
13.10 +
13.11 + libgpg-error is free software; you can redistribute it and/or
13.12 + modify it under the terms of the GNU Lesser General Public License
13.13 + as published by the Free Software Foundation; either version 2.1 of
13.14 + the License, or (at your option) any later version.
13.15 +
13.16 + libgpg-error is distributed in the hope that it will be useful, but
13.17 + WITHOUT ANY WARRANTY; without even the implied warranty of
13.18 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13.19 + Lesser General Public License for more details.
13.20 +
13.21 + You should have received a copy of the GNU Lesser General Public
13.22 + License along with this program; if not, see <http://www.gnu.org/licenses/>.
13.23 + */
13.24 +
13.25 +
13.26 +#ifndef GPG_ERROR_H
13.27 +#define GPG_ERROR_H 1
13.28 +
13.29 +#include <stddef.h>
13.30 +
13.31 +#ifdef __GNUC__
13.32 +#define GPG_ERR_INLINE __inline__
13.33 +#elif __STDC_VERSION__ >= 199901L
13.34 +#define GPG_ERR_INLINE inline
13.35 +#else
13.36 +#ifndef GPG_ERR_INLINE
13.37 +#define GPG_ERR_INLINE
13.38 +#endif
13.39 +#endif
13.40 +
13.41 +
13.42 +#ifdef __cplusplus
13.43 +extern "C" {
13.44 +#if 0 /* just to make Emacs auto-indent happy */
13.45 +}
13.46 +#endif
13.47 +#endif /* __cplusplus */
13.48 +
13.49 +/* The GnuPG project consists of many components. Error codes are
13.50 + exchanged between all components. The common error codes and their
13.51 + user-presentable descriptions are kept into a shared library to
13.52 + allow adding new error codes and components without recompiling any
13.53 + of the other components. The interface will not change in a
13.54 + backward incompatible way.
13.55 +
13.56 + An error code together with an error source build up an error
13.57 + value. As the error value is been passed from one component to
13.58 + another, it preserver the information about the source and nature
13.59 + of the error.
13.60 +
13.61 + A component of the GnuPG project can define the following macros to
13.62 + tune the behaviour of the library:
13.63 +
13.64 + GPG_ERR_SOURCE_DEFAULT: Define to an error source of type
13.65 + gpg_err_source_t to make that source the default for gpg_error().
13.66 + Otherwise GPG_ERR_SOURCE_UNKNOWN is used as default.
13.67 +
13.68 + GPG_ERR_ENABLE_GETTEXT_MACROS: Define to provide macros to map the
13.69 + internal gettext API to standard names. This has only an effect on
13.70 + Windows platforms. */
13.71 +
13.72 +
13.73 +/* The error source type gpg_err_source_t.
13.74 +
13.75 + Where as the Poo out of a welle small
13.76 + Taketh his firste springing and his sours.
13.77 + --Chaucer. */
13.78 +
13.79 +/* Only use free slots, never change or reorder the existing
13.80 + entries. */
13.81 +typedef enum
13.82 + {
13.83 + GPG_ERR_SOURCE_UNKNOWN = 0,
13.84 + GPG_ERR_SOURCE_GCRYPT = 1,
13.85 + GPG_ERR_SOURCE_GPG = 2,
13.86 + GPG_ERR_SOURCE_GPGSM = 3,
13.87 + GPG_ERR_SOURCE_GPGAGENT = 4,
13.88 + GPG_ERR_SOURCE_PINENTRY = 5,
13.89 + GPG_ERR_SOURCE_SCD = 6,
13.90 + GPG_ERR_SOURCE_GPGME = 7,
13.91 + GPG_ERR_SOURCE_KEYBOX = 8,
13.92 + GPG_ERR_SOURCE_KSBA = 9,
13.93 + GPG_ERR_SOURCE_DIRMNGR = 10,
13.94 + GPG_ERR_SOURCE_GSTI = 11,
13.95 + GPG_ERR_SOURCE_GPA = 12,
13.96 + GPG_ERR_SOURCE_KLEO = 13,
13.97 + GPG_ERR_SOURCE_G13 = 14,
13.98 + GPG_ERR_SOURCE_ANY = 31,
13.99 + GPG_ERR_SOURCE_USER_1 = 32,
13.100 + GPG_ERR_SOURCE_USER_2 = 33,
13.101 + GPG_ERR_SOURCE_USER_3 = 34,
13.102 + GPG_ERR_SOURCE_USER_4 = 35,
13.103 +
13.104 + /* This is one more than the largest allowed entry. */
13.105 + GPG_ERR_SOURCE_DIM = 128
13.106 + } gpg_err_source_t;
13.107 +
13.108 +
13.109 +/* The error code type gpg_err_code_t. */
13.110 +
13.111 +/* Only use free slots, never change or reorder the existing
13.112 + entries. */
13.113 +typedef enum
13.114 + {
13.115 + GPG_ERR_NO_ERROR = 0,
13.116 + GPG_ERR_GENERAL = 1,
13.117 + GPG_ERR_UNKNOWN_PACKET = 2,
13.118 + GPG_ERR_UNKNOWN_VERSION = 3,
13.119 + GPG_ERR_PUBKEY_ALGO = 4,
13.120 + GPG_ERR_DIGEST_ALGO = 5,
13.121 + GPG_ERR_BAD_PUBKEY = 6,
13.122 + GPG_ERR_BAD_SECKEY = 7,
13.123 + GPG_ERR_BAD_SIGNATURE = 8,
13.124 + GPG_ERR_NO_PUBKEY = 9,
13.125 + GPG_ERR_CHECKSUM = 10,
13.126 + GPG_ERR_BAD_PASSPHRASE = 11,
13.127 + GPG_ERR_CIPHER_ALGO = 12,
13.128 + GPG_ERR_KEYRING_OPEN = 13,
13.129 + GPG_ERR_INV_PACKET = 14,
13.130 + GPG_ERR_INV_ARMOR = 15,
13.131 + GPG_ERR_NO_USER_ID = 16,
13.132 + GPG_ERR_NO_SECKEY = 17,
13.133 + GPG_ERR_WRONG_SECKEY = 18,
13.134 + GPG_ERR_BAD_KEY = 19,
13.135 + GPG_ERR_COMPR_ALGO = 20,
13.136 + GPG_ERR_NO_PRIME = 21,
13.137 + GPG_ERR_NO_ENCODING_METHOD = 22,
13.138 + GPG_ERR_NO_ENCRYPTION_SCHEME = 23,
13.139 + GPG_ERR_NO_SIGNATURE_SCHEME = 24,
13.140 + GPG_ERR_INV_ATTR = 25,
13.141 + GPG_ERR_NO_VALUE = 26,
13.142 + GPG_ERR_NOT_FOUND = 27,
13.143 + GPG_ERR_VALUE_NOT_FOUND = 28,
13.144 + GPG_ERR_SYNTAX = 29,
13.145 + GPG_ERR_BAD_MPI = 30,
13.146 + GPG_ERR_INV_PASSPHRASE = 31,
13.147 + GPG_ERR_SIG_CLASS = 32,
13.148 + GPG_ERR_RESOURCE_LIMIT = 33,
13.149 + GPG_ERR_INV_KEYRING = 34,
13.150 + GPG_ERR_TRUSTDB = 35,
13.151 + GPG_ERR_BAD_CERT = 36,
13.152 + GPG_ERR_INV_USER_ID = 37,
13.153 + GPG_ERR_UNEXPECTED = 38,
13.154 + GPG_ERR_TIME_CONFLICT = 39,
13.155 + GPG_ERR_KEYSERVER = 40,
13.156 + GPG_ERR_WRONG_PUBKEY_ALGO = 41,
13.157 + GPG_ERR_TRIBUTE_TO_D_A = 42,
13.158 + GPG_ERR_WEAK_KEY = 43,
13.159 + GPG_ERR_INV_KEYLEN = 44,
13.160 + GPG_ERR_INV_ARG = 45,
13.161 + GPG_ERR_BAD_URI = 46,
13.162 + GPG_ERR_INV_URI = 47,
13.163 + GPG_ERR_NETWORK = 48,
13.164 + GPG_ERR_UNKNOWN_HOST = 49,
13.165 + GPG_ERR_SELFTEST_FAILED = 50,
13.166 + GPG_ERR_NOT_ENCRYPTED = 51,
13.167 + GPG_ERR_NOT_PROCESSED = 52,
13.168 + GPG_ERR_UNUSABLE_PUBKEY = 53,
13.169 + GPG_ERR_UNUSABLE_SECKEY = 54,
13.170 + GPG_ERR_INV_VALUE = 55,
13.171 + GPG_ERR_BAD_CERT_CHAIN = 56,
13.172 + GPG_ERR_MISSING_CERT = 57,
13.173 + GPG_ERR_NO_DATA = 58,
13.174 + GPG_ERR_BUG = 59,
13.175 + GPG_ERR_NOT_SUPPORTED = 60,
13.176 + GPG_ERR_INV_OP = 61,
13.177 + GPG_ERR_TIMEOUT = 62,
13.178 + GPG_ERR_INTERNAL = 63,
13.179 + GPG_ERR_EOF_GCRYPT = 64,
13.180 + GPG_ERR_INV_OBJ = 65,
13.181 + GPG_ERR_TOO_SHORT = 66,
13.182 + GPG_ERR_TOO_LARGE = 67,
13.183 + GPG_ERR_NO_OBJ = 68,
13.184 + GPG_ERR_NOT_IMPLEMENTED = 69,
13.185 + GPG_ERR_CONFLICT = 70,
13.186 + GPG_ERR_INV_CIPHER_MODE = 71,
13.187 + GPG_ERR_INV_FLAG = 72,
13.188 + GPG_ERR_INV_HANDLE = 73,
13.189 + GPG_ERR_TRUNCATED = 74,
13.190 + GPG_ERR_INCOMPLETE_LINE = 75,
13.191 + GPG_ERR_INV_RESPONSE = 76,
13.192 + GPG_ERR_NO_AGENT = 77,
13.193 + GPG_ERR_AGENT = 78,
13.194 + GPG_ERR_INV_DATA = 79,
13.195 + GPG_ERR_ASSUAN_SERVER_FAULT = 80,
13.196 + GPG_ERR_ASSUAN = 81,
13.197 + GPG_ERR_INV_SESSION_KEY = 82,
13.198 + GPG_ERR_INV_SEXP = 83,
13.199 + GPG_ERR_UNSUPPORTED_ALGORITHM = 84,
13.200 + GPG_ERR_NO_PIN_ENTRY = 85,
13.201 + GPG_ERR_PIN_ENTRY = 86,
13.202 + GPG_ERR_BAD_PIN = 87,
13.203 + GPG_ERR_INV_NAME = 88,
13.204 + GPG_ERR_BAD_DATA = 89,
13.205 + GPG_ERR_INV_PARAMETER = 90,
13.206 + GPG_ERR_WRONG_CARD = 91,
13.207 + GPG_ERR_NO_DIRMNGR = 92,
13.208 + GPG_ERR_DIRMNGR = 93,
13.209 + GPG_ERR_CERT_REVOKED = 94,
13.210 + GPG_ERR_NO_CRL_KNOWN = 95,
13.211 + GPG_ERR_CRL_TOO_OLD = 96,
13.212 + GPG_ERR_LINE_TOO_LONG = 97,
13.213 + GPG_ERR_NOT_TRUSTED = 98,
13.214 + GPG_ERR_CANCELED = 99,
13.215 + GPG_ERR_BAD_CA_CERT = 100,
13.216 + GPG_ERR_CERT_EXPIRED = 101,
13.217 + GPG_ERR_CERT_TOO_YOUNG = 102,
13.218 + GPG_ERR_UNSUPPORTED_CERT = 103,
13.219 + GPG_ERR_UNKNOWN_SEXP = 104,
13.220 + GPG_ERR_UNSUPPORTED_PROTECTION = 105,
13.221 + GPG_ERR_CORRUPTED_PROTECTION = 106,
13.222 + GPG_ERR_AMBIGUOUS_NAME = 107,
13.223 + GPG_ERR_CARD = 108,
13.224 + GPG_ERR_CARD_RESET = 109,
13.225 + GPG_ERR_CARD_REMOVED = 110,
13.226 + GPG_ERR_INV_CARD = 111,
13.227 + GPG_ERR_CARD_NOT_PRESENT = 112,
13.228 + GPG_ERR_NO_PKCS15_APP = 113,
13.229 + GPG_ERR_NOT_CONFIRMED = 114,
13.230 + GPG_ERR_CONFIGURATION = 115,
13.231 + GPG_ERR_NO_POLICY_MATCH = 116,
13.232 + GPG_ERR_INV_INDEX = 117,
13.233 + GPG_ERR_INV_ID = 118,
13.234 + GPG_ERR_NO_SCDAEMON = 119,
13.235 + GPG_ERR_SCDAEMON = 120,
13.236 + GPG_ERR_UNSUPPORTED_PROTOCOL = 121,
13.237 + GPG_ERR_BAD_PIN_METHOD = 122,
13.238 + GPG_ERR_CARD_NOT_INITIALIZED = 123,
13.239 + GPG_ERR_UNSUPPORTED_OPERATION = 124,
13.240 + GPG_ERR_WRONG_KEY_USAGE = 125,
13.241 + GPG_ERR_NOTHING_FOUND = 126,
13.242 + GPG_ERR_WRONG_BLOB_TYPE = 127,
13.243 + GPG_ERR_MISSING_VALUE = 128,
13.244 + GPG_ERR_HARDWARE = 129,
13.245 + GPG_ERR_PIN_BLOCKED = 130,
13.246 + GPG_ERR_USE_CONDITIONS = 131,
13.247 + GPG_ERR_PIN_NOT_SYNCED = 132,
13.248 + GPG_ERR_INV_CRL = 133,
13.249 + GPG_ERR_BAD_BER = 134,
13.250 + GPG_ERR_INV_BER = 135,
13.251 + GPG_ERR_ELEMENT_NOT_FOUND = 136,
13.252 + GPG_ERR_IDENTIFIER_NOT_FOUND = 137,
13.253 + GPG_ERR_INV_TAG = 138,
13.254 + GPG_ERR_INV_LENGTH = 139,
13.255 + GPG_ERR_INV_KEYINFO = 140,
13.256 + GPG_ERR_UNEXPECTED_TAG = 141,
13.257 + GPG_ERR_NOT_DER_ENCODED = 142,
13.258 + GPG_ERR_NO_CMS_OBJ = 143,
13.259 + GPG_ERR_INV_CMS_OBJ = 144,
13.260 + GPG_ERR_UNKNOWN_CMS_OBJ = 145,
13.261 + GPG_ERR_UNSUPPORTED_CMS_OBJ = 146,
13.262 + GPG_ERR_UNSUPPORTED_ENCODING = 147,
13.263 + GPG_ERR_UNSUPPORTED_CMS_VERSION = 148,
13.264 + GPG_ERR_UNKNOWN_ALGORITHM = 149,
13.265 + GPG_ERR_INV_ENGINE = 150,
13.266 + GPG_ERR_PUBKEY_NOT_TRUSTED = 151,
13.267 + GPG_ERR_DECRYPT_FAILED = 152,
13.268 + GPG_ERR_KEY_EXPIRED = 153,
13.269 + GPG_ERR_SIG_EXPIRED = 154,
13.270 + GPG_ERR_ENCODING_PROBLEM = 155,
13.271 + GPG_ERR_INV_STATE = 156,
13.272 + GPG_ERR_DUP_VALUE = 157,
13.273 + GPG_ERR_MISSING_ACTION = 158,
13.274 + GPG_ERR_MODULE_NOT_FOUND = 159,
13.275 + GPG_ERR_INV_OID_STRING = 160,
13.276 + GPG_ERR_INV_TIME = 161,
13.277 + GPG_ERR_INV_CRL_OBJ = 162,
13.278 + GPG_ERR_UNSUPPORTED_CRL_VERSION = 163,
13.279 + GPG_ERR_INV_CERT_OBJ = 164,
13.280 + GPG_ERR_UNKNOWN_NAME = 165,
13.281 + GPG_ERR_LOCALE_PROBLEM = 166,
13.282 + GPG_ERR_NOT_LOCKED = 167,
13.283 + GPG_ERR_PROTOCOL_VIOLATION = 168,
13.284 + GPG_ERR_INV_MAC = 169,
13.285 + GPG_ERR_INV_REQUEST = 170,
13.286 + GPG_ERR_UNKNOWN_EXTN = 171,
13.287 + GPG_ERR_UNKNOWN_CRIT_EXTN = 172,
13.288 + GPG_ERR_LOCKED = 173,
13.289 + GPG_ERR_UNKNOWN_OPTION = 174,
13.290 + GPG_ERR_UNKNOWN_COMMAND = 175,
13.291 + GPG_ERR_NOT_OPERATIONAL = 176,
13.292 + GPG_ERR_NO_PASSPHRASE = 177,
13.293 + GPG_ERR_NO_PIN = 178,
13.294 + GPG_ERR_NOT_ENABLED = 179,
13.295 + GPG_ERR_NO_ENGINE = 180,
13.296 + GPG_ERR_MISSING_KEY = 181,
13.297 + GPG_ERR_TOO_MANY = 182,
13.298 + GPG_ERR_LIMIT_REACHED = 183,
13.299 + GPG_ERR_NOT_INITIALIZED = 184,
13.300 + GPG_ERR_MISSING_ISSUER_CERT = 185,
13.301 + GPG_ERR_FULLY_CANCELED = 198,
13.302 + GPG_ERR_UNFINISHED = 199,
13.303 + GPG_ERR_BUFFER_TOO_SHORT = 200,
13.304 + GPG_ERR_SEXP_INV_LEN_SPEC = 201,
13.305 + GPG_ERR_SEXP_STRING_TOO_LONG = 202,
13.306 + GPG_ERR_SEXP_UNMATCHED_PAREN = 203,
13.307 + GPG_ERR_SEXP_NOT_CANONICAL = 204,
13.308 + GPG_ERR_SEXP_BAD_CHARACTER = 205,
13.309 + GPG_ERR_SEXP_BAD_QUOTATION = 206,
13.310 + GPG_ERR_SEXP_ZERO_PREFIX = 207,
13.311 + GPG_ERR_SEXP_NESTED_DH = 208,
13.312 + GPG_ERR_SEXP_UNMATCHED_DH = 209,
13.313 + GPG_ERR_SEXP_UNEXPECTED_PUNC = 210,
13.314 + GPG_ERR_SEXP_BAD_HEX_CHAR = 211,
13.315 + GPG_ERR_SEXP_ODD_HEX_NUMBERS = 212,
13.316 + GPG_ERR_SEXP_BAD_OCT_CHAR = 213,
13.317 + GPG_ERR_ASS_GENERAL = 257,
13.318 + GPG_ERR_ASS_ACCEPT_FAILED = 258,
13.319 + GPG_ERR_ASS_CONNECT_FAILED = 259,
13.320 + GPG_ERR_ASS_INV_RESPONSE = 260,
13.321 + GPG_ERR_ASS_INV_VALUE = 261,
13.322 + GPG_ERR_ASS_INCOMPLETE_LINE = 262,
13.323 + GPG_ERR_ASS_LINE_TOO_LONG = 263,
13.324 + GPG_ERR_ASS_NESTED_COMMANDS = 264,
13.325 + GPG_ERR_ASS_NO_DATA_CB = 265,
13.326 + GPG_ERR_ASS_NO_INQUIRE_CB = 266,
13.327 + GPG_ERR_ASS_NOT_A_SERVER = 267,
13.328 + GPG_ERR_ASS_NOT_A_CLIENT = 268,
13.329 + GPG_ERR_ASS_SERVER_START = 269,
13.330 + GPG_ERR_ASS_READ_ERROR = 270,
13.331 + GPG_ERR_ASS_WRITE_ERROR = 271,
13.332 + GPG_ERR_ASS_TOO_MUCH_DATA = 273,
13.333 + GPG_ERR_ASS_UNEXPECTED_CMD = 274,
13.334 + GPG_ERR_ASS_UNKNOWN_CMD = 275,
13.335 + GPG_ERR_ASS_SYNTAX = 276,
13.336 + GPG_ERR_ASS_CANCELED = 277,
13.337 + GPG_ERR_ASS_NO_INPUT = 278,
13.338 + GPG_ERR_ASS_NO_OUTPUT = 279,
13.339 + GPG_ERR_ASS_PARAMETER = 280,
13.340 + GPG_ERR_ASS_UNKNOWN_INQUIRE = 281,
13.341 + GPG_ERR_USER_1 = 1024,
13.342 + GPG_ERR_USER_2 = 1025,
13.343 + GPG_ERR_USER_3 = 1026,
13.344 + GPG_ERR_USER_4 = 1027,
13.345 + GPG_ERR_USER_5 = 1028,
13.346 + GPG_ERR_USER_6 = 1029,
13.347 + GPG_ERR_USER_7 = 1030,
13.348 + GPG_ERR_USER_8 = 1031,
13.349 + GPG_ERR_USER_9 = 1032,
13.350 + GPG_ERR_USER_10 = 1033,
13.351 + GPG_ERR_USER_11 = 1034,
13.352 + GPG_ERR_USER_12 = 1035,
13.353 + GPG_ERR_USER_13 = 1036,
13.354 + GPG_ERR_USER_14 = 1037,
13.355 + GPG_ERR_USER_15 = 1038,
13.356 + GPG_ERR_USER_16 = 1039,
13.357 + GPG_ERR_MISSING_ERRNO = 16381,
13.358 + GPG_ERR_UNKNOWN_ERRNO = 16382,
13.359 + GPG_ERR_EOF = 16383,
13.360 +
13.361 + /* The following error codes are used to map system errors. */
13.362 +#define GPG_ERR_SYSTEM_ERROR (1 << 15)
13.363 + GPG_ERR_E2BIG = GPG_ERR_SYSTEM_ERROR | 0,
13.364 + GPG_ERR_EACCES = GPG_ERR_SYSTEM_ERROR | 1,
13.365 + GPG_ERR_EADDRINUSE = GPG_ERR_SYSTEM_ERROR | 2,
13.366 + GPG_ERR_EADDRNOTAVAIL = GPG_ERR_SYSTEM_ERROR | 3,
13.367 + GPG_ERR_EADV = GPG_ERR_SYSTEM_ERROR | 4,
13.368 + GPG_ERR_EAFNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 5,
13.369 + GPG_ERR_EAGAIN = GPG_ERR_SYSTEM_ERROR | 6,
13.370 + GPG_ERR_EALREADY = GPG_ERR_SYSTEM_ERROR | 7,
13.371 + GPG_ERR_EAUTH = GPG_ERR_SYSTEM_ERROR | 8,
13.372 + GPG_ERR_EBACKGROUND = GPG_ERR_SYSTEM_ERROR | 9,
13.373 + GPG_ERR_EBADE = GPG_ERR_SYSTEM_ERROR | 10,
13.374 + GPG_ERR_EBADF = GPG_ERR_SYSTEM_ERROR | 11,
13.375 + GPG_ERR_EBADFD = GPG_ERR_SYSTEM_ERROR | 12,
13.376 + GPG_ERR_EBADMSG = GPG_ERR_SYSTEM_ERROR | 13,
13.377 + GPG_ERR_EBADR = GPG_ERR_SYSTEM_ERROR | 14,
13.378 + GPG_ERR_EBADRPC = GPG_ERR_SYSTEM_ERROR | 15,
13.379 + GPG_ERR_EBADRQC = GPG_ERR_SYSTEM_ERROR | 16,
13.380 + GPG_ERR_EBADSLT = GPG_ERR_SYSTEM_ERROR | 17,
13.381 + GPG_ERR_EBFONT = GPG_ERR_SYSTEM_ERROR | 18,
13.382 + GPG_ERR_EBUSY = GPG_ERR_SYSTEM_ERROR | 19,
13.383 + GPG_ERR_ECANCELED = GPG_ERR_SYSTEM_ERROR | 20,
13.384 + GPG_ERR_ECHILD = GPG_ERR_SYSTEM_ERROR | 21,
13.385 + GPG_ERR_ECHRNG = GPG_ERR_SYSTEM_ERROR | 22,
13.386 + GPG_ERR_ECOMM = GPG_ERR_SYSTEM_ERROR | 23,
13.387 + GPG_ERR_ECONNABORTED = GPG_ERR_SYSTEM_ERROR | 24,
13.388 + GPG_ERR_ECONNREFUSED = GPG_ERR_SYSTEM_ERROR | 25,
13.389 + GPG_ERR_ECONNRESET = GPG_ERR_SYSTEM_ERROR | 26,
13.390 + GPG_ERR_ED = GPG_ERR_SYSTEM_ERROR | 27,
13.391 + GPG_ERR_EDEADLK = GPG_ERR_SYSTEM_ERROR | 28,
13.392 + GPG_ERR_EDEADLOCK = GPG_ERR_SYSTEM_ERROR | 29,
13.393 + GPG_ERR_EDESTADDRREQ = GPG_ERR_SYSTEM_ERROR | 30,
13.394 + GPG_ERR_EDIED = GPG_ERR_SYSTEM_ERROR | 31,
13.395 + GPG_ERR_EDOM = GPG_ERR_SYSTEM_ERROR | 32,
13.396 + GPG_ERR_EDOTDOT = GPG_ERR_SYSTEM_ERROR | 33,
13.397 + GPG_ERR_EDQUOT = GPG_ERR_SYSTEM_ERROR | 34,
13.398 + GPG_ERR_EEXIST = GPG_ERR_SYSTEM_ERROR | 35,
13.399 + GPG_ERR_EFAULT = GPG_ERR_SYSTEM_ERROR | 36,
13.400 + GPG_ERR_EFBIG = GPG_ERR_SYSTEM_ERROR | 37,
13.401 + GPG_ERR_EFTYPE = GPG_ERR_SYSTEM_ERROR | 38,
13.402 + GPG_ERR_EGRATUITOUS = GPG_ERR_SYSTEM_ERROR | 39,
13.403 + GPG_ERR_EGREGIOUS = GPG_ERR_SYSTEM_ERROR | 40,
13.404 + GPG_ERR_EHOSTDOWN = GPG_ERR_SYSTEM_ERROR | 41,
13.405 + GPG_ERR_EHOSTUNREACH = GPG_ERR_SYSTEM_ERROR | 42,
13.406 + GPG_ERR_EIDRM = GPG_ERR_SYSTEM_ERROR | 43,
13.407 + GPG_ERR_EIEIO = GPG_ERR_SYSTEM_ERROR | 44,
13.408 + GPG_ERR_EILSEQ = GPG_ERR_SYSTEM_ERROR | 45,
13.409 + GPG_ERR_EINPROGRESS = GPG_ERR_SYSTEM_ERROR | 46,
13.410 + GPG_ERR_EINTR = GPG_ERR_SYSTEM_ERROR | 47,
13.411 + GPG_ERR_EINVAL = GPG_ERR_SYSTEM_ERROR | 48,
13.412 + GPG_ERR_EIO = GPG_ERR_SYSTEM_ERROR | 49,
13.413 + GPG_ERR_EISCONN = GPG_ERR_SYSTEM_ERROR | 50,
13.414 + GPG_ERR_EISDIR = GPG_ERR_SYSTEM_ERROR | 51,
13.415 + GPG_ERR_EISNAM = GPG_ERR_SYSTEM_ERROR | 52,
13.416 + GPG_ERR_EL2HLT = GPG_ERR_SYSTEM_ERROR | 53,
13.417 + GPG_ERR_EL2NSYNC = GPG_ERR_SYSTEM_ERROR | 54,
13.418 + GPG_ERR_EL3HLT = GPG_ERR_SYSTEM_ERROR | 55,
13.419 + GPG_ERR_EL3RST = GPG_ERR_SYSTEM_ERROR | 56,
13.420 + GPG_ERR_ELIBACC = GPG_ERR_SYSTEM_ERROR | 57,
13.421 + GPG_ERR_ELIBBAD = GPG_ERR_SYSTEM_ERROR | 58,
13.422 + GPG_ERR_ELIBEXEC = GPG_ERR_SYSTEM_ERROR | 59,
13.423 + GPG_ERR_ELIBMAX = GPG_ERR_SYSTEM_ERROR | 60,
13.424 + GPG_ERR_ELIBSCN = GPG_ERR_SYSTEM_ERROR | 61,
13.425 + GPG_ERR_ELNRNG = GPG_ERR_SYSTEM_ERROR | 62,
13.426 + GPG_ERR_ELOOP = GPG_ERR_SYSTEM_ERROR | 63,
13.427 + GPG_ERR_EMEDIUMTYPE = GPG_ERR_SYSTEM_ERROR | 64,
13.428 + GPG_ERR_EMFILE = GPG_ERR_SYSTEM_ERROR | 65,
13.429 + GPG_ERR_EMLINK = GPG_ERR_SYSTEM_ERROR | 66,
13.430 + GPG_ERR_EMSGSIZE = GPG_ERR_SYSTEM_ERROR | 67,
13.431 + GPG_ERR_EMULTIHOP = GPG_ERR_SYSTEM_ERROR | 68,
13.432 + GPG_ERR_ENAMETOOLONG = GPG_ERR_SYSTEM_ERROR | 69,
13.433 + GPG_ERR_ENAVAIL = GPG_ERR_SYSTEM_ERROR | 70,
13.434 + GPG_ERR_ENEEDAUTH = GPG_ERR_SYSTEM_ERROR | 71,
13.435 + GPG_ERR_ENETDOWN = GPG_ERR_SYSTEM_ERROR | 72,
13.436 + GPG_ERR_ENETRESET = GPG_ERR_SYSTEM_ERROR | 73,
13.437 + GPG_ERR_ENETUNREACH = GPG_ERR_SYSTEM_ERROR | 74,
13.438 + GPG_ERR_ENFILE = GPG_ERR_SYSTEM_ERROR | 75,
13.439 + GPG_ERR_ENOANO = GPG_ERR_SYSTEM_ERROR | 76,
13.440 + GPG_ERR_ENOBUFS = GPG_ERR_SYSTEM_ERROR | 77,
13.441 + GPG_ERR_ENOCSI = GPG_ERR_SYSTEM_ERROR | 78,
13.442 + GPG_ERR_ENODATA = GPG_ERR_SYSTEM_ERROR | 79,
13.443 + GPG_ERR_ENODEV = GPG_ERR_SYSTEM_ERROR | 80,
13.444 + GPG_ERR_ENOENT = GPG_ERR_SYSTEM_ERROR | 81,
13.445 + GPG_ERR_ENOEXEC = GPG_ERR_SYSTEM_ERROR | 82,
13.446 + GPG_ERR_ENOLCK = GPG_ERR_SYSTEM_ERROR | 83,
13.447 + GPG_ERR_ENOLINK = GPG_ERR_SYSTEM_ERROR | 84,
13.448 + GPG_ERR_ENOMEDIUM = GPG_ERR_SYSTEM_ERROR | 85,
13.449 + GPG_ERR_ENOMEM = GPG_ERR_SYSTEM_ERROR | 86,
13.450 + GPG_ERR_ENOMSG = GPG_ERR_SYSTEM_ERROR | 87,
13.451 + GPG_ERR_ENONET = GPG_ERR_SYSTEM_ERROR | 88,
13.452 + GPG_ERR_ENOPKG = GPG_ERR_SYSTEM_ERROR | 89,
13.453 + GPG_ERR_ENOPROTOOPT = GPG_ERR_SYSTEM_ERROR | 90,
13.454 + GPG_ERR_ENOSPC = GPG_ERR_SYSTEM_ERROR | 91,
13.455 + GPG_ERR_ENOSR = GPG_ERR_SYSTEM_ERROR | 92,
13.456 + GPG_ERR_ENOSTR = GPG_ERR_SYSTEM_ERROR | 93,
13.457 + GPG_ERR_ENOSYS = GPG_ERR_SYSTEM_ERROR | 94,
13.458 + GPG_ERR_ENOTBLK = GPG_ERR_SYSTEM_ERROR | 95,
13.459 + GPG_ERR_ENOTCONN = GPG_ERR_SYSTEM_ERROR | 96,
13.460 + GPG_ERR_ENOTDIR = GPG_ERR_SYSTEM_ERROR | 97,
13.461 + GPG_ERR_ENOTEMPTY = GPG_ERR_SYSTEM_ERROR | 98,
13.462 + GPG_ERR_ENOTNAM = GPG_ERR_SYSTEM_ERROR | 99,
13.463 + GPG_ERR_ENOTSOCK = GPG_ERR_SYSTEM_ERROR | 100,
13.464 + GPG_ERR_ENOTSUP = GPG_ERR_SYSTEM_ERROR | 101,
13.465 + GPG_ERR_ENOTTY = GPG_ERR_SYSTEM_ERROR | 102,
13.466 + GPG_ERR_ENOTUNIQ = GPG_ERR_SYSTEM_ERROR | 103,
13.467 + GPG_ERR_ENXIO = GPG_ERR_SYSTEM_ERROR | 104,
13.468 + GPG_ERR_EOPNOTSUPP = GPG_ERR_SYSTEM_ERROR | 105,
13.469 + GPG_ERR_EOVERFLOW = GPG_ERR_SYSTEM_ERROR | 106,
13.470 + GPG_ERR_EPERM = GPG_ERR_SYSTEM_ERROR | 107,
13.471 + GPG_ERR_EPFNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 108,
13.472 + GPG_ERR_EPIPE = GPG_ERR_SYSTEM_ERROR | 109,
13.473 + GPG_ERR_EPROCLIM = GPG_ERR_SYSTEM_ERROR | 110,
13.474 + GPG_ERR_EPROCUNAVAIL = GPG_ERR_SYSTEM_ERROR | 111,
13.475 + GPG_ERR_EPROGMISMATCH = GPG_ERR_SYSTEM_ERROR | 112,
13.476 + GPG_ERR_EPROGUNAVAIL = GPG_ERR_SYSTEM_ERROR | 113,
13.477 + GPG_ERR_EPROTO = GPG_ERR_SYSTEM_ERROR | 114,
13.478 + GPG_ERR_EPROTONOSUPPORT = GPG_ERR_SYSTEM_ERROR | 115,
13.479 + GPG_ERR_EPROTOTYPE = GPG_ERR_SYSTEM_ERROR | 116,
13.480 + GPG_ERR_ERANGE = GPG_ERR_SYSTEM_ERROR | 117,
13.481 + GPG_ERR_EREMCHG = GPG_ERR_SYSTEM_ERROR | 118,
13.482 + GPG_ERR_EREMOTE = GPG_ERR_SYSTEM_ERROR | 119,
13.483 + GPG_ERR_EREMOTEIO = GPG_ERR_SYSTEM_ERROR | 120,
13.484 + GPG_ERR_ERESTART = GPG_ERR_SYSTEM_ERROR | 121,
13.485 + GPG_ERR_EROFS = GPG_ERR_SYSTEM_ERROR | 122,
13.486 + GPG_ERR_ERPCMISMATCH = GPG_ERR_SYSTEM_ERROR | 123,
13.487 + GPG_ERR_ESHUTDOWN = GPG_ERR_SYSTEM_ERROR | 124,
13.488 + GPG_ERR_ESOCKTNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 125,
13.489 + GPG_ERR_ESPIPE = GPG_ERR_SYSTEM_ERROR | 126,
13.490 + GPG_ERR_ESRCH = GPG_ERR_SYSTEM_ERROR | 127,
13.491 + GPG_ERR_ESRMNT = GPG_ERR_SYSTEM_ERROR | 128,
13.492 + GPG_ERR_ESTALE = GPG_ERR_SYSTEM_ERROR | 129,
13.493 + GPG_ERR_ESTRPIPE = GPG_ERR_SYSTEM_ERROR | 130,
13.494 + GPG_ERR_ETIME = GPG_ERR_SYSTEM_ERROR | 131,
13.495 + GPG_ERR_ETIMEDOUT = GPG_ERR_SYSTEM_ERROR | 132,
13.496 + GPG_ERR_ETOOMANYREFS = GPG_ERR_SYSTEM_ERROR | 133,
13.497 + GPG_ERR_ETXTBSY = GPG_ERR_SYSTEM_ERROR | 134,
13.498 + GPG_ERR_EUCLEAN = GPG_ERR_SYSTEM_ERROR | 135,
13.499 + GPG_ERR_EUNATCH = GPG_ERR_SYSTEM_ERROR | 136,
13.500 + GPG_ERR_EUSERS = GPG_ERR_SYSTEM_ERROR | 137,
13.501 + GPG_ERR_EWOULDBLOCK = GPG_ERR_SYSTEM_ERROR | 138,
13.502 + GPG_ERR_EXDEV = GPG_ERR_SYSTEM_ERROR | 139,
13.503 + GPG_ERR_EXFULL = GPG_ERR_SYSTEM_ERROR | 140,
13.504 +
13.505 + /* This is one more than the largest allowed entry. */
13.506 + GPG_ERR_CODE_DIM = 65536
13.507 + } gpg_err_code_t;
13.508 +
13.509 +
13.510 +/* The error value type gpg_error_t. */
13.511 +
13.512 +/* We would really like to use bit-fields in a struct, but using
13.513 + structs as return values can cause binary compatibility issues, in
13.514 + particular if you want to do it effeciently (also see
13.515 + -freg-struct-return option to GCC). */
13.516 +typedef unsigned int gpg_error_t;
13.517 +
13.518 +/* We use the lowest 16 bits of gpg_error_t for error codes. The 16th
13.519 + bit indicates system errors. */
13.520 +#define GPG_ERR_CODE_MASK (GPG_ERR_CODE_DIM - 1)
13.521 +
13.522 +/* Bits 17 to 24 are reserved. */
13.523 +
13.524 +/* We use the upper 7 bits of gpg_error_t for error sources. */
13.525 +#define GPG_ERR_SOURCE_MASK (GPG_ERR_SOURCE_DIM - 1)
13.526 +#define GPG_ERR_SOURCE_SHIFT 24
13.527 +
13.528 +/* The highest bit is reserved. It shouldn't be used to prevent
13.529 + potential negative numbers when transmitting error values as
13.530 + text. */
13.531 +
13.532 +
13.533 +/* GCC feature test. */
13.534 +#undef _GPG_ERR_HAVE_CONSTRUCTOR
13.535 +#if __GNUC__
13.536 +#define _GPG_ERR_GCC_VERSION (__GNUC__ * 10000 \
13.537 + + __GNUC_MINOR__ * 100 \
13.538 + + __GNUC_PATCHLEVEL__)
13.539 +
13.540 +#if _GPG_ERR_GCC_VERSION > 30100
13.541 +#define _GPG_ERR_CONSTRUCTOR __attribute__ ((__constructor__))
13.542 +#define _GPG_ERR_HAVE_CONSTRUCTOR
13.543 +#endif
13.544 +#endif
13.545 +
13.546 +#ifndef _GPG_ERR_CONSTRUCTOR
13.547 +#define _GPG_ERR_CONSTRUCTOR
13.548 +#endif
13.549 +
13.550 +
13.551 +/* Initialization function. */
13.552 +
13.553 +/* Initialize the library. This function should be run early. */
13.554 +gpg_error_t gpg_err_init (void) _GPG_ERR_CONSTRUCTOR;
13.555 +
13.556 +/* If this is defined, the library is already initialized by the
13.557 + constructor and does not need to be initialized explicitely. */
13.558 +#undef GPG_ERR_INITIALIZED
13.559 +#ifdef _GPG_ERR_HAVE_CONSTRUCTOR
13.560 +#define GPG_ERR_INITIALIZED 1
13.561 +#endif
13.562 +
13.563 +/* See the source on how to use the deinit function; it is usually not
13.564 + required. */
13.565 +void gpg_err_deinit (int mode);
13.566 +
13.567 +
13.568 +/* Constructor and accessor functions. */
13.569 +
13.570 +/* Construct an error value from an error code and source. Within a
13.571 + subsystem, use gpg_error. */
13.572 +static GPG_ERR_INLINE gpg_error_t
13.573 +gpg_err_make (gpg_err_source_t source, gpg_err_code_t code)
13.574 +{
13.575 + return code == GPG_ERR_NO_ERROR ? GPG_ERR_NO_ERROR
13.576 + : (((source & GPG_ERR_SOURCE_MASK) << GPG_ERR_SOURCE_SHIFT)
13.577 + | (code & GPG_ERR_CODE_MASK));
13.578 +}
13.579 +
13.580 +
13.581 +/* The user should define GPG_ERR_SOURCE_DEFAULT before including this
13.582 + file to specify a default source for gpg_error. */
13.583 +#ifndef GPG_ERR_SOURCE_DEFAULT
13.584 +#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_UNKNOWN
13.585 +#endif
13.586 +
13.587 +static GPG_ERR_INLINE gpg_error_t
13.588 +gpg_error (gpg_err_code_t code)
13.589 +{
13.590 + return gpg_err_make (GPG_ERR_SOURCE_DEFAULT, code);
13.591 +}
13.592 +
13.593 +
13.594 +/* Retrieve the error code from an error value. */
13.595 +static GPG_ERR_INLINE gpg_err_code_t
13.596 +gpg_err_code (gpg_error_t err)
13.597 +{
13.598 + return (gpg_err_code_t) (err & GPG_ERR_CODE_MASK);
13.599 +}
13.600 +
13.601 +
13.602 +/* Retrieve the error source from an error value. */
13.603 +static GPG_ERR_INLINE gpg_err_source_t
13.604 +gpg_err_source (gpg_error_t err)
13.605 +{
13.606 + return (gpg_err_source_t) ((err >> GPG_ERR_SOURCE_SHIFT)
13.607 + & GPG_ERR_SOURCE_MASK);
13.608 +}
13.609 +
13.610 +
13.611 +/* String functions. */
13.612 +
13.613 +/* Return a pointer to a string containing a description of the error
13.614 + code in the error value ERR. This function is not thread-safe. */
13.615 +const char *gpg_strerror (gpg_error_t err);
13.616 +
13.617 +/* Return the error string for ERR in the user-supplied buffer BUF of
13.618 + size BUFLEN. This function is, in contrast to gpg_strerror,
13.619 + thread-safe if a thread-safe strerror_r() function is provided by
13.620 + the system. If the function succeeds, 0 is returned and BUF
13.621 + contains the string describing the error. If the buffer was not
13.622 + large enough, ERANGE is returned and BUF contains as much of the
13.623 + beginning of the error string as fits into the buffer. */
13.624 +int gpg_strerror_r (gpg_error_t err, char *buf, size_t buflen);
13.625 +
13.626 +/* Return a pointer to a string containing a description of the error
13.627 + source in the error value ERR. */
13.628 +const char *gpg_strsource (gpg_error_t err);
13.629 +
13.630 +
13.631 +/* Mapping of system errors (errno). */
13.632 +
13.633 +/* Retrieve the error code for the system error ERR. This returns
13.634 + GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
13.635 + this). */
13.636 +gpg_err_code_t gpg_err_code_from_errno (int err);
13.637 +
13.638 +
13.639 +/* Retrieve the system error for the error code CODE. This returns 0
13.640 + if CODE is not a system error code. */
13.641 +int gpg_err_code_to_errno (gpg_err_code_t code);
13.642 +
13.643 +
13.644 +/* Retrieve the error code directly from the ERRNO variable. This
13.645 + returns GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped
13.646 + (report this) and GPG_ERR_MISSING_ERRNO if ERRNO has the value 0. */
13.647 +gpg_err_code_t gpg_err_code_from_syserror (void);
13.648 +
13.649 +
13.650 +/* Set the ERRNO variable. This function is the preferred way to set
13.651 + ERRNO due to peculiarities on WindowsCE. */
13.652 +void gpg_err_set_errno (int err);
13.653 +
13.654 +
13.655 +/* Self-documenting convenience functions. */
13.656 +
13.657 +static GPG_ERR_INLINE gpg_error_t
13.658 +gpg_err_make_from_errno (gpg_err_source_t source, int err)
13.659 +{
13.660 + return gpg_err_make (source, gpg_err_code_from_errno (err));
13.661 +}
13.662 +
13.663 +
13.664 +static GPG_ERR_INLINE gpg_error_t
13.665 +gpg_error_from_errno (int err)
13.666 +{
13.667 + return gpg_error (gpg_err_code_from_errno (err));
13.668 +}
13.669 +
13.670 +static GPG_ERR_INLINE gpg_error_t
13.671 +gpg_error_from_syserror (void)
13.672 +{
13.673 + return gpg_error (gpg_err_code_from_syserror ());
13.674 +}
13.675 +
13.676 +#ifdef __cplusplus
13.677 +}
13.678 +#endif
13.679 +
13.680 +
13.681 +#endif /* GPG_ERROR_H */
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/Frameworks/libgpgerror.framework/Versions/1.10/Resources/English.lproj/InfoPlist.strings Thu Sep 06 18:49:22 2012 +0200
14.3 @@ -0,0 +1,3 @@
14.4 +/* Localized versions of Info.plist keys */
14.5 +
14.6 +CFBundleName = "libgpgerror";
15.1 Binary file Frameworks/libgpgerror.framework/Versions/1.10/Resources/Info.plist has changed
16.1 Binary file Frameworks/libgpgerror.framework/Versions/1.10/libgpgerror has changed
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2 +++ b/Frameworks/libgpgerror.framework/Versions/Current Thu Sep 06 18:49:22 2012 +0200
17.3 @@ -0,0 +1,1 @@
17.4 +1.10
17.5 \ No newline at end of file
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
18.2 +++ b/Frameworks/libgpgerror.framework/libgpgerror Thu Sep 06 18:49:22 2012 +0200
18.3 @@ -0,0 +1,1 @@
18.4 +Versions/1.10/libgpgerror
18.5 \ No newline at end of file
19.1 --- a/Frameworks/libotr.framework/Headers Wed Sep 05 23:24:55 2012 +0200
19.2 +++ b/Frameworks/libotr.framework/Headers Thu Sep 06 18:49:22 2012 +0200
19.3 @@ -1,1 +1,1 @@
19.4 -Versions/2.2.0/Headers
19.5 \ No newline at end of file
19.6 +Versions/3.2.1/Headers
19.7 \ No newline at end of file
20.1 --- a/Frameworks/libotr.framework/Resources Wed Sep 05 23:24:55 2012 +0200
20.2 +++ b/Frameworks/libotr.framework/Resources Thu Sep 06 18:49:22 2012 +0200
20.3 @@ -1,1 +1,1 @@
20.4 -Versions/2.2.0/Resources
20.5 \ No newline at end of file
20.6 +Versions/3.2.1/Resources
20.7 \ No newline at end of file
21.1 --- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/auth.h Wed Sep 05 23:24:55 2012 +0200
21.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
21.3 @@ -1,157 +0,0 @@
21.4 -/*
21.5 - * Off-the-Record Messaging library
21.6 - * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
21.7 - * <otr@cypherpunks.ca>
21.8 - *
21.9 - * This library is free software; you can redistribute it and/or
21.10 - * modify it under the terms of version 2.1 of the GNU Lesser General
21.11 - * Public License as published by the Free Software Foundation.
21.12 - *
21.13 - * This library is distributed in the hope that it will be useful,
21.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
21.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21.16 - * Lesser General Public License for more details.
21.17 - *
21.18 - * You should have received a copy of the GNU Lesser General Public
21.19 - * License along with this library; if not, write to the Free Software
21.20 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21.21 - */
21.22 -
21.23 -#ifndef __AUTH_H__
21.24 -#define __AUTH_H__
21.25 -
21.26 -#include <gcrypt.h>
21.27 -#include "dh.h"
21.28 -
21.29 -typedef enum {
21.30 - OTRL_AUTHSTATE_NONE,
21.31 - OTRL_AUTHSTATE_AWAITING_DHKEY,
21.32 - OTRL_AUTHSTATE_AWAITING_REVEALSIG,
21.33 - OTRL_AUTHSTATE_AWAITING_SIG,
21.34 - OTRL_AUTHSTATE_V1_SETUP
21.35 -} OtrlAuthState;
21.36 -
21.37 -typedef struct {
21.38 - OtrlAuthState authstate; /* Our state */
21.39 -
21.40 - DH_keypair our_dh; /* Our D-H key */
21.41 - unsigned int our_keyid; /* ...and its keyid */
21.42 -
21.43 - unsigned char *encgx; /* The encrypted value of g^x */
21.44 - size_t encgx_len; /* ...and its length */
21.45 - unsigned char r[16]; /* The encryption key */
21.46 -
21.47 - unsigned char hashgx[32]; /* SHA256(g^x) */
21.48 -
21.49 - gcry_mpi_t their_pub; /* Their D-H public key */
21.50 - unsigned int their_keyid; /* ...and its keyid */
21.51 -
21.52 - gcry_cipher_hd_t enc_c, enc_cp; /* c and c' encryption keys */
21.53 - gcry_md_hd_t mac_m1, mac_m1p; /* m1 and m1' MAC keys */
21.54 - gcry_md_hd_t mac_m2, mac_m2p; /* m2 and m2' MAC keys */
21.55 -
21.56 - unsigned char their_fingerprint[20]; /* The fingerprint of their
21.57 - long-term signing key */
21.58 -
21.59 - int initiated; /* Did we initiate this
21.60 - authentication? */
21.61 -
21.62 - unsigned int protocol_version; /* The protocol version number
21.63 - used to authenticate. */
21.64 -
21.65 - unsigned char secure_session_id[20]; /* The secure session id */
21.66 - size_t secure_session_id_len; /* And its actual length,
21.67 - which may be either 20 (for
21.68 - v1) or 8 (for v2) */
21.69 - OtrlSessionIdHalf session_id_half; /* Which half of the session
21.70 - id gets shown in bold */
21.71 -
21.72 - char *lastauthmsg; /* The last auth message
21.73 - (base-64 encoded) we sent,
21.74 - in case we need to
21.75 - retransmit it. */
21.76 -} OtrlAuthInfo;
21.77 -
21.78 -#include "privkey-t.h"
21.79 -
21.80 -/*
21.81 - * Initialize the fields of an OtrlAuthInfo (already allocated).
21.82 - */
21.83 -void otrl_auth_new(OtrlAuthInfo *auth);
21.84 -
21.85 -/*
21.86 - * Clear the fields of an OtrlAuthInfo (but leave it allocated).
21.87 - */
21.88 -void otrl_auth_clear(OtrlAuthInfo *auth);
21.89 -
21.90 -/*
21.91 - * Start a fresh AKE (version 2) using the given OtrlAuthInfo. Generate
21.92 - * a fresh DH keypair to use. If no error is returned, the message to
21.93 - * transmit will be contained in auth->lastauthmsg.
21.94 - */
21.95 -gcry_error_t otrl_auth_start_v2(OtrlAuthInfo *auth);
21.96 -
21.97 -/*
21.98 - * Handle an incoming D-H Commit Message. If no error is returned, the
21.99 - * message to send will be left in auth->lastauthmsg. Generate a fresh
21.100 - * keypair to use.
21.101 - */
21.102 -gcry_error_t otrl_auth_handle_commit(OtrlAuthInfo *auth,
21.103 - const char *commitmsg);
21.104 -
21.105 -/*
21.106 - * Handle an incoming D-H Key Message. If no error is returned, and
21.107 - * *havemsgp is 1, the message to sent will be left in auth->lastauthmsg.
21.108 - * Use the given private authentication key to sign messages.
21.109 - */
21.110 -gcry_error_t otrl_auth_handle_key(OtrlAuthInfo *auth, const char *keymsg,
21.111 - int *havemsgp, OtrlPrivKey *privkey);
21.112 -
21.113 -/*
21.114 - * Handle an incoming Reveal Signature Message. If no error is
21.115 - * returned, and *havemsgp is 1, the message to be sent will be left in
21.116 - * auth->lastauthmsg. Use the given private authentication key to sign
21.117 - * messages. Call the auth_succeeded callback if authentication is
21.118 - * successful.
21.119 - */
21.120 -gcry_error_t otrl_auth_handle_revealsig(OtrlAuthInfo *auth,
21.121 - const char *revealmsg, int *havemsgp, OtrlPrivKey *privkey,
21.122 - gcry_error_t (*auth_succeeded)(const OtrlAuthInfo *auth, void *asdata),
21.123 - void *asdata);
21.124 -
21.125 -/*
21.126 - * Handle an incoming Signature Message. If no error is returned, and
21.127 - * *havemsgp is 1, the message to be sent will be left in
21.128 - * auth->lastauthmsg. Call the auth_succeeded callback if
21.129 - * authentication is successful.
21.130 - */
21.131 -gcry_error_t otrl_auth_handle_signature(OtrlAuthInfo *auth,
21.132 - const char *sigmsg, int *havemsgp,
21.133 - gcry_error_t (*auth_succeeded)(const OtrlAuthInfo *auth, void *asdata),
21.134 - void *asdata);
21.135 -
21.136 -/*
21.137 - * Start a fresh AKE (version 1) using the given OtrlAuthInfo. If
21.138 - * our_dh is NULL, generate a fresh DH keypair to use. Otherwise, use a
21.139 - * copy of the one passed (with the given keyid). Use the given private
21.140 - * key to sign the message. If no error is returned, the message to
21.141 - * transmit will be contained in auth->lastauthmsg.
21.142 - */
21.143 -gcry_error_t otrl_auth_start_v1(OtrlAuthInfo *auth, DH_keypair *our_dh,
21.144 - unsigned int our_keyid, OtrlPrivKey *privkey);
21.145 -
21.146 -/*
21.147 - * Handle an incoming v1 Key Exchange Message. If no error is returned,
21.148 - * and *havemsgp is 1, the message to be sent will be left in
21.149 - * auth->lastauthmsg. Use the given private authentication key to sign
21.150 - * messages. Call the auth_secceeded callback if authentication is
21.151 - * successful. If non-NULL, use a copy of the given D-H keypair, with
21.152 - * the given keyid.
21.153 - */
21.154 -gcry_error_t otrl_auth_handle_v1_key_exchange(OtrlAuthInfo *auth,
21.155 - const char *keyexchmsg, int *havemsgp, OtrlPrivKey *privkey,
21.156 - DH_keypair *our_dh, unsigned int our_keyid,
21.157 - gcry_error_t (*auth_succeeded)(const OtrlAuthInfo *auth, void *asdata),
21.158 - void *asdata);
21.159 -
21.160 -#endif
22.1 --- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/b64.h Wed Sep 05 23:24:55 2012 +0200
22.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
22.3 @@ -1,57 +0,0 @@
22.4 -/*
22.5 - * Off-the-Record Messaging library
22.6 - * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
22.7 - * <otr@cypherpunks.ca>
22.8 - *
22.9 - * This library is free software; you can redistribute it and/or
22.10 - * modify it under the terms of version 2.1 of the GNU Lesser General
22.11 - * Public License as published by the Free Software Foundation.
22.12 - *
22.13 - * This library is distributed in the hope that it will be useful,
22.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
22.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22.16 - * Lesser General Public License for more details.
22.17 - *
22.18 - * You should have received a copy of the GNU Lesser General Public
22.19 - * License along with this library; if not, write to the Free Software
22.20 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22.21 - */
22.22 -
22.23 -#ifndef __B64_H__
22.24 -#define __B64_H__
22.25 -
22.26 -/*
22.27 - * base64 encode data. Insert no linebreaks or whitespace.
22.28 - *
22.29 - * The buffer base64data must contain at least ((datalen+2)/3)*4 bytes of
22.30 - * space. This function will return the number of bytes actually used.
22.31 - */
22.32 -size_t otrl_base64_encode(char *base64data, const unsigned char *data,
22.33 - size_t datalen);
22.34 -
22.35 -/*
22.36 - * base64 decode data. Skip non-base64 chars, and terminate at the
22.37 - * first '=', or the end of the buffer.
22.38 - *
22.39 - * The buffer data must contain at least (base64len / 4) * 3 bytes of
22.40 - * space. This function will return the number of bytes actually used.
22.41 - */
22.42 -size_t otrl_base64_decode(unsigned char *data, const char *base64data,
22.43 - size_t base64len);
22.44 -
22.45 -/*
22.46 - * Base64-encode a block of data, stick "?OTR:" and "." around it, and
22.47 - * return the result, or NULL in the event of a memory error.
22.48 - */
22.49 -char *otrl_base64_otr_encode(const unsigned char *buf, size_t buflen);
22.50 -
22.51 -/*
22.52 - * Base64-decode the portion of the given message between "?OTR:" and
22.53 - * ".". Set *bufp to the decoded data, and set *lenp to its length.
22.54 - * The caller must free() the result. Return 0 on success, -1 on a
22.55 - * memory error, or -2 on invalid input.
22.56 - */
22.57 -int otrl_base64_otr_decode(const char *msg, unsigned char **bufp,
22.58 - size_t *lenp);
22.59 -
22.60 -#endif
23.1 --- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/context.h Wed Sep 05 23:24:55 2012 +0200
23.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
23.3 @@ -1,179 +0,0 @@
23.4 -/*
23.5 - * Off-the-Record Messaging library
23.6 - * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
23.7 - * <otr@cypherpunks.ca>
23.8 - *
23.9 - * This library is free software; you can redistribute it and/or
23.10 - * modify it under the terms of version 2.1 of the GNU Lesser General
23.11 - * Public License as published by the Free Software Foundation.
23.12 - *
23.13 - * This library is distributed in the hope that it will be useful,
23.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
23.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23.16 - * Lesser General Public License for more details.
23.17 - *
23.18 - * You should have received a copy of the GNU Lesser General Public
23.19 - * License along with this library; if not, write to the Free Software
23.20 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23.21 - */
23.22 -
23.23 -#ifndef __CONTEXT_H__
23.24 -#define __CONTEXT_H__
23.25 -
23.26 -#include <gcrypt.h>
23.27 -
23.28 -#include "dh.h"
23.29 -#include "auth.h"
23.30 -#include "sm.h"
23.31 -
23.32 -typedef enum {
23.33 - OTRL_MSGSTATE_PLAINTEXT, /* Not yet started an encrypted
23.34 - conversation */
23.35 - OTRL_MSGSTATE_ENCRYPTED, /* Currently in an encrypted
23.36 - conversation */
23.37 - OTRL_MSGSTATE_FINISHED /* The remote side has sent us a
23.38 - notification that he has ended
23.39 - his end of the encrypted
23.40 - conversation; prevent any
23.41 - further messages from being
23.42 - sent to him. */
23.43 -} OtrlMessageState;
23.44 -
23.45 -typedef struct s_fingerprint {
23.46 - struct s_fingerprint *next; /* The next fingerprint in the list */
23.47 - struct s_fingerprint **tous; /* A pointer to the pointer to us */
23.48 - unsigned char *fingerprint; /* The fingerprint, or NULL */
23.49 - struct context *context; /* The context to which we belong */
23.50 - char *trust; /* The trust level of the fingerprint */
23.51 -} Fingerprint;
23.52 -
23.53 -typedef struct context {
23.54 - struct context * next; /* Linked list pointer */
23.55 - struct context ** tous; /* A pointer to the pointer to us */
23.56 -
23.57 - char * username; /* The user this context is for */
23.58 - char * accountname; /* The username is relative to
23.59 - this account... */
23.60 - char * protocol; /* ... and this protocol */
23.61 -
23.62 - char *fragment; /* The part of the fragmented message
23.63 - we've seen so far */
23.64 - size_t fragment_len; /* The length of fragment */
23.65 - unsigned short fragment_n; /* The total number of fragments
23.66 - in this message */
23.67 - unsigned short fragment_k; /* The highest fragment number
23.68 - we've seen so far for this
23.69 - message */
23.70 -
23.71 - OtrlMessageState msgstate; /* The state of message disposition
23.72 - with this user */
23.73 - OtrlAuthInfo auth; /* The state of ongoing
23.74 - authentication with this user */
23.75 -
23.76 - Fingerprint fingerprint_root; /* The root of a linked list of
23.77 - Fingerprints entries */
23.78 - Fingerprint *active_fingerprint; /* Which fingerprint is in use now?
23.79 - A pointer into the above list */
23.80 - unsigned int their_keyid; /* current keyid used by other side;
23.81 - this is set to 0 if we get a
23.82 - OTRL_TLV_DISCONNECTED message from
23.83 - them. */
23.84 - gcry_mpi_t their_y; /* Y[their_keyid] (their DH pubkey) */
23.85 - gcry_mpi_t their_old_y; /* Y[their_keyid-1] (their prev DH
23.86 - pubkey) */
23.87 - unsigned int our_keyid; /* current keyid used by us */
23.88 - DH_keypair our_dh_key; /* DH key[our_keyid] */
23.89 - DH_keypair our_old_dh_key; /* DH key[our_keyid-1] */
23.90 -
23.91 - DH_sesskeys sesskeys[2][2]; /* sesskeys[i][j] are the session keys
23.92 - derived from DH key[our_keyid-i]
23.93 - and mpi Y[their_keyid-j] */
23.94 -
23.95 - unsigned char sessionid[20]; /* The sessionid and bold half */
23.96 - size_t sessionid_len; /* determined when this private */
23.97 - OtrlSessionIdHalf sessionid_half; /* connection was established. */
23.98 -
23.99 - unsigned int protocol_version; /* The version of OTR in use */
23.100 -
23.101 - unsigned char *preshared_secret; /* A secret you share with this
23.102 - user, in order to do
23.103 - authentication. */
23.104 - size_t preshared_secret_len; /* The length of the above secret. */
23.105 -
23.106 - /* saved mac keys to be revealed later */
23.107 - unsigned int numsavedkeys;
23.108 - unsigned char *saved_mac_keys;
23.109 -
23.110 - /* generation number: increment every time we go private, and never
23.111 - * reset to 0 (unless we remove the context entirely) */
23.112 - unsigned int generation;
23.113 -
23.114 - time_t lastsent; /* The last time a Data Message was sent */
23.115 - char *lastmessage; /* The plaintext of the last Data Message sent */
23.116 - int may_retransmit; /* Is the last message eligible for
23.117 - retransmission? */
23.118 -
23.119 - enum {
23.120 - OFFER_NOT,
23.121 - OFFER_SENT,
23.122 - OFFER_REJECTED,
23.123 - OFFER_ACCEPTED
23.124 - } otr_offer; /* Has this correspondent repsponded to our
23.125 - OTR offers? */
23.126 -
23.127 - /* Application data to be associated with this context */
23.128 - void *app_data;
23.129 - /* A function to free the above data when we forget this context */
23.130 - void (*app_data_free)(void *);
23.131 -
23.132 - OtrlSMState *smstate; /* The state of the current
23.133 - socialist millionaires exchange */
23.134 -} ConnContext;
23.135 -
23.136 -#include "userstate.h"
23.137 -
23.138 -/* Look up a connection context by name/account/protocol from the given
23.139 - * OtrlUserState. If add_if_missing is true, allocate and return a new
23.140 - * context if one does not currently exist. In that event, call
23.141 - * add_app_data(data, context) so that app_data and app_data_free can be
23.142 - * filled in by the application, and set *addedp to 1. */
23.143 -ConnContext * otrl_context_find(OtrlUserState us, const char *user,
23.144 - const char *accountname, const char *protocol, int add_if_missing,
23.145 - int *addedp,
23.146 - void (*add_app_data)(void *data, ConnContext *context), void *data);
23.147 -
23.148 -/* Find a fingerprint in a given context, perhaps adding it if not
23.149 - * present. */
23.150 -Fingerprint *otrl_context_find_fingerprint(ConnContext *context,
23.151 - unsigned char fingerprint[20], int add_if_missing, int *addedp);
23.152 -
23.153 -/* Set the trust level for a given fingerprint */
23.154 -void otrl_context_set_trust(Fingerprint *fprint, const char *trust);
23.155 -
23.156 -/* Set the preshared secret for a given fingerprint. Note that this
23.157 - * currently only stores the secret in the ConnContext structure, but
23.158 - * doesn't yet do anything with it. */
23.159 -void otrl_context_set_preshared_secret(ConnContext *context,
23.160 - const unsigned char *secret, size_t secret_len);
23.161 -
23.162 -/* Force a context into the OTRL_MSGSTATE_FINISHED state. */
23.163 -void otrl_context_force_finished(ConnContext *context);
23.164 -
23.165 -/* Force a context into the OTRL_MSGSTATE_PLAINTEXT state. */
23.166 -void otrl_context_force_plaintext(ConnContext *context);
23.167 -
23.168 -/* Forget a fingerprint (so long as it's not the active one. If it's a
23.169 - * fingerprint_root, forget the whole context (as long as
23.170 - * and_maybe_context is set, and it's PLAINTEXT). Also, if it's not
23.171 - * the fingerprint_root, but it's the only fingerprint, and we're
23.172 - * PLAINTEXT, forget the whole context if and_maybe_context is set. */
23.173 -void otrl_context_forget_fingerprint(Fingerprint *fprint,
23.174 - int and_maybe_context);
23.175 -
23.176 -/* Forget a whole context, so long as it's PLAINTEXT. */
23.177 -void otrl_context_forget(ConnContext *context);
23.178 -
23.179 -/* Forget all the contexts in a given OtrlUserState. */
23.180 -void otrl_context_forget_all(OtrlUserState us);
23.181 -
23.182 -#endif
24.1 --- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/dh.h Wed Sep 05 23:24:55 2012 +0200
24.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
24.3 @@ -1,119 +0,0 @@
24.4 -/*
24.5 - * Off-the-Record Messaging library
24.6 - * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
24.7 - * <otr@cypherpunks.ca>
24.8 - *
24.9 - * This library is free software; you can redistribute it and/or
24.10 - * modify it under the terms of version 2.1 of the GNU Lesser General
24.11 - * Public License as published by the Free Software Foundation.
24.12 - *
24.13 - * This library is distributed in the hope that it will be useful,
24.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
24.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24.16 - * Lesser General Public License for more details.
24.17 - *
24.18 - * You should have received a copy of the GNU Lesser General Public
24.19 - * License along with this library; if not, write to the Free Software
24.20 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24.21 - */
24.22 -
24.23 -#ifndef __DH_H__
24.24 -#define __DH_H__
24.25 -
24.26 -#define DH1536_GROUP_ID 5
24.27 -
24.28 -typedef struct {
24.29 - unsigned int groupid;
24.30 - gcry_mpi_t priv, pub;
24.31 -} DH_keypair;
24.32 -
24.33 -/* Which half of the secure session id should be shown in bold? */
24.34 -typedef enum {
24.35 - OTRL_SESSIONID_FIRST_HALF_BOLD,
24.36 - OTRL_SESSIONID_SECOND_HALF_BOLD
24.37 -} OtrlSessionIdHalf;
24.38 -
24.39 -typedef struct {
24.40 - unsigned char sendctr[16];
24.41 - unsigned char rcvctr[16];
24.42 - gcry_cipher_hd_t sendenc;
24.43 - gcry_cipher_hd_t rcvenc;
24.44 - gcry_md_hd_t sendmac;
24.45 - unsigned char sendmackey[20];
24.46 - int sendmacused;
24.47 - gcry_md_hd_t rcvmac;
24.48 - unsigned char rcvmackey[20];
24.49 - int rcvmacused;
24.50 -} DH_sesskeys;
24.51 -
24.52 -/*
24.53 - * Call this once, at plugin load time. It sets up the modulus and
24.54 - * generator MPIs.
24.55 - */
24.56 -void otrl_dh_init(void);
24.57 -
24.58 -/*
24.59 - * Initialize the fields of a DH keypair.
24.60 - */
24.61 -void otrl_dh_keypair_init(DH_keypair *kp);
24.62 -
24.63 -/*
24.64 - * Copy a DH_keypair.
24.65 - */
24.66 -void otrl_dh_keypair_copy(DH_keypair *dst, const DH_keypair *src);
24.67 -
24.68 -/*
24.69 - * Deallocate the contents of a DH_keypair (but not the DH_keypair
24.70 - * itself)
24.71 - */
24.72 -void otrl_dh_keypair_free(DH_keypair *kp);
24.73 -
24.74 -/*
24.75 - * Generate a DH keypair for a specified group.
24.76 - */
24.77 -gcry_error_t otrl_dh_gen_keypair(unsigned int groupid, DH_keypair *kp);
24.78 -
24.79 -/*
24.80 - * Construct session keys from a DH keypair and someone else's public
24.81 - * key.
24.82 - */
24.83 -gcry_error_t otrl_dh_session(DH_sesskeys *sess, const DH_keypair *kp,
24.84 - gcry_mpi_t y);
24.85 -
24.86 -/*
24.87 - * Compute the secure session id, two encryption keys, and four MAC keys
24.88 - * given our DH key and their DH public key.
24.89 - */
24.90 -gcry_error_t otrl_dh_compute_v2_auth_keys(const DH_keypair *our_dh,
24.91 - gcry_mpi_t their_pub, unsigned char *sessionid, size_t *sessionidlenp,
24.92 - gcry_cipher_hd_t *enc_c, gcry_cipher_hd_t *enc_cp,
24.93 - gcry_md_hd_t *mac_m1, gcry_md_hd_t *mac_m1p,
24.94 - gcry_md_hd_t *mac_m2, gcry_md_hd_t *mac_m2p);
24.95 -
24.96 -/*
24.97 - * Compute the secure session id, given our DH key and their DH public
24.98 - * key.
24.99 - */
24.100 -gcry_error_t otrl_dh_compute_v1_session_id(const DH_keypair *our_dh,
24.101 - gcry_mpi_t their_pub, unsigned char *sessionid, size_t *sessionidlenp,
24.102 - OtrlSessionIdHalf *halfp);
24.103 -
24.104 -/*
24.105 - * Deallocate the contents of a DH_sesskeys (but not the DH_sesskeys
24.106 - * itself)
24.107 - */
24.108 -void otrl_dh_session_free(DH_sesskeys *sess);
24.109 -
24.110 -/*
24.111 - * Blank out the contents of a DH_sesskeys (without releasing it)
24.112 - */
24.113 -void otrl_dh_session_blank(DH_sesskeys *sess);
24.114 -
24.115 -/* Increment the top half of a counter block */
24.116 -void otrl_dh_incctr(unsigned char *ctr);
24.117 -
24.118 -/* Compare two counter values (8 bytes each). Return 0 if ctr1 == ctr2,
24.119 - * < 0 if ctr1 < ctr2 (as unsigned 64-bit values), > 0 if ctr1 > ctr2. */
24.120 -int otrl_dh_cmpctr(const unsigned char *ctr1, const unsigned char *ctr2);
24.121 -
24.122 -#endif
25.1 --- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/gcrypt-module.h Wed Sep 05 23:24:55 2012 +0200
25.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
25.3 @@ -1,233 +0,0 @@
25.4 -/* gcrypt-module.h - GNU Cryptographic Library Interface
25.5 - Copyright (C) 2003, 2007 Free Software Foundation, Inc.
25.6 -
25.7 - This file is part of Libgcrypt.
25.8 -
25.9 - Libgcrypt is free software; you can redistribute it and/or modify
25.10 - it under the terms of the GNU Lesser General Public License as
25.11 - published by the Free Software Foundation; either version 2.1 of
25.12 - the License, or (at your option) any later version.
25.13 -
25.14 - Libgcrypt is distributed in the hope that it will be useful,
25.15 - but WITHOUT ANY WARRANTY; without even the implied warranty of
25.16 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25.17 - GNU Lesser General Public License for more details.
25.18 -
25.19 - You should have received a copy of the GNU Lesser General Public
25.20 - License along with this program; if not, see <http://www.gnu.org/licenses/>.
25.21 - */
25.22 -
25.23 -/*
25.24 - This file contains the necessary declarations/definitions for
25.25 - working with Libgcrypt modules.
25.26 - */
25.27 -
25.28 -#ifndef _GCRYPT_MODULE_H
25.29 -#define _GCRYPT_MODULE_H
25.30 -
25.31 -#ifdef __cplusplus
25.32 -extern "C" {
25.33 -#if 0 /* keep Emacsens's auto-indent happy */
25.34 -}
25.35 -#endif
25.36 -#endif
25.37 -
25.38 -/* The interfaces using the module system reserve a certain range of
25.39 - IDs for application use. These IDs are not valid within Libgcrypt
25.40 - but Libgcrypt makes sure never to allocate such a module ID. */
25.41 -#define GCRY_MODULE_ID_USER 1024
25.42 -#define GCRY_MODULE_ID_USER_LAST 4095
25.43 -
25.44 -
25.45 -/* This type represents a `module'. */
25.46 -typedef struct gcry_module *gcry_module_t;
25.47 -
25.48 -/* Check that the library fulfills the version requirement. */
25.49 -
25.50 -/* Type for the cipher_setkey function. */
25.51 -typedef gcry_err_code_t (*gcry_cipher_setkey_t) (void *c,
25.52 - const unsigned char *key,
25.53 - unsigned keylen);
25.54 -
25.55 -/* Type for the cipher_encrypt function. */
25.56 -typedef void (*gcry_cipher_encrypt_t) (void *c,
25.57 - unsigned char *outbuf,
25.58 - const unsigned char *inbuf);
25.59 -
25.60 -/* Type for the cipher_decrypt function. */
25.61 -typedef void (*gcry_cipher_decrypt_t) (void *c,
25.62 - unsigned char *outbuf,
25.63 - const unsigned char *inbuf);
25.64 -
25.65 -/* Type for the cipher_stencrypt function. */
25.66 -typedef void (*gcry_cipher_stencrypt_t) (void *c,
25.67 - unsigned char *outbuf,
25.68 - const unsigned char *inbuf,
25.69 - unsigned int n);
25.70 -
25.71 -/* Type for the cipher_stdecrypt function. */
25.72 -typedef void (*gcry_cipher_stdecrypt_t) (void *c,
25.73 - unsigned char *outbuf,
25.74 - const unsigned char *inbuf,
25.75 - unsigned int n);
25.76 -
25.77 -typedef struct gcry_cipher_oid_spec
25.78 -{
25.79 - const char *oid;
25.80 - int mode;
25.81 -} gcry_cipher_oid_spec_t;
25.82 -
25.83 -/* Module specification structure for ciphers. */
25.84 -typedef struct gcry_cipher_spec
25.85 -{
25.86 - const char *name;
25.87 - const char **aliases;
25.88 - gcry_cipher_oid_spec_t *oids;
25.89 - size_t blocksize;
25.90 - size_t keylen;
25.91 - size_t contextsize;
25.92 - gcry_cipher_setkey_t setkey;
25.93 - gcry_cipher_encrypt_t encrypt;
25.94 - gcry_cipher_decrypt_t decrypt;
25.95 - gcry_cipher_stencrypt_t stencrypt;
25.96 - gcry_cipher_stdecrypt_t stdecrypt;
25.97 -} gcry_cipher_spec_t;
25.98 -
25.99 -/* Register a new cipher module whose specification can be found in
25.100 - CIPHER. On success, a new algorithm ID is stored in ALGORITHM_ID
25.101 - and a pointer representing this module is stored in MODULE. */
25.102 -gcry_error_t gcry_cipher_register (gcry_cipher_spec_t *cipher,
25.103 - int *algorithm_id,
25.104 - gcry_module_t *module);
25.105 -
25.106 -/* Unregister the cipher identified by MODULE, which must have been
25.107 - registered with gcry_cipher_register. */
25.108 -void gcry_cipher_unregister (gcry_module_t module);
25.109 -
25.110 -/* ********************** */
25.111 -
25.112 -/* Type for the pk_generate function. */
25.113 -typedef gcry_err_code_t (*gcry_pk_generate_t) (int algo,
25.114 - unsigned int nbits,
25.115 - unsigned long use_e,
25.116 - gcry_mpi_t *skey,
25.117 - gcry_mpi_t **retfactors);
25.118 -
25.119 -/* Type for the pk_check_secret_key function. */
25.120 -typedef gcry_err_code_t (*gcry_pk_check_secret_key_t) (int algo,
25.121 - gcry_mpi_t *skey);
25.122 -
25.123 -/* Type for the pk_encrypt function. */
25.124 -typedef gcry_err_code_t (*gcry_pk_encrypt_t) (int algo,
25.125 - gcry_mpi_t *resarr,
25.126 - gcry_mpi_t data,
25.127 - gcry_mpi_t *pkey,
25.128 - int flags);
25.129 -
25.130 -/* Type for the pk_decrypt function. */
25.131 -typedef gcry_err_code_t (*gcry_pk_decrypt_t) (int algo,
25.132 - gcry_mpi_t *result,
25.133 - gcry_mpi_t *data,
25.134 - gcry_mpi_t *skey,
25.135 - int flags);
25.136 -
25.137 -/* Type for the pk_sign function. */
25.138 -typedef gcry_err_code_t (*gcry_pk_sign_t) (int algo,
25.139 - gcry_mpi_t *resarr,
25.140 - gcry_mpi_t data,
25.141 - gcry_mpi_t *skey);
25.142 -
25.143 -/* Type for the pk_verify function. */
25.144 -typedef gcry_err_code_t (*gcry_pk_verify_t) (int algo,
25.145 - gcry_mpi_t hash,
25.146 - gcry_mpi_t *data,
25.147 - gcry_mpi_t *pkey,
25.148 - int (*cmp) (void *, gcry_mpi_t),
25.149 - void *opaquev);
25.150 -
25.151 -/* Type for the pk_get_nbits function. */
25.152 -typedef unsigned (*gcry_pk_get_nbits_t) (int algo, gcry_mpi_t *pkey);
25.153 -
25.154 -/* Module specification structure for message digests. */
25.155 -typedef struct gcry_pk_spec
25.156 -{
25.157 - const char *name;
25.158 - const char **aliases;
25.159 - const char *elements_pkey;
25.160 - const char *elements_skey;
25.161 - const char *elements_enc;
25.162 - const char *elements_sig;
25.163 - const char *elements_grip;
25.164 - int use;
25.165 - gcry_pk_generate_t generate;
25.166 - gcry_pk_check_secret_key_t check_secret_key;
25.167 - gcry_pk_encrypt_t encrypt;
25.168 - gcry_pk_decrypt_t decrypt;
25.169 - gcry_pk_sign_t sign;
25.170 - gcry_pk_verify_t verify;
25.171 - gcry_pk_get_nbits_t get_nbits;
25.172 -} gcry_pk_spec_t;
25.173 -
25.174 -/* Register a new pubkey module whose specification can be found in
25.175 - PUBKEY. On success, a new algorithm ID is stored in ALGORITHM_ID
25.176 - and a pointer representhing this module is stored in MODULE. */
25.177 -gcry_error_t gcry_pk_register (gcry_pk_spec_t *pubkey,
25.178 - unsigned int *algorithm_id,
25.179 - gcry_module_t *module);
25.180 -
25.181 -/* Unregister the pubkey identified by ID, which must have been
25.182 - registered with gcry_pk_register. */
25.183 -void gcry_pk_unregister (gcry_module_t module);
25.184 -
25.185 -/* ********************** */
25.186 -
25.187 -/* Type for the md_init function. */
25.188 -typedef void (*gcry_md_init_t) (void *c);
25.189 -
25.190 -/* Type for the md_write function. */
25.191 -typedef void (*gcry_md_write_t) (void *c, const void *buf, size_t nbytes);
25.192 -
25.193 -/* Type for the md_final function. */
25.194 -typedef void (*gcry_md_final_t) (void *c);
25.195 -
25.196 -/* Type for the md_read function. */
25.197 -typedef unsigned char *(*gcry_md_read_t) (void *c);
25.198 -
25.199 -typedef struct gcry_md_oid_spec
25.200 -{
25.201 - const char *oidstring;
25.202 -} gcry_md_oid_spec_t;
25.203 -
25.204 -/* Module specification structure for message digests. */
25.205 -typedef struct gcry_md_spec
25.206 -{
25.207 - const char *name;
25.208 - unsigned char *asnoid;
25.209 - int asnlen;
25.210 - gcry_md_oid_spec_t *oids;
25.211 - int mdlen;
25.212 - gcry_md_init_t init;
25.213 - gcry_md_write_t write;
25.214 - gcry_md_final_t final;
25.215 - gcry_md_read_t read;
25.216 - size_t contextsize; /* allocate this amount of context */
25.217 -} gcry_md_spec_t;
25.218 -
25.219 -/* Register a new digest module whose specification can be found in
25.220 - DIGEST. On success, a new algorithm ID is stored in ALGORITHM_ID
25.221 - and a pointer representhing this module is stored in MODULE. */
25.222 -gcry_error_t gcry_md_register (gcry_md_spec_t *digest,
25.223 - unsigned int *algorithm_id,
25.224 - gcry_module_t *module);
25.225 -
25.226 -/* Unregister the digest identified by ID, which must have been
25.227 - registered with gcry_digest_register. */
25.228 -void gcry_md_unregister (gcry_module_t module);
25.229 -
25.230 -#if 0 /* keep Emacsens's auto-indent happy */
25.231 -{
25.232 -#endif
25.233 -#ifdef __cplusplus
25.234 -}
25.235 -#endif
25.236 -#endif
26.1 --- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/gcrypt.h Wed Sep 05 23:24:55 2012 +0200
26.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
26.3 @@ -1,1831 +0,0 @@
26.4 -/* gcrypt.h - GNU Cryptographic Library Interface -*- c -*-
26.5 - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006
26.6 - 2007, 2008, 2009 Free Software Foundation, Inc.
26.7 -
26.8 - This file is part of Libgcrypt.
26.9 -
26.10 - Libgcrypt is free software; you can redistribute it and/or modify
26.11 - it under the terms of the GNU Lesser General Public License as
26.12 - published by the Free Software Foundation; either version 2.1 of
26.13 - the License, or (at your option) any later version.
26.14 -
26.15 - Libgcrypt is distributed in the hope that it will be useful,
26.16 - but WITHOUT ANY WARRANTY; without even the implied warranty of
26.17 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26.18 - GNU Lesser General Public License for more details.
26.19 -
26.20 - You should have received a copy of the GNU Lesser General Public
26.21 - License along with this program; if not, see <http://www.gnu.org/licenses/>.
26.22 -
26.23 - File: src/gcrypt.h. Generated from gcrypt.h.in by configure. */
26.24 -
26.25 -#ifndef _GCRYPT_H
26.26 -#define _GCRYPT_H
26.27 -
26.28 -#include <stdlib.h>
26.29 -#include <stdarg.h>
26.30 -#include <string.h>
26.31 -
26.32 -#include <gpg-error.h>
26.33 -
26.34 -#include <sys/types.h>
26.35 -
26.36 -#if defined _WIN32 || defined __WIN32__
26.37 -# include <winsock2.h>
26.38 -# include <ws2tcpip.h>
26.39 -#else
26.40 -# include <sys/socket.h>
26.41 -#endif /*!_WIN32*/
26.42 -
26.43 -typedef socklen_t gcry_socklen_t;
26.44 -
26.45 -#include <sys/time.h>
26.46 -
26.47 -/* This is required for error code compatibility. */
26.48 -#define _GCRY_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GCRYPT
26.49 -
26.50 -#ifdef __cplusplus
26.51 -extern "C" {
26.52 -#if 0 /* (Keep Emacsens' auto-indent happy.) */
26.53 -}
26.54 -#endif
26.55 -#endif
26.56 -
26.57 -/* The version of this header should match the one of the library. It
26.58 - should not be used by a program because gcry_check_version() should
26.59 - return the same version. The purpose of this macro is to let
26.60 - autoconf (using the AM_PATH_GCRYPT macro) check that this header
26.61 - matches the installed library. */
26.62 -#define GCRYPT_VERSION "1.4.4"
26.63 -
26.64 -/* Internal: We can't use the convenience macros for the multi
26.65 - precision integer functions when building this library. */
26.66 -#ifdef _GCRYPT_IN_LIBGCRYPT
26.67 -#ifndef GCRYPT_NO_MPI_MACROS
26.68 -#define GCRYPT_NO_MPI_MACROS 1
26.69 -#endif
26.70 -#endif
26.71 -
26.72 -/* We want to use gcc attributes when possible. Warning: Don't use
26.73 - these macros in your programs: As indicated by the leading
26.74 - underscore they are subject to change without notice. */
26.75 -#ifdef __GNUC__
26.76 -
26.77 -#define _GCRY_GCC_VERSION (__GNUC__ * 10000 \
26.78 - + __GNUC_MINOR__ * 100 \
26.79 - + __GNUC_PATCHLEVEL__)
26.80 -
26.81 -#if _GCRY_GCC_VERSION >= 30100
26.82 -#define _GCRY_GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__))
26.83 -#endif
26.84 -
26.85 -#if _GCRY_GCC_VERSION >= 29600
26.86 -#define _GCRY_GCC_ATTR_PURE __attribute__ ((__pure__))
26.87 -#endif
26.88 -
26.89 -#if _GCRY_GCC_VERSION >= 30200
26.90 -#define _GCRY_GCC_ATTR_MALLOC __attribute__ ((__malloc__))
26.91 -#endif
26.92 -
26.93 -#endif /*__GNUC__*/
26.94 -
26.95 -#ifndef _GCRY_GCC_ATTR_DEPRECATED
26.96 -#define _GCRY_GCC_ATTR_DEPRECATED
26.97 -#endif
26.98 -#ifndef _GCRY_GCC_ATTR_PURE
26.99 -#define _GCRY_GCC_ATTR_PURE
26.100 -#endif
26.101 -#ifndef _GCRY_GCC_ATTR_MALLOC
26.102 -#define _GCRY_GCC_ATTR_MALLOC
26.103 -#endif
26.104 -
26.105 -/* Some members in a public type should only be used internally.
26.106 - There is no "internal" attribute, so we abuse the deprecated
26.107 - attribute to discourage external use. */
26.108 -#ifdef _GCRYPT_IN_LIBGCRYPT
26.109 -#define _GCRY_ATTR_INTERNAL
26.110 -#else
26.111 -#define _GCRY_ATTR_INTERNAL _GCRY_GCC_ATTR_DEPRECATED
26.112 -#endif
26.113 -
26.114 -/* Wrappers for the libgpg-error library. */
26.115 -
26.116 -typedef gpg_error_t gcry_error_t;
26.117 -typedef gpg_err_code_t gcry_err_code_t;
26.118 -typedef gpg_err_source_t gcry_err_source_t;
26.119 -
26.120 -static GPG_ERR_INLINE gcry_error_t
26.121 -gcry_err_make (gcry_err_source_t source, gcry_err_code_t code)
26.122 -{
26.123 - return gpg_err_make (source, code);
26.124 -}
26.125 -
26.126 -/* The user can define GPG_ERR_SOURCE_DEFAULT before including this
26.127 - file to specify a default source for gpg_error. */
26.128 -#ifndef GCRY_ERR_SOURCE_DEFAULT
26.129 -#define GCRY_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_USER_1
26.130 -#endif
26.131 -
26.132 -static GPG_ERR_INLINE gcry_error_t
26.133 -gcry_error (gcry_err_code_t code)
26.134 -{
26.135 - return gcry_err_make (GCRY_ERR_SOURCE_DEFAULT, code);
26.136 -}
26.137 -
26.138 -static GPG_ERR_INLINE gcry_err_code_t
26.139 -gcry_err_code (gcry_error_t err)
26.140 -{
26.141 - return gpg_err_code (err);
26.142 -}
26.143 -
26.144 -
26.145 -static GPG_ERR_INLINE gcry_err_source_t
26.146 -gcry_err_source (gcry_error_t err)
26.147 -{
26.148 - return gpg_err_source (err);
26.149 -}
26.150 -
26.151 -/* Return a pointer to a string containing a description of the error
26.152 - code in the error value ERR. */
26.153 -const char *gcry_strerror (gcry_error_t err);
26.154 -
26.155 -/* Return a pointer to a string containing a description of the error
26.156 - source in the error value ERR. */
26.157 -const char *gcry_strsource (gcry_error_t err);
26.158 -
26.159 -/* Retrieve the error code for the system error ERR. This returns
26.160 - GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
26.161 - this). */
26.162 -gcry_err_code_t gcry_err_code_from_errno (int err);
26.163 -
26.164 -/* Retrieve the system error for the error code CODE. This returns 0
26.165 - if CODE is not a system error code. */
26.166 -int gcry_err_code_to_errno (gcry_err_code_t code);
26.167 -
26.168 -/* Return an error value with the error source SOURCE and the system
26.169 - error ERR. */
26.170 -gcry_error_t gcry_err_make_from_errno (gcry_err_source_t source, int err);
26.171 -
26.172 -/* Return an error value with the system error ERR. */
26.173 -gcry_err_code_t gcry_error_from_errno (int err);
26.174 -
26.175 -
26.176 -/* This enum is deprecated; it is only declared for the sake of
26.177 - complete API compatibility. */
26.178 -enum gcry_thread_option
26.179 - {
26.180 - _GCRY_THREAD_OPTION_DUMMY
26.181 - } _GCRY_GCC_ATTR_DEPRECATED;
26.182 -
26.183 -
26.184 -/* Constants defining the thread model to use. Used with the OPTION
26.185 - field of the struct gcry_thread_cbs. */
26.186 -#define GCRY_THREAD_OPTION_DEFAULT 0
26.187 -#define GCRY_THREAD_OPTION_USER 1
26.188 -#define GCRY_THREAD_OPTION_PTH 2
26.189 -#define GCRY_THREAD_OPTION_PTHREAD 3
26.190 -
26.191 -/* The version number encoded in the OPTION field of the struct
26.192 - gcry_thread_cbs. */
26.193 -#define GCRY_THREAD_OPTION_VERSION 0
26.194 -
26.195 -/* Wrapper for struct ath_ops. */
26.196 -struct gcry_thread_cbs
26.197 -{
26.198 - /* The OPTION field encodes the thread model and the version number
26.199 - of this structure.
26.200 - Bits 7 - 0 are used for the thread model
26.201 - Bits 15 - 8 are used for the version number.
26.202 - */
26.203 - unsigned int option;
26.204 -
26.205 - int (*init) (void);
26.206 - int (*mutex_init) (void **priv);
26.207 - int (*mutex_destroy) (void **priv);
26.208 - int (*mutex_lock) (void **priv);
26.209 - int (*mutex_unlock) (void **priv);
26.210 - ssize_t (*read) (int fd, void *buf, size_t nbytes);
26.211 - ssize_t (*write) (int fd, const void *buf, size_t nbytes);
26.212 -#ifdef _WIN32
26.213 - ssize_t (*select) (int nfd, void *rset, void *wset, void *eset,
26.214 - struct timeval *timeout);
26.215 - ssize_t (*waitpid) (pid_t pid, int *status, int options);
26.216 - int (*accept) (int s, void *addr, int *length_ptr);
26.217 - int (*connect) (int s, void *addr, gcry_socklen_t length);
26.218 - int (*sendmsg) (int s, const void *msg, int flags);
26.219 - int (*recvmsg) (int s, void *msg, int flags);
26.220 -#else
26.221 - ssize_t (*select) (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
26.222 - struct timeval *timeout);
26.223 - ssize_t (*waitpid) (pid_t pid, int *status, int options);
26.224 - int (*accept) (int s, struct sockaddr *addr, gcry_socklen_t *length_ptr);
26.225 - int (*connect) (int s, struct sockaddr *addr, gcry_socklen_t length);
26.226 - int (*sendmsg) (int s, const struct msghdr *msg, int flags);
26.227 - int (*recvmsg) (int s, struct msghdr *msg, int flags);
26.228 -#endif
26.229 -};
26.230 -
26.231 -#ifdef _WIN32
26.232 -# define _GCRY_THREAD_OPTION_PTH_IMPL_NET \
26.233 -static ssize_t gcry_pth_select (int nfd, void *rset, void *wset, \
26.234 - void *eset, struct timeval *timeout) \
26.235 - { return pth_select (nfd, rset, wset, eset, timeout); } \
26.236 -static ssize_t gcry_pth_waitpid (pid_t pid, int *status, int options) \
26.237 - { return pth_waitpid (pid, status, options); } \
26.238 -static int gcry_pth_accept (int s, void *addr, \
26.239 - gcry_socklen_t *length_ptr) \
26.240 - { return pth_accept (s, addr, length_ptr); } \
26.241 -static int gcry_pth_connect (int s, void *addr, \
26.242 - gcry_socklen_t length) \
26.243 - { return pth_connect (s, addr, length); }
26.244 -#else /*!_WIN32*/
26.245 -# define _GCRY_THREAD_OPTION_PTH_IMPL_NET \
26.246 -static ssize_t gcry_pth_select (int nfd, fd_set *rset, fd_set *wset, \
26.247 - fd_set *eset, struct timeval *timeout) \
26.248 - { return pth_select (nfd, rset, wset, eset, timeout); } \
26.249 -static ssize_t gcry_pth_waitpid (pid_t pid, int *status, int options) \
26.250 - { return pth_waitpid (pid, status, options); } \
26.251 -static int gcry_pth_accept (int s, struct sockaddr *addr, \
26.252 - gcry_socklen_t *length_ptr) \
26.253 - { return pth_accept (s, addr, length_ptr); } \
26.254 -static int gcry_pth_connect (int s, struct sockaddr *addr, \
26.255 - gcry_socklen_t length) \
26.256 - { return pth_connect (s, addr, length); }
26.257 -#endif /*!_WIN32*/
26.258 -
26.259 -
26.260 -
26.261 -#define GCRY_THREAD_OPTION_PTH_IMPL \
26.262 -static int gcry_pth_init (void) \
26.263 -{ return (pth_init () == FALSE) ? errno : 0; } \
26.264 -static int gcry_pth_mutex_init (void **priv) \
26.265 -{ \
26.266 - int err = 0; \
26.267 - pth_mutex_t *lock = malloc (sizeof (pth_mutex_t)); \
26.268 - \
26.269 - if (!lock) \
26.270 - err = ENOMEM; \
26.271 - if (!err) \
26.272 - { \
26.273 - err = pth_mutex_init (lock); \
26.274 - if (err == FALSE) \
26.275 - err = errno; \
26.276 - else \
26.277 - err = 0; \
26.278 - if (err) \
26.279 - free (lock); \
26.280 - else \
26.281 - *priv = lock; \
26.282 - } \
26.283 - return err; \
26.284 -} \
26.285 -static int gcry_pth_mutex_destroy (void **lock) \
26.286 - { /* GNU Pth has no destructor function. */ free (*lock); return 0; } \
26.287 -static int gcry_pth_mutex_lock (void **lock) \
26.288 - { return ((pth_mutex_acquire (*lock, 0, NULL)) == FALSE) \
26.289 - ? errno : 0; } \
26.290 -static int gcry_pth_mutex_unlock (void **lock) \
26.291 - { return ((pth_mutex_release (*lock)) == FALSE) \
26.292 - ? errno : 0; } \
26.293 -static ssize_t gcry_pth_read (int fd, void *buf, size_t nbytes) \
26.294 - { return pth_read (fd, buf, nbytes); } \
26.295 -static ssize_t gcry_pth_write (int fd, const void *buf, size_t nbytes) \
26.296 - { return pth_write (fd, buf, nbytes); } \
26.297 -_GCRY_THREAD_OPTION_PTH_IMPL_NET \
26.298 - \
26.299 -/* Note: GNU Pth is missing pth_sendmsg and pth_recvmsg. */ \
26.300 -static struct gcry_thread_cbs gcry_threads_pth = { \
26.301 - (GCRY_THREAD_OPTION_PTH | (GCRY_THREAD_OPTION_VERSION << 8)), \
26.302 - gcry_pth_init, gcry_pth_mutex_init, gcry_pth_mutex_destroy, \
26.303 - gcry_pth_mutex_lock, gcry_pth_mutex_unlock, gcry_pth_read, gcry_pth_write, \
26.304 - gcry_pth_select, gcry_pth_waitpid, gcry_pth_accept, gcry_pth_connect, \
26.305 - NULL, NULL }
26.306 -
26.307 -
26.308 -#define GCRY_THREAD_OPTION_PTHREAD_IMPL \
26.309 -static int gcry_pthread_mutex_init (void **priv) \
26.310 -{ \
26.311 - int err = 0; \
26.312 - pthread_mutex_t *lock = (pthread_mutex_t*)malloc (sizeof (pthread_mutex_t));\
26.313 - \
26.314 - if (!lock) \
26.315 - err = ENOMEM; \
26.316 - if (!err) \
26.317 - { \
26.318 - err = pthread_mutex_init (lock, NULL); \
26.319 - if (err) \
26.320 - free (lock); \
26.321 - else \
26.322 - *priv = lock; \
26.323 - } \
26.324 - return err; \
26.325 -} \
26.326 -static int gcry_pthread_mutex_destroy (void **lock) \
26.327 - { int err = pthread_mutex_destroy ((pthread_mutex_t*)*lock); \
26.328 - free (*lock); return err; } \
26.329 -static int gcry_pthread_mutex_lock (void **lock) \
26.330 - { return pthread_mutex_lock ((pthread_mutex_t*)*lock); } \
26.331 -static int gcry_pthread_mutex_unlock (void **lock) \
26.332 - { return pthread_mutex_unlock ((pthread_mutex_t*)*lock); } \
26.333 - \
26.334 -static struct gcry_thread_cbs gcry_threads_pthread = { \
26.335 - (GCRY_THREAD_OPTION_PTHREAD | (GCRY_THREAD_OPTION_VERSION << 8)), \
26.336 - NULL, gcry_pthread_mutex_init, gcry_pthread_mutex_destroy, \
26.337 - gcry_pthread_mutex_lock, gcry_pthread_mutex_unlock, \
26.338 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
26.339 -
26.340 -
26.341 -/* The data object used to hold a multi precision integer. */
26.342 -struct gcry_mpi;
26.343 -typedef struct gcry_mpi *gcry_mpi_t;
26.344 -
26.345 -#ifndef GCRYPT_NO_DEPRECATED
26.346 -typedef struct gcry_mpi *GCRY_MPI _GCRY_GCC_ATTR_DEPRECATED;
26.347 -typedef struct gcry_mpi *GcryMPI _GCRY_GCC_ATTR_DEPRECATED;
26.348 -#endif
26.349 -
26.350 -
26.351 -
26.352 -/* Check that the library fulfills the version requirement. */
26.353 -const char *gcry_check_version (const char *req_version);
26.354 -
26.355 -/* Codes for function dispatchers. */
26.356 -
26.357 -/* Codes used with the gcry_control function. */
26.358 -enum gcry_ctl_cmds
26.359 - {
26.360 - GCRYCTL_SET_KEY = 1,
26.361 - GCRYCTL_SET_IV = 2,
26.362 - GCRYCTL_CFB_SYNC = 3,
26.363 - GCRYCTL_RESET = 4, /* e.g. for MDs */
26.364 - GCRYCTL_FINALIZE = 5,
26.365 - GCRYCTL_GET_KEYLEN = 6,
26.366 - GCRYCTL_GET_BLKLEN = 7,
26.367 - GCRYCTL_TEST_ALGO = 8,
26.368 - GCRYCTL_IS_SECURE = 9,
26.369 - GCRYCTL_GET_ASNOID = 10,
26.370 - GCRYCTL_ENABLE_ALGO = 11,
26.371 - GCRYCTL_DISABLE_ALGO = 12,
26.372 - GCRYCTL_DUMP_RANDOM_STATS = 13,
26.373 - GCRYCTL_DUMP_SECMEM_STATS = 14,
26.374 - GCRYCTL_GET_ALGO_NPKEY = 15,
26.375 - GCRYCTL_GET_ALGO_NSKEY = 16,
26.376 - GCRYCTL_GET_ALGO_NSIGN = 17,
26.377 - GCRYCTL_GET_ALGO_NENCR = 18,
26.378 - GCRYCTL_SET_VERBOSITY = 19,
26.379 - GCRYCTL_SET_DEBUG_FLAGS = 20,
26.380 - GCRYCTL_CLEAR_DEBUG_FLAGS = 21,
26.381 - GCRYCTL_USE_SECURE_RNDPOOL= 22,
26.382 - GCRYCTL_DUMP_MEMORY_STATS = 23,
26.383 - GCRYCTL_INIT_SECMEM = 24,
26.384 - GCRYCTL_TERM_SECMEM = 25,
26.385 - GCRYCTL_DISABLE_SECMEM_WARN = 27,
26.386 - GCRYCTL_SUSPEND_SECMEM_WARN = 28,
26.387 - GCRYCTL_RESUME_SECMEM_WARN = 29,
26.388 - GCRYCTL_DROP_PRIVS = 30,
26.389 - GCRYCTL_ENABLE_M_GUARD = 31,
26.390 - GCRYCTL_START_DUMP = 32,
26.391 - GCRYCTL_STOP_DUMP = 33,
26.392 - GCRYCTL_GET_ALGO_USAGE = 34,
26.393 - GCRYCTL_IS_ALGO_ENABLED = 35,
26.394 - GCRYCTL_DISABLE_INTERNAL_LOCKING = 36,
26.395 - GCRYCTL_DISABLE_SECMEM = 37,
26.396 - GCRYCTL_INITIALIZATION_FINISHED = 38,
26.397 - GCRYCTL_INITIALIZATION_FINISHED_P = 39,
26.398 - GCRYCTL_ANY_INITIALIZATION_P = 40,
26.399 - GCRYCTL_SET_CBC_CTS = 41,
26.400 - GCRYCTL_SET_CBC_MAC = 42,
26.401 - GCRYCTL_SET_CTR = 43,
26.402 - GCRYCTL_ENABLE_QUICK_RANDOM = 44,
26.403 - GCRYCTL_SET_RANDOM_SEED_FILE = 45,
26.404 - GCRYCTL_UPDATE_RANDOM_SEED_FILE = 46,
26.405 - GCRYCTL_SET_THREAD_CBS = 47,
26.406 - GCRYCTL_FAST_POLL = 48,
26.407 - GCRYCTL_SET_RANDOM_DAEMON_SOCKET = 49,
26.408 - GCRYCTL_USE_RANDOM_DAEMON = 50,
26.409 - GCRYCTL_FAKED_RANDOM_P = 51,
26.410 - GCRYCTL_SET_RNDEGD_SOCKET = 52,
26.411 - GCRYCTL_PRINT_CONFIG = 53,
26.412 - GCRYCTL_OPERATIONAL_P = 54,
26.413 - GCRYCTL_FIPS_MODE_P = 55,
26.414 - GCRYCTL_FORCE_FIPS_MODE = 56,
26.415 - GCRYCTL_SELFTEST = 57
26.416 - /* Note: 58 .. 62 are used internally. */
26.417 - };
26.418 -
26.419 -/* Perform various operations defined by CMD. */
26.420 -gcry_error_t gcry_control (enum gcry_ctl_cmds CMD, ...);
26.421 -
26.422 -
26.423 -/* S-expression management. */
26.424 -
26.425 -/* The object to represent an S-expression as used with the public key
26.426 - functions. */
26.427 -struct gcry_sexp;
26.428 -typedef struct gcry_sexp *gcry_sexp_t;
26.429 -
26.430 -#ifndef GCRYPT_NO_DEPRECATED
26.431 -typedef struct gcry_sexp *GCRY_SEXP _GCRY_GCC_ATTR_DEPRECATED;
26.432 -typedef struct gcry_sexp *GcrySexp _GCRY_GCC_ATTR_DEPRECATED;
26.433 -#endif
26.434 -
26.435 -/* The possible values for the S-expression format. */
26.436 -enum gcry_sexp_format
26.437 - {
26.438 - GCRYSEXP_FMT_DEFAULT = 0,
26.439 - GCRYSEXP_FMT_CANON = 1,
26.440 - GCRYSEXP_FMT_BASE64 = 2,
26.441 - GCRYSEXP_FMT_ADVANCED = 3
26.442 - };
26.443 -
26.444 -/* Create an new S-expression object from BUFFER of size LENGTH and
26.445 - return it in RETSEXP. With AUTODETECT set to 0 the data in BUFFER
26.446 - is expected to be in canonized format. */
26.447 -gcry_error_t gcry_sexp_new (gcry_sexp_t *retsexp,
26.448 - const void *buffer, size_t length,
26.449 - int autodetect);
26.450 -
26.451 - /* Same as gcry_sexp_new but allows to pass a FREEFNC which has the
26.452 - effect to transfer ownership of BUFFER to the created object. */
26.453 -gcry_error_t gcry_sexp_create (gcry_sexp_t *retsexp,
26.454 - void *buffer, size_t length,
26.455 - int autodetect, void (*freefnc) (void *));
26.456 -
26.457 -/* Scan BUFFER and return a new S-expression object in RETSEXP. This
26.458 - function expects a printf like string in BUFFER. */
26.459 -gcry_error_t gcry_sexp_sscan (gcry_sexp_t *retsexp, size_t *erroff,
26.460 - const char *buffer, size_t length);
26.461 -
26.462 -/* Same as gcry_sexp_sscan but expects a string in FORMAT and can thus
26.463 - only be used for certain encodings. */
26.464 -gcry_error_t gcry_sexp_build (gcry_sexp_t *retsexp, size_t *erroff,
26.465 - const char *format, ...);
26.466 -
26.467 -/* Like gcry_sexp_build, but uses an array instead of variable
26.468 - function arguments. */
26.469 -gcry_error_t gcry_sexp_build_array (gcry_sexp_t *retsexp, size_t *erroff,
26.470 - const char *format, void **arg_list);
26.471 -
26.472 -/* Release the S-expression object SEXP */
26.473 -void gcry_sexp_release (gcry_sexp_t sexp);
26.474 -
26.475 -/* Calculate the length of an canonized S-expresion in BUFFER and
26.476 - check for a valid encoding. */
26.477 -size_t gcry_sexp_canon_len (const unsigned char *buffer, size_t length,
26.478 - size_t *erroff, gcry_error_t *errcode);
26.479 -
26.480 -/* Copies the S-expression object SEXP into BUFFER using the format
26.481 - specified in MODE. */
26.482 -size_t gcry_sexp_sprint (gcry_sexp_t sexp, int mode, void *buffer,
26.483 - size_t maxlength);
26.484 -
26.485 -/* Dumps the S-expression object A in a format suitable for debugging
26.486 - to Libgcrypt's logging stream. */
26.487 -void gcry_sexp_dump (const gcry_sexp_t a);
26.488 -
26.489 -gcry_sexp_t gcry_sexp_cons (const gcry_sexp_t a, const gcry_sexp_t b);
26.490 -gcry_sexp_t gcry_sexp_alist (const gcry_sexp_t *array);
26.491 -gcry_sexp_t gcry_sexp_vlist (const gcry_sexp_t a, ...);
26.492 -gcry_sexp_t gcry_sexp_append (const gcry_sexp_t a, const gcry_sexp_t n);
26.493 -gcry_sexp_t gcry_sexp_prepend (const gcry_sexp_t a, const gcry_sexp_t n);
26.494 -
26.495 -/* Scan the S-expression for a sublist with a type (the car of the
26.496 - list) matching the string TOKEN. If TOKLEN is not 0, the token is
26.497 - assumed to be raw memory of this length. The function returns a
26.498 - newly allocated S-expression consisting of the found sublist or
26.499 - `NULL' when not found. */
26.500 -gcry_sexp_t gcry_sexp_find_token (gcry_sexp_t list,
26.501 - const char *tok, size_t toklen);
26.502 -/* Return the length of the LIST. For a valid S-expression this
26.503 - should be at least 1. */
26.504 -int gcry_sexp_length (const gcry_sexp_t list);
26.505 -
26.506 -/* Create and return a new S-expression from the element with index
26.507 - NUMBER in LIST. Note that the first element has the index 0. If
26.508 - there is no such element, `NULL' is returned. */
26.509 -gcry_sexp_t gcry_sexp_nth (const gcry_sexp_t list, int number);
26.510 -
26.511 -/* Create and return a new S-expression from the first element in
26.512 - LIST; this called the "type" and should always exist and be a
26.513 - string. `NULL' is returned in case of a problem. */
26.514 -gcry_sexp_t gcry_sexp_car (const gcry_sexp_t list);
26.515 -
26.516 -/* Create and return a new list form all elements except for the first
26.517 - one. Note, that this function may return an invalid S-expression
26.518 - because it is not guaranteed, that the type exists and is a string.
26.519 - However, for parsing a complex S-expression it might be useful for
26.520 - intermediate lists. Returns `NULL' on error. */
26.521 -gcry_sexp_t gcry_sexp_cdr (const gcry_sexp_t list);
26.522 -
26.523 -gcry_sexp_t gcry_sexp_cadr (const gcry_sexp_t list);
26.524 -
26.525 -
26.526 -/* This function is used to get data from a LIST. A pointer to the
26.527 - actual data with index NUMBER is returned and the length of this
26.528 - data will be stored to DATALEN. If there is no data at the given
26.529 - index or the index represents another list, `NULL' is returned.
26.530 - *Note:* The returned pointer is valid as long as LIST is not
26.531 - modified or released. */
26.532 -const char *gcry_sexp_nth_data (const gcry_sexp_t list, int number,
26.533 - size_t *datalen);
26.534 -
26.535 -/* This function is used to get and convert data from a LIST. The
26.536 - data is assumed to be a Nul terminated string. The caller must
26.537 - release the returned value using `gcry_free'. If there is no data
26.538 - at the given index, the index represents a list or the value can't
26.539 - be converted to a string, `NULL' is returned. */
26.540 -char *gcry_sexp_nth_string (gcry_sexp_t list, int number);
26.541 -
26.542 -/* This function is used to get and convert data from a LIST. This
26.543 - data is assumed to be an MPI stored in the format described by
26.544 - MPIFMT and returned as a standard Libgcrypt MPI. The caller must
26.545 - release this returned value using `gcry_mpi_release'. If there is
26.546 - no data at the given index, the index represents a list or the
26.547 - value can't be converted to an MPI, `NULL' is returned. */
26.548 -gcry_mpi_t gcry_sexp_nth_mpi (gcry_sexp_t list, int number, int mpifmt);
26.549 -
26.550 -
26.551 -
26.552 -/*******************************************
26.553 - * *
26.554 - * Multi Precision Integer Functions *
26.555 - * *
26.556 - *******************************************/
26.557 -
26.558 -/* Different formats of external big integer representation. */
26.559 -enum gcry_mpi_format
26.560 - {
26.561 - GCRYMPI_FMT_NONE= 0,
26.562 - GCRYMPI_FMT_STD = 1, /* Twos complement stored without length. */
26.563 - GCRYMPI_FMT_PGP = 2, /* As used by OpenPGP (unsigned only). */
26.564 - GCRYMPI_FMT_SSH = 3, /* As used by SSH (like STD but with length). */
26.565 - GCRYMPI_FMT_HEX = 4, /* Hex format. */
26.566 - GCRYMPI_FMT_USG = 5 /* Like STD but unsigned. */
26.567 - };
26.568 -
26.569 -/* Flags used for creating big integers. */
26.570 -enum gcry_mpi_flag
26.571 - {
26.572 - GCRYMPI_FLAG_SECURE = 1, /* Allocate the number in "secure" memory. */
26.573 - GCRYMPI_FLAG_OPAQUE = 2 /* The number is not a real one but just
26.574 - a way to store some bytes. This is
26.575 - useful for encrypted big integers. */
26.576 - };
26.577 -
26.578 -
26.579 -/* Allocate a new big integer object, initialize it with 0 and
26.580 - initially allocate memory for a number of at least NBITS. */
26.581 -gcry_mpi_t gcry_mpi_new (unsigned int nbits);
26.582 -
26.583 -/* Same as gcry_mpi_new() but allocate in "secure" memory. */
26.584 -gcry_mpi_t gcry_mpi_snew (unsigned int nbits);
26.585 -
26.586 -/* Release the number A and free all associated resources. */
26.587 -void gcry_mpi_release (gcry_mpi_t a);
26.588 -
26.589 -/* Create a new number with the same value as A. */
26.590 -gcry_mpi_t gcry_mpi_copy (const gcry_mpi_t a);
26.591 -
26.592 -/* Store the big integer value U in W. */
26.593 -gcry_mpi_t gcry_mpi_set (gcry_mpi_t w, const gcry_mpi_t u);
26.594 -
26.595 -/* Store the unsigned integer value U in W. */
26.596 -gcry_mpi_t gcry_mpi_set_ui (gcry_mpi_t w, unsigned long u);
26.597 -
26.598 -/* Swap the values of A and B. */
26.599 -void gcry_mpi_swap (gcry_mpi_t a, gcry_mpi_t b);
26.600 -
26.601 -/* Compare the big integer number U and V returning 0 for equality, a
26.602 - positive value for U > V and a negative for U < V. */
26.603 -int gcry_mpi_cmp (const gcry_mpi_t u, const gcry_mpi_t v);
26.604 -
26.605 -/* Compare the big integer number U with the unsigned integer V
26.606 - returning 0 for equality, a positive value for U > V and a negative
26.607 - for U < V. */
26.608 -int gcry_mpi_cmp_ui (const gcry_mpi_t u, unsigned long v);
26.609 -
26.610 -/* Convert the external representation of an integer stored in BUFFER
26.611 - with a length of BUFLEN into a newly create MPI returned in
26.612 - RET_MPI. If NSCANNED is not NULL, it will receive the number of
26.613 - bytes actually scanned after a successful operation. */
26.614 -gcry_error_t gcry_mpi_scan (gcry_mpi_t *ret_mpi, enum gcry_mpi_format format,
26.615 - const void *buffer, size_t buflen,
26.616 - size_t *nscanned);
26.617 -
26.618 -/* Convert the big integer A into the external representation
26.619 - described by FORMAT and store it in the provided BUFFER which has
26.620 - been allocated by the user with a size of BUFLEN bytes. NWRITTEN
26.621 - receives the actual length of the external representation unless it
26.622 - has been passed as NULL. */
26.623 -gcry_error_t gcry_mpi_print (enum gcry_mpi_format format,
26.624 - unsigned char *buffer, size_t buflen,
26.625 - size_t *nwritten,
26.626 - const gcry_mpi_t a);
26.627 -
26.628 -/* Convert the big integer A int the external representation described
26.629 - by FORMAT and store it in a newly allocated buffer which address
26.630 - will be put into BUFFER. NWRITTEN receives the actual lengths of the
26.631 - external representation. */
26.632 -gcry_error_t gcry_mpi_aprint (enum gcry_mpi_format format,
26.633 - unsigned char **buffer, size_t *nwritten,
26.634 - const gcry_mpi_t a);
26.635 -
26.636 -/* Dump the value of A in a format suitable for debugging to
26.637 - Libgcrypt's logging stream. Note that one leading space but no
26.638 - trailing space or linefeed will be printed. It is okay to pass
26.639 - NULL for A. */
26.640 -void gcry_mpi_dump (const gcry_mpi_t a);
26.641 -
26.642 -
26.643 -/* W = U + V. */
26.644 -void gcry_mpi_add (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v);
26.645 -
26.646 -/* W = U + V. V is an unsigned integer. */
26.647 -void gcry_mpi_add_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v);
26.648 -
26.649 -/* W = U + V mod M. */
26.650 -void gcry_mpi_addm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m);
26.651 -
26.652 -/* W = U - V. */
26.653 -void gcry_mpi_sub (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v);
26.654 -
26.655 -/* W = U - V. V is an unsigned integer. */
26.656 -void gcry_mpi_sub_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v );
26.657 -
26.658 -/* W = U - V mod M */
26.659 -void gcry_mpi_subm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m);
26.660 -
26.661 -/* W = U * V. */
26.662 -void gcry_mpi_mul (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v);
26.663 -
26.664 -/* W = U * V. V is an unsigned integer. */
26.665 -void gcry_mpi_mul_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v );
26.666 -
26.667 -/* W = U * V mod M. */
26.668 -void gcry_mpi_mulm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m);
26.669 -
26.670 -/* W = U * (2 ^ CNT). */
26.671 -void gcry_mpi_mul_2exp (gcry_mpi_t w, gcry_mpi_t u, unsigned long cnt);
26.672 -
26.673 -/* Q = DIVIDEND / DIVISOR, R = DIVIDEND % DIVISOR,
26.674 - Q or R may be passed as NULL. ROUND should be negative or 0. */
26.675 -void gcry_mpi_div (gcry_mpi_t q, gcry_mpi_t r,
26.676 - gcry_mpi_t dividend, gcry_mpi_t divisor, int round);
26.677 -
26.678 -/* R = DIVIDEND % DIVISOR */
26.679 -void gcry_mpi_mod (gcry_mpi_t r, gcry_mpi_t dividend, gcry_mpi_t divisor);
26.680 -
26.681 -/* W = B ^ E mod M. */
26.682 -void gcry_mpi_powm (gcry_mpi_t w,
26.683 - const gcry_mpi_t b, const gcry_mpi_t e,
26.684 - const gcry_mpi_t m);
26.685 -
26.686 -/* Set G to the greatest common divisor of A and B.
26.687 - Return true if the G is 1. */
26.688 -int gcry_mpi_gcd (gcry_mpi_t g, gcry_mpi_t a, gcry_mpi_t b);
26.689 -
26.690 -/* Set X to the multiplicative inverse of A mod M.
26.691 - Return true if the value exists. */
26.692 -int gcry_mpi_invm (gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t m);
26.693 -
26.694 -
26.695 -/* Return the number of bits required to represent A. */
26.696 -unsigned int gcry_mpi_get_nbits (gcry_mpi_t a);
26.697 -
26.698 -/* Return true when bit number N (counting from 0) is set in A. */
26.699 -int gcry_mpi_test_bit (gcry_mpi_t a, unsigned int n);
26.700 -
26.701 -/* Set bit number N in A. */
26.702 -void gcry_mpi_set_bit (gcry_mpi_t a, unsigned int n);
26.703 -
26.704 -/* Clear bit number N in A. */
26.705 -void gcry_mpi_clear_bit (gcry_mpi_t a, unsigned int n);
26.706 -
26.707 -/* Set bit number N in A and clear all bits greater than N. */
26.708 -void gcry_mpi_set_highbit (gcry_mpi_t a, unsigned int n);
26.709 -
26.710 -/* Clear bit number N in A and all bits greater than N. */
26.711 -void gcry_mpi_clear_highbit (gcry_mpi_t a, unsigned int n);
26.712 -
26.713 -/* Shift the value of A by N bits to the right and store the result in X. */
26.714 -void gcry_mpi_rshift (gcry_mpi_t x, gcry_mpi_t a, unsigned int n);
26.715 -
26.716 -/* Shift the value of A by N bits to the left and store the result in X. */
26.717 -void gcry_mpi_lshift (gcry_mpi_t x, gcry_mpi_t a, unsigned int n);
26.718 -
26.719 -/* Store NBITS of the value P points to in A and mark A as an opaque
26.720 - value. WARNING: Never use an opaque MPI for anything thing else then
26.721 - gcry_mpi_release, gcry_mpi_get_opaque. */
26.722 -gcry_mpi_t gcry_mpi_set_opaque (gcry_mpi_t a, void *p, unsigned int nbits);
26.723 -
26.724 -/* Return a pointer to an opaque value stored in A and return its size
26.725 - in NBITS. Note that the returned pointer is still owned by A and
26.726 - that the function should never be used for an non-opaque MPI. */
26.727 -void *gcry_mpi_get_opaque (gcry_mpi_t a, unsigned int *nbits);
26.728 -
26.729 -/* Set the FLAG for the big integer A. Currently only the flag
26.730 - GCRYMPI_FLAG_SECURE is allowed to convert A into an big intger
26.731 - stored in "secure" memory. */
26.732 -void gcry_mpi_set_flag (gcry_mpi_t a, enum gcry_mpi_flag flag);
26.733 -
26.734 -/* Clear FLAG for the big integer A. Note that this function is
26.735 - currently useless as no flags are allowed. */
26.736 -void gcry_mpi_clear_flag (gcry_mpi_t a, enum gcry_mpi_flag flag);
26.737 -
26.738 -/* Return true when the FLAG is set for A. */
26.739 -int gcry_mpi_get_flag (gcry_mpi_t a, enum gcry_mpi_flag flag);
26.740 -
26.741 -/* Unless the GCRYPT_NO_MPI_MACROS is used, provide a couple of
26.742 - convenience macros for the big integer functions. */
26.743 -#ifndef GCRYPT_NO_MPI_MACROS
26.744 -#define mpi_new(n) gcry_mpi_new( (n) )
26.745 -#define mpi_secure_new( n ) gcry_mpi_snew( (n) )
26.746 -#define mpi_release(a) \
26.747 - do \
26.748 - { \
26.749 - gcry_mpi_release ((a)); \
26.750 - (a) = NULL; \
26.751 - } \
26.752 - while (0)
26.753 -
26.754 -#define mpi_copy( a ) gcry_mpi_copy( (a) )
26.755 -#define mpi_set( w, u) gcry_mpi_set( (w), (u) )
26.756 -#define mpi_set_ui( w, u) gcry_mpi_set_ui( (w), (u) )
26.757 -#define mpi_cmp( u, v ) gcry_mpi_cmp( (u), (v) )
26.758 -#define mpi_cmp_ui( u, v ) gcry_mpi_cmp_ui( (u), (v) )
26.759 -
26.760 -#define mpi_add_ui(w,u,v) gcry_mpi_add_ui((w),(u),(v))
26.761 -#define mpi_add(w,u,v) gcry_mpi_add ((w),(u),(v))
26.762 -#define mpi_addm(w,u,v,m) gcry_mpi_addm ((w),(u),(v),(m))
26.763 -#define mpi_sub_ui(w,u,v) gcry_mpi_sub_ui ((w),(u),(v))
26.764 -#define mpi_sub(w,u,v) gcry_mpi_sub ((w),(u),(v))
26.765 -#define mpi_subm(w,u,v,m) gcry_mpi_subm ((w),(u),(v),(m))
26.766 -#define mpi_mul_ui(w,u,v) gcry_mpi_mul_ui ((w),(u),(v))
26.767 -#define mpi_mul_2exp(w,u,v) gcry_mpi_mul_2exp ((w),(u),(v))
26.768 -#define mpi_mul(w,u,v) gcry_mpi_mul ((w),(u),(v))
26.769 -#define mpi_mulm(w,u,v,m) gcry_mpi_mulm ((w),(u),(v),(m))
26.770 -#define mpi_powm(w,b,e,m) gcry_mpi_powm ( (w), (b), (e), (m) )
26.771 -#define mpi_tdiv(q,r,a,m) gcry_mpi_div ( (q), (r), (a), (m), 0)
26.772 -#define mpi_fdiv(q,r,a,m) gcry_mpi_div ( (q), (r), (a), (m), -1)
26.773 -#define mpi_mod(r,a,m) gcry_mpi_mod ((r), (a), (m))
26.774 -#define mpi_gcd(g,a,b) gcry_mpi_gcd ( (g), (a), (b) )
26.775 -#define mpi_invm(g,a,b) gcry_mpi_invm ( (g), (a), (b) )
26.776 -
26.777 -#define mpi_get_nbits(a) gcry_mpi_get_nbits ((a))
26.778 -#define mpi_test_bit(a,b) gcry_mpi_test_bit ((a),(b))
26.779 -#define mpi_set_bit(a,b) gcry_mpi_set_bit ((a),(b))
26.780 -#define mpi_set_highbit(a,b) gcry_mpi_set_highbit ((a),(b))
26.781 -#define mpi_clear_bit(a,b) gcry_mpi_clear_bit ((a),(b))
26.782 -#define mpi_clear_highbit(a,b) gcry_mpi_clear_highbit ((a),(b))
26.783 -#define mpi_rshift(a,b,c) gcry_mpi_rshift ((a),(b),(c))
26.784 -#define mpi_lshift(a,b,c) gcry_mpi_lshift ((a),(b),(c))
26.785 -
26.786 -#define mpi_set_opaque(a,b,c) gcry_mpi_set_opaque( (a), (b), (c) )
26.787 -#define mpi_get_opaque(a,b) gcry_mpi_get_opaque( (a), (b) )
26.788 -#endif /* GCRYPT_NO_MPI_MACROS */
26.789 -
26.790 -
26.791 -
26.792 -/************************************
26.793 - * *
26.794 - * Symmetric Cipher Functions *
26.795 - * *
26.796 - ************************************/
26.797 -
26.798 -/* The data object used to hold a handle to an encryption object. */
26.799 -struct gcry_cipher_handle;
26.800 -typedef struct gcry_cipher_handle *gcry_cipher_hd_t;
26.801 -
26.802 -#ifndef GCRYPT_NO_DEPRECATED
26.803 -typedef struct gcry_cipher_handle *GCRY_CIPHER_HD _GCRY_GCC_ATTR_DEPRECATED;
26.804 -typedef struct gcry_cipher_handle *GcryCipherHd _GCRY_GCC_ATTR_DEPRECATED;
26.805 -#endif
26.806 -
26.807 -/* All symmetric encryption algorithms are identified by their IDs.
26.808 - More IDs may be registered at runtime. */
26.809 -enum gcry_cipher_algos
26.810 - {
26.811 - GCRY_CIPHER_NONE = 0,
26.812 - GCRY_CIPHER_IDEA = 1,
26.813 - GCRY_CIPHER_3DES = 2,
26.814 - GCRY_CIPHER_CAST5 = 3,
26.815 - GCRY_CIPHER_BLOWFISH = 4,
26.816 - GCRY_CIPHER_SAFER_SK128 = 5,
26.817 - GCRY_CIPHER_DES_SK = 6,
26.818 - GCRY_CIPHER_AES = 7,
26.819 - GCRY_CIPHER_AES192 = 8,
26.820 - GCRY_CIPHER_AES256 = 9,
26.821 - GCRY_CIPHER_TWOFISH = 10,
26.822 -
26.823 - /* Other cipher numbers are above 300 for OpenPGP reasons. */
26.824 - GCRY_CIPHER_ARCFOUR = 301, /* Fully compatible with RSA's RC4 (tm). */
26.825 - GCRY_CIPHER_DES = 302, /* Yes, this is single key 56 bit DES. */
26.826 - GCRY_CIPHER_TWOFISH128 = 303,
26.827 - GCRY_CIPHER_SERPENT128 = 304,
26.828 - GCRY_CIPHER_SERPENT192 = 305,
26.829 - GCRY_CIPHER_SERPENT256 = 306,
26.830 - GCRY_CIPHER_RFC2268_40 = 307, /* Ron's Cipher 2 (40 bit). */
26.831 - GCRY_CIPHER_RFC2268_128 = 308, /* Ron's Cipher 2 (128 bit). */
26.832 - GCRY_CIPHER_SEED = 309, /* 128 bit cipher described in RFC4269. */
26.833 - GCRY_CIPHER_CAMELLIA128 = 310,
26.834 - GCRY_CIPHER_CAMELLIA192 = 311,
26.835 - GCRY_CIPHER_CAMELLIA256 = 312
26.836 - };
26.837 -
26.838 -/* The Rijndael algorithm is basically AES, so provide some macros. */
26.839 -#define GCRY_CIPHER_AES128 GCRY_CIPHER_AES
26.840 -#define GCRY_CIPHER_RIJNDAEL GCRY_CIPHER_AES
26.841 -#define GCRY_CIPHER_RIJNDAEL128 GCRY_CIPHER_AES128
26.842 -#define GCRY_CIPHER_RIJNDAEL192 GCRY_CIPHER_AES192
26.843 -#define GCRY_CIPHER_RIJNDAEL256 GCRY_CIPHER_AES256
26.844 -
26.845 -/* The supported encryption modes. Note that not all of them are
26.846 - supported for each algorithm. */
26.847 -enum gcry_cipher_modes
26.848 - {
26.849 - GCRY_CIPHER_MODE_NONE = 0, /* Not yet specified. */
26.850 - GCRY_CIPHER_MODE_ECB = 1, /* Electronic codebook. */
26.851 - GCRY_CIPHER_MODE_CFB = 2, /* Cipher feedback. */
26.852 - GCRY_CIPHER_MODE_CBC = 3, /* Cipher block chaining. */
26.853 - GCRY_CIPHER_MODE_STREAM = 4, /* Used with stream ciphers. */
26.854 - GCRY_CIPHER_MODE_OFB = 5, /* Outer feedback. */
26.855 - GCRY_CIPHER_MODE_CTR = 6 /* Counter. */
26.856 - };
26.857 -
26.858 -/* Flags used with the open function. */
26.859 -enum gcry_cipher_flags
26.860 - {
26.861 - GCRY_CIPHER_SECURE = 1, /* Allocate in secure memory. */
26.862 - GCRY_CIPHER_ENABLE_SYNC = 2, /* Enable CFB sync mode. */
26.863 - GCRY_CIPHER_CBC_CTS = 4, /* Enable CBC cipher text stealing (CTS). */
26.864 - GCRY_CIPHER_CBC_MAC = 8 /* Enable CBC message auth. code (MAC). */
26.865 - };
26.866 -
26.867 -
26.868 -/* Create a handle for algorithm ALGO to be used in MODE. FLAGS may
26.869 - be given as an bitwise OR of the gcry_cipher_flags values. */
26.870 -gcry_error_t gcry_cipher_open (gcry_cipher_hd_t *handle,
26.871 - int algo, int mode, unsigned int flags);
26.872 -
26.873 -/* Close the cioher handle H and release all resource. */
26.874 -void gcry_cipher_close (gcry_cipher_hd_t h);
26.875 -
26.876 -/* Perform various operations on the cipher object H. */
26.877 -gcry_error_t gcry_cipher_ctl (gcry_cipher_hd_t h, int cmd, void *buffer,
26.878 - size_t buflen);
26.879 -
26.880 -/* Retrieve various information about the cipher object H. */
26.881 -gcry_error_t gcry_cipher_info (gcry_cipher_hd_t h, int what, void *buffer,
26.882 - size_t *nbytes);
26.883 -
26.884 -/* Retrieve various information about the cipher algorithm ALGO. */
26.885 -gcry_error_t gcry_cipher_algo_info (int algo, int what, void *buffer,
26.886 - size_t *nbytes);
26.887 -
26.888 -/* Map the cipher algorithm whose ID is contained in ALGORITHM to a
26.889 - string representation of the algorithm name. For unknown algorithm
26.890 - IDs this function returns "?". */
26.891 -const char *gcry_cipher_algo_name (int algorithm) _GCRY_GCC_ATTR_PURE;
26.892 -
26.893 -/* Map the algorithm name NAME to an cipher algorithm ID. Return 0 if
26.894 - the algorithm name is not known. */
26.895 -int gcry_cipher_map_name (const char *name) _GCRY_GCC_ATTR_PURE;
26.896 -
26.897 -/* Given an ASN.1 object identifier in standard IETF dotted decimal
26.898 - format in STRING, return the encryption mode associated with that
26.899 - OID or 0 if not known or applicable. */
26.900 -int gcry_cipher_mode_from_oid (const char *string) _GCRY_GCC_ATTR_PURE;
26.901 -
26.902 -/* Encrypt the plaintext of size INLEN in IN using the cipher handle H
26.903 - into the buffer OUT which has an allocated length of OUTSIZE. For
26.904 - most algorithms it is possible to pass NULL for in and 0 for INLEN
26.905 - and do a in-place decryption of the data provided in OUT. */
26.906 -gcry_error_t gcry_cipher_encrypt (gcry_cipher_hd_t h,
26.907 - void *out, size_t outsize,
26.908 - const void *in, size_t inlen);
26.909 -
26.910 -/* The counterpart to gcry_cipher_encrypt. */
26.911 -gcry_error_t gcry_cipher_decrypt (gcry_cipher_hd_t h,
26.912 - void *out, size_t outsize,
26.913 - const void *in, size_t inlen);
26.914 -
26.915 -/* Set KEY of length KEYLEN for the cipher handle HD. */
26.916 -gcry_error_t gcry_cipher_setkey (gcry_cipher_hd_t hd,
26.917 - const void *key, size_t keylen);
26.918 -
26.919 -
26.920 -/* Set initialization vector IV of length IVLEN for the cipher handle HD. */
26.921 -gcry_error_t gcry_cipher_setiv (gcry_cipher_hd_t hd,
26.922 - const void *iv, size_t ivlen);
26.923 -
26.924 -
26.925 -/* Reset the handle to the state after open. */
26.926 -#define gcry_cipher_reset(h) gcry_cipher_ctl ((h), GCRYCTL_RESET, NULL, 0)
26.927 -
26.928 -/* Perform the OpenPGP sync operation if this is enabled for the
26.929 - cipher handle H. */
26.930 -#define gcry_cipher_sync(h) gcry_cipher_ctl( (h), GCRYCTL_CFB_SYNC, NULL, 0)
26.931 -
26.932 -/* Enable or disable CTS in future calls to gcry_encrypt(). CBC mode only. */
26.933 -#define gcry_cipher_cts(h,on) gcry_cipher_ctl( (h), GCRYCTL_SET_CBC_CTS, \
26.934 - NULL, on )
26.935 -
26.936 -/* Set counter for CTR mode. (CTR,CTRLEN) must denote a buffer of
26.937 - block size length, or (NULL,0) to set the CTR to the all-zero block. */
26.938 -gpg_error_t gcry_cipher_setctr (gcry_cipher_hd_t hd,
26.939 - const void *ctr, size_t ctrlen);
26.940 -
26.941 -/* Retrieved the key length used with algorithm A. */
26.942 -size_t gcry_cipher_get_algo_keylen (int algo);
26.943 -
26.944 -/* Retrieve the block length used with algorithm A. */
26.945 -size_t gcry_cipher_get_algo_blklen (int algo);
26.946 -
26.947 -/* Return 0 if the algorithm A is available for use. */
26.948 -#define gcry_cipher_test_algo(a) \
26.949 - gcry_cipher_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL )
26.950 -
26.951 -/* Get a list consisting of the IDs of the loaded cipher modules. If
26.952 - LIST is zero, write the number of loaded cipher modules to
26.953 - LIST_LENGTH and return. If LIST is non-zero, the first
26.954 - *LIST_LENGTH algorithm IDs are stored in LIST, which must be of
26.955 - according size. In case there are less cipher modules than
26.956 - *LIST_LENGTH, *LIST_LENGTH is updated to the correct number. */
26.957 -gcry_error_t gcry_cipher_list (int *list, int *list_length);
26.958 -
26.959 -
26.960 -/************************************
26.961 - * *
26.962 - * Asymmetric Cipher Functions *
26.963 - * *
26.964 - ************************************/
26.965 -
26.966 -/* The algorithms and their IDs we support. */
26.967 -enum gcry_pk_algos
26.968 - {
26.969 - GCRY_PK_RSA = 1,
26.970 - GCRY_PK_RSA_E = 2, /* (deprecated) */
26.971 - GCRY_PK_RSA_S = 3, /* (deprecated) */
26.972 - GCRY_PK_ELG_E = 16,
26.973 - GCRY_PK_DSA = 17,
26.974 - GCRY_PK_ELG = 20,
26.975 - GCRY_PK_ECDSA = 301
26.976 - };
26.977 -
26.978 -/* Flags describing usage capabilities of a PK algorithm. */
26.979 -#define GCRY_PK_USAGE_SIGN 1 /* Good for signatures. */
26.980 -#define GCRY_PK_USAGE_ENCR 2 /* Good for encryption. */
26.981 -#define GCRY_PK_USAGE_CERT 4 /* Good to certify other keys. */
26.982 -#define GCRY_PK_USAGE_AUTH 8 /* Good for authentication. */
26.983 -#define GCRY_PK_USAGE_UNKN 128 /* Unknown usage flag. */
26.984 -
26.985 -/* Encrypt the DATA using the public key PKEY and store the result as
26.986 - a newly created S-expression at RESULT. */
26.987 -gcry_error_t gcry_pk_encrypt (gcry_sexp_t *result,
26.988 - gcry_sexp_t data, gcry_sexp_t pkey);
26.989 -
26.990 -/* Decrypt the DATA using the private key SKEY and store the result as
26.991 - a newly created S-expression at RESULT. */
26.992 -gcry_error_t gcry_pk_decrypt (gcry_sexp_t *result,
26.993 - gcry_sexp_t data, gcry_sexp_t skey);
26.994 -
26.995 -/* Sign the DATA using the private key SKEY and store the result as
26.996 - a newly created S-expression at RESULT. */
26.997 -gcry_error_t gcry_pk_sign (gcry_sexp_t *result,
26.998 - gcry_sexp_t data, gcry_sexp_t skey);
26.999 -
26.1000 -/* Check the signature SIGVAL on DATA using the public key PKEY. */
26.1001 -gcry_error_t gcry_pk_verify (gcry_sexp_t sigval,
26.1002 - gcry_sexp_t data, gcry_sexp_t pkey);
26.1003 -
26.1004 -/* Check that private KEY is sane. */
26.1005 -gcry_error_t gcry_pk_testkey (gcry_sexp_t key);
26.1006 -
26.1007 -/* Generate a new key pair according to the parameters given in
26.1008 - S_PARMS. The new key pair is returned in as an S-expression in
26.1009 - R_KEY. */
26.1010 -gcry_error_t gcry_pk_genkey (gcry_sexp_t *r_key, gcry_sexp_t s_parms);
26.1011 -
26.1012 -/* Catch all function for miscellaneous operations. */
26.1013 -gcry_error_t gcry_pk_ctl (int cmd, void *buffer, size_t buflen);
26.1014 -
26.1015 -/* Retrieve information about the public key algorithm ALGO. */
26.1016 -gcry_error_t gcry_pk_algo_info (int algo, int what,
26.1017 - void *buffer, size_t *nbytes);
26.1018 -
26.1019 -/* Map the public key algorithm whose ID is contained in ALGORITHM to
26.1020 - a string representation of the algorithm name. For unknown
26.1021 - algorithm IDs this functions returns "?". */
26.1022 -const char *gcry_pk_algo_name (int algorithm) _GCRY_GCC_ATTR_PURE;
26.1023 -
26.1024 -/* Map the algorithm NAME to a public key algorithm Id. Return 0 if
26.1025 - the algorithm name is not known. */
26.1026 -int gcry_pk_map_name (const char* name) _GCRY_GCC_ATTR_PURE;
26.1027 -
26.1028 -/* Return what is commonly referred as the key length for the given
26.1029 - public or private KEY. */
26.1030 -unsigned int gcry_pk_get_nbits (gcry_sexp_t key) _GCRY_GCC_ATTR_PURE;
26.1031 -
26.1032 -/* Please note that keygrip is still experimental and should not be
26.1033 - used without contacting the author. */
26.1034 -unsigned char *gcry_pk_get_keygrip (gcry_sexp_t key, unsigned char *array);
26.1035 -
26.1036 -/* Return 0 if the public key algorithm A is available for use. */
26.1037 -#define gcry_pk_test_algo(a) \
26.1038 - gcry_pk_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL )
26.1039 -
26.1040 -/* Get a list consisting of the IDs of the loaded pubkey modules. If
26.1041 - LIST is zero, write the number of loaded pubkey modules to
26.1042 - LIST_LENGTH and return. If LIST is non-zero, the first
26.1043 - *LIST_LENGTH algorithm IDs are stored in LIST, which must be of
26.1044 - according size. In case there are less pubkey modules than
26.1045 - *LIST_LENGTH, *LIST_LENGTH is updated to the correct number. */
26.1046 -gcry_error_t gcry_pk_list (int *list, int *list_length);
26.1047 -
26.1048 -
26.1049 -
26.1050 -/************************************
26.1051 - * *
26.1052 - * Cryptograhic Hash Functions *
26.1053 - * *
26.1054 - ************************************/
26.1055 -
26.1056 -/* Algorithm IDs for the hash functions we know about. Not all of them
26.1057 - are implemnted. */
26.1058 -enum gcry_md_algos
26.1059 - {
26.1060 - GCRY_MD_NONE = 0,
26.1061 - GCRY_MD_MD5 = 1,
26.1062 - GCRY_MD_SHA1 = 2,
26.1063 - GCRY_MD_RMD160 = 3,
26.1064 - GCRY_MD_MD2 = 5,
26.1065 - GCRY_MD_TIGER = 6, /* TIGER/192. */
26.1066 - GCRY_MD_HAVAL = 7, /* HAVAL, 5 pass, 160 bit. */
26.1067 - GCRY_MD_SHA256 = 8,
26.1068 - GCRY_MD_SHA384 = 9,
26.1069 - GCRY_MD_SHA512 = 10,
26.1070 - GCRY_MD_SHA224 = 11,
26.1071 - GCRY_MD_MD4 = 301,
26.1072 - GCRY_MD_CRC32 = 302,
26.1073 - GCRY_MD_CRC32_RFC1510 = 303,
26.1074 - GCRY_MD_CRC24_RFC2440 = 304,
26.1075 - GCRY_MD_WHIRLPOOL = 305
26.1076 - };
26.1077 -
26.1078 -/* Flags used with the open function. */
26.1079 -enum gcry_md_flags
26.1080 - {
26.1081 - GCRY_MD_FLAG_SECURE = 1, /* Allocate all buffers in "secure" memory. */
26.1082 - GCRY_MD_FLAG_HMAC = 2 /* Make an HMAC out of this algorithm. */
26.1083 - };
26.1084 -
26.1085 -/* (Forward declaration.) */
26.1086 -struct gcry_md_context;
26.1087 -
26.1088 -/* This object is used to hold a handle to a message digest object.
26.1089 - This structure is private - only to be used by the public gcry_md_*
26.1090 - macros. */
26.1091 -typedef struct gcry_md_handle
26.1092 -{
26.1093 - /* Actual context. */
26.1094 - struct gcry_md_context *ctx;
26.1095 -
26.1096 - /* Buffer management. */
26.1097 - int bufpos;
26.1098 - int bufsize;
26.1099 - unsigned char buf[1];
26.1100 -} *gcry_md_hd_t;
26.1101 -
26.1102 -/* Compatibility types, do not use them. */
26.1103 -#ifndef GCRYPT_NO_DEPRECATED
26.1104 -typedef struct gcry_md_handle *GCRY_MD_HD _GCRY_GCC_ATTR_DEPRECATED;
26.1105 -typedef struct gcry_md_handle *GcryMDHd _GCRY_GCC_ATTR_DEPRECATED;
26.1106 -#endif
26.1107 -
26.1108 -/* Create a message digest object for algorithm ALGO. FLAGS may be
26.1109 - given as an bitwise OR of the gcry_md_flags values. ALGO may be
26.1110 - given as 0 if the algorithms to be used are later set using
26.1111 - gcry_md_enable. */
26.1112 -gcry_error_t gcry_md_open (gcry_md_hd_t *h, int algo, unsigned int flags);
26.1113 -
26.1114 -/* Release the message digest object HD. */
26.1115 -void gcry_md_close (gcry_md_hd_t hd);
26.1116 -
26.1117 -/* Add the message digest algorithm ALGO to the digest object HD. */
26.1118 -gcry_error_t gcry_md_enable (gcry_md_hd_t hd, int algo);
26.1119 -
26.1120 -/* Create a new digest object as an exact copy of the object HD. */
26.1121 -gcry_error_t gcry_md_copy (gcry_md_hd_t *bhd, gcry_md_hd_t ahd);
26.1122 -
26.1123 -/* Reset the digest object HD to its initial state. */
26.1124 -void gcry_md_reset (gcry_md_hd_t hd);
26.1125 -
26.1126 -/* Perform various operations on the digest object HD. */
26.1127 -gcry_error_t gcry_md_ctl (gcry_md_hd_t hd, int cmd,
26.1128 - void *buffer, size_t buflen);
26.1129 -
26.1130 -/* Pass LENGTH bytes of data in BUFFER to the digest object HD so that
26.1131 - it can update the digest values. This is the actual hash
26.1132 - function. */
26.1133 -void gcry_md_write (gcry_md_hd_t hd, const void *buffer, size_t length);
26.1134 -
26.1135 -/* Read out the final digest from HD return the digest value for
26.1136 - algorithm ALGO. */
26.1137 -unsigned char *gcry_md_read (gcry_md_hd_t hd, int algo);
26.1138 -
26.1139 -/* Convenience function to calculate the hash from the data in BUFFER
26.1140 - of size LENGTH using the algorithm ALGO avoiding the creating of a
26.1141 - hash object. The hash is returned in the caller provided buffer
26.1142 - DIGEST which must be large enough to hold the digest of the given
26.1143 - algorithm. */
26.1144 -void gcry_md_hash_buffer (int algo, void *digest,
26.1145 - const void *buffer, size_t length);
26.1146 -
26.1147 -/* Retrieve the algorithm used with HD. This does not work reliable
26.1148 - if more than one algorithm is enabled in HD. */
26.1149 -int gcry_md_get_algo (gcry_md_hd_t hd);
26.1150 -
26.1151 -/* Retrieve the length in bytes of the digest yielded by algorithm
26.1152 - ALGO. */
26.1153 -unsigned int gcry_md_get_algo_dlen (int algo);
26.1154 -
26.1155 -/* Return true if the the algorithm ALGO is enabled in the digest
26.1156 - object A. */
26.1157 -int gcry_md_is_enabled (gcry_md_hd_t a, int algo);
26.1158 -
26.1159 -/* Return true if the digest object A is allocated in "secure" memory. */
26.1160 -int gcry_md_is_secure (gcry_md_hd_t a);
26.1161 -
26.1162 -/* Retrieve various information about the object H. */
26.1163 -gcry_error_t gcry_md_info (gcry_md_hd_t h, int what, void *buffer,
26.1164 - size_t *nbytes);
26.1165 -
26.1166 -/* Retrieve various information about the algorithm ALGO. */
26.1167 -gcry_error_t gcry_md_algo_info (int algo, int what, void *buffer,
26.1168 - size_t *nbytes);
26.1169 -
26.1170 -/* Map the digest algorithm id ALGO to a string representation of the
26.1171 - algorithm name. For unknown algorithms this function returns
26.1172 - "?". */
26.1173 -const char *gcry_md_algo_name (int algo) _GCRY_GCC_ATTR_PURE;
26.1174 -
26.1175 -/* Map the algorithm NAME to a digest algorithm Id. Return 0 if
26.1176 - the algorithm name is not known. */
26.1177 -int gcry_md_map_name (const char* name) _GCRY_GCC_ATTR_PURE;
26.1178 -
26.1179 -/* For use with the HMAC feature, the set MAC key to the KEY of
26.1180 - KEYLEN. */
26.1181 -gcry_error_t gcry_md_setkey (gcry_md_hd_t hd, const void *key, size_t keylen);
26.1182 -
26.1183 -/* Start or stop debugging for digest handle HD; i.e. create a file
26.1184 - named dbgmd-<n>.<suffix> while hashing. If SUFFIX is NULL,
26.1185 - debugging stops and the file will be closed. */
26.1186 -void gcry_md_debug (gcry_md_hd_t hd, const char *suffix);
26.1187 -
26.1188 -
26.1189 -/* Update the hash(s) of H with the character C. This is a buffered
26.1190 - version of the gcry_md_write function. */
26.1191 -#define gcry_md_putc(h,c) \
26.1192 - do { \
26.1193 - gcry_md_hd_t h__ = (h); \
26.1194 - if( (h__)->bufpos == (h__)->bufsize ) \
26.1195 - gcry_md_write( (h__), NULL, 0 ); \
26.1196 - (h__)->buf[(h__)->bufpos++] = (c) & 0xff; \
26.1197 - } while(0)
26.1198 -
26.1199 -/* Finalize the digest calculation. This is not really needed because
26.1200 - gcry_md_read() does this implicitly. */
26.1201 -#define gcry_md_final(a) \
26.1202 - gcry_md_ctl ((a), GCRYCTL_FINALIZE, NULL, 0)
26.1203 -
26.1204 -/* Return 0 if the algorithm A is available for use. */
26.1205 -#define gcry_md_test_algo(a) \
26.1206 - gcry_md_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL )
26.1207 -
26.1208 -/* Return an DER encoded ASN.1 OID for the algorithm A in buffer B. N
26.1209 - must point to size_t variable with the available size of buffer B.
26.1210 - After return it will receive the actual size of the returned
26.1211 - OID. */
26.1212 -#define gcry_md_get_asnoid(a,b,n) \
26.1213 - gcry_md_algo_info((a), GCRYCTL_GET_ASNOID, (b), (n))
26.1214 -
26.1215 -/* Enable debugging for digest object A; i.e. create files named
26.1216 - dbgmd-<n>.<string> while hashing. B is a string used as the suffix
26.1217 - for the filename. This macro is deprecated, use gcry_md_debug. */
26.1218 -#ifndef GCRYPT_NO_DEPRECATED
26.1219 -#define gcry_md_start_debug(a,b) \
26.1220 - gcry_md_ctl( (a), GCRYCTL_START_DUMP, (b), 0 )
26.1221 -
26.1222 -/* Disable the debugging of A. This macro is deprecated, use
26.1223 - gcry_md_debug. */
26.1224 -#define gcry_md_stop_debug(a,b) \
26.1225 - gcry_md_ctl( (a), GCRYCTL_STOP_DUMP, (b), 0 )
26.1226 -#endif
26.1227 -
26.1228 -/* Get a list consisting of the IDs of the loaded message digest
26.1229 - modules. If LIST is zero, write the number of loaded message
26.1230 - digest modules to LIST_LENGTH and return. If LIST is non-zero, the
26.1231 - first *LIST_LENGTH algorithm IDs are stored in LIST, which must be
26.1232 - of according size. In case there are less message digest modules
26.1233 - than *LIST_LENGTH, *LIST_LENGTH is updated to the correct
26.1234 - number. */
26.1235 -gcry_error_t gcry_md_list (int *list, int *list_length);
26.1236 -
26.1237 -
26.1238 -
26.1239 -/* Alternative interface for asymmetric cryptography. This interface
26.1240 - is deprecated. */
26.1241 -
26.1242 -/* The algorithm IDs. */
26.1243 -typedef enum gcry_ac_id
26.1244 - {
26.1245 - GCRY_AC_RSA = 1,
26.1246 - GCRY_AC_DSA = 17,
26.1247 - GCRY_AC_ELG = 20,
26.1248 - GCRY_AC_ELG_E = 16
26.1249 - }
26.1250 -gcry_ac_id_t;
26.1251 -
26.1252 -/* Key types. */
26.1253 -typedef enum gcry_ac_key_type
26.1254 - {
26.1255 - GCRY_AC_KEY_SECRET,
26.1256 - GCRY_AC_KEY_PUBLIC
26.1257 - }
26.1258 -gcry_ac_key_type_t;
26.1259 -
26.1260 -/* Encoding methods. */
26.1261 -typedef enum gcry_ac_em
26.1262 - {
26.1263 - GCRY_AC_EME_PKCS_V1_5,
26.1264 - GCRY_AC_EMSA_PKCS_V1_5
26.1265 - }
26.1266 -gcry_ac_em_t;
26.1267 -
26.1268 -/* Encryption and Signature schemes. */
26.1269 -typedef enum gcry_ac_scheme
26.1270 - {
26.1271 - GCRY_AC_ES_PKCS_V1_5,
26.1272 - GCRY_AC_SSA_PKCS_V1_5
26.1273 - }
26.1274 -gcry_ac_scheme_t;
26.1275 -
26.1276 -/* AC data. */
26.1277 -#define GCRY_AC_FLAG_DEALLOC (1 << 0)
26.1278 -#define GCRY_AC_FLAG_COPY (1 << 1)
26.1279 -#define GCRY_AC_FLAG_NO_BLINDING (1 << 2)
26.1280 -
26.1281 -/* This type represents a `data set'. */
26.1282 -typedef struct gcry_ac_data *gcry_ac_data_t;
26.1283 -
26.1284 -/* This type represents a single `key', either a secret one or a
26.1285 - public one. */
26.1286 -typedef struct gcry_ac_key *gcry_ac_key_t;
26.1287 -
26.1288 -/* This type represents a `key pair' containing a secret and a public
26.1289 - key. */
26.1290 -typedef struct gcry_ac_key_pair *gcry_ac_key_pair_t;
26.1291 -
26.1292 -/* This type represents a `handle' that is needed by functions
26.1293 - performing cryptographic operations. */
26.1294 -typedef struct gcry_ac_handle *gcry_ac_handle_t;
26.1295 -
26.1296 -typedef gpg_error_t (*gcry_ac_data_read_cb_t) (void *opaque,
26.1297 - unsigned char *buffer,
26.1298 - size_t *buffer_n);
26.1299 -
26.1300 -typedef gpg_error_t (*gcry_ac_data_write_cb_t) (void *opaque,
26.1301 - unsigned char *buffer,
26.1302 - size_t buffer_n);
26.1303 -
26.1304 -typedef enum
26.1305 - {
26.1306 - GCRY_AC_IO_READABLE,
26.1307 - GCRY_AC_IO_WRITABLE
26.1308 - }
26.1309 -gcry_ac_io_mode_t;
26.1310 -
26.1311 -typedef enum
26.1312 - {
26.1313 - GCRY_AC_IO_STRING,
26.1314 - GCRY_AC_IO_CALLBACK
26.1315 - }
26.1316 -gcry_ac_io_type_t;
26.1317 -
26.1318 -typedef struct gcry_ac_io
26.1319 -{
26.1320 - /* This is an INTERNAL structure, do NOT use manually. */
26.1321 - gcry_ac_io_mode_t mode _GCRY_ATTR_INTERNAL;
26.1322 - gcry_ac_io_type_t type _GCRY_ATTR_INTERNAL;
26.1323 - union
26.1324 - {
26.1325 - union
26.1326 - {
26.1327 - struct
26.1328 - {
26.1329 - gcry_ac_data_read_cb_t cb;
26.1330 - void *opaque;
26.1331 - } callback;
26.1332 - struct
26.1333 - {
26.1334 - unsigned char *data;
26.1335 - size_t data_n;
26.1336 - } string;
26.1337 - void *opaque;
26.1338 - } readable;
26.1339 - union
26.1340 - {
26.1341 - struct
26.1342 - {
26.1343 - gcry_ac_data_write_cb_t cb;
26.1344 - void *opaque;
26.1345 - } callback;
26.1346 - struct
26.1347 - {
26.1348 - unsigned char **data;
26.1349 - size_t *data_n;
26.1350 - } string;
26.1351 - void *opaque;
26.1352 - } writable;
26.1353 - } io _GCRY_ATTR_INTERNAL;
26.1354 -}
26.1355 -gcry_ac_io_t;
26.1356 -
26.1357 -/* The caller of gcry_ac_key_pair_generate can provide one of these
26.1358 - structures in order to influence the key generation process in an
26.1359 - algorithm-specific way. */
26.1360 -typedef struct gcry_ac_key_spec_rsa
26.1361 -{
26.1362 - gcry_mpi_t e; /* E to use. */
26.1363 -} gcry_ac_key_spec_rsa_t;
26.1364 -
26.1365 -/* Structure used for passing data to the implementation of the
26.1366 - `EME-PKCS-V1_5' encoding method. */
26.1367 -typedef struct gcry_ac_eme_pkcs_v1_5
26.1368 -{
26.1369 - size_t key_size;
26.1370 -} gcry_ac_eme_pkcs_v1_5_t;
26.1371 -
26.1372 -typedef enum gcry_md_algos gcry_md_algo_t;
26.1373 -
26.1374 -/* Structure used for passing data to the implementation of the
26.1375 - `EMSA-PKCS-V1_5' encoding method. */
26.1376 -typedef struct gcry_ac_emsa_pkcs_v1_5
26.1377 -{
26.1378 - gcry_md_algo_t md;
26.1379 - size_t em_n;
26.1380 -} gcry_ac_emsa_pkcs_v1_5_t;
26.1381 -
26.1382 -/* Structure used for passing data to the implementation of the
26.1383 - `SSA-PKCS-V1_5' signature scheme. */
26.1384 -typedef struct gcry_ac_ssa_pkcs_v1_5
26.1385 -{
26.1386 - gcry_md_algo_t md;
26.1387 -} gcry_ac_ssa_pkcs_v1_5_t;
26.1388 -
26.1389 -/* Returns a new, empty data set in DATA. */
26.1390 -gcry_error_t gcry_ac_data_new (gcry_ac_data_t *data);
26.1391 -
26.1392 -/* Destroy the data set DATA. */
26.1393 -void gcry_ac_data_destroy (gcry_ac_data_t data);
26.1394 -
26.1395 -/* Create a copy of the data set DATA and store it in DATA_CP. */
26.1396 -gcry_error_t gcry_ac_data_copy (gcry_ac_data_t *data_cp,
26.1397 - gcry_ac_data_t data);
26.1398 -
26.1399 -/* Return the number of named MPI values inside of the data set
26.1400 - DATA. */
26.1401 -unsigned int gcry_ac_data_length (gcry_ac_data_t data);
26.1402 -
26.1403 -/* Destroy any values contained in the data set DATA. */
26.1404 -void gcry_ac_data_clear (gcry_ac_data_t data);
26.1405 -
26.1406 -/* Add the value MPI to DATA with the label NAME. If FLAGS contains
26.1407 - GCRY_AC_FLAG_DATA_COPY, the data set will contain copies of NAME
26.1408 - and MPI. If FLAGS contains GCRY_AC_FLAG_DATA_DEALLOC or
26.1409 - GCRY_AC_FLAG_DATA_COPY, the values contained in the data set will
26.1410 - be deallocated when they are to be removed from the data set. */
26.1411 -gcry_error_t gcry_ac_data_set (gcry_ac_data_t data, unsigned int flags,
26.1412 - const char *name, gcry_mpi_t mpi);
26.1413 -
26.1414 -/* Store the value labelled with NAME found in DATA in MPI. If FLAGS
26.1415 - contains GCRY_AC_FLAG_COPY, store a copy of the MPI value contained
26.1416 - in the data set. MPI may be NULL. */
26.1417 -gcry_error_t gcry_ac_data_get_name (gcry_ac_data_t data, unsigned int flags,
26.1418 - const char *name, gcry_mpi_t *mpi);
26.1419 -
26.1420 -/* Stores in NAME and MPI the named MPI value contained in the data
26.1421 - set DATA with the index IDX. If FLAGS contains GCRY_AC_FLAG_COPY,
26.1422 - store copies of the values contained in the data set. NAME or MPI
26.1423 - may be NULL. */
26.1424 -gcry_error_t gcry_ac_data_get_index (gcry_ac_data_t data, unsigned int flags,
26.1425 - unsigned int idx,
26.1426 - const char **name, gcry_mpi_t *mpi);
26.1427 -
26.1428 -/* Convert the data set DATA into a new S-Expression, which is to be
26.1429 - stored in SEXP, according to the identifiers contained in
26.1430 - IDENTIFIERS. */
26.1431 -gcry_error_t gcry_ac_data_to_sexp (gcry_ac_data_t data, gcry_sexp_t *sexp,
26.1432 - const char **identifiers);
26.1433 -
26.1434 -/* Create a new data set, which is to be stored in DATA_SET, from the
26.1435 - S-Expression SEXP, according to the identifiers contained in
26.1436 - IDENTIFIERS. */
26.1437 -gcry_error_t gcry_ac_data_from_sexp (gcry_ac_data_t *data, gcry_sexp_t sexp,
26.1438 - const char **identifiers);
26.1439 -
26.1440 -/* Initialize AC_IO according to MODE, TYPE and the variable list of
26.1441 - arguments. The list of variable arguments to specify depends on
26.1442 - the given TYPE. */
26.1443 -void gcry_ac_io_init (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode,
26.1444 - gcry_ac_io_type_t type, ...);
26.1445 -
26.1446 -/* Initialize AC_IO according to MODE, TYPE and the variable list of
26.1447 - arguments AP. The list of variable arguments to specify depends on
26.1448 - the given TYPE. */
26.1449 -void gcry_ac_io_init_va (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode,
26.1450 - gcry_ac_io_type_t type, va_list ap);
26.1451 -
26.1452 -/* Create a new ac handle. */
26.1453 -gcry_error_t gcry_ac_open (gcry_ac_handle_t *handle,
26.1454 - gcry_ac_id_t algorithm, unsigned int flags);
26.1455 -
26.1456 -/* Destroy an ac handle. */
26.1457 -void gcry_ac_close (gcry_ac_handle_t handle);
26.1458 -
26.1459 -/* Initialize a key from a given data set. */
26.1460 -gcry_error_t gcry_ac_key_init (gcry_ac_key_t *key, gcry_ac_handle_t handle,
26.1461 - gcry_ac_key_type_t type, gcry_ac_data_t data);
26.1462 -
26.1463 -/* Generates a new key pair via the handle HANDLE of NBITS bits and
26.1464 - stores it in KEY_PAIR. In case non-standard settings are wanted, a
26.1465 - pointer to a structure of type gcry_ac_key_spec_<algorithm>_t,
26.1466 - matching the selected algorithm, can be given as KEY_SPEC.
26.1467 - MISC_DATA is not used yet. */
26.1468 -gcry_error_t gcry_ac_key_pair_generate (gcry_ac_handle_t handle,
26.1469 - unsigned int nbits, void *spec,
26.1470 - gcry_ac_key_pair_t *key_pair,
26.1471 - gcry_mpi_t **misc_data);
26.1472 -
26.1473 -/* Returns the key of type WHICH out of the key pair KEY_PAIR. */
26.1474 -gcry_ac_key_t gcry_ac_key_pair_extract (gcry_ac_key_pair_t key_pair,
26.1475 - gcry_ac_key_type_t which);
26.1476 -
26.1477 -/* Returns the data set contained in the key KEY. */
26.1478 -gcry_ac_data_t gcry_ac_key_data_get (gcry_ac_key_t key);
26.1479 -
26.1480 -/* Verifies that the key KEY is sane via HANDLE. */
26.1481 -gcry_error_t gcry_ac_key_test (gcry_ac_handle_t handle, gcry_ac_key_t key);
26.1482 -
26.1483 -/* Stores the number of bits of the key KEY in NBITS via HANDLE. */
26.1484 -gcry_error_t gcry_ac_key_get_nbits (gcry_ac_handle_t handle,
26.1485 - gcry_ac_key_t key, unsigned int *nbits);
26.1486 -
26.1487 -/* Writes the 20 byte long key grip of the key KEY to KEY_GRIP via
26.1488 - HANDLE. */
26.1489 -gcry_error_t gcry_ac_key_get_grip (gcry_ac_handle_t handle, gcry_ac_key_t key,
26.1490 - unsigned char *key_grip);
26.1491 -
26.1492 -/* Destroy a key. */
26.1493 -void gcry_ac_key_destroy (gcry_ac_key_t key);
26.1494 -
26.1495 -/* Destroy a key pair. */
26.1496 -void gcry_ac_key_pair_destroy (gcry_ac_key_pair_t key_pair);
26.1497 -
26.1498 -/* Encodes a message according to the encoding method METHOD. OPTIONS
26.1499 - must be a pointer to a method-specific structure
26.1500 - (gcry_ac_em*_t). */
26.1501 -gcry_error_t gcry_ac_data_encode (gcry_ac_em_t method,
26.1502 - unsigned int flags, void *options,
26.1503 - gcry_ac_io_t *io_read,
26.1504 - gcry_ac_io_t *io_write);
26.1505 -
26.1506 -/* Decodes a message according to the encoding method METHOD. OPTIONS
26.1507 - must be a pointer to a method-specific structure
26.1508 - (gcry_ac_em*_t). */
26.1509 -gcry_error_t gcry_ac_data_decode (gcry_ac_em_t method,
26.1510 - unsigned int flags, void *options,
26.1511 - gcry_ac_io_t *io_read,
26.1512 - gcry_ac_io_t *io_write);
26.1513 -
26.1514 -/* Encrypt the plain text MPI value DATA_PLAIN with the key KEY under
26.1515 - the control of the flags FLAGS and store the resulting data set
26.1516 - into DATA_ENCRYPTED. */
26.1517 -gcry_error_t gcry_ac_data_encrypt (gcry_ac_handle_t handle,
26.1518 - unsigned int flags,
26.1519 - gcry_ac_key_t key,
26.1520 - gcry_mpi_t data_plain,
26.1521 - gcry_ac_data_t *data_encrypted);
26.1522 -
26.1523 -/* Decrypt the decrypted data contained in the data set DATA_ENCRYPTED
26.1524 - with the key KEY under the control of the flags FLAGS and store the
26.1525 - resulting plain text MPI value in DATA_PLAIN. */
26.1526 -gcry_error_t gcry_ac_data_decrypt (gcry_ac_handle_t handle,
26.1527 - unsigned int flags,
26.1528 - gcry_ac_key_t key,
26.1529 - gcry_mpi_t *data_plain,
26.1530 - gcry_ac_data_t data_encrypted);
26.1531 -
26.1532 -/* Sign the data contained in DATA with the key KEY and store the
26.1533 - resulting signature in the data set DATA_SIGNATURE. */
26.1534 -gcry_error_t gcry_ac_data_sign (gcry_ac_handle_t handle,
26.1535 - gcry_ac_key_t key,
26.1536 - gcry_mpi_t data,
26.1537 - gcry_ac_data_t *data_signature);
26.1538 -
26.1539 -/* Verify that the signature contained in the data set DATA_SIGNATURE
26.1540 - is indeed the result of signing the data contained in DATA with the
26.1541 - secret key belonging to the public key KEY. */
26.1542 -gcry_error_t gcry_ac_data_verify (gcry_ac_handle_t handle,
26.1543 - gcry_ac_key_t key,
26.1544 - gcry_mpi_t data,
26.1545 - gcry_ac_data_t data_signature);
26.1546 -
26.1547 -/* Encrypts the plain text readable from IO_MESSAGE through HANDLE
26.1548 - with the public key KEY according to SCHEME, FLAGS and OPTS. If
26.1549 - OPTS is not NULL, it has to be a pointer to a structure specific to
26.1550 - the chosen scheme (gcry_ac_es_*_t). The encrypted message is
26.1551 - written to IO_CIPHER. */
26.1552 -gcry_error_t gcry_ac_data_encrypt_scheme (gcry_ac_handle_t handle,
26.1553 - gcry_ac_scheme_t scheme,
26.1554 - unsigned int flags, void *opts,
26.1555 - gcry_ac_key_t key,
26.1556 - gcry_ac_io_t *io_message,
26.1557 - gcry_ac_io_t *io_cipher);
26.1558 -
26.1559 -/* Decrypts the cipher text readable from IO_CIPHER through HANDLE
26.1560 - with the secret key KEY according to SCHEME, @var{flags} and OPTS.
26.1561 - If OPTS is not NULL, it has to be a pointer to a structure specific
26.1562 - to the chosen scheme (gcry_ac_es_*_t). The decrypted message is
26.1563 - written to IO_MESSAGE. */
26.1564 -gcry_error_t gcry_ac_data_decrypt_scheme (gcry_ac_handle_t handle,
26.1565 - gcry_ac_scheme_t scheme,
26.1566 - unsigned int flags, void *opts,
26.1567 - gcry_ac_key_t key,
26.1568 - gcry_ac_io_t *io_cipher,
26.1569 - gcry_ac_io_t *io_message);
26.1570 -
26.1571 -/* Signs the message readable from IO_MESSAGE through HANDLE with the
26.1572 - secret key KEY according to SCHEME, FLAGS and OPTS. If OPTS is not
26.1573 - NULL, it has to be a pointer to a structure specific to the chosen
26.1574 - scheme (gcry_ac_ssa_*_t). The signature is written to
26.1575 - IO_SIGNATURE. */
26.1576 -gcry_error_t gcry_ac_data_sign_scheme (gcry_ac_handle_t handle,
26.1577 - gcry_ac_scheme_t scheme,
26.1578 - unsigned int flags, void *opts,
26.1579 - gcry_ac_key_t key,
26.1580 - gcry_ac_io_t *io_message,
26.1581 - gcry_ac_io_t *io_signature);
26.1582 -
26.1583 -/* Verifies through HANDLE that the signature readable from
26.1584 - IO_SIGNATURE is indeed the result of signing the message readable
26.1585 - from IO_MESSAGE with the secret key belonging to the public key KEY
26.1586 - according to SCHEME and OPTS. If OPTS is not NULL, it has to be an
26.1587 - anonymous structure (gcry_ac_ssa_*_t) specific to the chosen
26.1588 - scheme. */
26.1589 -gcry_error_t gcry_ac_data_verify_scheme (gcry_ac_handle_t handle,
26.1590 - gcry_ac_scheme_t scheme,
26.1591 - unsigned int flags, void *opts,
26.1592 - gcry_ac_key_t key,
26.1593 - gcry_ac_io_t *io_message,
26.1594 - gcry_ac_io_t *io_signature);
26.1595 -
26.1596 -/* Store the textual representation of the algorithm whose id is given
26.1597 - in ALGORITHM in NAME. This function is deprecated; use
26.1598 - gcry_pk_algo_name. */
26.1599 -#ifndef GCRYPT_NO_DEPRECATED
26.1600 -gcry_error_t gcry_ac_id_to_name (gcry_ac_id_t algorithm,
26.1601 - const char **name)
26.1602 - /* */ _GCRY_GCC_ATTR_DEPRECATED;
26.1603 -/* Store the numeric ID of the algorithm whose textual representation
26.1604 - is contained in NAME in ALGORITHM. This function is deprecated;
26.1605 - use gcry_pk_map_name. */
26.1606 -gcry_error_t gcry_ac_name_to_id (const char *name,
26.1607 - gcry_ac_id_t *algorithm)
26.1608 - /* */ _GCRY_GCC_ATTR_DEPRECATED;
26.1609 -#endif
26.1610 -
26.1611 -
26.1612 -/************************************
26.1613 - * *
26.1614 - * Random Generating Functions *
26.1615 - * *
26.1616 - ************************************/
26.1617 -
26.1618 -/* The possible values for the random quality. The rule of thumb is
26.1619 - to use STRONG for session keys and VERY_STRONG for key material.
26.1620 - WEAK is usually an alias for STRONG and should not be used anymore
26.1621 - (except with gcry_mpi_randomize); use gcry_create_nonce instead. */
26.1622 -typedef enum gcry_random_level
26.1623 - {
26.1624 - GCRY_WEAK_RANDOM = 0,
26.1625 - GCRY_STRONG_RANDOM = 1,
26.1626 - GCRY_VERY_STRONG_RANDOM = 2
26.1627 - }
26.1628 -gcry_random_level_t;
26.1629 -
26.1630 -/* Fill BUFFER with LENGTH bytes of random, using random numbers of
26.1631 - quality LEVEL. */
26.1632 -void gcry_randomize (void *buffer, size_t length,
26.1633 - enum gcry_random_level level);
26.1634 -
26.1635 -/* Add the external random from BUFFER with LENGTH bytes into the
26.1636 - pool. QUALITY should either be -1 for unknown or in the range of 0
26.1637 - to 100 */
26.1638 -gcry_error_t gcry_random_add_bytes (const void *buffer, size_t length,
26.1639 - int quality);
26.1640 -
26.1641 -/* If random numbers are used in an application, this macro should be
26.1642 - called from time to time so that new stuff gets added to the
26.1643 - internal pool of the RNG. */
26.1644 -#define gcry_fast_random_poll() gcry_control (GCRYCTL_FAST_POLL, NULL)
26.1645 -
26.1646 -
26.1647 -/* Return NBYTES of allocated random using a random numbers of quality
26.1648 - LEVEL. */
26.1649 -void *gcry_random_bytes (size_t nbytes, enum gcry_random_level level)
26.1650 - _GCRY_GCC_ATTR_MALLOC;
26.1651 -
26.1652 -/* Return NBYTES of allocated random using a random numbers of quality
26.1653 - LEVEL. The random numbers are created returned in "secure"
26.1654 - memory. */
26.1655 -void *gcry_random_bytes_secure (size_t nbytes, enum gcry_random_level level)
26.1656 - _GCRY_GCC_ATTR_MALLOC;
26.1657 -
26.1658 -
26.1659 -/* Set the big integer W to a random value of NBITS using a random
26.1660 - generator with quality LEVEL. Note that by using a level of
26.1661 - GCRY_WEAK_RANDOM gcry_create_nonce is used internally. */
26.1662 -void gcry_mpi_randomize (gcry_mpi_t w,
26.1663 - unsigned int nbits, enum gcry_random_level level);
26.1664 -
26.1665 -
26.1666 -/* Create an unpredicable nonce of LENGTH bytes in BUFFER. */
26.1667 -void gcry_create_nonce (void *buffer, size_t length);
26.1668 -
26.1669 -
26.1670 -
26.1671 -
26.1672 -
26.1673 -/*******************************/
26.1674 -/* */
26.1675 -/* Prime Number Functions */
26.1676 -/* */
26.1677 -/*******************************/
26.1678 -
26.1679 -/* Mode values passed to a gcry_prime_check_func_t. */
26.1680 -#define GCRY_PRIME_CHECK_AT_FINISH 0
26.1681 -#define GCRY_PRIME_CHECK_AT_GOT_PRIME 1
26.1682 -#define GCRY_PRIME_CHECK_AT_MAYBE_PRIME 2
26.1683 -
26.1684 -/* The function should return 1 if the operation shall continue, 0 to
26.1685 - reject the prime candidate. */
26.1686 -typedef int (*gcry_prime_check_func_t) (void *arg, int mode,
26.1687 - gcry_mpi_t candidate);
26.1688 -
26.1689 -/* Flags for gcry_prime_generate(): */
26.1690 -
26.1691 -/* Allocate prime numbers and factors in secure memory. */
26.1692 -#define GCRY_PRIME_FLAG_SECRET (1 << 0)
26.1693 -
26.1694 -/* Make sure that at least one prime factor is of size
26.1695 - `FACTOR_BITS'. */
26.1696 -#define GCRY_PRIME_FLAG_SPECIAL_FACTOR (1 << 1)
26.1697 -
26.1698 -/* Generate a new prime number of PRIME_BITS bits and store it in
26.1699 - PRIME. If FACTOR_BITS is non-zero, one of the prime factors of
26.1700 - (prime - 1) / 2 must be FACTOR_BITS bits long. If FACTORS is
26.1701 - non-zero, allocate a new, NULL-terminated array holding the prime
26.1702 - factors and store it in FACTORS. FLAGS might be used to influence
26.1703 - the prime number generation process. */
26.1704 -gcry_error_t gcry_prime_generate (gcry_mpi_t *prime,
26.1705 - unsigned int prime_bits,
26.1706 - unsigned int factor_bits,
26.1707 - gcry_mpi_t **factors,
26.1708 - gcry_prime_check_func_t cb_func,
26.1709 - void *cb_arg,
26.1710 - gcry_random_level_t random_level,
26.1711 - unsigned int flags);
26.1712 -
26.1713 -/* Find a generator for PRIME where the factorization of (prime-1) is
26.1714 - in the NULL terminated array FACTORS. Return the generator as a
26.1715 - newly allocated MPI in R_G. If START_G is not NULL, use this as
26.1716 - teh start for the search. */
26.1717 -gcry_error_t gcry_prime_group_generator (gcry_mpi_t *r_g,
26.1718 - gcry_mpi_t prime,
26.1719 - gcry_mpi_t *factors,
26.1720 - gcry_mpi_t start_g);
26.1721 -
26.1722 -
26.1723 -/* Convenience function to release the FACTORS array. */
26.1724 -void gcry_prime_release_factors (gcry_mpi_t *factors);
26.1725 -
26.1726 -
26.1727 -/* Check wether the number X is prime. */
26.1728 -gcry_error_t gcry_prime_check (gcry_mpi_t x, unsigned int flags);
26.1729 -
26.1730 -
26.1731 -
26.1732 -/************************************
26.1733 - * *
26.1734 - * Miscellaneous Stuff *
26.1735 - * *
26.1736 - ************************************/
26.1737 -
26.1738 -/* Log levels used by the internal logging facility. */
26.1739 -enum gcry_log_levels
26.1740 - {
26.1741 - GCRY_LOG_CONT = 0, /* (Continue the last log line.) */
26.1742 - GCRY_LOG_INFO = 10,
26.1743 - GCRY_LOG_WARN = 20,
26.1744 - GCRY_LOG_ERROR = 30,
26.1745 - GCRY_LOG_FATAL = 40,
26.1746 - GCRY_LOG_BUG = 50,
26.1747 - GCRY_LOG_DEBUG = 100
26.1748 - };
26.1749 -
26.1750 -/* Type for progress handlers. */
26.1751 -typedef void (*gcry_handler_progress_t) (void *, const char *, int, int, int);
26.1752 -
26.1753 -/* Type for memory allocation handlers. */
26.1754 -typedef void *(*gcry_handler_alloc_t) (size_t n);
26.1755 -
26.1756 -/* Type for secure memory check handlers. */
26.1757 -typedef int (*gcry_handler_secure_check_t) (const void *);
26.1758 -
26.1759 -/* Type for memory reallocation handlers. */
26.1760 -typedef void *(*gcry_handler_realloc_t) (void *p, size_t n);
26.1761 -
26.1762 -/* Type for memory free handlers. */
26.1763 -typedef void (*gcry_handler_free_t) (void *);
26.1764 -
26.1765 -/* Type for out-of-memory handlers. */
26.1766 -typedef int (*gcry_handler_no_mem_t) (void *, size_t, unsigned int);
26.1767 -
26.1768 -/* Type for fatal error handlers. */
26.1769 -typedef void (*gcry_handler_error_t) (void *, int, const char *);
26.1770 -
26.1771 -/* Type for logging handlers. */
26.1772 -typedef void (*gcry_handler_log_t) (void *, int, const char *, va_list);
26.1773 -
26.1774 -/* Certain operations can provide progress information. This function
26.1775 - is used to register a handler for retrieving these information. */
26.1776 -void gcry_set_progress_handler (gcry_handler_progress_t cb, void *cb_data);
26.1777 -
26.1778 -
26.1779 -/* Register a custom memory allocation functions. */
26.1780 -void gcry_set_allocation_handler (
26.1781 - gcry_handler_alloc_t func_alloc,
26.1782 - gcry_handler_alloc_t func_alloc_secure,
26.1783 - gcry_handler_secure_check_t func_secure_check,
26.1784 - gcry_handler_realloc_t func_realloc,
26.1785 - gcry_handler_free_t func_free);
26.1786 -
26.1787 -/* Register a function used instead of the internal out of memory
26.1788 - handler. */
26.1789 -void gcry_set_outofcore_handler (gcry_handler_no_mem_t h, void *opaque);
26.1790 -
26.1791 -/* Register a function used instead of the internal fatal error
26.1792 - handler. */
26.1793 -void gcry_set_fatalerror_handler (gcry_handler_error_t fnc, void *opaque);
26.1794 -
26.1795 -/* Register a function used instead of the internal logging
26.1796 - facility. */
26.1797 -void gcry_set_log_handler (gcry_handler_log_t f, void *opaque);
26.1798 -
26.1799 -/* Reserved for future use. */
26.1800 -void gcry_set_gettext_handler (const char *(*f)(const char*));
26.1801 -
26.1802 -/* Libgcrypt uses its own memory allocation. It is important to use
26.1803 - gcry_free () to release memory allocated by libgcrypt. */
26.1804 -void *gcry_malloc (size_t n) _GCRY_GCC_ATTR_MALLOC;
26.1805 -void *gcry_calloc (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC;
26.1806 -void *gcry_malloc_secure (size_t n) _GCRY_GCC_ATTR_MALLOC;
26.1807 -void *gcry_calloc_secure (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC;
26.1808 -void *gcry_realloc (void *a, size_t n);
26.1809 -char *gcry_strdup (const char *string) _GCRY_GCC_ATTR_MALLOC;
26.1810 -void *gcry_xmalloc (size_t n) _GCRY_GCC_ATTR_MALLOC;
26.1811 -void *gcry_xcalloc (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC;
26.1812 -void *gcry_xmalloc_secure (size_t n) _GCRY_GCC_ATTR_MALLOC;
26.1813 -void *gcry_xcalloc_secure (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC;
26.1814 -void *gcry_xrealloc (void *a, size_t n);
26.1815 -char *gcry_xstrdup (const char * a) _GCRY_GCC_ATTR_MALLOC;
26.1816 -void gcry_free (void *a);
26.1817 -
26.1818 -/* Return true if A is allocated in "secure" memory. */
26.1819 -int gcry_is_secure (const void *a) _GCRY_GCC_ATTR_PURE;
26.1820 -
26.1821 -/* Return true if Libgcrypt is in FIPS mode. */
26.1822 -#define gcry_fips_mode_active() !!gcry_control (GCRYCTL_FIPS_MODE_P, 0)
26.1823 -
26.1824 -
26.1825 -/* Include support for Libgcrypt modules. */
26.1826 -#include <gcrypt-module.h>
26.1827 -
26.1828 -#if 0 /* (Keep Emacsens' auto-indent happy.) */
26.1829 -{
26.1830 -#endif
26.1831 -#ifdef __cplusplus
26.1832 -}
26.1833 -#endif
26.1834 -#endif /* _GCRYPT_H */
27.1 --- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/gpg-error.h Wed Sep 05 23:24:55 2012 +0200
27.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
27.3 @@ -1,654 +0,0 @@
27.4 -/* Output of mkheader.awk. DO NOT EDIT. */
27.5 -
27.6 -/* gpg-error.h - Public interface to libgpg-error.
27.7 - Copyright (C) 2003, 2004 g10 Code GmbH
27.8 -
27.9 - This file is part of libgpg-error.
27.10 -
27.11 - libgpg-error is free software; you can redistribute it and/or
27.12 - modify it under the terms of the GNU Lesser General Public License
27.13 - as published by the Free Software Foundation; either version 2.1 of
27.14 - the License, or (at your option) any later version.
27.15 -
27.16 - libgpg-error is distributed in the hope that it will be useful, but
27.17 - WITHOUT ANY WARRANTY; without even the implied warranty of
27.18 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27.19 - Lesser General Public License for more details.
27.20 -
27.21 - You should have received a copy of the GNU Lesser General Public
27.22 - License along with libgpg-error; if not, write to the Free
27.23 - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27.24 - 02111-1307, USA. */
27.25 -
27.26 -#ifndef GPG_ERROR_H
27.27 -#define GPG_ERROR_H 1
27.28 -
27.29 -#include <stddef.h>
27.30 -
27.31 -#ifdef __GNUC__
27.32 -#define GPG_ERR_INLINE __inline__
27.33 -#elif __STDC_VERSION__ >= 199901L
27.34 -#define GPG_ERR_INLINE inline
27.35 -#else
27.36 -#ifndef GPG_ERR_INLINE
27.37 -#define GPG_ERR_INLINE
27.38 -#endif
27.39 -#endif
27.40 -
27.41 -
27.42 -#ifdef __cplusplus
27.43 -extern "C" {
27.44 -#if 0 /* just to make Emacs auto-indent happy */
27.45 -}
27.46 -#endif
27.47 -#endif /* __cplusplus */
27.48 -
27.49 -/* The GnuPG project consists of many components. Error codes are
27.50 - exchanged between all components. The common error codes and their
27.51 - user-presentable descriptions are kept into a shared library to
27.52 - allow adding new error codes and components without recompiling any
27.53 - of the other components. The interface will not change in a
27.54 - backward incompatible way.
27.55 -
27.56 - An error code together with an error source build up an error
27.57 - value. As the error value is been passed from one component to
27.58 - another, it preserver the information about the source and nature
27.59 - of the error.
27.60 -
27.61 - A component of the GnuPG project can define the following macro to
27.62 - tune the behaviour of the library:
27.63 -
27.64 - GPG_ERR_SOURCE_DEFAULT: Define to an error source of type
27.65 - gpg_err_source_t to make that source the default for gpg_error().
27.66 - Otherwise GPG_ERR_SOURCE_UNKNOWN is used as default. */
27.67 -
27.68 -
27.69 -/* The error source type gpg_err_source_t.
27.70 -
27.71 - Where as the Poo out of a welle small
27.72 - Taketh his firste springing and his sours.
27.73 - --Chaucer. */
27.74 -
27.75 -/* Only use free slots, never change or reorder the existing
27.76 - entries. */
27.77 -typedef enum
27.78 - {
27.79 - GPG_ERR_SOURCE_UNKNOWN = 0,
27.80 - GPG_ERR_SOURCE_GCRYPT = 1,
27.81 - GPG_ERR_SOURCE_GPG = 2,
27.82 - GPG_ERR_SOURCE_GPGSM = 3,
27.83 - GPG_ERR_SOURCE_GPGAGENT = 4,
27.84 - GPG_ERR_SOURCE_PINENTRY = 5,
27.85 - GPG_ERR_SOURCE_SCD = 6,
27.86 - GPG_ERR_SOURCE_GPGME = 7,
27.87 - GPG_ERR_SOURCE_KEYBOX = 8,
27.88 - GPG_ERR_SOURCE_KSBA = 9,
27.89 - GPG_ERR_SOURCE_DIRMNGR = 10,
27.90 - GPG_ERR_SOURCE_GSTI = 11,
27.91 - GPG_ERR_SOURCE_GPA = 12,
27.92 - GPG_ERR_SOURCE_KLEO = 13,
27.93 - GPG_ERR_SOURCE_ANY = 31,
27.94 - GPG_ERR_SOURCE_USER_1 = 32,
27.95 - GPG_ERR_SOURCE_USER_2 = 33,
27.96 - GPG_ERR_SOURCE_USER_3 = 34,
27.97 - GPG_ERR_SOURCE_USER_4 = 35,
27.98 -
27.99 - /* This is one more than the largest allowed entry. */
27.100 - GPG_ERR_SOURCE_DIM = 256
27.101 - } gpg_err_source_t;
27.102 -
27.103 -
27.104 -/* The error code type gpg_err_code_t. */
27.105 -
27.106 -/* Only use free slots, never change or reorder the existing
27.107 - entries. */
27.108 -typedef enum
27.109 - {
27.110 - GPG_ERR_NO_ERROR = 0,
27.111 - GPG_ERR_GENERAL = 1,
27.112 - GPG_ERR_UNKNOWN_PACKET = 2,
27.113 - GPG_ERR_UNKNOWN_VERSION = 3,
27.114 - GPG_ERR_PUBKEY_ALGO = 4,
27.115 - GPG_ERR_DIGEST_ALGO = 5,
27.116 - GPG_ERR_BAD_PUBKEY = 6,
27.117 - GPG_ERR_BAD_SECKEY = 7,
27.118 - GPG_ERR_BAD_SIGNATURE = 8,
27.119 - GPG_ERR_NO_PUBKEY = 9,
27.120 - GPG_ERR_CHECKSUM = 10,
27.121 - GPG_ERR_BAD_PASSPHRASE = 11,
27.122 - GPG_ERR_CIPHER_ALGO = 12,
27.123 - GPG_ERR_KEYRING_OPEN = 13,
27.124 - GPG_ERR_INV_PACKET = 14,
27.125 - GPG_ERR_INV_ARMOR = 15,
27.126 - GPG_ERR_NO_USER_ID = 16,
27.127 - GPG_ERR_NO_SECKEY = 17,
27.128 - GPG_ERR_WRONG_SECKEY = 18,
27.129 - GPG_ERR_BAD_KEY = 19,
27.130 - GPG_ERR_COMPR_ALGO = 20,
27.131 - GPG_ERR_NO_PRIME = 21,
27.132 - GPG_ERR_NO_ENCODING_METHOD = 22,
27.133 - GPG_ERR_NO_ENCRYPTION_SCHEME = 23,
27.134 - GPG_ERR_NO_SIGNATURE_SCHEME = 24,
27.135 - GPG_ERR_INV_ATTR = 25,
27.136 - GPG_ERR_NO_VALUE = 26,
27.137 - GPG_ERR_NOT_FOUND = 27,
27.138 - GPG_ERR_VALUE_NOT_FOUND = 28,
27.139 - GPG_ERR_SYNTAX = 29,
27.140 - GPG_ERR_BAD_MPI = 30,
27.141 - GPG_ERR_INV_PASSPHRASE = 31,
27.142 - GPG_ERR_SIG_CLASS = 32,
27.143 - GPG_ERR_RESOURCE_LIMIT = 33,
27.144 - GPG_ERR_INV_KEYRING = 34,
27.145 - GPG_ERR_TRUSTDB = 35,
27.146 - GPG_ERR_BAD_CERT = 36,
27.147 - GPG_ERR_INV_USER_ID = 37,
27.148 - GPG_ERR_UNEXPECTED = 38,
27.149 - GPG_ERR_TIME_CONFLICT = 39,
27.150 - GPG_ERR_KEYSERVER = 40,
27.151 - GPG_ERR_WRONG_PUBKEY_ALGO = 41,
27.152 - GPG_ERR_TRIBUTE_TO_D_A = 42,
27.153 - GPG_ERR_WEAK_KEY = 43,
27.154 - GPG_ERR_INV_KEYLEN = 44,
27.155 - GPG_ERR_INV_ARG = 45,
27.156 - GPG_ERR_BAD_URI = 46,
27.157 - GPG_ERR_INV_URI = 47,
27.158 - GPG_ERR_NETWORK = 48,
27.159 - GPG_ERR_UNKNOWN_HOST = 49,
27.160 - GPG_ERR_SELFTEST_FAILED = 50,
27.161 - GPG_ERR_NOT_ENCRYPTED = 51,
27.162 - GPG_ERR_NOT_PROCESSED = 52,
27.163 - GPG_ERR_UNUSABLE_PUBKEY = 53,
27.164 - GPG_ERR_UNUSABLE_SECKEY = 54,
27.165 - GPG_ERR_INV_VALUE = 55,
27.166 - GPG_ERR_BAD_CERT_CHAIN = 56,
27.167 - GPG_ERR_MISSING_CERT = 57,
27.168 - GPG_ERR_NO_DATA = 58,
27.169 - GPG_ERR_BUG = 59,
27.170 - GPG_ERR_NOT_SUPPORTED = 60,
27.171 - GPG_ERR_INV_OP = 61,
27.172 - GPG_ERR_TIMEOUT = 62,
27.173 - GPG_ERR_INTERNAL = 63,
27.174 - GPG_ERR_EOF_GCRYPT = 64,
27.175 - GPG_ERR_INV_OBJ = 65,
27.176 - GPG_ERR_TOO_SHORT = 66,
27.177 - GPG_ERR_TOO_LARGE = 67,
27.178 - GPG_ERR_NO_OBJ = 68,
27.179 - GPG_ERR_NOT_IMPLEMENTED = 69,
27.180 - GPG_ERR_CONFLICT = 70,
27.181 - GPG_ERR_INV_CIPHER_MODE = 71,
27.182 - GPG_ERR_INV_FLAG = 72,
27.183 - GPG_ERR_INV_HANDLE = 73,
27.184 - GPG_ERR_TRUNCATED = 74,
27.185 - GPG_ERR_INCOMPLETE_LINE = 75,
27.186 - GPG_ERR_INV_RESPONSE = 76,
27.187 - GPG_ERR_NO_AGENT = 77,
27.188 - GPG_ERR_AGENT = 78,
27.189 - GPG_ERR_INV_DATA = 79,
27.190 - GPG_ERR_ASSUAN_SERVER_FAULT = 80,
27.191 - GPG_ERR_ASSUAN = 81,
27.192 - GPG_ERR_INV_SESSION_KEY = 82,
27.193 - GPG_ERR_INV_SEXP = 83,
27.194 - GPG_ERR_UNSUPPORTED_ALGORITHM = 84,
27.195 - GPG_ERR_NO_PIN_ENTRY = 85,
27.196 - GPG_ERR_PIN_ENTRY = 86,
27.197 - GPG_ERR_BAD_PIN = 87,
27.198 - GPG_ERR_INV_NAME = 88,
27.199 - GPG_ERR_BAD_DATA = 89,
27.200 - GPG_ERR_INV_PARAMETER = 90,
27.201 - GPG_ERR_WRONG_CARD = 91,
27.202 - GPG_ERR_NO_DIRMNGR = 92,
27.203 - GPG_ERR_DIRMNGR = 93,
27.204 - GPG_ERR_CERT_REVOKED = 94,
27.205 - GPG_ERR_NO_CRL_KNOWN = 95,
27.206 - GPG_ERR_CRL_TOO_OLD = 96,
27.207 - GPG_ERR_LINE_TOO_LONG = 97,
27.208 - GPG_ERR_NOT_TRUSTED = 98,
27.209 - GPG_ERR_CANCELED = 99,
27.210 - GPG_ERR_BAD_CA_CERT = 100,
27.211 - GPG_ERR_CERT_EXPIRED = 101,
27.212 - GPG_ERR_CERT_TOO_YOUNG = 102,
27.213 - GPG_ERR_UNSUPPORTED_CERT = 103,
27.214 - GPG_ERR_UNKNOWN_SEXP = 104,
27.215 - GPG_ERR_UNSUPPORTED_PROTECTION = 105,
27.216 - GPG_ERR_CORRUPTED_PROTECTION = 106,
27.217 - GPG_ERR_AMBIGUOUS_NAME = 107,
27.218 - GPG_ERR_CARD = 108,
27.219 - GPG_ERR_CARD_RESET = 109,
27.220 - GPG_ERR_CARD_REMOVED = 110,
27.221 - GPG_ERR_INV_CARD = 111,
27.222 - GPG_ERR_CARD_NOT_PRESENT = 112,
27.223 - GPG_ERR_NO_PKCS15_APP = 113,
27.224 - GPG_ERR_NOT_CONFIRMED = 114,
27.225 - GPG_ERR_CONFIGURATION = 115,
27.226 - GPG_ERR_NO_POLICY_MATCH = 116,
27.227 - GPG_ERR_INV_INDEX = 117,
27.228 - GPG_ERR_INV_ID = 118,
27.229 - GPG_ERR_NO_SCDAEMON = 119,
27.230 - GPG_ERR_SCDAEMON = 120,
27.231 - GPG_ERR_UNSUPPORTED_PROTOCOL = 121,
27.232 - GPG_ERR_BAD_PIN_METHOD = 122,
27.233 - GPG_ERR_CARD_NOT_INITIALIZED = 123,
27.234 - GPG_ERR_UNSUPPORTED_OPERATION = 124,
27.235 - GPG_ERR_WRONG_KEY_USAGE = 125,
27.236 - GPG_ERR_NOTHING_FOUND = 126,
27.237 - GPG_ERR_WRONG_BLOB_TYPE = 127,
27.238 - GPG_ERR_MISSING_VALUE = 128,
27.239 - GPG_ERR_HARDWARE = 129,
27.240 - GPG_ERR_PIN_BLOCKED = 130,
27.241 - GPG_ERR_USE_CONDITIONS = 131,
27.242 - GPG_ERR_PIN_NOT_SYNCED = 132,
27.243 - GPG_ERR_INV_CRL = 133,
27.244 - GPG_ERR_BAD_BER = 134,
27.245 - GPG_ERR_INV_BER = 135,
27.246 - GPG_ERR_ELEMENT_NOT_FOUND = 136,
27.247 - GPG_ERR_IDENTIFIER_NOT_FOUND = 137,
27.248 - GPG_ERR_INV_TAG = 138,
27.249 - GPG_ERR_INV_LENGTH = 139,
27.250 - GPG_ERR_INV_KEYINFO = 140,
27.251 - GPG_ERR_UNEXPECTED_TAG = 141,
27.252 - GPG_ERR_NOT_DER_ENCODED = 142,
27.253 - GPG_ERR_NO_CMS_OBJ = 143,
27.254 - GPG_ERR_INV_CMS_OBJ = 144,
27.255 - GPG_ERR_UNKNOWN_CMS_OBJ = 145,
27.256 - GPG_ERR_UNSUPPORTED_CMS_OBJ = 146,
27.257 - GPG_ERR_UNSUPPORTED_ENCODING = 147,
27.258 - GPG_ERR_UNSUPPORTED_CMS_VERSION = 148,
27.259 - GPG_ERR_UNKNOWN_ALGORITHM = 149,
27.260 - GPG_ERR_INV_ENGINE = 150,
27.261 - GPG_ERR_PUBKEY_NOT_TRUSTED = 151,
27.262 - GPG_ERR_DECRYPT_FAILED = 152,
27.263 - GPG_ERR_KEY_EXPIRED = 153,
27.264 - GPG_ERR_SIG_EXPIRED = 154,
27.265 - GPG_ERR_ENCODING_PROBLEM = 155,
27.266 - GPG_ERR_INV_STATE = 156,
27.267 - GPG_ERR_DUP_VALUE = 157,
27.268 - GPG_ERR_MISSING_ACTION = 158,
27.269 - GPG_ERR_MODULE_NOT_FOUND = 159,
27.270 - GPG_ERR_INV_OID_STRING = 160,
27.271 - GPG_ERR_INV_TIME = 161,
27.272 - GPG_ERR_INV_CRL_OBJ = 162,
27.273 - GPG_ERR_UNSUPPORTED_CRL_VERSION = 163,
27.274 - GPG_ERR_INV_CERT_OBJ = 164,
27.275 - GPG_ERR_UNKNOWN_NAME = 165,
27.276 - GPG_ERR_LOCALE_PROBLEM = 166,
27.277 - GPG_ERR_NOT_LOCKED = 167,
27.278 - GPG_ERR_PROTOCOL_VIOLATION = 168,
27.279 - GPG_ERR_INV_MAC = 169,
27.280 - GPG_ERR_INV_REQUEST = 170,
27.281 - GPG_ERR_UNKNOWN_EXTN = 171,
27.282 - GPG_ERR_UNKNOWN_CRIT_EXTN = 172,
27.283 - GPG_ERR_LOCKED = 173,
27.284 - GPG_ERR_UNKNOWN_OPTION = 174,
27.285 - GPG_ERR_UNKNOWN_COMMAND = 175,
27.286 - GPG_ERR_NOT_OPERATIONAL = 176,
27.287 - GPG_ERR_NO_PASSPHRASE = 177,
27.288 - GPG_ERR_NO_PIN = 178,
27.289 - GPG_ERR_UNFINISHED = 199,
27.290 - GPG_ERR_BUFFER_TOO_SHORT = 200,
27.291 - GPG_ERR_SEXP_INV_LEN_SPEC = 201,
27.292 - GPG_ERR_SEXP_STRING_TOO_LONG = 202,
27.293 - GPG_ERR_SEXP_UNMATCHED_PAREN = 203,
27.294 - GPG_ERR_SEXP_NOT_CANONICAL = 204,
27.295 - GPG_ERR_SEXP_BAD_CHARACTER = 205,
27.296 - GPG_ERR_SEXP_BAD_QUOTATION = 206,
27.297 - GPG_ERR_SEXP_ZERO_PREFIX = 207,
27.298 - GPG_ERR_SEXP_NESTED_DH = 208,
27.299 - GPG_ERR_SEXP_UNMATCHED_DH = 209,
27.300 - GPG_ERR_SEXP_UNEXPECTED_PUNC = 210,
27.301 - GPG_ERR_SEXP_BAD_HEX_CHAR = 211,
27.302 - GPG_ERR_SEXP_ODD_HEX_NUMBERS = 212,
27.303 - GPG_ERR_SEXP_BAD_OCT_CHAR = 213,
27.304 - GPG_ERR_ASS_GENERAL = 257,
27.305 - GPG_ERR_ASS_ACCEPT_FAILED = 258,
27.306 - GPG_ERR_ASS_CONNECT_FAILED = 259,
27.307 - GPG_ERR_ASS_INV_RESPONSE = 260,
27.308 - GPG_ERR_ASS_INV_VALUE = 261,
27.309 - GPG_ERR_ASS_INCOMPLETE_LINE = 262,
27.310 - GPG_ERR_ASS_LINE_TOO_LONG = 263,
27.311 - GPG_ERR_ASS_NESTED_COMMANDS = 264,
27.312 - GPG_ERR_ASS_NO_DATA_CB = 265,
27.313 - GPG_ERR_ASS_NO_INQUIRE_CB = 266,
27.314 - GPG_ERR_ASS_NOT_A_SERVER = 267,
27.315 - GPG_ERR_ASS_NOT_A_CLIENT = 268,
27.316 - GPG_ERR_ASS_SERVER_START = 269,
27.317 - GPG_ERR_ASS_READ_ERROR = 270,
27.318 - GPG_ERR_ASS_WRITE_ERROR = 271,
27.319 - GPG_ERR_ASS_TOO_MUCH_DATA = 273,
27.320 - GPG_ERR_ASS_UNEXPECTED_CMD = 274,
27.321 - GPG_ERR_ASS_UNKNOWN_CMD = 275,
27.322 - GPG_ERR_ASS_SYNTAX = 276,
27.323 - GPG_ERR_ASS_CANCELED = 277,
27.324 - GPG_ERR_ASS_NO_INPUT = 278,
27.325 - GPG_ERR_ASS_NO_OUTPUT = 279,
27.326 - GPG_ERR_ASS_PARAMETER = 280,
27.327 - GPG_ERR_ASS_UNKNOWN_INQUIRE = 281,
27.328 - GPG_ERR_USER_1 = 1024,
27.329 - GPG_ERR_USER_2 = 1025,
27.330 - GPG_ERR_USER_3 = 1026,
27.331 - GPG_ERR_USER_4 = 1027,
27.332 - GPG_ERR_USER_5 = 1028,
27.333 - GPG_ERR_USER_6 = 1029,
27.334 - GPG_ERR_USER_7 = 1030,
27.335 - GPG_ERR_USER_8 = 1031,
27.336 - GPG_ERR_USER_9 = 1032,
27.337 - GPG_ERR_USER_10 = 1033,
27.338 - GPG_ERR_USER_11 = 1034,
27.339 - GPG_ERR_USER_12 = 1035,
27.340 - GPG_ERR_USER_13 = 1036,
27.341 - GPG_ERR_USER_14 = 1037,
27.342 - GPG_ERR_USER_15 = 1038,
27.343 - GPG_ERR_USER_16 = 1039,
27.344 - GPG_ERR_MISSING_ERRNO = 16381,
27.345 - GPG_ERR_UNKNOWN_ERRNO = 16382,
27.346 - GPG_ERR_EOF = 16383,
27.347 -
27.348 - /* The following error codes are used to map system errors. */
27.349 -#define GPG_ERR_SYSTEM_ERROR (1 << 15)
27.350 - GPG_ERR_E2BIG = GPG_ERR_SYSTEM_ERROR | 0,
27.351 - GPG_ERR_EACCES = GPG_ERR_SYSTEM_ERROR | 1,
27.352 - GPG_ERR_EADDRINUSE = GPG_ERR_SYSTEM_ERROR | 2,
27.353 - GPG_ERR_EADDRNOTAVAIL = GPG_ERR_SYSTEM_ERROR | 3,
27.354 - GPG_ERR_EADV = GPG_ERR_SYSTEM_ERROR | 4,
27.355 - GPG_ERR_EAFNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 5,
27.356 - GPG_ERR_EAGAIN = GPG_ERR_SYSTEM_ERROR | 6,
27.357 - GPG_ERR_EALREADY = GPG_ERR_SYSTEM_ERROR | 7,
27.358 - GPG_ERR_EAUTH = GPG_ERR_SYSTEM_ERROR | 8,
27.359 - GPG_ERR_EBACKGROUND = GPG_ERR_SYSTEM_ERROR | 9,
27.360 - GPG_ERR_EBADE = GPG_ERR_SYSTEM_ERROR | 10,
27.361 - GPG_ERR_EBADF = GPG_ERR_SYSTEM_ERROR | 11,
27.362 - GPG_ERR_EBADFD = GPG_ERR_SYSTEM_ERROR | 12,
27.363 - GPG_ERR_EBADMSG = GPG_ERR_SYSTEM_ERROR | 13,
27.364 - GPG_ERR_EBADR = GPG_ERR_SYSTEM_ERROR | 14,
27.365 - GPG_ERR_EBADRPC = GPG_ERR_SYSTEM_ERROR | 15,
27.366 - GPG_ERR_EBADRQC = GPG_ERR_SYSTEM_ERROR | 16,
27.367 - GPG_ERR_EBADSLT = GPG_ERR_SYSTEM_ERROR | 17,
27.368 - GPG_ERR_EBFONT = GPG_ERR_SYSTEM_ERROR | 18,
27.369 - GPG_ERR_EBUSY = GPG_ERR_SYSTEM_ERROR | 19,
27.370 - GPG_ERR_ECANCELED = GPG_ERR_SYSTEM_ERROR | 20,
27.371 - GPG_ERR_ECHILD = GPG_ERR_SYSTEM_ERROR | 21,
27.372 - GPG_ERR_ECHRNG = GPG_ERR_SYSTEM_ERROR | 22,
27.373 - GPG_ERR_ECOMM = GPG_ERR_SYSTEM_ERROR | 23,
27.374 - GPG_ERR_ECONNABORTED = GPG_ERR_SYSTEM_ERROR | 24,
27.375 - GPG_ERR_ECONNREFUSED = GPG_ERR_SYSTEM_ERROR | 25,
27.376 - GPG_ERR_ECONNRESET = GPG_ERR_SYSTEM_ERROR | 26,
27.377 - GPG_ERR_ED = GPG_ERR_SYSTEM_ERROR | 27,
27.378 - GPG_ERR_EDEADLK = GPG_ERR_SYSTEM_ERROR | 28,
27.379 - GPG_ERR_EDEADLOCK = GPG_ERR_SYSTEM_ERROR | 29,
27.380 - GPG_ERR_EDESTADDRREQ = GPG_ERR_SYSTEM_ERROR | 30,
27.381 - GPG_ERR_EDIED = GPG_ERR_SYSTEM_ERROR | 31,
27.382 - GPG_ERR_EDOM = GPG_ERR_SYSTEM_ERROR | 32,
27.383 - GPG_ERR_EDOTDOT = GPG_ERR_SYSTEM_ERROR | 33,
27.384 - GPG_ERR_EDQUOT = GPG_ERR_SYSTEM_ERROR | 34,
27.385 - GPG_ERR_EEXIST = GPG_ERR_SYSTEM_ERROR | 35,
27.386 - GPG_ERR_EFAULT = GPG_ERR_SYSTEM_ERROR | 36,
27.387 - GPG_ERR_EFBIG = GPG_ERR_SYSTEM_ERROR | 37,
27.388 - GPG_ERR_EFTYPE = GPG_ERR_SYSTEM_ERROR | 38,
27.389 - GPG_ERR_EGRATUITOUS = GPG_ERR_SYSTEM_ERROR | 39,
27.390 - GPG_ERR_EGREGIOUS = GPG_ERR_SYSTEM_ERROR | 40,
27.391 - GPG_ERR_EHOSTDOWN = GPG_ERR_SYSTEM_ERROR | 41,
27.392 - GPG_ERR_EHOSTUNREACH = GPG_ERR_SYSTEM_ERROR | 42,
27.393 - GPG_ERR_EIDRM = GPG_ERR_SYSTEM_ERROR | 43,
27.394 - GPG_ERR_EIEIO = GPG_ERR_SYSTEM_ERROR | 44,
27.395 - GPG_ERR_EILSEQ = GPG_ERR_SYSTEM_ERROR | 45,
27.396 - GPG_ERR_EINPROGRESS = GPG_ERR_SYSTEM_ERROR | 46,
27.397 - GPG_ERR_EINTR = GPG_ERR_SYSTEM_ERROR | 47,
27.398 - GPG_ERR_EINVAL = GPG_ERR_SYSTEM_ERROR | 48,
27.399 - GPG_ERR_EIO = GPG_ERR_SYSTEM_ERROR | 49,
27.400 - GPG_ERR_EISCONN = GPG_ERR_SYSTEM_ERROR | 50,
27.401 - GPG_ERR_EISDIR = GPG_ERR_SYSTEM_ERROR | 51,
27.402 - GPG_ERR_EISNAM = GPG_ERR_SYSTEM_ERROR | 52,
27.403 - GPG_ERR_EL2HLT = GPG_ERR_SYSTEM_ERROR | 53,
27.404 - GPG_ERR_EL2NSYNC = GPG_ERR_SYSTEM_ERROR | 54,
27.405 - GPG_ERR_EL3HLT = GPG_ERR_SYSTEM_ERROR | 55,
27.406 - GPG_ERR_EL3RST = GPG_ERR_SYSTEM_ERROR | 56,
27.407 - GPG_ERR_ELIBACC = GPG_ERR_SYSTEM_ERROR | 57,
27.408 - GPG_ERR_ELIBBAD = GPG_ERR_SYSTEM_ERROR | 58,
27.409 - GPG_ERR_ELIBEXEC = GPG_ERR_SYSTEM_ERROR | 59,
27.410 - GPG_ERR_ELIBMAX = GPG_ERR_SYSTEM_ERROR | 60,
27.411 - GPG_ERR_ELIBSCN = GPG_ERR_SYSTEM_ERROR | 61,
27.412 - GPG_ERR_ELNRNG = GPG_ERR_SYSTEM_ERROR | 62,
27.413 - GPG_ERR_ELOOP = GPG_ERR_SYSTEM_ERROR | 63,
27.414 - GPG_ERR_EMEDIUMTYPE = GPG_ERR_SYSTEM_ERROR | 64,
27.415 - GPG_ERR_EMFILE = GPG_ERR_SYSTEM_ERROR | 65,
27.416 - GPG_ERR_EMLINK = GPG_ERR_SYSTEM_ERROR | 66,
27.417 - GPG_ERR_EMSGSIZE = GPG_ERR_SYSTEM_ERROR | 67,
27.418 - GPG_ERR_EMULTIHOP = GPG_ERR_SYSTEM_ERROR | 68,
27.419 - GPG_ERR_ENAMETOOLONG = GPG_ERR_SYSTEM_ERROR | 69,
27.420 - GPG_ERR_ENAVAIL = GPG_ERR_SYSTEM_ERROR | 70,
27.421 - GPG_ERR_ENEEDAUTH = GPG_ERR_SYSTEM_ERROR | 71,
27.422 - GPG_ERR_ENETDOWN = GPG_ERR_SYSTEM_ERROR | 72,
27.423 - GPG_ERR_ENETRESET = GPG_ERR_SYSTEM_ERROR | 73,
27.424 - GPG_ERR_ENETUNREACH = GPG_ERR_SYSTEM_ERROR | 74,
27.425 - GPG_ERR_ENFILE = GPG_ERR_SYSTEM_ERROR | 75,
27.426 - GPG_ERR_ENOANO = GPG_ERR_SYSTEM_ERROR | 76,
27.427 - GPG_ERR_ENOBUFS = GPG_ERR_SYSTEM_ERROR | 77,
27.428 - GPG_ERR_ENOCSI = GPG_ERR_SYSTEM_ERROR | 78,
27.429 - GPG_ERR_ENODATA = GPG_ERR_SYSTEM_ERROR | 79,
27.430 - GPG_ERR_ENODEV = GPG_ERR_SYSTEM_ERROR | 80,
27.431 - GPG_ERR_ENOENT = GPG_ERR_SYSTEM_ERROR | 81,
27.432 - GPG_ERR_ENOEXEC = GPG_ERR_SYSTEM_ERROR | 82,
27.433 - GPG_ERR_ENOLCK = GPG_ERR_SYSTEM_ERROR | 83,
27.434 - GPG_ERR_ENOLINK = GPG_ERR_SYSTEM_ERROR | 84,
27.435 - GPG_ERR_ENOMEDIUM = GPG_ERR_SYSTEM_ERROR | 85,
27.436 - GPG_ERR_ENOMEM = GPG_ERR_SYSTEM_ERROR | 86,
27.437 - GPG_ERR_ENOMSG = GPG_ERR_SYSTEM_ERROR | 87,
27.438 - GPG_ERR_ENONET = GPG_ERR_SYSTEM_ERROR | 88,
27.439 - GPG_ERR_ENOPKG = GPG_ERR_SYSTEM_ERROR | 89,
27.440 - GPG_ERR_ENOPROTOOPT = GPG_ERR_SYSTEM_ERROR | 90,
27.441 - GPG_ERR_ENOSPC = GPG_ERR_SYSTEM_ERROR | 91,
27.442 - GPG_ERR_ENOSR = GPG_ERR_SYSTEM_ERROR | 92,
27.443 - GPG_ERR_ENOSTR = GPG_ERR_SYSTEM_ERROR | 93,
27.444 - GPG_ERR_ENOSYS = GPG_ERR_SYSTEM_ERROR | 94,
27.445 - GPG_ERR_ENOTBLK = GPG_ERR_SYSTEM_ERROR | 95,
27.446 - GPG_ERR_ENOTCONN = GPG_ERR_SYSTEM_ERROR | 96,
27.447 - GPG_ERR_ENOTDIR = GPG_ERR_SYSTEM_ERROR | 97,
27.448 - GPG_ERR_ENOTEMPTY = GPG_ERR_SYSTEM_ERROR | 98,
27.449 - GPG_ERR_ENOTNAM = GPG_ERR_SYSTEM_ERROR | 99,
27.450 - GPG_ERR_ENOTSOCK = GPG_ERR_SYSTEM_ERROR | 100,
27.451 - GPG_ERR_ENOTSUP = GPG_ERR_SYSTEM_ERROR | 101,
27.452 - GPG_ERR_ENOTTY = GPG_ERR_SYSTEM_ERROR | 102,
27.453 - GPG_ERR_ENOTUNIQ = GPG_ERR_SYSTEM_ERROR | 103,
27.454 - GPG_ERR_ENXIO = GPG_ERR_SYSTEM_ERROR | 104,
27.455 - GPG_ERR_EOPNOTSUPP = GPG_ERR_SYSTEM_ERROR | 105,
27.456 - GPG_ERR_EOVERFLOW = GPG_ERR_SYSTEM_ERROR | 106,
27.457 - GPG_ERR_EPERM = GPG_ERR_SYSTEM_ERROR | 107,
27.458 - GPG_ERR_EPFNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 108,
27.459 - GPG_ERR_EPIPE = GPG_ERR_SYSTEM_ERROR | 109,
27.460 - GPG_ERR_EPROCLIM = GPG_ERR_SYSTEM_ERROR | 110,
27.461 - GPG_ERR_EPROCUNAVAIL = GPG_ERR_SYSTEM_ERROR | 111,
27.462 - GPG_ERR_EPROGMISMATCH = GPG_ERR_SYSTEM_ERROR | 112,
27.463 - GPG_ERR_EPROGUNAVAIL = GPG_ERR_SYSTEM_ERROR | 113,
27.464 - GPG_ERR_EPROTO = GPG_ERR_SYSTEM_ERROR | 114,
27.465 - GPG_ERR_EPROTONOSUPPORT = GPG_ERR_SYSTEM_ERROR | 115,
27.466 - GPG_ERR_EPROTOTYPE = GPG_ERR_SYSTEM_ERROR | 116,
27.467 - GPG_ERR_ERANGE = GPG_ERR_SYSTEM_ERROR | 117,
27.468 - GPG_ERR_EREMCHG = GPG_ERR_SYSTEM_ERROR | 118,
27.469 - GPG_ERR_EREMOTE = GPG_ERR_SYSTEM_ERROR | 119,
27.470 - GPG_ERR_EREMOTEIO = GPG_ERR_SYSTEM_ERROR | 120,
27.471 - GPG_ERR_ERESTART = GPG_ERR_SYSTEM_ERROR | 121,
27.472 - GPG_ERR_EROFS = GPG_ERR_SYSTEM_ERROR | 122,
27.473 - GPG_ERR_ERPCMISMATCH = GPG_ERR_SYSTEM_ERROR | 123,
27.474 - GPG_ERR_ESHUTDOWN = GPG_ERR_SYSTEM_ERROR | 124,
27.475 - GPG_ERR_ESOCKTNOSUPPORT = GPG_ERR_SYSTEM_ERROR | 125,
27.476 - GPG_ERR_ESPIPE = GPG_ERR_SYSTEM_ERROR | 126,
27.477 - GPG_ERR_ESRCH = GPG_ERR_SYSTEM_ERROR | 127,
27.478 - GPG_ERR_ESRMNT = GPG_ERR_SYSTEM_ERROR | 128,
27.479 - GPG_ERR_ESTALE = GPG_ERR_SYSTEM_ERROR | 129,
27.480 - GPG_ERR_ESTRPIPE = GPG_ERR_SYSTEM_ERROR | 130,
27.481 - GPG_ERR_ETIME = GPG_ERR_SYSTEM_ERROR | 131,
27.482 - GPG_ERR_ETIMEDOUT = GPG_ERR_SYSTEM_ERROR | 132,
27.483 - GPG_ERR_ETOOMANYREFS = GPG_ERR_SYSTEM_ERROR | 133,
27.484 - GPG_ERR_ETXTBSY = GPG_ERR_SYSTEM_ERROR | 134,
27.485 - GPG_ERR_EUCLEAN = GPG_ERR_SYSTEM_ERROR | 135,
27.486 - GPG_ERR_EUNATCH = GPG_ERR_SYSTEM_ERROR | 136,
27.487 - GPG_ERR_EUSERS = GPG_ERR_SYSTEM_ERROR | 137,
27.488 - GPG_ERR_EWOULDBLOCK = GPG_ERR_SYSTEM_ERROR | 138,
27.489 - GPG_ERR_EXDEV = GPG_ERR_SYSTEM_ERROR | 139,
27.490 - GPG_ERR_EXFULL = GPG_ERR_SYSTEM_ERROR | 140,
27.491 -
27.492 - /* This is one more than the largest allowed entry. */
27.493 - GPG_ERR_CODE_DIM = 65536
27.494 - } gpg_err_code_t;
27.495 -
27.496 -
27.497 -/* The error value type gpg_error_t. */
27.498 -
27.499 -/* We would really like to use bit-fields in a struct, but using
27.500 - structs as return values can cause binary compatibility issues, in
27.501 - particular if you want to do it effeciently (also see
27.502 - -freg-struct-return option to GCC). */
27.503 -typedef unsigned int gpg_error_t;
27.504 -
27.505 -/* We use the lowest 16 bits of gpg_error_t for error codes. The 16th
27.506 - bit indicates system errors. */
27.507 -#define GPG_ERR_CODE_MASK (GPG_ERR_CODE_DIM - 1)
27.508 -
27.509 -/* Bits 17 to 24 are reserved. */
27.510 -
27.511 -/* We use the upper 8 bits of gpg_error_t for error sources. */
27.512 -#define GPG_ERR_SOURCE_MASK (GPG_ERR_SOURCE_DIM - 1)
27.513 -#define GPG_ERR_SOURCE_SHIFT 24
27.514 -
27.515 -
27.516 -/* GCC feature test. */
27.517 -#undef _GPG_ERR_HAVE_CONSTRUCTOR
27.518 -#if __GNUC__
27.519 -#define _GPG_ERR_GCC_VERSION (__GNUC__ * 10000 \
27.520 - + __GNUC_MINOR__ * 100 \
27.521 - + __GNUC_PATCHLEVEL__)
27.522 -
27.523 -#if _GPG_ERR_GCC_VERSION > 30100
27.524 -#define _GPG_ERR_CONSTRUCTOR __attribute__ ((__constructor__))
27.525 -#define _GPG_ERR_HAVE_CONSTRUCTOR
27.526 -#endif
27.527 -#endif
27.528 -
27.529 -#ifndef _GPG_ERR_CONSTRUCTOR
27.530 -#define _GPG_ERR_CONSTRUCTOR
27.531 -#endif
27.532 -
27.533 -
27.534 -/* Initialization function. */
27.535 -
27.536 -/* Initialize the library. This function should be run early. */
27.537 -gpg_error_t gpg_err_init (void) _GPG_ERR_CONSTRUCTOR;
27.538 -
27.539 -/* If this is defined, the library is already initialized by the
27.540 - constructor and does not need to be initialized explicitely. */
27.541 -#undef GPG_ERR_INITIALIZED
27.542 -#ifdef _GPG_ERR_HAVE_CONSTRUCTOR
27.543 -#define GPG_ERR_INITIALIZED 1
27.544 -#endif
27.545 -
27.546 -
27.547 -/* Constructor and accessor functions. */
27.548 -
27.549 -/* Construct an error value from an error code and source. Within a
27.550 - subsystem, use gpg_error. */
27.551 -static GPG_ERR_INLINE gpg_error_t
27.552 -gpg_err_make (gpg_err_source_t source, gpg_err_code_t code)
27.553 -{
27.554 - return code == GPG_ERR_NO_ERROR ? GPG_ERR_NO_ERROR
27.555 - : (((source & GPG_ERR_SOURCE_MASK) << GPG_ERR_SOURCE_SHIFT)
27.556 - | (code & GPG_ERR_CODE_MASK));
27.557 -}
27.558 -
27.559 -
27.560 -/* The user should define GPG_ERR_SOURCE_DEFAULT before including this
27.561 - file to specify a default source for gpg_error. */
27.562 -#ifndef GPG_ERR_SOURCE_DEFAULT
27.563 -#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_UNKNOWN
27.564 -#endif
27.565 -
27.566 -static GPG_ERR_INLINE gpg_error_t
27.567 -gpg_error (gpg_err_code_t code)
27.568 -{
27.569 - return gpg_err_make (GPG_ERR_SOURCE_DEFAULT, code);
27.570 -}
27.571 -
27.572 -
27.573 -/* Retrieve the error code from an error value. */
27.574 -static GPG_ERR_INLINE gpg_err_code_t
27.575 -gpg_err_code (gpg_error_t err)
27.576 -{
27.577 - return (gpg_err_code_t) (err & GPG_ERR_CODE_MASK);
27.578 -}
27.579 -
27.580 -
27.581 -/* Retrieve the error source from an error value. */
27.582 -static GPG_ERR_INLINE gpg_err_source_t
27.583 -gpg_err_source (gpg_error_t err)
27.584 -{
27.585 - return (gpg_err_source_t) ((err >> GPG_ERR_SOURCE_SHIFT)
27.586 - & GPG_ERR_SOURCE_MASK);
27.587 -}
27.588 -
27.589 -
27.590 -/* String functions. */
27.591 -
27.592 -/* Return a pointer to a string containing a description of the error
27.593 - code in the error value ERR. This function is not thread-safe. */
27.594 -const char *gpg_strerror (gpg_error_t err);
27.595 -
27.596 -/* Return the error string for ERR in the user-supplied buffer BUF of
27.597 - size BUFLEN. This function is, in contrast to gpg_strerror,
27.598 - thread-safe if a thread-safe strerror_r() function is provided by
27.599 - the system. If the function succeeds, 0 is returned and BUF
27.600 - contains the string describing the error. If the buffer was not
27.601 - large enough, ERANGE is returned and BUF contains as much of the
27.602 - beginning of the error string as fits into the buffer. */
27.603 -int gpg_strerror_r (gpg_error_t err, char *buf, size_t buflen);
27.604 -
27.605 -/* Return a pointer to a string containing a description of the error
27.606 - source in the error value ERR. */
27.607 -const char *gpg_strsource (gpg_error_t err);
27.608 -
27.609 -
27.610 -/* Mapping of system errors (errno). */
27.611 -
27.612 -/* Retrieve the error code for the system error ERR. This returns
27.613 - GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
27.614 - this). */
27.615 -gpg_err_code_t gpg_err_code_from_errno (int err);
27.616 -
27.617 -
27.618 -/* Retrieve the system error for the error code CODE. This returns 0
27.619 - if CODE is not a system error code. */
27.620 -int gpg_err_code_to_errno (gpg_err_code_t code);
27.621 -
27.622 -
27.623 -/* Retrieve the error code directly from the ERRNO variable. This
27.624 - returns GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped
27.625 - (report this) and GPG_ERR_MISSING_ERRNO if ERRNO has the value 0. */
27.626 -gpg_err_code_t gpg_err_code_from_syserror (void);
27.627 -
27.628 -
27.629 -
27.630 -
27.631 -/* Self-documenting convenience functions. */
27.632 -
27.633 -static GPG_ERR_INLINE gpg_error_t
27.634 -gpg_err_make_from_errno (gpg_err_source_t source, int err)
27.635 -{
27.636 - return gpg_err_make (source, gpg_err_code_from_errno (err));
27.637 -}
27.638 -
27.639 -
27.640 -static GPG_ERR_INLINE gpg_error_t
27.641 -gpg_error_from_errno (int err)
27.642 -{
27.643 - return gpg_error (gpg_err_code_from_errno (err));
27.644 -}
27.645 -
27.646 -static GPG_ERR_INLINE gpg_error_t
27.647 -gpg_error_from_syserror (void)
27.648 -{
27.649 - return gpg_error (gpg_err_code_from_syserror ());
27.650 -}
27.651 -
27.652 -#ifdef __cplusplus
27.653 -}
27.654 -#endif
27.655 -
27.656 -
27.657 -#endif /* GPG_ERROR_H */
28.1 --- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/mem.h Wed Sep 05 23:24:55 2012 +0200
28.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
28.3 @@ -1,25 +0,0 @@
28.4 -/*
28.5 - * Off-the-Record Messaging library
28.6 - * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
28.7 - * <otr@cypherpunks.ca>
28.8 - *
28.9 - * This library is free software; you can redistribute it and/or
28.10 - * modify it under the terms of version 2.1 of the GNU Lesser General
28.11 - * Public License as published by the Free Software Foundation.
28.12 - *
28.13 - * This library is distributed in the hope that it will be useful,
28.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
28.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28.16 - * Lesser General Public License for more details.
28.17 - *
28.18 - * You should have received a copy of the GNU Lesser General Public
28.19 - * License along with this library; if not, write to the Free Software
28.20 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28.21 - */
28.22 -
28.23 -#ifndef __MEM_H__
28.24 -#define __MEM_H__
28.25 -
28.26 -void otrl_mem_init(void);
28.27 -
28.28 -#endif
29.1 --- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/message.h Wed Sep 05 23:24:55 2012 +0200
29.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
29.3 @@ -1,210 +0,0 @@
29.4 -/*
29.5 - * Off-the-Record Messaging library
29.6 - * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
29.7 - * <otr@cypherpunks.ca>
29.8 - *
29.9 - * This library is free software; you can redistribute it and/or
29.10 - * modify it under the terms of version 2.1 of the GNU Lesser General
29.11 - * Public License as published by the Free Software Foundation.
29.12 - *
29.13 - * This library is distributed in the hope that it will be useful,
29.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
29.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29.16 - * Lesser General Public License for more details.
29.17 - *
29.18 - * You should have received a copy of the GNU Lesser General Public
29.19 - * License along with this library; if not, write to the Free Software
29.20 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29.21 - */
29.22 -
29.23 -#ifndef __MESSAGE_H__
29.24 -#define __MESSAGE_H__
29.25 -
29.26 -typedef enum {
29.27 - OTRL_NOTIFY_ERROR,
29.28 - OTRL_NOTIFY_WARNING,
29.29 - OTRL_NOTIFY_INFO
29.30 -} OtrlNotifyLevel;
29.31 -
29.32 -typedef struct s_OtrlMessageAppOps {
29.33 - /* Return the OTR policy for the given context. */
29.34 - OtrlPolicy (*policy)(void *opdata, ConnContext *context);
29.35 -
29.36 - /* Create a private key for the given accountname/protocol if
29.37 - * desired. */
29.38 - void (*create_privkey)(void *opdata, const char *accountname,
29.39 - const char *protocol);
29.40 -
29.41 - /* Report whether you think the given user is online. Return 1 if
29.42 - * you think he is, 0 if you think he isn't, -1 if you're not sure.
29.43 - *
29.44 - * If you return 1, messages such as heartbeats or other
29.45 - * notifications may be sent to the user, which could result in "not
29.46 - * logged in" errors if you're wrong. */
29.47 - int (*is_logged_in)(void *opdata, const char *accountname,
29.48 - const char *protocol, const char *recipient);
29.49 -
29.50 - /* Send the given IM to the given recipient from the given
29.51 - * accountname/protocol. */
29.52 - void (*inject_message)(void *opdata, const char *accountname,
29.53 - const char *protocol, const char *recipient, const char *message);
29.54 -
29.55 - /* Display a notification message for a particular accountname /
29.56 - * protocol / username conversation. */
29.57 - void (*notify)(void *opdata, OtrlNotifyLevel level,
29.58 - const char *accountname, const char *protocol,
29.59 - const char *username, const char *title,
29.60 - const char *primary, const char *secondary);
29.61 -
29.62 - /* Display an OTR control message for a particular accountname /
29.63 - * protocol / username conversation. Return 0 if you are able to
29.64 - * successfully display it. If you return non-0 (or if this
29.65 - * function is NULL), the control message will be displayed inline,
29.66 - * as a received message, or else by using the above notify()
29.67 - * callback. */
29.68 - int (*display_otr_message)(void *opdata, const char *accountname,
29.69 - const char *protocol, const char *username, const char *msg);
29.70 -
29.71 - /* When the list of ConnContexts changes (including a change in
29.72 - * state), this is called so the UI can be updated. */
29.73 - void (*update_context_list)(void *opdata);
29.74 -
29.75 - /* Return a newly allocated string containing a human-friendly name
29.76 - * for the given protocol id */
29.77 - const char *(*protocol_name)(void *opdata, const char *protocol);
29.78 -
29.79 - /* Deallocate a string allocated by protocol_name */
29.80 - void (*protocol_name_free)(void *opdata, const char *protocol_name);
29.81 -
29.82 - /* A new fingerprint for the given user has been received. */
29.83 - void (*new_fingerprint)(void *opdata, OtrlUserState us,
29.84 - const char *accountname, const char *protocol,
29.85 - const char *username, unsigned char fingerprint[20]);
29.86 -
29.87 - /* The list of known fingerprints has changed. Write them to disk. */
29.88 - void (*write_fingerprints)(void *opdata);
29.89 -
29.90 - /* A ConnContext has entered a secure state. */
29.91 - void (*gone_secure)(void *opdata, ConnContext *context);
29.92 -
29.93 - /* A ConnContext has left a secure state. */
29.94 - void (*gone_insecure)(void *opdata, ConnContext *context);
29.95 -
29.96 - /* We have completed an authentication, using the D-H keys we
29.97 - * already knew. is_reply indicates whether we initiated the AKE. */
29.98 - void (*still_secure)(void *opdata, ConnContext *context, int is_reply);
29.99 -
29.100 - /* Log a message. The passed message will end in "\n". */
29.101 - void (*log_message)(void *opdata, const char *message);
29.102 -
29.103 - /* Find the maximum message size supported by this protocol. */
29.104 - int (*max_message_size)(void *opdata, ConnContext *context);
29.105 -
29.106 - /* Return a newly allocated string containing a human-friendly
29.107 - * representation for the given account */
29.108 - const char *(*account_name)(void *opdata, const char *account,
29.109 - const char *protocol);
29.110 -
29.111 - /* Deallocate a string returned by account_name */
29.112 - void (*account_name_free)(void *opdata, const char *account_name);
29.113 -
29.114 -} OtrlMessageAppOps;
29.115 -
29.116 -/* Deallocate a message allocated by other otrl_message_* routines. */
29.117 -void otrl_message_free(char *message);
29.118 -
29.119 -/* Handle a message about to be sent to the network. It is safe to pass
29.120 - * all messages about to be sent to this routine. add_appdata is a
29.121 - * function that will be called in the event that a new ConnContext is
29.122 - * created. It will be passed the data that you supplied, as well as a
29.123 - * pointer to the new ConnContext. You can use this to add
29.124 - * application-specific information to the ConnContext using the
29.125 - * "context->app" field, for example. If you don't need to do this, you
29.126 - * can pass NULL for the last two arguments of otrl_message_sending.
29.127 - *
29.128 - * tlvs is a chain of OtrlTLVs to append to the private message. It is
29.129 - * usually correct to just pass NULL here.
29.130 - *
29.131 - * If this routine returns non-zero, then the library tried to encrypt
29.132 - * the message, but for some reason failed. DO NOT send the message in
29.133 - * the clear in that case.
29.134 - *
29.135 - * If *messagep gets set by the call to something non-NULL, then you
29.136 - * should replace your message with the contents of *messagep, and
29.137 - * send that instead. Call otrl_message_free(*messagep) when you're
29.138 - * done with it. */
29.139 -gcry_error_t otrl_message_sending(OtrlUserState us,
29.140 - const OtrlMessageAppOps *ops,
29.141 - void *opdata, const char *accountname, const char *protocol,
29.142 - const char *recipient, const char *message, OtrlTLV *tlvs,
29.143 - char **messagep,
29.144 - void (*add_appdata)(void *data, ConnContext *context),
29.145 - void *data);
29.146 -
29.147 -/* Handle a message just received from the network. It is safe to pass
29.148 - * all received messages to this routine. add_appdata is a function
29.149 - * that will be called in the event that a new ConnContext is created.
29.150 - * It will be passed the data that you supplied, as well as
29.151 - * a pointer to the new ConnContext. You can use this to add
29.152 - * application-specific information to the ConnContext using the
29.153 - * "context->app" field, for example. If you don't need to do this, you
29.154 - * can pass NULL for the last two arguments of otrl_message_receiving.
29.155 - *
29.156 - * If otrl_message_receiving returns 1, then the message you received
29.157 - * was an internal protocol message, and no message should be delivered
29.158 - * to the user.
29.159 - *
29.160 - * If it returns 0, then check if *messagep was set to non-NULL. If
29.161 - * so, replace the received message with the contents of *messagep, and
29.162 - * deliver that to the user instead. You must call
29.163 - * otrl_message_free(*messagep) when you're done with it. If tlvsp is
29.164 - * non-NULL, *tlvsp will be set to a chain of any TLVs that were
29.165 - * transmitted along with this message. You must call
29.166 - * otrl_tlv_free(*tlvsp) when you're done with those.
29.167 - *
29.168 - * If otrl_message_receiving returns 0 and *messagep is NULL, then this
29.169 - * was an ordinary, non-OTR message, which should just be delivered to
29.170 - * the user without modification. */
29.171 -int otrl_message_receiving(OtrlUserState us, const OtrlMessageAppOps *ops,
29.172 - void *opdata, const char *accountname, const char *protocol,
29.173 - const char *sender, const char *message, char **newmessagep,
29.174 - OtrlTLV **tlvsp,
29.175 - void (*add_appdata)(void *data, ConnContext *context),
29.176 - void *data);
29.177 -
29.178 -/* Send a message to the network, fragmenting first if necessary.
29.179 - * All messages to be sent to the network should go through this
29.180 - * method immediately before they are sent, ie after encryption. */
29.181 -gcry_error_t otrl_message_fragment_and_send(const OtrlMessageAppOps *ops,
29.182 - void *opdata, ConnContext *context, const char *message,
29.183 - OtrlFragmentPolicy fragPolicy, char **returnFragment);
29.184 -
29.185 -/* Put a connection into the PLAINTEXT state, first sending the
29.186 - * other side a notice that we're doing so if we're currently ENCRYPTED,
29.187 - * and we think he's logged in. */
29.188 -void otrl_message_disconnect(OtrlUserState us, const OtrlMessageAppOps *ops,
29.189 - void *opdata, const char *accountname, const char *protocol,
29.190 - const char *username);
29.191 -
29.192 -/* Initiate the Socialist Millionaires' Protocol */
29.193 -void otrl_message_initiate_smp(OtrlUserState us, const OtrlMessageAppOps *ops,
29.194 - void *opdata, ConnContext *context, const unsigned char *secret,
29.195 - size_t secretlen);
29.196 -
29.197 -/* Initiate the Socialist Millionaires' Protocol and send a prompt
29.198 - * question to the buddy */
29.199 -void otrl_message_initiate_smp_q(OtrlUserState us,
29.200 - const OtrlMessageAppOps *ops, void *opdata, ConnContext *context,
29.201 - const char *question, const unsigned char *secret, size_t secretlen);
29.202 -
29.203 -/* Respond to a buddy initiating the Socialist Millionaires' Protocol */
29.204 -void otrl_message_respond_smp(OtrlUserState us, const OtrlMessageAppOps *ops,
29.205 - void *opdata, ConnContext *context, const unsigned char *secret,
29.206 - size_t secretlen);
29.207 -
29.208 -/* Abort the SMP. Called when an unexpected SMP message breaks the
29.209 - * normal flow. */
29.210 -void otrl_message_abort_smp(OtrlUserState us, const OtrlMessageAppOps *ops,
29.211 - void *opdata, ConnContext *context);
29.212 -
29.213 -#endif
30.1 --- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/privkey-t.h Wed Sep 05 23:24:55 2012 +0200
30.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
30.3 @@ -1,39 +0,0 @@
30.4 -/*
30.5 - * Off-the-Record Messaging library
30.6 - * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
30.7 - * <otr@cypherpunks.ca>
30.8 - *
30.9 - * This library is free software; you can redistribute it and/or
30.10 - * modify it under the terms of version 2.1 of the GNU Lesser General
30.11 - * Public License as published by the Free Software Foundation.
30.12 - *
30.13 - * This library is distributed in the hope that it will be useful,
30.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
30.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30.16 - * Lesser General Public License for more details.
30.17 - *
30.18 - * You should have received a copy of the GNU Lesser General Public
30.19 - * License along with this library; if not, write to the Free Software
30.20 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30.21 - */
30.22 -
30.23 -#ifndef __PRIVKEY_T_H__
30.24 -#define __PRIVKEY_T_H__
30.25 -
30.26 -#include <gcrypt.h>
30.27 -
30.28 -typedef struct s_OtrlPrivKey {
30.29 - struct s_OtrlPrivKey *next;
30.30 - struct s_OtrlPrivKey **tous;
30.31 -
30.32 - char *accountname;
30.33 - char *protocol;
30.34 - unsigned short pubkey_type;
30.35 - gcry_sexp_t privkey;
30.36 - unsigned char *pubkey_data;
30.37 - size_t pubkey_datalen;
30.38 -} OtrlPrivKey;
30.39 -
30.40 -#define OTRL_PUBKEY_TYPE_DSA 0x0000
30.41 -
30.42 -#endif
31.1 --- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/privkey.h Wed Sep 05 23:24:55 2012 +0200
31.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
31.3 @@ -1,112 +0,0 @@
31.4 -/*
31.5 - * Off-the-Record Messaging library
31.6 - * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
31.7 - * <otr@cypherpunks.ca>
31.8 - *
31.9 - * This library is free software; you can redistribute it and/or
31.10 - * modify it under the terms of version 2.1 of the GNU Lesser General
31.11 - * Public License as published by the Free Software Foundation.
31.12 - *
31.13 - * This library is distributed in the hope that it will be useful,
31.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
31.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
31.16 - * Lesser General Public License for more details.
31.17 - *
31.18 - * You should have received a copy of the GNU Lesser General Public
31.19 - * License along with this library; if not, write to the Free Software
31.20 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31.21 - */
31.22 -
31.23 -#ifndef __PRIVKEY_H__
31.24 -#define __PRIVKEY_H__
31.25 -
31.26 -#include <stdio.h>
31.27 -#include "privkey-t.h"
31.28 -#include "userstate.h"
31.29 -
31.30 -/* Convert a 20-byte hash value to a 45-byte human-readable value */
31.31 -void otrl_privkey_hash_to_human(char human[45], const unsigned char hash[20]);
31.32 -
31.33 -/* Calculate a human-readable hash of our DSA public key. Return it in
31.34 - * the passed fingerprint buffer. Return NULL on error, or a pointer to
31.35 - * the given buffer on success. */
31.36 -char *otrl_privkey_fingerprint(OtrlUserState us, char fingerprint[45],
31.37 - const char *accountname, const char *protocol);
31.38 -
31.39 -/* Calculate a raw hash of our DSA public key. Return it in the passed
31.40 - * fingerprint buffer. Return NULL on error, or a pointer to the given
31.41 - * buffer on success. */
31.42 -unsigned char *otrl_privkey_fingerprint_raw(OtrlUserState us,
31.43 - unsigned char hash[20], const char *accountname, const char *protocol);
31.44 -
31.45 -/* Read a sets of private DSA keys from a file on disk into the given
31.46 - * OtrlUserState. */
31.47 -gcry_error_t otrl_privkey_read(OtrlUserState us, const char *filename);
31.48 -
31.49 -/* Read a sets of private DSA keys from a FILE* into the given
31.50 - * OtrlUserState. The FILE* must be open for reading. */
31.51 -gcry_error_t otrl_privkey_read_FILEp(OtrlUserState us, FILE *privf);
31.52 -
31.53 -/* Generate a private DSA key for a given account, storing it into a
31.54 - * file on disk, and loading it into the given OtrlUserState. Overwrite any
31.55 - * previously generated keys for that account in that OtrlUserState. */
31.56 -gcry_error_t otrl_privkey_generate(OtrlUserState us, const char *filename,
31.57 - const char *accountname, const char *protocol);
31.58 -
31.59 -/* Generate a private DSA key for a given account, storing it into a
31.60 - * FILE*, and loading it into the given OtrlUserState. Overwrite any
31.61 - * previously generated keys for that account in that OtrlUserState.
31.62 - * The FILE* must be open for reading and writing. */
31.63 -gcry_error_t otrl_privkey_generate_FILEp(OtrlUserState us, FILE *privf,
31.64 - const char *accountname, const char *protocol);
31.65 -
31.66 -/* Read the fingerprint store from a file on disk into the given
31.67 - * OtrlUserState. Use add_app_data to add application data to each
31.68 - * ConnContext so created. */
31.69 -gcry_error_t otrl_privkey_read_fingerprints(OtrlUserState us,
31.70 - const char *filename,
31.71 - void (*add_app_data)(void *data, ConnContext *context),
31.72 - void *data);
31.73 -
31.74 -/* Read the fingerprint store from a FILE* into the given
31.75 - * OtrlUserState. Use add_app_data to add application data to each
31.76 - * ConnContext so created. The FILE* must be open for reading. */
31.77 -gcry_error_t otrl_privkey_read_fingerprints_FILEp(OtrlUserState us,
31.78 - FILE *storef,
31.79 - void (*add_app_data)(void *data, ConnContext *context),
31.80 - void *data);
31.81 -
31.82 -/* Write the fingerprint store from a given OtrlUserState to a file on disk. */
31.83 -gcry_error_t otrl_privkey_write_fingerprints(OtrlUserState us,
31.84 - const char *filename);
31.85 -
31.86 -/* Write the fingerprint store from a given OtrlUserState to a FILE*.
31.87 - * The FILE* must be open for writing. */
31.88 -gcry_error_t otrl_privkey_write_fingerprints_FILEp(OtrlUserState us,
31.89 - FILE *storef);
31.90 -
31.91 -/* Fetch the private key from the given OtrlUserState associated with
31.92 - * the given account */
31.93 -OtrlPrivKey *otrl_privkey_find(OtrlUserState us, const char *accountname,
31.94 - const char *protocol);
31.95 -
31.96 -/* Forget a private key */
31.97 -void otrl_privkey_forget(OtrlPrivKey *privkey);
31.98 -
31.99 -/* Forget all private keys in a given OtrlUserState. */
31.100 -void otrl_privkey_forget_all(OtrlUserState us);
31.101 -
31.102 -/* Sign data using a private key. The data must be small enough to be
31.103 - * signed (i.e. already hashed, if necessary). The signature will be
31.104 - * returned in *sigp, which the caller must free(). Its length will be
31.105 - * returned in *siglenp. */
31.106 -gcry_error_t otrl_privkey_sign(unsigned char **sigp, size_t *siglenp,
31.107 - OtrlPrivKey *privkey, const unsigned char *data, size_t len);
31.108 -
31.109 -/* Verify a signature on data using a public key. The data must be
31.110 - * small enough to be signed (i.e. already hashed, if necessary). */
31.111 -gcry_error_t otrl_privkey_verify(const unsigned char *sigbuf, size_t siglen,
31.112 - unsigned short pubkey_type, gcry_sexp_t pubs,
31.113 - const unsigned char *data, size_t len);
31.114 -
31.115 -#endif
32.1 --- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/proto.h Wed Sep 05 23:24:55 2012 +0200
32.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
32.3 @@ -1,150 +0,0 @@
32.4 -/*
32.5 - * Off-the-Record Messaging library
32.6 - * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
32.7 - * <otr@cypherpunks.ca>
32.8 - *
32.9 - * This library is free software; you can redistribute it and/or
32.10 - * modify it under the terms of version 2.1 of the GNU Lesser General
32.11 - * Public License as published by the Free Software Foundation.
32.12 - *
32.13 - * This library is distributed in the hope that it will be useful,
32.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
32.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
32.16 - * Lesser General Public License for more details.
32.17 - *
32.18 - * You should have received a copy of the GNU Lesser General Public
32.19 - * License along with this library; if not, write to the Free Software
32.20 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32.21 - */
32.22 -
32.23 -#ifndef __PROTO_H__
32.24 -#define __PROTO_H__
32.25 -
32.26 -#include "context.h"
32.27 -#include "version.h"
32.28 -#include "tlv.h"
32.29 -
32.30 -/* If we ever see this sequence in a plaintext message, we'll assume the
32.31 - * other side speaks OTR, and try to establish a connection. */
32.32 -#define OTRL_MESSAGE_TAG_BASE " \t \t\t\t\t \t \t \t "
32.33 -/* The following must each be of length 8 */
32.34 -#define OTRL_MESSAGE_TAG_V1 " \t \t \t "
32.35 -#define OTRL_MESSAGE_TAG_V2 " \t\t \t "
32.36 -
32.37 -/* The possible flags contained in a Data Message */
32.38 -#define OTRL_MSGFLAGS_IGNORE_UNREADABLE 0x01
32.39 -
32.40 -typedef unsigned int OtrlPolicy;
32.41 -
32.42 -#define OTRL_POLICY_ALLOW_V1 0x01
32.43 -#define OTRL_POLICY_ALLOW_V2 0x02
32.44 -#define OTRL_POLICY_REQUIRE_ENCRYPTION 0x04
32.45 -#define OTRL_POLICY_SEND_WHITESPACE_TAG 0x08
32.46 -#define OTRL_POLICY_WHITESPACE_START_AKE 0x10
32.47 -#define OTRL_POLICY_ERROR_START_AKE 0x20
32.48 -
32.49 -#define OTRL_POLICY_VERSION_MASK (OTRL_POLICY_ALLOW_V1 | OTRL_POLICY_ALLOW_V2)
32.50 -
32.51 -/* For v1 compatibility */
32.52 -#define OTRL_POLICY_NEVER 0x00
32.53 -#define OTRL_POLICY_OPPORTUNISTIC \
32.54 - ( OTRL_POLICY_ALLOW_V1 | \
32.55 - OTRL_POLICY_ALLOW_V2 | \
32.56 - OTRL_POLICY_SEND_WHITESPACE_TAG | \
32.57 - OTRL_POLICY_WHITESPACE_START_AKE | \
32.58 - OTRL_POLICY_ERROR_START_AKE )
32.59 -#define OTRL_POLICY_MANUAL \
32.60 - ( OTRL_POLICY_ALLOW_V1 | \
32.61 - OTRL_POLICY_ALLOW_V2 )
32.62 -#define OTRL_POLICY_ALWAYS \
32.63 - ( OTRL_POLICY_ALLOW_V1 | \
32.64 - OTRL_POLICY_ALLOW_V2 | \
32.65 - OTRL_POLICY_REQUIRE_ENCRYPTION | \
32.66 - OTRL_POLICY_WHITESPACE_START_AKE | \
32.67 - OTRL_POLICY_ERROR_START_AKE )
32.68 -#define OTRL_POLICY_DEFAULT OTRL_POLICY_OPPORTUNISTIC
32.69 -
32.70 -typedef enum {
32.71 - OTRL_MSGTYPE_NOTOTR,
32.72 - OTRL_MSGTYPE_TAGGEDPLAINTEXT,
32.73 - OTRL_MSGTYPE_QUERY,
32.74 - OTRL_MSGTYPE_DH_COMMIT,
32.75 - OTRL_MSGTYPE_DH_KEY,
32.76 - OTRL_MSGTYPE_REVEALSIG,
32.77 - OTRL_MSGTYPE_SIGNATURE,
32.78 - OTRL_MSGTYPE_V1_KEYEXCH,
32.79 - OTRL_MSGTYPE_DATA,
32.80 - OTRL_MSGTYPE_ERROR,
32.81 - OTRL_MSGTYPE_UNKNOWN
32.82 -} OtrlMessageType;
32.83 -
32.84 -typedef enum {
32.85 - OTRL_FRAGMENT_UNFRAGMENTED,
32.86 - OTRL_FRAGMENT_INCOMPLETE,
32.87 - OTRL_FRAGMENT_COMPLETE
32.88 -} OtrlFragmentResult;
32.89 -
32.90 -typedef enum {
32.91 - OTRL_FRAGMENT_SEND_ALL,
32.92 - OTRL_FRAGMENT_SEND_ALL_BUT_FIRST,
32.93 - OTRL_FRAGMENT_SEND_ALL_BUT_LAST
32.94 -} OtrlFragmentPolicy;
32.95 -
32.96 -/* Initialize the OTR library. Pass the version of the API you are
32.97 - * using. */
32.98 -void otrl_init(unsigned int ver_major, unsigned int ver_minor,
32.99 - unsigned int ver_sub);
32.100 -
32.101 -/* Shortcut */
32.102 -#define OTRL_INIT do { \
32.103 - otrl_init(OTRL_VERSION_MAJOR, OTRL_VERSION_MINOR, OTRL_VERSION_SUB); \
32.104 - } while(0)
32.105 -
32.106 -/* Return a pointer to a static string containing the version number of
32.107 - * the OTR library. */
32.108 -const char *otrl_version(void);
32.109 -
32.110 -/* Return a pointer to a newly-allocated OTR query message, customized
32.111 - * with our name. The caller should free() the result when he's done
32.112 - * with it. */
32.113 -char *otrl_proto_default_query_msg(const char *ourname, OtrlPolicy policy);
32.114 -
32.115 -/* Return the best version of OTR support by both sides, given an OTR
32.116 - * Query Message and the local policy. */
32.117 -unsigned int otrl_proto_query_bestversion(const char *querymsg,
32.118 - OtrlPolicy policy);
32.119 -
32.120 -/* Locate any whitespace tag in this message, and return the best
32.121 - * version of OTR support on both sides. Set *starttagp and *endtagp to
32.122 - * the start and end of the located tag, so that it can be snipped out. */
32.123 -unsigned int otrl_proto_whitespace_bestversion(const char *msg,
32.124 - const char **starttagp, const char **endtagp, OtrlPolicy policy);
32.125 -
32.126 -/* Return the Message type of the given message. */
32.127 -OtrlMessageType otrl_proto_message_type(const char *message);
32.128 -
32.129 -/* Create an OTR Data message. Pass the plaintext as msg, and an
32.130 - * optional chain of TLVs. A newly-allocated string will be returned in
32.131 - * *encmessagep. */
32.132 -gcry_error_t otrl_proto_create_data(char **encmessagep, ConnContext *context,
32.133 - const char *msg, const OtrlTLV *tlvs, unsigned char flags);
32.134 -
32.135 -/* Extract the flags from an otherwise unreadable Data Message. */
32.136 -gcry_error_t otrl_proto_data_read_flags(const char *datamsg,
32.137 - unsigned char *flagsp);
32.138 -
32.139 -/* Accept an OTR Data Message in datamsg. Decrypt it and put the
32.140 - * plaintext into *plaintextp, and any TLVs into tlvsp. Put any
32.141 - * received flags into *flagsp (if non-NULL). */
32.142 -gcry_error_t otrl_proto_accept_data(char **plaintextp, OtrlTLV **tlvsp,
32.143 - ConnContext *context, const char *datamsg, unsigned char *flagsp);
32.144 -
32.145 -/* Accumulate a potential fragment into the current context. */
32.146 -OtrlFragmentResult otrl_proto_fragment_accumulate(char **unfragmessagep,
32.147 - ConnContext *context, const char *msg);
32.148 -
32.149 -gcry_error_t otrl_proto_fragment_create(int mms, int fragment_count,
32.150 - char ***fragments, const char *message);
32.151 -
32.152 -void otrl_proto_fragment_free(char ***fragments, unsigned short arraylen);
32.153 -#endif
33.1 --- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/serial.h Wed Sep 05 23:24:55 2012 +0200
33.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
33.3 @@ -1,85 +0,0 @@
33.4 -/*
33.5 - * Off-the-Record Messaging library
33.6 - * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
33.7 - * <otr@cypherpunks.ca>
33.8 - *
33.9 - * This library is free software; you can redistribute it and/or
33.10 - * modify it under the terms of version 2.1 of the GNU Lesser General
33.11 - * Public License as published by the Free Software Foundation.
33.12 - *
33.13 - * This library is distributed in the hope that it will be useful,
33.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
33.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
33.16 - * Lesser General Public License for more details.
33.17 - *
33.18 - * You should have received a copy of the GNU Lesser General Public
33.19 - * License along with this library; if not, write to the Free Software
33.20 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33.21 - */
33.22 -
33.23 -#ifndef __SERIAL_H__
33.24 -#define __SERIAL_H__
33.25 -
33.26 -#undef DEBUG
33.27 -
33.28 -#ifdef DEBUG
33.29 -
33.30 -#include <stdio.h>
33.31 -
33.32 -#define debug_data(t,b,l) do { const unsigned char *data = (b); size_t i; \
33.33 - fprintf(stderr, "%s: ", (t)); \
33.34 - for(i=0;i<(l);++i) { \
33.35 - fprintf(stderr, "%02x", data[i]); \
33.36 - } \
33.37 - fprintf(stderr, "\n"); \
33.38 - } while(0)
33.39 -
33.40 -#define debug_int(t,b) do { const unsigned char *data = (b); \
33.41 - unsigned int v = \
33.42 - (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; \
33.43 - fprintf(stderr, "%s: %u (0x%x)\n", (t), v, v); \
33.44 - } while(0)
33.45 -
33.46 -#else
33.47 -#define debug_data(t,b,l)
33.48 -#define debug_int(t,b)
33.49 -#endif
33.50 -
33.51 -#define write_int(x) do { \
33.52 - bufp[0] = ((x) >> 24) & 0xff; \
33.53 - bufp[1] = ((x) >> 16) & 0xff; \
33.54 - bufp[2] = ((x) >> 8) & 0xff; \
33.55 - bufp[3] = (x) & 0xff; \
33.56 - bufp += 4; lenp -= 4; \
33.57 - } while(0)
33.58 -
33.59 -#define write_mpi(x,nx,dx) do { \
33.60 - write_int(nx); \
33.61 - gcry_mpi_print(format, bufp, lenp, NULL, (x)); \
33.62 - debug_data((dx), bufp, (nx)); \
33.63 - bufp += (nx); lenp -= (nx); \
33.64 - } while(0)
33.65 -
33.66 -#define require_len(l) do { \
33.67 - if (lenp < (l)) goto invval; \
33.68 - } while(0)
33.69 -
33.70 -#define read_int(x) do { \
33.71 - require_len(4); \
33.72 - (x) = (bufp[0] << 24) | (bufp[1] << 16) | (bufp[2] << 8) | bufp[3]; \
33.73 - bufp += 4; lenp -= 4; \
33.74 - } while(0)
33.75 -
33.76 -#define read_mpi(x) do { \
33.77 - size_t mpilen; \
33.78 - read_int(mpilen); \
33.79 - if (mpilen) { \
33.80 - require_len(mpilen); \
33.81 - gcry_mpi_scan(&(x), GCRYMPI_FMT_USG, bufp, mpilen, NULL); \
33.82 - } else { \
33.83 - (x) = gcry_mpi_set_ui(NULL, 0); \
33.84 - } \
33.85 - bufp += mpilen; lenp -= mpilen; \
33.86 - } while(0)
33.87 -
33.88 -#endif
34.1 --- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/sm.h Wed Sep 05 23:24:55 2012 +0200
34.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
34.3 @@ -1,83 +0,0 @@
34.4 -/*
34.5 - * Off-the-Record Messaging library
34.6 - * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
34.7 - * <otr@cypherpunks.ca>
34.8 - *
34.9 - * This library is free software; you can redistribute it and/or
34.10 - * modify it under the terms of version 2.1 of the GNU Lesser General
34.11 - * Public License as published by the Free Software Foundation.
34.12 - *
34.13 - * This library is distributed in the hope that it will be useful,
34.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
34.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
34.16 - * Lesser General Public License for more details.
34.17 - *
34.18 - * You should have received a copy of the GNU Lesser General Public
34.19 - * License along with this library; if not, write to the Free Software
34.20 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34.21 - */
34.22 -
34.23 -#ifndef __SM_H__
34.24 -#define __SM_H__
34.25 -
34.26 -#include <gcrypt.h>
34.27 -
34.28 -#define SM_HASH_ALGORITHM GCRY_MD_SHA256
34.29 -#define SM_DIGEST_SIZE 32
34.30 -
34.31 -typedef enum {
34.32 - OTRL_SMP_EXPECT1,
34.33 - OTRL_SMP_EXPECT2,
34.34 - OTRL_SMP_EXPECT3,
34.35 - OTRL_SMP_EXPECT4,
34.36 - OTRL_SMP_EXPECT5
34.37 -} NextExpectedSMP;
34.38 -
34.39 -typedef enum {
34.40 - OTRL_SMP_PROG_OK = 0, /* All is going fine so far */
34.41 - OTRL_SMP_PROG_CHEATED = -2, /* Some verification failed */
34.42 - OTRL_SMP_PROG_FAILED = -1, /* The secrets didn't match */
34.43 - OTRL_SMP_PROG_SUCCEEDED = 1 /* The SMP completed successfully */
34.44 -} OtrlSMProgState;
34.45 -
34.46 -typedef struct {
34.47 - gcry_mpi_t secret, x2, x3, g1, g2, g3, g3o, p, q, pab, qab;
34.48 - NextExpectedSMP nextExpected;
34.49 - int received_question; /* 1 if we received a question in an SMP1Q TLV */
34.50 - OtrlSMProgState sm_prog_state;
34.51 -} OtrlSMState;
34.52 -
34.53 -typedef OtrlSMState OtrlSMAliceState;
34.54 -typedef OtrlSMState OtrlSMBobState;
34.55 -
34.56 -/*
34.57 - * Call this once, at plugin load time. It sets up the modulus and
34.58 - * generator MPIs.
34.59 - */
34.60 -void otrl_sm_init(void);
34.61 -
34.62 -/*
34.63 - * Initialize the fields of a SM state.
34.64 - */
34.65 -void otrl_sm_state_new(OtrlSMState *smst);
34.66 -
34.67 -/*
34.68 - * Initialize the fields of a SM state. Called the first time that
34.69 - * a user begins an SMP session.
34.70 - */
34.71 -void otrl_sm_state_init(OtrlSMState *smst);
34.72 -
34.73 -/*
34.74 - * Deallocate the contents of a OtrlSMState (but not the OtrlSMState
34.75 - * itself)
34.76 - */
34.77 -void otrl_sm_state_free(OtrlSMState *smst);
34.78 -
34.79 -gcry_error_t otrl_sm_step1(OtrlSMAliceState *astate, const unsigned char* secret, int secretlen, unsigned char** output, int* outputlen);
34.80 -gcry_error_t otrl_sm_step2a(OtrlSMBobState *bstate, const unsigned char* input, const int inputlen, int received_question);
34.81 -gcry_error_t otrl_sm_step2b(OtrlSMBobState *bstate, const unsigned char* secret, int secretlen, unsigned char **output, int* outputlen);
34.82 -gcry_error_t otrl_sm_step3(OtrlSMAliceState *astate, const unsigned char* input, const int inputlen, unsigned char **output, int* outputlen);
34.83 -gcry_error_t otrl_sm_step4(OtrlSMBobState *bstate, const unsigned char* input, const int inputlen, unsigned char **output, int* outputlen);
34.84 -gcry_error_t otrl_sm_step5(OtrlSMAliceState *astate, const unsigned char* input, const int inputlen);
34.85 -
34.86 -#endif
35.1 --- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/tlv.h Wed Sep 05 23:24:55 2012 +0200
35.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
35.3 @@ -1,70 +0,0 @@
35.4 -/*
35.5 - * Off-the-Record Messaging library
35.6 - * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
35.7 - * <otr@cypherpunks.ca>
35.8 - *
35.9 - * This library is free software; you can redistribute it and/or
35.10 - * modify it under the terms of version 2.1 of the GNU Lesser General
35.11 - * Public License as published by the Free Software Foundation.
35.12 - *
35.13 - * This library is distributed in the hope that it will be useful,
35.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
35.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
35.16 - * Lesser General Public License for more details.
35.17 - *
35.18 - * You should have received a copy of the GNU Lesser General Public
35.19 - * License along with this library; if not, write to the Free Software
35.20 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
35.21 - */
35.22 -
35.23 -#ifndef __TLV_H__
35.24 -#define __TLV_H__
35.25 -
35.26 -typedef struct s_OtrlTLV {
35.27 - unsigned short type;
35.28 - unsigned short len;
35.29 - unsigned char *data;
35.30 - struct s_OtrlTLV *next;
35.31 -} OtrlTLV;
35.32 -
35.33 -/* TLV types */
35.34 -
35.35 -/* This is just padding for the encrypted message, and should be ignored. */
35.36 -#define OTRL_TLV_PADDING 0x0000
35.37 -
35.38 -/* The sender has thrown away his OTR session keys with you */
35.39 -#define OTRL_TLV_DISCONNECTED 0x0001
35.40 -
35.41 -/* The message contains a step in the Socialist Millionaires' Protocol. */
35.42 -#define OTRL_TLV_SMP1 0x0002
35.43 -#define OTRL_TLV_SMP2 0x0003
35.44 -#define OTRL_TLV_SMP3 0x0004
35.45 -#define OTRL_TLV_SMP4 0x0005
35.46 -#define OTRL_TLV_SMP_ABORT 0x0006
35.47 -/* Like OTRL_TLV_SMP1, but there's a question for the buddy at the
35.48 - * beginning */
35.49 -#define OTRL_TLV_SMP1Q 0x0007
35.50 -
35.51 -/* Make a single TLV, copying the supplied data */
35.52 -OtrlTLV *otrl_tlv_new(unsigned short type, unsigned short len,
35.53 - const unsigned char *data);
35.54 -
35.55 -/* Construct a chain of TLVs from the given data */
35.56 -OtrlTLV *otrl_tlv_parse(const unsigned char *serialized, size_t seriallen);
35.57 -
35.58 -/* Deallocate a chain of TLVs */
35.59 -void otrl_tlv_free(OtrlTLV *tlv);
35.60 -
35.61 -/* Find the serialized length of a chain of TLVs */
35.62 -size_t otrl_tlv_seriallen(const OtrlTLV *tlv);
35.63 -
35.64 -/* Serialize a chain of TLVs. The supplied buffer must already be large
35.65 - * enough. */
35.66 -void otrl_tlv_serialize(unsigned char *buf, const OtrlTLV *tlv);
35.67 -
35.68 -/* Return the first TLV with the given type in the chain, or NULL if one
35.69 - * isn't found. (The tlvs argument isn't const because the return type
35.70 - * needs to be non-const.) */
35.71 -OtrlTLV *otrl_tlv_find(OtrlTLV *tlvs, unsigned short type);
35.72 -
35.73 -#endif
36.1 --- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/userstate.h Wed Sep 05 23:24:55 2012 +0200
36.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
36.3 @@ -1,45 +0,0 @@
36.4 -/*
36.5 - * Off-the-Record Messaging library
36.6 - * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
36.7 - * <otr@cypherpunks.ca>
36.8 - *
36.9 - * This library is free software; you can redistribute it and/or
36.10 - * modify it under the terms of version 2.1 of the GNU Lesser General
36.11 - * Public License as published by the Free Software Foundation.
36.12 - *
36.13 - * This library is distributed in the hope that it will be useful,
36.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
36.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
36.16 - * Lesser General Public License for more details.
36.17 - *
36.18 - * You should have received a copy of the GNU Lesser General Public
36.19 - * License along with this library; if not, write to the Free Software
36.20 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
36.21 - */
36.22 -
36.23 -#ifndef __USERSTATE_H__
36.24 -#define __USERSTATE_H__
36.25 -
36.26 -typedef struct s_OtrlUserState* OtrlUserState;
36.27 -
36.28 -#include "context.h"
36.29 -#include "privkey-t.h"
36.30 -
36.31 -struct s_OtrlUserState {
36.32 - ConnContext *context_root;
36.33 - OtrlPrivKey *privkey_root;
36.34 -};
36.35 -
36.36 -/* Create a new OtrlUserState. Most clients will only need one of
36.37 - * these. A OtrlUserState encapsulates the list of known fingerprints
36.38 - * and the list of private keys; if you have separate files for these
36.39 - * things for (say) different users, use different OtrlUserStates. If
36.40 - * you've got only one user, with multiple accounts all stored together
36.41 - * in the same fingerprint store and privkey store files, use just one
36.42 - * OtrlUserState. */
36.43 -OtrlUserState otrl_userstate_create(void);
36.44 -
36.45 -/* Free a OtrlUserState */
36.46 -void otrl_userstate_free(OtrlUserState us);
36.47 -
36.48 -#endif
37.1 --- a/Frameworks/libotr.framework/Versions/2.2.0/Headers/version.h Wed Sep 05 23:24:55 2012 +0200
37.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
37.3 @@ -1,29 +0,0 @@
37.4 -/*
37.5 - * Off-the-Record Messaging library
37.6 - * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
37.7 - * <otr@cypherpunks.ca>
37.8 - *
37.9 - * This library is free software; you can redistribute it and/or
37.10 - * modify it under the terms of version 2.1 of the GNU Lesser General
37.11 - * Public License as published by the Free Software Foundation.
37.12 - *
37.13 - * This library is distributed in the hope that it will be useful,
37.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
37.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
37.16 - * Lesser General Public License for more details.
37.17 - *
37.18 - * You should have received a copy of the GNU Lesser General Public
37.19 - * License along with this library; if not, write to the Free Software
37.20 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
37.21 - */
37.22 -
37.23 -#ifndef __VERSION_H__
37.24 -#define __VERSION_H__
37.25 -
37.26 -#define OTRL_VERSION "3.2.0"
37.27 -
37.28 -#define OTRL_VERSION_MAJOR 3
37.29 -#define OTRL_VERSION_MINOR 2
37.30 -#define OTRL_VERSION_SUB 0
37.31 -
37.32 -#endif
38.1 --- a/Frameworks/libotr.framework/Versions/2.2.0/Resources/English.lproj/InfoPlist.strings Wed Sep 05 23:24:55 2012 +0200
38.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
38.3 @@ -1,3 +0,0 @@
38.4 -/* Localized versions of Info.plist keys */
38.5 -
38.6 -CFBundleName = "libotr";
39.1 --- a/Frameworks/libotr.framework/Versions/2.2.0/Resources/Info.plist Wed Sep 05 23:24:55 2012 +0200
39.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
39.3 @@ -1,18 +0,0 @@
39.4 -<?xml version="1.0" encoding="UTF-8"?>
39.5 -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
39.6 -<plist version="1.0">
39.7 -<dict>
39.8 - <key>CFBundleDevelopmentRegion</key>
39.9 - <string>English</string>
39.10 - <key>CFBundleInfoDictionaryVersion</key>
39.11 - <string>6.0</string>
39.12 - <key>CFBundlePackageType</key>
39.13 - <string>FMWK</string>
39.14 - <key>CFBundleSignature</key>
39.15 - <string>????</string>
39.16 - <key>CFBundleVersion</key>
39.17 - <string>2.2.0</string>
39.18 - <key>CFBundleIdentifier</key>
39.19 - <string>im.adium.libotr</string>
39.20 -</dict>
39.21 -</plist>
40.1 Binary file Frameworks/libotr.framework/Versions/2.2.0/libotr has changed
41.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
41.2 +++ b/Frameworks/libotr.framework/Versions/3.2.1/Headers/auth.h Thu Sep 06 18:49:22 2012 +0200
41.3 @@ -0,0 +1,157 @@
41.4 +/*
41.5 + * Off-the-Record Messaging library
41.6 + * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
41.7 + * <otr@cypherpunks.ca>
41.8 + *
41.9 + * This library is free software; you can redistribute it and/or
41.10 + * modify it under the terms of version 2.1 of the GNU Lesser General
41.11 + * Public License as published by the Free Software Foundation.
41.12 + *
41.13 + * This library is distributed in the hope that it will be useful,
41.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
41.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41.16 + * Lesser General Public License for more details.
41.17 + *
41.18 + * You should have received a copy of the GNU Lesser General Public
41.19 + * License along with this library; if not, write to the Free Software
41.20 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
41.21 + */
41.22 +
41.23 +#ifndef __AUTH_H__
41.24 +#define __AUTH_H__
41.25 +
41.26 +#include <gcrypt.h>
41.27 +#include "dh.h"
41.28 +
41.29 +typedef enum {
41.30 + OTRL_AUTHSTATE_NONE,
41.31 + OTRL_AUTHSTATE_AWAITING_DHKEY,
41.32 + OTRL_AUTHSTATE_AWAITING_REVEALSIG,
41.33 + OTRL_AUTHSTATE_AWAITING_SIG,
41.34 + OTRL_AUTHSTATE_V1_SETUP
41.35 +} OtrlAuthState;
41.36 +
41.37 +typedef struct {
41.38 + OtrlAuthState authstate; /* Our state */
41.39 +
41.40 + DH_keypair our_dh; /* Our D-H key */
41.41 + unsigned int our_keyid; /* ...and its keyid */
41.42 +
41.43 + unsigned char *encgx; /* The encrypted value of g^x */
41.44 + size_t encgx_len; /* ...and its length */
41.45 + unsigned char r[16]; /* The encryption key */
41.46 +
41.47 + unsigned char hashgx[32]; /* SHA256(g^x) */
41.48 +
41.49 + gcry_mpi_t their_pub; /* Their D-H public key */
41.50 + unsigned int their_keyid; /* ...and its keyid */
41.51 +
41.52 + gcry_cipher_hd_t enc_c, enc_cp; /* c and c' encryption keys */
41.53 + gcry_md_hd_t mac_m1, mac_m1p; /* m1 and m1' MAC keys */
41.54 + gcry_md_hd_t mac_m2, mac_m2p; /* m2 and m2' MAC keys */
41.55 +
41.56 + unsigned char their_fingerprint[20]; /* The fingerprint of their
41.57 + long-term signing key */
41.58 +
41.59 + int initiated; /* Did we initiate this
41.60 + authentication? */
41.61 +
41.62 + unsigned int protocol_version; /* The protocol version number
41.63 + used to authenticate. */
41.64 +
41.65 + unsigned char secure_session_id[20]; /* The secure session id */
41.66 + size_t secure_session_id_len; /* And its actual length,
41.67 + which may be either 20 (for
41.68 + v1) or 8 (for v2) */
41.69 + OtrlSessionIdHalf session_id_half; /* Which half of the session
41.70 + id gets shown in bold */
41.71 +
41.72 + char *lastauthmsg; /* The last auth message
41.73 + (base-64 encoded) we sent,
41.74 + in case we need to
41.75 + retransmit it. */
41.76 +} OtrlAuthInfo;
41.77 +
41.78 +#include "privkey-t.h"
41.79 +
41.80 +/*
41.81 + * Initialize the fields of an OtrlAuthInfo (already allocated).
41.82 + */
41.83 +void otrl_auth_new(OtrlAuthInfo *auth);
41.84 +
41.85 +/*
41.86 + * Clear the fields of an OtrlAuthInfo (but leave it allocated).
41.87 + */
41.88 +void otrl_auth_clear(OtrlAuthInfo *auth);
41.89 +
41.90 +/*
41.91 + * Start a fresh AKE (version 2) using the given OtrlAuthInfo. Generate
41.92 + * a fresh DH keypair to use. If no error is returned, the message to
41.93 + * transmit will be contained in auth->lastauthmsg.
41.94 + */
41.95 +gcry_error_t otrl_auth_start_v2(OtrlAuthInfo *auth);
41.96 +
41.97 +/*
41.98 + * Handle an incoming D-H Commit Message. If no error is returned, the
41.99 + * message to send will be left in auth->lastauthmsg. Generate a fresh
41.100 + * keypair to use.
41.101 + */
41.102 +gcry_error_t otrl_auth_handle_commit(OtrlAuthInfo *auth,
41.103 + const char *commitmsg);
41.104 +
41.105 +/*
41.106 + * Handle an incoming D-H Key Message. If no error is returned, and
41.107 + * *havemsgp is 1, the message to sent will be left in auth->lastauthmsg.
41.108 + * Use the given private authentication key to sign messages.
41.109 + */
41.110 +gcry_error_t otrl_auth_handle_key(OtrlAuthInfo *auth, const char *keymsg,
41.111 + int *havemsgp, OtrlPrivKey *privkey);
41.112 +
41.113 +/*
41.114 + * Handle an incoming Reveal Signature Message. If no error is
41.115 + * returned, and *havemsgp is 1, the message to be sent will be left in
41.116 + * auth->lastauthmsg. Use the given private authentication key to sign
41.117 + * messages. Call the auth_succeeded callback if authentication is
41.118 + * successful.
41.119 + */
41.120 +gcry_error_t otrl_auth_handle_revealsig(OtrlAuthInfo *auth,
41.121 + const char *revealmsg, int *havemsgp, OtrlPrivKey *privkey,
41.122 + gcry_error_t (*auth_succeeded)(const OtrlAuthInfo *auth, void *asdata),
41.123 + void *asdata);
41.124 +
41.125 +/*
41.126 + * Handle an incoming Signature Message. If no error is returned, and
41.127 + * *havemsgp is 1, the message to be sent will be left in
41.128 + * auth->lastauthmsg. Call the auth_succeeded callback if
41.129 + * authentication is successful.
41.130 + */
41.131 +gcry_error_t otrl_auth_handle_signature(OtrlAuthInfo *auth,
41.132 + const char *sigmsg, int *havemsgp,
41.133 + gcry_error_t (*auth_succeeded)(const OtrlAuthInfo *auth, void *asdata),
41.134 + void *asdata);
41.135 +
41.136 +/*
41.137 + * Start a fresh AKE (version 1) using the given OtrlAuthInfo. If
41.138 + * our_dh is NULL, generate a fresh DH keypair to use. Otherwise, use a
41.139 + * copy of the one passed (with the given keyid). Use the given private
41.140 + * key to sign the message. If no error is returned, the message to
41.141 + * transmit will be contained in auth->lastauthmsg.
41.142 + */
41.143 +gcry_error_t otrl_auth_start_v1(OtrlAuthInfo *auth, DH_keypair *our_dh,
41.144 + unsigned int our_keyid, OtrlPrivKey *privkey);
41.145 +
41.146 +/*
41.147 + * Handle an incoming v1 Key Exchange Message. If no error is returned,
41.148 + * and *havemsgp is 1, the message to be sent will be left in
41.149 + * auth->lastauthmsg. Use the given private authentication key to sign
41.150 + * messages. Call the auth_secceeded callback if authentication is
41.151 + * successful. If non-NULL, use a copy of the given D-H keypair, with
41.152 + * the given keyid.
41.153 + */
41.154 +gcry_error_t otrl_auth_handle_v1_key_exchange(OtrlAuthInfo *auth,
41.155 + const char *keyexchmsg, int *havemsgp, OtrlPrivKey *privkey,
41.156 + DH_keypair *our_dh, unsigned int our_keyid,
41.157 + gcry_error_t (*auth_succeeded)(const OtrlAuthInfo *auth, void *asdata),
41.158 + void *asdata);
41.159 +
41.160 +#endif
42.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
42.2 +++ b/Frameworks/libotr.framework/Versions/3.2.1/Headers/b64.h Thu Sep 06 18:49:22 2012 +0200
42.3 @@ -0,0 +1,71 @@
42.4 +/*
42.5 + * Off-the-Record Messaging library
42.6 + * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
42.7 + * <otr@cypherpunks.ca>
42.8 + *
42.9 + * This library is free software; you can redistribute it and/or
42.10 + * modify it under the terms of version 2.1 of the GNU Lesser General
42.11 + * Public License as published by the Free Software Foundation.
42.12 + *
42.13 + * This library is distributed in the hope that it will be useful,
42.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
42.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
42.16 + * Lesser General Public License for more details.
42.17 + *
42.18 + * You should have received a copy of the GNU Lesser General Public
42.19 + * License along with this library; if not, write to the Free Software
42.20 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
42.21 + */
42.22 +
42.23 +#ifndef __B64_H__
42.24 +#define __B64_H__
42.25 +
42.26 +#include <stdlib.h>
42.27 +
42.28 +/* Base64 encodes blocks of this many bytes: */
42.29 +#define OTRL_B64_DECODED_LEN 3
42.30 +/* into blocks of this many bytes: */
42.31 +#define OTRL_B64_ENCODED_LEN 4
42.32 +
42.33 +/* An encoded block of length encoded_len can turn into a maximum of
42.34 + * this many decoded bytes: */
42.35 +#define OTRL_B64_MAX_DECODED_SIZE(encoded_len) \
42.36 + (((encoded_len + OTRL_B64_ENCODED_LEN - 1) / OTRL_B64_ENCODED_LEN) \
42.37 + * OTRL_B64_DECODED_LEN)
42.38 +
42.39 +/*
42.40 + * base64 encode data. Insert no linebreaks or whitespace.
42.41 + *
42.42 + * The buffer base64data must contain at least ((datalen+2)/3)*4 bytes of
42.43 + * space. This function will return the number of bytes actually used.
42.44 + */
42.45 +size_t otrl_base64_encode(char *base64data, const unsigned char *data,
42.46 + size_t datalen);
42.47 +
42.48 +/*
42.49 + * base64 decode data. Skip non-base64 chars, and terminate at the
42.50 + * first '=', or the end of the buffer.
42.51 + *
42.52 + * The buffer data must contain at least ((base64len+3) / 4) * 3 bytes
42.53 + * of space. This function will return the number of bytes actually
42.54 + * used.
42.55 + */
42.56 +size_t otrl_base64_decode(unsigned char *data, const char *base64data,
42.57 + size_t base64len);
42.58 +
42.59 +/*
42.60 + * Base64-encode a block of data, stick "?OTR:" and "." around it, and
42.61 + * return the result, or NULL in the event of a memory error.
42.62 + */
42.63 +char *otrl_base64_otr_encode(const unsigned char *buf, size_t buflen);
42.64 +
42.65 +/*
42.66 + * Base64-decode the portion of the given message between "?OTR:" and
42.67 + * ".". Set *bufp to the decoded data, and set *lenp to its length.
42.68 + * The caller must free() the result. Return 0 on success, -1 on a
42.69 + * memory error, or -2 on invalid input.
42.70 + */
42.71 +int otrl_base64_otr_decode(const char *msg, unsigned char **bufp,
42.72 + size_t *lenp);
42.73 +
42.74 +#endif
43.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
43.2 +++ b/Frameworks/libotr.framework/Versions/3.2.1/Headers/context.h Thu Sep 06 18:49:22 2012 +0200
43.3 @@ -0,0 +1,179 @@
43.4 +/*
43.5 + * Off-the-Record Messaging library
43.6 + * Copyright (C) 2004-2008 Ian Goldberg, Chris Alexander, Nikita Borisov
43.7 + * <otr@cypherpunks.ca>
43.8 + *
43.9 + * This library is free software; you can redistribute it and/or
43.10 + * modify it under the terms of version 2.1 of the GNU Lesser General
43.11 + * Public License as published by the Free Software Foundation.
43.12 + *
43.13 + * This library is distributed in the hope that it will be useful,
43.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
43.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
43.16 + * Lesser General Public License for more details.
43.17 + *
43.18 + * You should have received a copy of the GNU Lesser General Public
43.19 + * License along with this library; if not, write to the Free Software
43.20 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
43.21 + */
43.22 +
43.23 +#ifndef __CONTEXT_H__
43.24 +#define __CONTEXT_H__
43.25 +
43.26 +#include <gcrypt.h>
43.27 +
43.28 +#include "dh.h"
43.29 +#include "auth.h"
43.30 +#include "sm.h"
43.31 +
43.32 +typedef enum {
43.33 + OTRL_MSGSTATE_PLAINTEXT, /* Not yet started an encrypted
43.34 + conversation */
43.35 + OTRL_MSGSTATE_ENCRYPTED, /* Currently in an encrypted
43.36 + conversation */
43.37 + OTRL_MSGSTATE_FINISHED /* The remote side has sent us a
43.38 + notification that he has ended
43.39 + his end of the encrypted
43.40 + conversation; prevent any
43.41 + further messages from being
43.42 + sent to him. */
43.43 +} OtrlMessageState;
43.44 +
43.45 +typedef struct s_fingerprint {
43.46 + struct s_fingerprint *next; /* The next fingerprint in the list */
43.47 + struct s_fingerprint **tous; /* A pointer to the pointer to us */
43.48 + unsigned char *fingerprint; /* The fingerprint, or NULL */
43.49 + struct context *context; /* The context to which we belong */
43.50 + char *trust; /* The trust level of the fingerprint */
43.51 +} Fingerprint;
43.52 +
43.53 +typedef struct context {
43.54 + struct context * next; /* Linked list pointer */
43.55 + struct context ** tous; /* A pointer to the pointer to us */
43.56 +
43.57 + char * username; /* The user this context is for */
43.58 + char * accountname; /* The username is relative to
43.59 + this account... */
43.60 + char * protocol; /* ... and this protocol */
43.61 +
43.62 + char *fragment; /* The part of the fragmented message
43.63 + we've seen so far */
43.64 + size_t fragment_len; /* The length of fragment */
43.65 + unsigned short fragment_n; /* The total number of fragments
43.66 + in this message */
43.67 + unsigned short fragment_k; /* The highest fragment number
43.68 + we've seen so far for this
43.69 + message */
43.70 +
43.71 + OtrlMessageState msgstate; /* The state of message disposition
43.72 + with this user */
43.73 + OtrlAuthInfo auth; /* The state of ongoing
43.74 + authentication with this user */
43.75 +
43.76 + Fingerprint fingerprint_root; /* The root of a linked list of
43.77 + Fingerprints entries */
43.78 + Fingerprint *active_fingerprint; /* Which fingerprint is in use now?
43.79 + A pointer into the above list */
43.80 + unsigned int their_keyid; /* current keyid used by other side;
43.81 + this is set to 0 if we get a
43.82 + OTRL_TLV_DISCONNECTED message from
43.83 + them. */
43.84 + gcry_mpi_t their_y; /* Y[their_keyid] (their DH pubkey) */
43.85 + gcry_mpi_t their_old_y; /* Y[their_keyid-1] (their prev DH
43.86 + pubkey) */
43.87 + unsigned int our_keyid; /* current keyid used by us */
43.88 + DH_keypair our_dh_key; /* DH key[our_keyid] */
43.89 + DH_keypair our_old_dh_key; /* DH key[our_keyid-1] */
43.90 +
43.91 + DH_sesskeys sesskeys[2][2]; /* sesskeys[i][j] are the session keys
43.92 + derived from DH key[our_keyid-i]
43.93 + and mpi Y[their_keyid-j] */
43.94 +
43.95 + unsigned char sessionid[20]; /* The sessionid and bold half */
43.96 + size_t sessionid_len; /* determined when this private */
43.97 + OtrlSessionIdHalf sessionid_half; /* connection was established. */
43.98 +
43.99 + unsigned int protocol_version; /* The version of OTR in use */
43.100 +
43.101 + unsigned char *preshared_secret; /* A secret you share with this
43.102 + user, in order to do
43.103 + authentication. */
43.104 + size_t preshared_secret_len; /* The length of the above secret. */
43.105 +
43.106 + /* saved mac keys to be revealed later */
43.107 + unsigned int numsavedkeys;
43.108 + unsigned char *saved_mac_keys;
43.109 +
43.110 + /* generation number: increment every time we go private, and never
43.111 + * reset to 0 (unless we remove the context entirely) */
43.112 + unsigned int generation;
43.113 +
43.114 + time_t lastsent; /* The last time a Data Message was sent */
43.115 + char *lastmessage; /* The plaintext of the last Data Message sent */
43.116 + int may_retransmit; /* Is the last message eligible for
43.117 + retransmission? */
43.118 +
43.119 + enum {
43.120 + OFFER_NOT,
43.121 + OFFER_SENT,
43.122 + OFFER_REJECTED,
43.123 + OFFER_ACCEPTED
43.124 + } otr_offer; /* Has this correspondent repsponded to our
43.125 + OTR offers? */
43.126 +
43.127 + /* Application data to be associated with this context */