GNUnet 0.22.2
crypto_mpi.c File Reference

Helper functions for libgcrypt MPIs. More...

#include "platform.h"
#include <gcrypt.h>
#include "gnunet_util_lib.h"
Include dependency graph for crypto_mpi.c:

Go to the source code of this file.

Macros

#define LOG(kind, ...)   GNUNET_log_from (kind, "util-crypto-mpi", __VA_ARGS__)
 
#define LOG_GCRY(level, cmd, rc)
 Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the message given by gcry_strerror(rc). More...
 

Functions

static void adjust (void *buf, size_t size, size_t target)
 If target != size, move target bytes to the end of the size-sized buffer and zero out the first target - size bytes. More...
 
void GNUNET_CRYPTO_mpi_print_unsigned (void *buf, size_t size, gcry_mpi_t val)
 Output the given MPI value to the given buffer in network byte order. More...
 
void GNUNET_CRYPTO_mpi_scan_unsigned (gcry_mpi_t *result, const void *data, size_t size)
 Convert data buffer into MPI value. More...
 

Detailed Description

Helper functions for libgcrypt MPIs.

Author
Christian Grothoff
Florian Dold

Definition in file crypto_mpi.c.

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log_from (kind, "util-crypto-mpi", __VA_ARGS__)

Definition at line 33 of file crypto_mpi.c.

◆ LOG_GCRY

#define LOG_GCRY (   level,
  cmd,
  rc 
)
Value:
do { LOG (level, _ ( \
"`%s' failed at %s:%d with error: %s\n"), \
cmd, __FILE__, __LINE__, \
gcry_strerror (rc)); } while (0)
#define LOG(kind,...)
Definition: crypto_mpi.c:33
#define _(String)
GNU gettext support macro.
Definition: platform.h:179

Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the message given by gcry_strerror(rc).

Definition at line 40 of file crypto_mpi.c.

Function Documentation

◆ adjust()

static void adjust ( void *  buf,
size_t  size,
size_t  target 
)
static

If target != size, move target bytes to the end of the size-sized buffer and zero out the first target - size bytes.

Parameters
buforiginal buffer
sizenumber of bytes in buf
targettarget size of the buffer

Definition at line 55 of file crypto_mpi.c.

58{
59 char *p = buf;
60
61 if (size < target)
62 {
63 memmove (&p[target - size], buf, size);
64 memset (buf, 0, target - size);
65 }
66}
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-uri.c:38
static unsigned int size
Size of the "table".
Definition: peer.c:68

References p, and size.

Referenced by GNUNET_CRYPTO_mpi_print_unsigned().

Here is the caller graph for this function: