~ubuntu-branches/ubuntu/natty/libgcrypt11/natty-proposed

« back to all changes in this revision

Viewing changes to src/gcrypt.h.in

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2009-05-16 20:13:32 UTC
  • mfrom: (1.1.6 upstream) (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090516201332-czkobpu32w318i16
Tags: 1.4.4-2ubuntu1
* Merge from Debian unstable (LP: #364535), remaining changes:
  - Add libgcrypt11-udeb for use by cryptsetup-udeb.
  - Add clean-la.mk, and add a symlink for the .la
  - Install to /lib.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* gcrypt.h -  GNU Cryptographic Library Interface              -*- c -*-
2
2
   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006
3
 
                 2007  Free Software Foundation, Inc.
 
3
                 2007, 2008, 2009  Free Software Foundation, Inc.
4
4
  
5
5
   This file is part of Libgcrypt.
6
6
  
46
46
 
47
47
#ifdef __cplusplus
48
48
extern "C" {
49
 
#if 0 /* keep Emacsens' auto-indent happy */
 
49
#if 0 /* (Keep Emacsens' auto-indent happy.) */
50
50
}
51
51
#endif
52
52
#endif
170
170
gcry_err_code_t gcry_error_from_errno (int err);
171
171
 
172
172
 
 
173
/* This enum is deprecated; it is only declared for the sake of
 
174
   complete API compatibility.  */
173
175
enum gcry_thread_option
174
176
  {
175
 
    GCRY_THREAD_OPTION_DEFAULT = 0,
176
 
    GCRY_THREAD_OPTION_USER = 1,
177
 
    GCRY_THREAD_OPTION_PTH = 2,
178
 
    GCRY_THREAD_OPTION_PTHREAD = 3
179
 
  };
 
177
    _GCRY_THREAD_OPTION_DUMMY
 
178
  } _GCRY_GCC_ATTR_DEPRECATED;
 
179
 
 
180
 
 
181
/* Constants defining the thread model to use.  Used with the OPTION
 
182
   field of the struct gcry_thread_cbs.  */
 
183
#define GCRY_THREAD_OPTION_DEFAULT  0
 
184
#define GCRY_THREAD_OPTION_USER     1
 
185
#define GCRY_THREAD_OPTION_PTH      2
 
186
#define GCRY_THREAD_OPTION_PTHREAD  3
 
187
 
 
188
/* The version number encoded in the OPTION field of the struct
 
189
   gcry_thread_cbs.  */
 
190
#define GCRY_THREAD_OPTION_VERSION  0
180
191
 
181
192
/* Wrapper for struct ath_ops.  */
182
193
struct gcry_thread_cbs
183
194
{
184
 
  enum gcry_thread_option option;
 
195
  /* The OPTION field encodes the thread model and the version number
 
196
     of this structure.   
 
197
       Bits  7 - 0  are used for the thread model
 
198
       Bits 15 - 8  are used for the version number.
 
199
  */
 
200
  unsigned int option;
 
201
 
185
202
  int (*init) (void);
186
203
  int (*mutex_init) (void **priv);
187
204
  int (*mutex_destroy) (void **priv);
276
293
  { return pth_write (fd, buf, nbytes); }                                     \
277
294
_GCRY_THREAD_OPTION_PTH_IMPL_NET                                              \
278
295
                                                                              \
279
 
/* FIXME: GNU Pth is missing pth_sendmsg and pth_recvmsg.  */                 \
280
 
static struct gcry_thread_cbs gcry_threads_pth = { GCRY_THREAD_OPTION_PTH,    \
 
296
/* Note: GNU Pth is missing pth_sendmsg and pth_recvmsg.  */                  \
 
297
static struct gcry_thread_cbs gcry_threads_pth = {                            \
 
298
  (GCRY_THREAD_OPTION_PTH | (GCRY_THREAD_OPTION_VERSION << 8)),               \
281
299
  gcry_pth_init, gcry_pth_mutex_init, gcry_pth_mutex_destroy,                 \
282
300
  gcry_pth_mutex_lock, gcry_pth_mutex_unlock, gcry_pth_read, gcry_pth_write,  \
283
301
  gcry_pth_select, gcry_pth_waitpid, gcry_pth_accept, gcry_pth_connect,       \
310
328
static int gcry_pthread_mutex_unlock (void **lock)                            \
311
329
  { return pthread_mutex_unlock ((pthread_mutex_t*)*lock); }                  \
312
330
                                                                              \
313
 
static struct gcry_thread_cbs gcry_threads_pthread =                          \
314
 
{ GCRY_THREAD_OPTION_PTHREAD, NULL,                                           \
315
 
  gcry_pthread_mutex_init, gcry_pthread_mutex_destroy,                        \
 
331
static struct gcry_thread_cbs gcry_threads_pthread = {                        \
 
332
  (GCRY_THREAD_OPTION_PTHREAD | (GCRY_THREAD_OPTION_VERSION << 8)),           \
 
333
  NULL, gcry_pthread_mutex_init, gcry_pthread_mutex_destroy,                  \
316
334
  gcry_pthread_mutex_lock, gcry_pthread_mutex_unlock,                         \
317
335
  NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
318
336
 
387
405
    GCRYCTL_USE_RANDOM_DAEMON = 50,
388
406
    GCRYCTL_FAKED_RANDOM_P = 51,
389
407
    GCRYCTL_SET_RNDEGD_SOCKET = 52,
390
 
    GCRYCTL_PRINT_CONFIG = 53
 
408
    GCRYCTL_PRINT_CONFIG = 53,
 
409
    GCRYCTL_OPERATIONAL_P = 54,
 
410
    GCRYCTL_FIPS_MODE_P = 55,
 
411
    GCRYCTL_FORCE_FIPS_MODE = 56,
 
412
    GCRYCTL_SELFTEST = 57
 
413
    /* Note: 58 .. 62 are used internally.  */
391
414
  };
392
415
 
393
416
/* Perform various operations defined by CMD. */
456
479
size_t gcry_sexp_sprint (gcry_sexp_t sexp, int mode, void *buffer,
457
480
                         size_t maxlength);
458
481
 
459
 
/* Dumps the S-expression object A in a aformat suitable for debugging
 
482
/* Dumps the S-expression object A in a format suitable for debugging
460
483
   to Libgcrypt's logging stream.  */
461
484
void gcry_sexp_dump (const gcry_sexp_t a);
462
485
 
525
548
 
526
549
/*******************************************
527
550
 *                                         *
528
 
 *  multi precision integer functions      *
 
551
 *  Multi Precision Integer Functions      *
529
552
 *                                         *
530
553
 *******************************************/
531
554
 
533
556
enum gcry_mpi_format 
534
557
  {
535
558
    GCRYMPI_FMT_NONE= 0,
536
 
    GCRYMPI_FMT_STD = 1,    /* twos complement stored without length */
537
 
    GCRYMPI_FMT_PGP = 2,    /* As used by OpenPGP (only defined as unsigned)*/
538
 
    GCRYMPI_FMT_SSH = 3,    /* As used by SSH (same as 1 but with length)*/
539
 
    GCRYMPI_FMT_HEX = 4,    /* hex format */
540
 
    GCRYMPI_FMT_USG = 5     /* like STD but this is an unsigned one */
 
559
    GCRYMPI_FMT_STD = 1,    /* Twos complement stored without length.  */
 
560
    GCRYMPI_FMT_PGP = 2,    /* As used by OpenPGP (unsigned only).  */
 
561
    GCRYMPI_FMT_SSH = 3,    /* As used by SSH (like STD but with length).  */
 
562
    GCRYMPI_FMT_HEX = 4,    /* Hex format. */
 
563
    GCRYMPI_FMT_USG = 5     /* Like STD but unsigned. */
541
564
  };
542
565
 
543
566
/* Flags used for creating big integers.  */
544
567
enum gcry_mpi_flag 
545
568
  {
546
 
    GCRYMPI_FLAG_SECURE = 1,  /* Allocate the number in "secure" memory. */
547
 
    GCRYMPI_FLAG_OPAQUE = 2   /* The number is not a real one but just a
548
 
                               way to store some bytes.  This is
549
 
                               useful for encrypted big integers. */
 
569
    GCRYMPI_FLAG_SECURE = 1,  /* Allocate the number in "secure" memory.  */
 
570
    GCRYMPI_FLAG_OPAQUE = 2   /* The number is not a real one but just
 
571
                                 a way to store some bytes.  This is
 
572
                                 useful for encrypted big integers.  */
550
573
  };
551
574
 
552
575
 
687
710
/* Shift the value of A by N bits to the right and store the result in X. */
688
711
void     gcry_mpi_rshift (gcry_mpi_t x, gcry_mpi_t a, unsigned int n);
689
712
 
 
713
/* Shift the value of A by N bits to the left and store the result in X. */
 
714
void     gcry_mpi_lshift (gcry_mpi_t x, gcry_mpi_t a, unsigned int n);
 
715
 
690
716
/* Store NBITS of the value P points to in A and mark A as an opaque
691
717
   value.  WARNING: Never use an opaque MPI for anything thing else then 
692
718
   gcry_mpi_release, gcry_mpi_get_opaque. */
710
736
int gcry_mpi_get_flag (gcry_mpi_t a, enum gcry_mpi_flag flag);
711
737
 
712
738
/* Unless the GCRYPT_NO_MPI_MACROS is used, provide a couple of
713
 
   convenience macors for the big integer functions. */
 
739
   convenience macros for the big integer functions. */
714
740
#ifndef GCRYPT_NO_MPI_MACROS
715
741
#define mpi_new(n)          gcry_mpi_new( (n) )
716
742
#define mpi_secure_new( n ) gcry_mpi_snew( (n) )
722
748
    } \
723
749
  while (0)
724
750
 
725
 
#define mpi_copy( a )       gcry_mpi_copy( (a) )
726
 
#define mpi_set( w, u)      gcry_mpi_set( (w), (u) )
727
 
#define mpi_set_ui( w, u)   gcry_mpi_set_ui( (w), (u) )
728
 
#define mpi_cmp( u, v )     gcry_mpi_cmp( (u), (v) )
729
 
#define mpi_cmp_ui( u, v )  gcry_mpi_cmp_ui( (u), (v) )
730
 
 
731
 
#define mpi_add_ui(w,u,v)   gcry_mpi_add_ui((w),(u),(v))
732
 
#define mpi_add(w,u,v)      gcry_mpi_add ((w),(u),(v))
733
 
#define mpi_addm(w,u,v,m)   gcry_mpi_addm ((w),(u),(v),(m))
734
 
#define mpi_sub_ui(w,u,v)   gcry_mpi_sub_ui ((w),(u),(v))
735
 
#define mpi_sub(w,u,v)      gcry_mpi_sub ((w),(u),(v))
736
 
#define mpi_subm(w,u,v,m)   gcry_mpi_subm ((w),(u),(v),(m))
737
 
#define mpi_mul_ui(w,u,v)   gcry_mpi_mul_ui ((w),(u),(v))
738
 
#define mpi_mul_2exp(w,u,v) gcry_mpi_mul_2exp ((w),(u),(v))
739
 
#define mpi_mul(w,u,v)      gcry_mpi_mul ((w),(u),(v))
740
 
#define mpi_mulm(w,u,v,m)   gcry_mpi_mulm ((w),(u),(v),(m))
741
 
#define mpi_powm(w,b,e,m)   gcry_mpi_powm ( (w), (b), (e), (m) )
742
 
#define mpi_tdiv(q,r,a,m)   gcry_mpi_div ( (q), (r), (a), (m), 0)
743
 
#define mpi_fdiv(q,r,a,m)   gcry_mpi_div ( (q), (r), (a), (m), -1)
744
 
#define mpi_mod(r,a,m)      gcry_mpi_mod ((r), (a), (m))
745
 
#define mpi_gcd(g,a,b)      gcry_mpi_gcd ( (g), (a), (b) )
746
 
#define mpi_invm(g,a,b)     gcry_mpi_invm ( (g), (a), (b) )
 
751
#define mpi_copy( a )          gcry_mpi_copy( (a) )
 
752
#define mpi_set( w, u)         gcry_mpi_set( (w), (u) )
 
753
#define mpi_set_ui( w, u)      gcry_mpi_set_ui( (w), (u) )
 
754
#define mpi_cmp( u, v )        gcry_mpi_cmp( (u), (v) )
 
755
#define mpi_cmp_ui( u, v )     gcry_mpi_cmp_ui( (u), (v) )
 
756
                              
 
757
#define mpi_add_ui(w,u,v)      gcry_mpi_add_ui((w),(u),(v))
 
758
#define mpi_add(w,u,v)         gcry_mpi_add ((w),(u),(v))
 
759
#define mpi_addm(w,u,v,m)      gcry_mpi_addm ((w),(u),(v),(m))
 
760
#define mpi_sub_ui(w,u,v)      gcry_mpi_sub_ui ((w),(u),(v))
 
761
#define mpi_sub(w,u,v)         gcry_mpi_sub ((w),(u),(v))
 
762
#define mpi_subm(w,u,v,m)      gcry_mpi_subm ((w),(u),(v),(m))
 
763
#define mpi_mul_ui(w,u,v)      gcry_mpi_mul_ui ((w),(u),(v))
 
764
#define mpi_mul_2exp(w,u,v)    gcry_mpi_mul_2exp ((w),(u),(v))
 
765
#define mpi_mul(w,u,v)         gcry_mpi_mul ((w),(u),(v))
 
766
#define mpi_mulm(w,u,v,m)      gcry_mpi_mulm ((w),(u),(v),(m))
 
767
#define mpi_powm(w,b,e,m)      gcry_mpi_powm ( (w), (b), (e), (m) )
 
768
#define mpi_tdiv(q,r,a,m)      gcry_mpi_div ( (q), (r), (a), (m), 0)
 
769
#define mpi_fdiv(q,r,a,m)      gcry_mpi_div ( (q), (r), (a), (m), -1)
 
770
#define mpi_mod(r,a,m)         gcry_mpi_mod ((r), (a), (m))
 
771
#define mpi_gcd(g,a,b)         gcry_mpi_gcd ( (g), (a), (b) )
 
772
#define mpi_invm(g,a,b)        gcry_mpi_invm ( (g), (a), (b) )
747
773
 
748
774
#define mpi_get_nbits(a)       gcry_mpi_get_nbits ((a))
749
775
#define mpi_test_bit(a,b)      gcry_mpi_test_bit ((a),(b))
752
778
#define mpi_clear_bit(a,b)     gcry_mpi_clear_bit ((a),(b))
753
779
#define mpi_clear_highbit(a,b) gcry_mpi_clear_highbit ((a),(b))
754
780
#define mpi_rshift(a,b,c)      gcry_mpi_rshift ((a),(b),(c))
 
781
#define mpi_lshift(a,b,c)      gcry_mpi_lshift ((a),(b),(c))
755
782
 
756
 
#define mpi_set_opaque(a,b,c) gcry_mpi_set_opaque( (a), (b), (c) )
757
 
#define mpi_get_opaque(a,b)   gcry_mpi_get_opaque( (a), (b) )
 
783
#define mpi_set_opaque(a,b,c)  gcry_mpi_set_opaque( (a), (b), (c) )
 
784
#define mpi_get_opaque(a,b)    gcry_mpi_get_opaque( (a), (b) )
758
785
#endif /* GCRYPT_NO_MPI_MACROS */
759
786
 
760
787
 
761
788
 
762
789
/************************************
763
790
 *                                  *
764
 
 *   symmetric cipher functions     *
 
791
 *   Symmetric Cipher Functions     *
765
792
 *                                  *
766
793
 ************************************/
767
794
 
882
909
                                  void *out, size_t outsize,
883
910
                                  const void *in, size_t inlen);
884
911
 
885
 
/* Set key K of length L for the cipher handle H.  (We have to cast
886
 
   away a const char* here - this catch-all ctl function was probably
887
 
   not the best choice) */
888
 
#define gcry_cipher_setkey(h,k,l)  gcry_cipher_ctl( (h), GCRYCTL_SET_KEY, \
889
 
                                                         (char*)(k), (l) )
890
 
 
891
 
/* Set initialization vector K of length L for the cipher handle H. */
892
 
#define gcry_cipher_setiv(h,k,l)  gcry_cipher_ctl( (h), GCRYCTL_SET_IV, \
893
 
                                                         (char*)(k), (l) )
 
912
/* Set KEY of length KEYLEN for the cipher handle HD.  */
 
913
gcry_error_t gcry_cipher_setkey (gcry_cipher_hd_t hd,
 
914
                                 const void *key, size_t keylen);
 
915
 
 
916
 
 
917
/* Set initialization vector IV of length IVLEN for the cipher handle HD. */
 
918
gcry_error_t gcry_cipher_setiv (gcry_cipher_hd_t hd,
 
919
                                const void *iv, size_t ivlen);
 
920
 
894
921
 
895
922
/* Reset the handle to the state after open.  */
896
923
#define gcry_cipher_reset(h)  gcry_cipher_ctl ((h), GCRYCTL_RESET, NULL, 0)
897
924
 
898
 
/* Perform the the OpenPGP sync operation if this is enabled for the
 
925
/* Perform the OpenPGP sync operation if this is enabled for the
899
926
   cipher handle H. */
900
 
#define gcry_cipher_sync(h)  gcry_cipher_ctl( (h), GCRYCTL_CFB_SYNC, \
901
 
                                                                   NULL, 0 )
 
927
#define gcry_cipher_sync(h)  gcry_cipher_ctl( (h), GCRYCTL_CFB_SYNC, NULL, 0)
902
928
 
903
929
/* Enable or disable CTS in future calls to gcry_encrypt(). CBC mode only. */
904
930
#define gcry_cipher_cts(h,on)  gcry_cipher_ctl( (h), GCRYCTL_SET_CBC_CTS, \
905
931
                                                                   NULL, on )
906
932
 
907
 
/* Set counter for CTR mode.  (K,L) must denote a buffer of block size
908
 
   length, or (NULL,0) to set the CTR to the all-zero block. */
909
 
#define gcry_cipher_setctr(h,k,l)  gcry_cipher_ctl( (h), GCRYCTL_SET_CTR, \
910
 
                                                    (char*)(k), (l) )
 
933
/* Set counter for CTR mode.  (CTR,CTRLEN) must denote a buffer of
 
934
   block size length, or (NULL,0) to set the CTR to the all-zero block. */
 
935
gpg_error_t gcry_cipher_setctr (gcry_cipher_hd_t hd,
 
936
                                const void *ctr, size_t ctrlen);
911
937
 
912
938
/* Retrieved the key length used with algorithm A. */
913
939
size_t gcry_cipher_get_algo_keylen (int algo);
930
956
 
931
957
/************************************
932
958
 *                                  *
933
 
 *    asymmetric cipher functions   *
 
959
 *    Asymmetric Cipher Functions   *
934
960
 *                                  *
935
961
 ************************************/
936
962
 
937
963
/* The algorithms and their IDs we support. */
938
964
enum gcry_pk_algos 
939
965
  {
940
 
    GCRY_PK_RSA = 1,
941
 
    GCRY_PK_RSA_E = 2,      /* deprecated */
942
 
    GCRY_PK_RSA_S = 3,      /* deprecated */
943
 
    GCRY_PK_ELG_E = 16,     /* use only for OpenPGP */
 
966
    GCRY_PK_RSA   = 1,
 
967
    GCRY_PK_RSA_E = 2,      /* (deprecated) */
 
968
    GCRY_PK_RSA_S = 3,      /* (deprecated) */
 
969
    GCRY_PK_ELG_E = 16,
944
970
    GCRY_PK_DSA   = 17,
945
971
    GCRY_PK_ELG   = 20,
946
 
    GCRY_PK_ECDSA = 301     /* Experimental implementation; not for
947
 
                               production. */
 
972
    GCRY_PK_ECDSA = 301
948
973
  };
949
974
 
950
975
/* Flags describing usage capabilities of a PK algorithm. */
1021
1046
 
1022
1047
/************************************
1023
1048
 *                                  *
1024
 
 *   cryptograhic hash functions    *
 
1049
 *   Cryptograhic Hash Functions    *
1025
1050
 *                                  *
1026
1051
 ************************************/
1027
1052
 
1041
1066
    GCRY_MD_SHA512  = 10,
1042
1067
    GCRY_MD_SHA224  = 11,
1043
1068
    GCRY_MD_MD4     = 301,
1044
 
    GCRY_MD_CRC32               = 302,
1045
 
    GCRY_MD_CRC32_RFC1510       = 303,
1046
 
    GCRY_MD_CRC24_RFC2440       = 304,
 
1069
    GCRY_MD_CRC32         = 302,
 
1070
    GCRY_MD_CRC32_RFC1510 = 303,
 
1071
    GCRY_MD_CRC24_RFC2440 = 304,
1047
1072
    GCRY_MD_WHIRLPOOL = 305
1048
1073
  };
1049
1074
 
1050
1075
/* Flags used with the open function.  */
1051
1076
enum gcry_md_flags
1052
1077
  {
1053
 
    GCRY_MD_FLAG_SECURE = 1,  /* Allocate all buffers in "secure"
1054
 
                                 memory.  */
1055
 
    GCRY_MD_FLAG_HMAC   = 2   /* Make an HMAC out of this
1056
 
                                 algorithm.  */
 
1078
    GCRY_MD_FLAG_SECURE = 1,  /* Allocate all buffers in "secure" memory.  */
 
1079
    GCRY_MD_FLAG_HMAC   = 2   /* Make an HMAC out of this algorithm.  */
1057
1080
  };
1058
1081
 
1059
 
/* Forward declaration.  */
 
1082
/* (Forward declaration.)  */
1060
1083
struct gcry_md_context;
1061
1084
 
1062
1085
/* This object is used to hold a handle to a message digest object.
1142
1165
                               size_t *nbytes);
1143
1166
 
1144
1167
/* Map the digest algorithm id ALGO to a string representation of the
1145
 
   algorithm name.  For unknown algorithms this functions returns
 
1168
   algorithm name.  For unknown algorithms this function returns
1146
1169
   "?". */
1147
1170
const char *gcry_md_algo_name (int algo) _GCRY_GCC_ATTR_PURE;
1148
1171
 
1210
1233
 
1211
1234
 
1212
1235
 
1213
 
/* Alternative interface for asymetric cryptography.  */
 
1236
/* Alternative interface for asymmetric cryptography.  This interface
 
1237
   is deprecated.  */
1214
1238
 
1215
1239
/* The algorithm IDs. */
1216
1240
typedef enum gcry_ac_id
1584
1608
 
1585
1609
/************************************
1586
1610
 *                                  *
1587
 
 *   random generating functions    *
 
1611
 *   Random Generating Functions    *
1588
1612
 *                                  *
1589
1613
 ************************************/
1590
1614
 
1591
1615
/* The possible values for the random quality.  The rule of thumb is
1592
1616
   to use STRONG for session keys and VERY_STRONG for key material.
1593
 
   WEAK is currently an alias for STRONG and should not be used
1594
 
   anymore - use gcry_create_nonce instead. */
 
1617
   WEAK is usually an alias for STRONG and should not be used anymore
 
1618
   (except with gcry_mpi_randomize); use gcry_create_nonce instead. */
1595
1619
typedef enum gcry_random_level
1596
1620
  {
1597
1621
    GCRY_WEAK_RANDOM = 0,
1630
1654
 
1631
1655
 
1632
1656
/* Set the big integer W to a random value of NBITS using a random
1633
 
   generator with quality LEVEL. */
 
1657
   generator with quality LEVEL.  Note that by using a level of
 
1658
   GCRY_WEAK_RANDOM gcry_create_nonce is used internally. */
1634
1659
void gcry_mpi_randomize (gcry_mpi_t w,
1635
1660
                         unsigned int nbits, enum gcry_random_level level);
1636
1661
 
1641
1666
 
1642
1667
 
1643
1668
 
1644
 
/* Prime interface.  */
 
1669
 
 
1670
/*******************************/
 
1671
/*                             */
 
1672
/*    Prime Number Functions   */
 
1673
/*                             */
 
1674
/*******************************/
1645
1675
 
1646
1676
/* Mode values passed to a gcry_prime_check_func_t. */
1647
1677
#define GCRY_PRIME_CHECK_AT_FINISH      0
1682
1712
   newly allocated MPI in R_G.  If START_G is not NULL, use this as
1683
1713
   teh start for the search. */
1684
1714
gcry_error_t gcry_prime_group_generator (gcry_mpi_t *r_g,
1685
 
                                         gcry_mpi_t prime, gcry_mpi_t *factors,
 
1715
                                         gcry_mpi_t prime,
 
1716
                                         gcry_mpi_t *factors,
1686
1717
                                         gcry_mpi_t start_g);
1687
1718
 
1688
1719
 
1697
1728
 
1698
1729
/************************************
1699
1730
 *                                  *
1700
 
 *     miscellaneous stuff          *
 
1731
 *     Miscellaneous Stuff          *
1701
1732
 *                                  *
1702
1733
 ************************************/
1703
1734
 
1704
1735
/* Log levels used by the internal logging facility. */
1705
1736
enum gcry_log_levels 
1706
1737
  {
1707
 
    GCRY_LOG_CONT   = 0,    /* continue the last log line */
 
1738
    GCRY_LOG_CONT   = 0,    /* (Continue the last log line.) */
1708
1739
    GCRY_LOG_INFO   = 10,
1709
1740
    GCRY_LOG_WARN   = 20,
1710
1741
    GCRY_LOG_ERROR  = 30,
1784
1815
/* Return true if A is allocated in "secure" memory. */
1785
1816
int gcry_is_secure (const void *a) _GCRY_GCC_ATTR_PURE;
1786
1817
 
 
1818
/* Return true if Libgcrypt is in FIPS mode.  */
 
1819
#define gcry_fips_mode_active()  !!gcry_control (GCRYCTL_FIPS_MODE_P, 0)
 
1820
 
 
1821
 
1787
1822
/* Include support for Libgcrypt modules.  */
1788
1823
#include <gcrypt-module.h>
1789
1824
 
1790
 
#if 0 /* keep Emacsens' auto-indent happy */
 
1825
#if 0 /* (Keep Emacsens' auto-indent happy.) */
1791
1826
{
1792
1827
#endif
1793
1828
#ifdef __cplusplus