1
/* gcrypt.h - GNU cryptographic library interface
2
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
3
* 2004 Free Software Foundation, Inc.
5
* This file is part of Libgcrypt.
7
* Libgcrypt is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU Lesser General Public License as
9
* published by the Free Software Foundation; either version 2.1 of
10
* the License, or (at your option) any later version.
12
* Libgcrypt is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
1
/* gcrypt.h - GNU Cryptographic Library Interface -*- c -*-
2
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006
3
2007 Free Software Foundation, Inc.
5
This file is part of Libgcrypt.
7
Libgcrypt is free software; you can redistribute it and/or modify
8
it under the terms of the GNU Lesser General Public License as
9
published by the Free Software Foundation; either version 2.1 of
10
the License, or (at your option) any later version.
12
Libgcrypt is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU Lesser General Public License for more details.
17
You should have received a copy of the GNU Lesser General Public
18
License along with this program; if not, see <http://www.gnu.org/licenses/>.
20
File: src/gcrypt.h. Generated from gcrypt.h.in by configure. */
25
26
#include <stdarg.h>
26
27
#include <string.h>
28
29
#include <gpg-error.h>
30
31
#include <sys/types.h>
32
#include <sys/socket.h>
33
#if defined _WIN32 || defined __WIN32__
34
# include <winsock2.h>
35
# include <ws2tcpip.h>
37
# include <sys/socket.h>
40
typedef socklen_t gcry_socklen_t;
34
42
#include <sys/time.h>
36
44
/* This is required for error code compatibility. */
186
189
int (*mutex_unlock) (void **priv);
187
190
ssize_t (*read) (int fd, void *buf, size_t nbytes);
188
191
ssize_t (*write) (int fd, const void *buf, size_t nbytes);
189
ssize_t (*select) (int nfd, _GCRY_PTH_FD_SET *rset, _GCRY_PTH_FD_SET *wset,
190
_GCRY_PTH_FD_SET *eset, struct timeval *timeout);
191
ssize_t (*waitpid) (pid_t pid, int *status, int options);
192
int (*accept) (int s, _GCRY_PTH_SOCKADDR *addr,
193
_GCRY_PTH_SOCKLEN_T *length_ptr);
194
int (*connect) (int s, _GCRY_PTH_SOCKADDR *addr,
195
_GCRY_PTH_SOCKLEN_T length);
196
int (*sendmsg) (int s, const _GCRY_PTH_MSGHDR *msg, int flags);
197
int (*recvmsg) (int s, _GCRY_PTH_MSGHDR *msg, int flags);
193
ssize_t (*select) (int nfd, void *rset, void *wset, void *eset,
194
struct timeval *timeout);
195
ssize_t (*waitpid) (pid_t pid, int *status, int options);
196
int (*accept) (int s, void *addr, int *length_ptr);
197
int (*connect) (int s, void *addr, gcry_socklen_t length);
198
int (*sendmsg) (int s, const void *msg, int flags);
199
int (*recvmsg) (int s, void *msg, int flags);
201
ssize_t (*select) (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
202
struct timeval *timeout);
203
ssize_t (*waitpid) (pid_t pid, int *status, int options);
204
int (*accept) (int s, struct sockaddr *addr, gcry_socklen_t *length_ptr);
205
int (*connect) (int s, struct sockaddr *addr, gcry_socklen_t length);
206
int (*sendmsg) (int s, const struct msghdr *msg, int flags);
207
int (*recvmsg) (int s, struct msghdr *msg, int flags);
212
# define _GCRY_THREAD_OPTION_PTH_IMPL_NET \
213
static ssize_t gcry_pth_select (int nfd, void *rset, void *wset, \
214
void *eset, struct timeval *timeout) \
215
{ return pth_select (nfd, rset, wset, eset, timeout); } \
216
static ssize_t gcry_pth_waitpid (pid_t pid, int *status, int options) \
217
{ return pth_waitpid (pid, status, options); } \
218
static int gcry_pth_accept (int s, void *addr, \
219
gcry_socklen_t *length_ptr) \
220
{ return pth_accept (s, addr, length_ptr); } \
221
static int gcry_pth_connect (int s, void *addr, \
222
gcry_socklen_t length) \
223
{ return pth_connect (s, addr, length); }
225
# define _GCRY_THREAD_OPTION_PTH_IMPL_NET \
226
static ssize_t gcry_pth_select (int nfd, fd_set *rset, fd_set *wset, \
227
fd_set *eset, struct timeval *timeout) \
228
{ return pth_select (nfd, rset, wset, eset, timeout); } \
229
static ssize_t gcry_pth_waitpid (pid_t pid, int *status, int options) \
230
{ return pth_waitpid (pid, status, options); } \
231
static int gcry_pth_accept (int s, struct sockaddr *addr, \
232
gcry_socklen_t *length_ptr) \
233
{ return pth_accept (s, addr, length_ptr); } \
234
static int gcry_pth_connect (int s, struct sockaddr *addr, \
235
gcry_socklen_t length) \
236
{ return pth_connect (s, addr, length); }
200
241
#define GCRY_THREAD_OPTION_PTH_IMPL \
201
242
static int gcry_pth_init (void) \
202
243
{ return (pth_init () == FALSE) ? errno : 0; } \
233
274
{ return pth_read (fd, buf, nbytes); } \
234
275
static ssize_t gcry_pth_write (int fd, const void *buf, size_t nbytes) \
235
276
{ return pth_write (fd, buf, nbytes); } \
236
static ssize_t gcry_pth_select (int nfd, _GCRY_PTH_FD_SET *rset, \
237
_GCRY_PTH_FD_SET *wset, \
238
_GCRY_PTH_FD_SET *eset, \
239
struct timeval *timeout) \
240
{ return pth_select (nfd, rset, wset, eset, timeout); } \
241
static ssize_t gcry_pth_waitpid (pid_t pid, int *status, int options) \
242
{ return pth_waitpid (pid, status, options); } \
243
static int gcry_pth_accept (int s, _GCRY_PTH_SOCKADDR *addr, \
244
_GCRY_PTH_SOCKLEN_T *length_ptr) \
245
{ return pth_accept (s, addr, length_ptr); } \
246
static int gcry_pth_connect (int s, _GCRY_PTH_SOCKADDR *addr, \
247
_GCRY_PTH_SOCKLEN_T length) \
248
{ return pth_connect (s, addr, length); } \
277
_GCRY_THREAD_OPTION_PTH_IMPL_NET \
250
279
/* FIXME: GNU Pth is missing pth_sendmsg and pth_recvmsg. */ \
251
280
static struct gcry_thread_cbs gcry_threads_pth = { GCRY_THREAD_OPTION_PTH, \
252
281
gcry_pth_init, gcry_pth_mutex_init, gcry_pth_mutex_destroy, \
253
282
gcry_pth_mutex_lock, gcry_pth_mutex_unlock, gcry_pth_read, gcry_pth_write, \
254
gcry_pth_select, gcry_pth_waitpid, gcry_pth_accept, gcry_pth_connect }
283
gcry_pth_select, gcry_pth_waitpid, gcry_pth_accept, gcry_pth_connect, \
256
287
#define GCRY_THREAD_OPTION_PTHREAD_IMPL \
257
288
static int gcry_pthread_mutex_init (void **priv) \
260
pthread_mutex_t *lock = malloc (sizeof (pthread_mutex_t)); \
291
pthread_mutex_t *lock = (pthread_mutex_t*)malloc (sizeof (pthread_mutex_t));\
957
1017
*LIST_LENGTH, *LIST_LENGTH is updated to the correct number. */
958
1018
gcry_error_t gcry_pk_list (int *list, int *list_length);
1022
/************************************
1024
* cryptograhic hash functions *
1026
************************************/
1028
/* Algorithm IDs for the hash functions we know about. Not all of them
1037
GCRY_MD_TIGER = 6, /* TIGER/192. */
1038
GCRY_MD_HAVAL = 7, /* HAVAL, 5 pass, 160 bit. */
1041
GCRY_MD_SHA512 = 10,
1042
GCRY_MD_SHA224 = 11,
1044
GCRY_MD_CRC32 = 302,
1045
GCRY_MD_CRC32_RFC1510 = 303,
1046
GCRY_MD_CRC24_RFC2440 = 304,
1047
GCRY_MD_WHIRLPOOL = 305
1050
/* Flags used with the open function. */
1053
GCRY_MD_FLAG_SECURE = 1, /* Allocate all buffers in "secure"
1055
GCRY_MD_FLAG_HMAC = 2 /* Make an HMAC out of this
1059
/* Forward declaration. */
1060
struct gcry_md_context;
1062
/* This object is used to hold a handle to a message digest object.
1063
This structure is private - only to be used by the public gcry_md_*
1065
typedef struct gcry_md_handle
1067
/* Actual context. */
1068
struct gcry_md_context *ctx;
1070
/* Buffer management. */
1073
unsigned char buf[1];
1076
/* Compatibility types, do not use them. */
1077
#ifndef GCRYPT_NO_DEPRECATED
1078
typedef struct gcry_md_handle *GCRY_MD_HD _GCRY_GCC_ATTR_DEPRECATED;
1079
typedef struct gcry_md_handle *GcryMDHd _GCRY_GCC_ATTR_DEPRECATED;
1082
/* Create a message digest object for algorithm ALGO. FLAGS may be
1083
given as an bitwise OR of the gcry_md_flags values. ALGO may be
1084
given as 0 if the algorithms to be used are later set using
1086
gcry_error_t gcry_md_open (gcry_md_hd_t *h, int algo, unsigned int flags);
1088
/* Release the message digest object HD. */
1089
void gcry_md_close (gcry_md_hd_t hd);
1091
/* Add the message digest algorithm ALGO to the digest object HD. */
1092
gcry_error_t gcry_md_enable (gcry_md_hd_t hd, int algo);
1094
/* Create a new digest object as an exact copy of the object HD. */
1095
gcry_error_t gcry_md_copy (gcry_md_hd_t *bhd, gcry_md_hd_t ahd);
1097
/* Reset the digest object HD to its initial state. */
1098
void gcry_md_reset (gcry_md_hd_t hd);
1100
/* Perform various operations on the digest object HD. */
1101
gcry_error_t gcry_md_ctl (gcry_md_hd_t hd, int cmd,
1102
void *buffer, size_t buflen);
1104
/* Pass LENGTH bytes of data in BUFFER to the digest object HD so that
1105
it can update the digest values. This is the actual hash
1107
void gcry_md_write (gcry_md_hd_t hd, const void *buffer, size_t length);
1109
/* Read out the final digest from HD return the digest value for
1111
unsigned char *gcry_md_read (gcry_md_hd_t hd, int algo);
1113
/* Convenience function to calculate the hash from the data in BUFFER
1114
of size LENGTH using the algorithm ALGO avoiding the creating of a
1115
hash object. The hash is returned in the caller provided buffer
1116
DIGEST which must be large enough to hold the digest of the given
1118
void gcry_md_hash_buffer (int algo, void *digest,
1119
const void *buffer, size_t length);
1121
/* Retrieve the algorithm used with HD. This does not work reliable
1122
if more than one algorithm is enabled in HD. */
1123
int gcry_md_get_algo (gcry_md_hd_t hd);
1125
/* Retrieve the length in bytes of the digest yielded by algorithm
1127
unsigned int gcry_md_get_algo_dlen (int algo);
1129
/* Return true if the the algorithm ALGO is enabled in the digest
1131
int gcry_md_is_enabled (gcry_md_hd_t a, int algo);
1133
/* Return true if the digest object A is allocated in "secure" memory. */
1134
int gcry_md_is_secure (gcry_md_hd_t a);
1136
/* Retrieve various information about the object H. */
1137
gcry_error_t gcry_md_info (gcry_md_hd_t h, int what, void *buffer,
1140
/* Retrieve various information about the algorithm ALGO. */
1141
gcry_error_t gcry_md_algo_info (int algo, int what, void *buffer,
1144
/* Map the digest algorithm id ALGO to a string representation of the
1145
algorithm name. For unknown algorithms this functions returns
1147
const char *gcry_md_algo_name (int algo) _GCRY_GCC_ATTR_PURE;
1149
/* Map the algorithm NAME to a digest algorithm Id. Return 0 if
1150
the algorithm name is not known. */
1151
int gcry_md_map_name (const char* name) _GCRY_GCC_ATTR_PURE;
1153
/* For use with the HMAC feature, the set MAC key to the KEY of
1155
gcry_error_t gcry_md_setkey (gcry_md_hd_t hd, const void *key, size_t keylen);
1157
/* Start or stop debugging for digest handle HD; i.e. create a file
1158
named dbgmd-<n>.<suffix> while hashing. If SUFFIX is NULL,
1159
debugging stops and the file will be closed. */
1160
void gcry_md_debug (gcry_md_hd_t hd, const char *suffix);
1163
/* Update the hash(s) of H with the character C. This is a buffered
1164
version of the gcry_md_write function. */
1165
#define gcry_md_putc(h,c) \
1167
gcry_md_hd_t h__ = (h); \
1168
if( (h__)->bufpos == (h__)->bufsize ) \
1169
gcry_md_write( (h__), NULL, 0 ); \
1170
(h__)->buf[(h__)->bufpos++] = (c) & 0xff; \
1173
/* Finalize the digest calculation. This is not really needed because
1174
gcry_md_read() does this implicitly. */
1175
#define gcry_md_final(a) \
1176
gcry_md_ctl ((a), GCRYCTL_FINALIZE, NULL, 0)
1178
/* Return 0 if the algorithm A is available for use. */
1179
#define gcry_md_test_algo(a) \
1180
gcry_md_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL )
1182
/* Return an DER encoded ASN.1 OID for the algorithm A in buffer B. N
1183
must point to size_t variable with the available size of buffer B.
1184
After return it will receive the actual size of the returned
1186
#define gcry_md_get_asnoid(a,b,n) \
1187
gcry_md_algo_info((a), GCRYCTL_GET_ASNOID, (b), (n))
1189
/* Enable debugging for digest object A; i.e. create files named
1190
dbgmd-<n>.<string> while hashing. B is a string used as the suffix
1191
for the filename. This macro is deprecated, use gcry_md_debug. */
1192
#ifndef GCRYPT_NO_DEPRECATED
1193
#define gcry_md_start_debug(a,b) \
1194
gcry_md_ctl( (a), GCRYCTL_START_DUMP, (b), 0 )
1196
/* Disable the debugging of A. This macro is deprecated, use
1198
#define gcry_md_stop_debug(a,b) \
1199
gcry_md_ctl( (a), GCRYCTL_STOP_DUMP, (b), 0 )
1202
/* Get a list consisting of the IDs of the loaded message digest
1203
modules. If LIST is zero, write the number of loaded message
1204
digest modules to LIST_LENGTH and return. If LIST is non-zero, the
1205
first *LIST_LENGTH algorithm IDs are stored in LIST, which must be
1206
of according size. In case there are less message digest modules
1207
than *LIST_LENGTH, *LIST_LENGTH is updated to the correct
1209
gcry_error_t gcry_md_list (int *list, int *list_length);
960
1213
/* Alternative interface for asymetric cryptography. */
962
1215
/* The algorithm IDs. */
1123
1517
gcry_mpi_t data,
1124
1518
gcry_ac_data_t data_signature);
1520
/* Encrypts the plain text readable from IO_MESSAGE through HANDLE
1521
with the public key KEY according to SCHEME, FLAGS and OPTS. If
1522
OPTS is not NULL, it has to be a pointer to a structure specific to
1523
the chosen scheme (gcry_ac_es_*_t). The encrypted message is
1524
written to IO_CIPHER. */
1525
gcry_error_t gcry_ac_data_encrypt_scheme (gcry_ac_handle_t handle,
1526
gcry_ac_scheme_t scheme,
1527
unsigned int flags, void *opts,
1529
gcry_ac_io_t *io_message,
1530
gcry_ac_io_t *io_cipher);
1532
/* Decrypts the cipher text readable from IO_CIPHER through HANDLE
1533
with the secret key KEY according to SCHEME, @var{flags} and OPTS.
1534
If OPTS is not NULL, it has to be a pointer to a structure specific
1535
to the chosen scheme (gcry_ac_es_*_t). The decrypted message is
1536
written to IO_MESSAGE. */
1537
gcry_error_t gcry_ac_data_decrypt_scheme (gcry_ac_handle_t handle,
1538
gcry_ac_scheme_t scheme,
1539
unsigned int flags, void *opts,
1541
gcry_ac_io_t *io_cipher,
1542
gcry_ac_io_t *io_message);
1544
/* Signs the message readable from IO_MESSAGE through HANDLE with the
1545
secret key KEY according to SCHEME, FLAGS and OPTS. If OPTS is not
1546
NULL, it has to be a pointer to a structure specific to the chosen
1547
scheme (gcry_ac_ssa_*_t). The signature is written to
1549
gcry_error_t gcry_ac_data_sign_scheme (gcry_ac_handle_t handle,
1550
gcry_ac_scheme_t scheme,
1551
unsigned int flags, void *opts,
1553
gcry_ac_io_t *io_message,
1554
gcry_ac_io_t *io_signature);
1556
/* Verifies through HANDLE that the signature readable from
1557
IO_SIGNATURE is indeed the result of signing the message readable
1558
from IO_MESSAGE with the secret key belonging to the public key KEY
1559
according to SCHEME and OPTS. If OPTS is not NULL, it has to be an
1560
anonymous structure (gcry_ac_ssa_*_t) specific to the chosen
1562
gcry_error_t gcry_ac_data_verify_scheme (gcry_ac_handle_t handle,
1563
gcry_ac_scheme_t scheme,
1564
unsigned int flags, void *opts,
1566
gcry_ac_io_t *io_message,
1567
gcry_ac_io_t *io_signature);
1126
1569
/* Store the textual representation of the algorithm whose id is given
1127
in ALGORITHM in NAME. */
1570
in ALGORITHM in NAME. This function is deprecated; use
1571
gcry_pk_algo_name. */
1572
#ifndef GCRYPT_NO_DEPRECATED
1128
1573
gcry_error_t gcry_ac_id_to_name (gcry_ac_id_t algorithm,
1575
/* */ _GCRY_GCC_ATTR_DEPRECATED;
1131
1576
/* Store the numeric ID of the algorithm whose textual representation
1132
is contained in NAME in ALGORITHM. */
1577
is contained in NAME in ALGORITHM. This function is deprecated;
1578
use gcry_pk_map_name. */
1133
1579
gcry_error_t gcry_ac_name_to_id (const char *name,
1134
gcry_ac_id_t *algorithm);
1138
/************************************
1140
* cryptograhic hash functions *
1142
************************************/
1144
/* Algorithm IDs for the hash functions we know about. Not all of them
1153
GCRY_MD_TIGER = 6, /* TIGER/192. */
1154
GCRY_MD_HAVAL = 7, /* HAVAL, 5 pass, 160 bit. */
1157
GCRY_MD_SHA512 = 10,
1159
GCRY_MD_CRC32 = 302,
1160
GCRY_MD_CRC32_RFC1510 = 303,
1161
GCRY_MD_CRC24_RFC2440 = 304
1164
/* Flags used with the open function. */
1167
GCRY_MD_FLAG_SECURE = 1, /* Allocate all buffers in "secure"
1169
GCRY_MD_FLAG_HMAC = 2 /* Make an HMAC out of this
1173
/* Forward declaration. */
1174
struct gcry_md_context;
1176
/* This object is used to hold a handle to a message digest object.
1177
This structure is private - only to be used by the public gcry_md_*
1179
typedef struct gcry_md_handle
1181
/* Actual context. */
1182
struct gcry_md_context *ctx;
1184
/* Buffer management. */
1187
unsigned char buf[1];
1190
/* Compatibility types, do not use them. */
1191
typedef struct gcry_md_handle *GCRY_MD_HD _GCRY_GCC_ATTR_DEPRECATED;
1192
typedef struct gcry_md_handle *GcryMDHd _GCRY_GCC_ATTR_DEPRECATED;
1194
/* Create a message digest object for algorithm ALGO. FLAGS may be
1195
given as an bitwise OR of the gcry_md_flags values. ALGO may be
1196
given as 0 if the algorithms to be used are later set using
1198
gcry_error_t gcry_md_open (gcry_md_hd_t *h, int algo, unsigned int flags);
1200
/* Release the message digest object HD. */
1201
void gcry_md_close (gcry_md_hd_t hd);
1203
/* Add the message digest algorithm ALGO to the digest object HD. */
1204
gcry_error_t gcry_md_enable (gcry_md_hd_t hd, int algo);
1206
/* Create a new digest object as an exact copy of the object HD. */
1207
gcry_error_t gcry_md_copy (gcry_md_hd_t *bhd, gcry_md_hd_t ahd);
1209
/* Reset the digest object HD to its initial state. */
1210
void gcry_md_reset (gcry_md_hd_t hd);
1212
/* Perform various operations on the digets object HD. */
1213
gcry_error_t gcry_md_ctl (gcry_md_hd_t hd, int cmd,
1214
void *buffer, size_t buflen);
1216
/* Pass LENGTH bytes of data in BUFFER to the digest object HD so that
1217
it can update the digest values. This is the actual hash
1219
void gcry_md_write (gcry_md_hd_t hd, const void *buffer, size_t length);
1221
/* Read out the final digest from HD return the digest value for
1223
unsigned char *gcry_md_read (gcry_md_hd_t hd, int algo);
1225
/* Convenience function to calculate the hash from the data in BUFFER
1226
of size LENGTH using the algorithm ALGO avoiding the creating of a
1227
hash object. The hash is returned in the caller provided buffer
1228
DIGEST which must be large enough to hold the digest of the given
1230
void gcry_md_hash_buffer (int algo, void *digest,
1231
const void *buffer, size_t length);
1233
/* Retrieve the algorithm used with HD. This does not work reliable
1234
if more than one algorithm is enabled in HD. */
1235
int gcry_md_get_algo (gcry_md_hd_t hd);
1237
/* Retrieve the length in bytes of the digest yielded by algorithm
1239
unsigned int gcry_md_get_algo_dlen (int algo);
1241
/* Return true if the the algorithm ALGO is enabled in the digest
1243
int gcry_md_is_enabled (gcry_md_hd_t a, int algo);
1245
/* Return true if the digest object A is allocated in "secure" memory. */
1246
int gcry_md_is_secure (gcry_md_hd_t a);
1248
/* Retrieve various information about the object H. */
1249
gcry_error_t gcry_md_info (gcry_md_hd_t h, int what, void *buffer,
1252
/* Retrieve various information about the algorithm ALGO. */
1253
gcry_error_t gcry_md_algo_info (int algo, int what, void *buffer,
1256
/* Map the digest algorithm id ALGO to a string representation of the
1257
algorithm name. For unknown algorithms this functions returns an
1259
const char *gcry_md_algo_name (int algo) _GCRY_GCC_ATTR_PURE;
1261
/* Map the algorithm NAME to a digest algorithm Id. Return 0 if
1262
the algorithm name is not known. */
1263
int gcry_md_map_name (const char* name) _GCRY_GCC_ATTR_PURE;
1265
/* For use with the HMAC feature, the set MAC key to the KEY of
1267
gcry_error_t gcry_md_setkey (gcry_md_hd_t hd, const void *key, size_t keylen);
1269
/* Update the hash(s) of H with the character C. This is a buffered
1270
version of the gcry_md_write function. */
1271
#define gcry_md_putc(h,c) \
1273
gcry_md_hd_t h__ = (h); \
1274
if( (h__)->bufpos == (h__)->bufsize ) \
1275
gcry_md_write( (h__), NULL, 0 ); \
1276
(h__)->buf[(h__)->bufpos++] = (c) & 0xff; \
1279
/* Finalize the digest calculation. This is not really needed because
1280
gcry_md_read() does this implicitly. */
1281
#define gcry_md_final(a) \
1282
gcry_md_ctl ((a), GCRYCTL_FINALIZE, NULL, 0)
1284
/* Return 0 if the algorithm A is available for use. */
1285
#define gcry_md_test_algo(a) \
1286
gcry_md_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL )
1288
/* Return an DER encoded ASN.1 OID for the algorithm A in buffer B. N
1289
must point to size_t variable with the available size of buffer B.
1290
After return it will receive the actual size of the returned
1292
#define gcry_md_get_asnoid(a,b,n) \
1293
gcry_md_algo_info((a), GCRYCTL_GET_ASNOID, (b), (n))
1295
/* Enable debugging for digets object A; i.e. create files named
1296
dbgmd-<n>.<string> while hashing. B is a string used as the suffix
1297
for the filename. */
1298
#define gcry_md_start_debug(a,b) \
1299
gcry_md_ctl( (a), GCRYCTL_START_DUMP, (b), 0 )
1301
/* Disable the debugging of A. */
1302
#define gcry_md_stop_debug(a,b) \
1303
gcry_md_ctl( (a), GCRYCTL_STOP_DUMP, (b), 0 )
1305
/* Get a list consisting of the IDs of the loaded message digest
1306
modules. If LIST is zero, write the number of loaded message
1307
digest modules to LIST_LENGTH and return. If LIST is non-zero, the
1308
first *LIST_LENGTH algorithm IDs are stored in LIST, which must be
1309
of according size. In case there are less message digest modules
1310
than *LIST_LENGTH, *LIST_LENGTH is updated to the correct
1312
gcry_error_t gcry_md_list (int *list, int *list_length);
1580
gcry_ac_id_t *algorithm)
1581
/* */ _GCRY_GCC_ATTR_DEPRECATED;
1315
1585
/************************************