## 17 Architecture ¶

This chapter describes the internal architecture of Libgcrypt.

Libgcrypt is a function library written in ISO C-90. Any compliant compiler should be able to build Libgcrypt as long as the target is either a POSIX platform or compatible to the API used by Windows NT. Provisions have been taken so that the library can be directly used from C++ applications; however building with a C++ compiler is not supported.

Building Libgcrypt is done by using the common `./configure && make` approach. The configure command is included in the source distribution, and as a portable shell script it works on any Unix-alike system. The result of running the configure script are a C header file (`config.h`), customized Makefiles, the setup of symbolic links and a few other things. After that the make tool builds and optionally installs the library and the documentation. See the files `INSTALL` and `README` in the source distribution on how to do this.

Libgcrypt is developed using a Subversion3 repository. Although all released versions are tagged in this repository, they should not be used to build production versions of Libgcrypt. Instead released tarballs should be used. These tarballs are available from several places with the master copy at ‘`ftp://ftp.gnupg.org/gcrypt/libgcrypt/`’. Announcements of new releases are posted to the ‘`gnupg-announce@gnupg.org`’ mailing list4.

Figure 17.1: Libgcrypt subsystems

Libgcrypt consists of several subsystems (see Figure 17.1) and all these subsystems provide a public API; this includes the helper subsystems like the one for S-expressions. The API style depends on the subsystem; in general an open-use-close approach is implemented. The open returns a handle to a context used for all further operations on this handle, several functions may then be used on this handle, and a final close function releases all resources associated with the handle.

#### Footnotes

##### (3)

A version control system available for many platforms

##### (4)

See http://www.gnupg.org/documentation/mailing-lists.en.html for details.