DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(gcrypt.info.gz) MPI formats

Info Catalog (gcrypt.info.gz) Basic functions (gcrypt.info.gz) MPI library (gcrypt.info.gz) Calculations
 
 11.3 MPI formats
 ================
 
 The following functions are used to convert between an external
 representation of an MPI and the internal one of Libgcrypt.
 
  -- Function: int gcry_mpi_scan (gcry_mpi_t *R_MPI,
           enum gcry_mpi_format FORMAT, const void *BUFFER,
           size_t BUFLEN, size_t *NSCANNED)
      Convert the external representation of an integer stored in BUFFER
      with a length of BUFLEN into a newly created MPI returned which
      will be stored at the address of R_MPI.  For certain formats the
      length argument is not required and may be passed as `0'.  After a
      successful operation the variable NSCANNED receives the number of
      bytes actually scanned unless NSCANNED was given as `NULL'. FORMAT
      describes the format of the MPI as stored in BUFFER:
 
     `GCRYMPI_FMT_STD'
           2-complement stored without a length header.
 
     `GCRYMPI_FMT_PGP'
           As used by OpenPGP (only defined as unsigned). This is
           basically `GCRYMPI_FMT_STD' with a 2 byte big endian length
           header.
 
     `GCRYMPI_FMT_SSH'
           As used in the Secure Shell protocol.  This is
           `GCRYMPI_FMT_STD' with a 4 byte big endian header.
 
     `GCRYMPI_FMT_HEX'
           Stored as a C style string with each byte of the MPI encoded
           as 2 hex digits.
 
     `GCRYMPI_FMT_USG'
           Simple unsigned integer.
 
      Note, that all of the above formats store the integer in big-endian
      format (MSB first).
 
  -- Function: int gcry_mpi_print (enum gcry_mpi_format FORMAT,
           unsigned char *BUFFER, size_t BUFLEN, size_t *NWRITTEN,
           const gcry_mpi_t A)
      Convert the MPI A into an external representation described by
      FORMAT (see above) and store it in the provided BUFFER which has a
      usable length of at least the BUFLEN bytes. If NWRITTEN is not
      NULL, it will receive the number of bytes actually stored in
      BUFFER after a successful operation.
 
  -- Function: int gcry_mpi_aprint (enum gcry_mpi_format FORMAT,
           unsigned char **BUFFER, size_t *NBYTES, const gcry_mpi_t A)
      Convert the MPI A into an external representation described by
      FORMAT (see above) and store it in a newly allocated buffer which
      address will be stored in the variable BUFFER points to.  The
      number of bytes stored in this buffer will be stored in the
      variable NBYTES points to, unless NBYTES is `NULL'.
 
  -- Function: void gcry_mpi_dump (const gcry_mpi_t A)
      Dump the value of A in a format suitable for debugging to
      Libgcrypt's logging stream.  Note that one leading space but no
      trailing space or linefeed will be printed.  It is okay to pass
      `NULL' for A.
 
Info Catalog (gcrypt.info.gz) Basic functions (gcrypt.info.gz) MPI library (gcrypt.info.gz) Calculations
automatically generated byinfo2html