[nettle] Updated the Win32 precompiled build of Nettle from 3.4 to 3.5.1.

Reorganized directories to match rom-properties' gettext.win32 layout.
- Single include directory.
- lib.i386 and lib.amd64 library directories.
This commit is contained in:
David Korth 2019-12-30 14:16:18 -05:00
parent feda58ac7e
commit 36aaca94aa
176 changed files with 2147 additions and 11578 deletions

View File

@ -32,20 +32,20 @@ ELSE(NOT WIN32)
MESSAGE(FATAL_ERROR "Architecture ${arch} is not supported.")
ENDIF(NOT arch MATCHES "^(i.|x)86$|^x86_64$|^amd64$")
SET(NETTLE_WIN32_BASE_PATH "${CMAKE_SOURCE_DIR}/extlib/nettle.win32/${arch}")
SET(NETTLE_WIN32_BASE_PATH "${CMAKE_SOURCE_DIR}/extlib/nettle.win32")
SET(NETTLE_INCLUDE_DIRS "${NETTLE_WIN32_BASE_PATH}/include")
IF(MSVC)
SET(NETTLE_LIBRARY "${NETTLE_WIN32_BASE_PATH}/lib/libnettle-6.lib")
SET(HOGWEED_LIBRARY "${NETTLE_WIN32_BASE_PATH}/lib/libhogweed-4.lib")
SET(NETTLE_LIBRARY "${NETTLE_WIN32_BASE_PATH}/lib.${arch}/libnettle-7.lib")
SET(HOGWEED_LIBRARY "${NETTLE_WIN32_BASE_PATH}/lib.${arch}/libhogweed-5.lib")
ELSE(MSVC)
SET(NETTLE_LIBRARY "${NETTLE_WIN32_BASE_PATH}/lib/libnettle.dll.a")
SET(HOGWEED_LIBRARY "${NETTLE_WIN32_BASE_PATH}/lib/libhogweed.dll.a")
SET(NETTLE_LIBRARY "${NETTLE_WIN32_BASE_PATH}/lib.${arch}/libnettle.dll.a")
SET(HOGWEED_LIBRARY "${NETTLE_WIN32_BASE_PATH}/lib.${arch}/libhogweed.dll.a")
ENDIF(MSVC)
SET(NETTLE_LIBRARIES ${NETTLE_LIBRARY} ${HOGWEED_LIBRARY})
# Copy and install the DLLs.
SET(NETTLE_NETTLE_DLL "${NETTLE_WIN32_BASE_PATH}/lib/libnettle-6.dll")
SET(NETTLE_HOGWEED_DLL "${NETTLE_WIN32_BASE_PATH}/lib/libhogweed-4.dll")
SET(NETTLE_NETTLE_DLL "${NETTLE_WIN32_BASE_PATH}/lib.${arch}/libnettle-7.dll")
SET(NETTLE_HOGWEED_DLL "${NETTLE_WIN32_BASE_PATH}/lib.${arch}/libhogweed-5.dll")
# Destination directory.
# If CMAKE_CFG_INTDIR is set, a Debug or Release subdirectory is being used.
@ -61,13 +61,13 @@ ELSE(NOT WIN32)
ADD_CUSTOM_COMMAND(OUTPUT nettle_dll_command
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different
"${NETTLE_NETTLE_DLL}" "${DLL_DESTDIR}/libnettle-6.dll"
"${NETTLE_NETTLE_DLL}" "${DLL_DESTDIR}/libnettle-7.dll"
DEPENDS nettle_always_rebuild
)
ADD_CUSTOM_COMMAND(OUTPUT hogweed_dll_command
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different
"${NETTLE_HOGWEED_DLL}" "${DLL_DESTDIR}/libhogweed-4.dll"
"${NETTLE_HOGWEED_DLL}" "${DLL_DESTDIR}/libhogweed-5.dll"
DEPENDS nettle_always_rebuild
)
ADD_CUSTOM_COMMAND(OUTPUT nettle_always_rebuild

View File

@ -1,10 +1,13 @@
Precompiled libraries for Win32.
GNU Nettle 3.5.1, precompiled for Win32.
GNU Nettle 3.4: https://www.lysator.liu.se/~nisse/nettle/
- License: LGPLv3 or LGPLv2.1
- ASM optimizations are enabled in "fat binary" mode.
- i386 build:
- Compiled with i686-w64-mingw32-gcc 7.3.0.
- i686-optimized.
- amd64 build:
- Compiled with x86_64-w64-mingw32-gcc 7.3.0.
License: LGPLv3 or LGPLv2.1
ASM optimizations are enabled in "fat binary" mode.
i386 build:
- Compiled with i686-w64-mingw32-gcc 9.2.0.
- Ubuntu version: 9.2.1-9ubuntu1+22~exp1ubuntu2
- i686-optimized.
amd64 build:
- Compiled with x86_64-w64-mingw32-gcc 9.2.0.
- Ubuntu version: 9.2.1-9ubuntu1+22~exp1ubuntu2

View File

@ -1,87 +0,0 @@
/* cfb.h
Cipher feedback mode.
Copyright (C) 2015, 2017 Dmitry Eremin-Solenikov
Copyright (C) 2001 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_CFB_H_INCLUDED
#define NETTLE_CFB_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define cfb_encrypt nettle_cfb_encrypt
#define cfb_decrypt nettle_cfb_decrypt
void
cfb_encrypt(const void *ctx, nettle_cipher_func *f,
size_t block_size, uint8_t *iv,
size_t length, uint8_t *dst,
const uint8_t *src);
void
cfb_decrypt(const void *ctx, nettle_cipher_func *f,
size_t block_size, uint8_t *iv,
size_t length, uint8_t *dst,
const uint8_t *src);
#define CFB_CTX(type, size) \
{ type ctx; uint8_t iv[size]; }
#define CFB_SET_IV(ctx, data) \
memcpy((ctx)->iv, (data), sizeof((ctx)->iv))
/* NOTE: Avoid using NULL, as we don't include anything defining it. */
#define CFB_ENCRYPT(self, f, length, dst, src) \
(0 ? ((f)(&(self)->ctx, ~(size_t) 0, \
(uint8_t *) 0, (const uint8_t *) 0)) \
: cfb_encrypt((void *) &(self)->ctx, \
(nettle_cipher_func *) (f), \
sizeof((self)->iv), (self)->iv, \
(length), (dst), (src)))
#define CFB_DECRYPT(self, f, length, dst, src) \
(0 ? ((f)(&(self)->ctx, ~(size_t) 0, \
(uint8_t *) 0, (const uint8_t *) 0)) \
: cfb_decrypt((void *) &(self)->ctx, \
(nettle_cipher_func *) (f), \
sizeof((self)->iv), (self)->iv, \
(length), (dst), (src)))
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_CFB_H_INCLUDED */

View File

@ -1,96 +0,0 @@
/* chacha.h
The ChaCha stream cipher.
Copyright (C) 2013 Joachim Strömbergson
Copyright (C) 2012 Simon Josefsson
Copyright (C) 2014 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_CHACHA_H_INCLUDED
#define NETTLE_CHACHA_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define chacha_set_key nettle_chacha_set_key
#define chacha_set_nonce nettle_chacha_set_nonce
#define chacha_set_nonce96 nettle_chacha_set_nonce96
#define chacha_crypt nettle_chacha_crypt
#define _chacha_core _nettle_chacha_core
/* Currently, only 256-bit keys are supported. */
#define CHACHA_KEY_SIZE 32
#define CHACHA_BLOCK_SIZE 64
#define CHACHA_NONCE_SIZE 8
#define CHACHA_NONCE96_SIZE 12
#define _CHACHA_STATE_LENGTH 16
struct chacha_ctx
{
/* Indices 0-3 holds a constant (SIGMA or TAU).
Indices 4-11 holds the key.
Indices 12-13 holds the block counter.
Indices 14-15 holds the IV:
This creates the state matrix:
C C C C
K K K K
K K K K
B B I I
*/
uint32_t state[_CHACHA_STATE_LENGTH];
};
void
chacha_set_key(struct chacha_ctx *ctx, const uint8_t *key);
void
chacha_set_nonce(struct chacha_ctx *ctx, const uint8_t *nonce);
void
chacha_set_nonce96(struct chacha_ctx *ctx, const uint8_t *nonce);
void
chacha_crypt(struct chacha_ctx *ctx, size_t length,
uint8_t *dst, const uint8_t *src);
void
_chacha_core(uint32_t *dst, const uint32_t *src, unsigned rounds);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_CHACHA_H_INCLUDED */

View File

@ -1,162 +0,0 @@
/* des-compat.h
The des block cipher, old libdes/openssl-style interface.
Copyright (C) 2001 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_DES_COMPAT_H_INCLUDED
#define NETTLE_DES_COMPAT_H_INCLUDED
/* According to Assar, des_set_key, des_set_key_odd_parity,
* des_is_weak_key, plus the encryption functions (des_*_encrypt and
* des_cbc_cksum) would be a pretty useful subset. */
/* NOTE: This is quite experimental, and not all functions are
* implemented. Contributions, in particular test cases are welcome. */
#include "des.h"
#ifdef __cplusplus
extern "C" {
#endif
/* We use some name mangling, to avoid collisions with either other
* nettle functions or with libcrypto. */
#define des_ecb3_encrypt nettle_openssl_des_ecb3_encrypt
#define des_cbc_cksum nettle_openssl_des_cbc_cksum
#define des_ncbc_encrypt nettle_openssl_des_ncbc_encrypt
#define des_cbc_encrypt nettle_openssl_des_cbc_encrypt
#define des_ecb_encrypt nettle_openssl_des_ecb_encrypt
#define des_ede3_cbc_encrypt nettle_openssl_des_ede3_cbc_encrypt
#define des_set_odd_parity nettle_openssl_des_set_odd_parity
#define des_check_key nettle_openssl_des_check_key
#define des_key_sched nettle_openssl_des_key_sched
#define des_is_weak_key nettle_openssl_des_is_weak_key
/* An extra alias */
#undef des_set_key
#define des_set_key nettle_openssl_des_key_sched
enum { DES_DECRYPT = 0, DES_ENCRYPT = 1 };
/* Types */
typedef uint32_t DES_LONG;
/* Note: Typedef:ed arrays should be avoided, but they're used here
* for compatibility. */
typedef struct des_ctx des_key_schedule[1];
typedef uint8_t des_cblock[DES_BLOCK_SIZE];
/* Note: The proper definition,
typedef const uint8_t const_des_cblock[DES_BLOCK_SIZE];
would have worked, *if* all the prototypes had used arguments like
foo(const_des_cblock src, des_cblock dst), letting argument arrays
"decay" into pointers of type uint8_t * and const uint8_t *.
But since openssl's prototypes use *pointers* const_des_cblock *src,
des_cblock *dst, this ends up in type conflicts, and the workaround
is to not use const at all.
*/
#define const_des_cblock des_cblock
/* Aliases */
#define des_ecb2_encrypt(i,o,k1,k2,e) \
des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
/* Global flag */
extern int des_check_key;
/* Prototypes */
/* Typing is a little confusing. Since both des_cblock and
des_key_schedule are typedef:ed arrays, it automatically decay to
a pointers.
But the functions are declared taking pointers to des_cblock, i.e.
pointers to arrays. And on the other hand, they take plain
des_key_schedule arguments, which is equivalent to pointers to
struct des_ctx. */
void
des_ecb3_encrypt(const_des_cblock *src, des_cblock *dst,
des_key_schedule k1,
des_key_schedule k2,
des_key_schedule k3, int enc);
/* des_cbc_cksum in libdes returns a 32 bit integer, representing the
* latter half of the output block, using little endian byte order. */
uint32_t
des_cbc_cksum(const uint8_t *src, des_cblock *dst,
long length, des_key_schedule ctx,
const_des_cblock *iv);
/* NOTE: Doesn't update iv. */
void
des_cbc_encrypt(const_des_cblock *src, des_cblock *dst, long length,
des_key_schedule ctx, const_des_cblock *iv,
int enc);
/* Similar, but updates iv. */
void
des_ncbc_encrypt(const_des_cblock *src, des_cblock *dst, long length,
des_key_schedule ctx, des_cblock *iv,
int enc);
void
des_ecb_encrypt(const_des_cblock *src, des_cblock *dst,
des_key_schedule ctx, int enc);
void
des_ede3_cbc_encrypt(const_des_cblock *src, des_cblock *dst, long length,
des_key_schedule k1,
des_key_schedule k2,
des_key_schedule k3,
des_cblock *iv,
int enc);
int
des_set_odd_parity(des_cblock *key);
int
des_key_sched(const_des_cblock *key, des_key_schedule ctx);
int
des_is_weak_key(const_des_cblock *key);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_DES_COMPAT_H_INCLUDED */

View File

@ -1,216 +0,0 @@
/* dsa.h
The DSA publickey algorithm.
Copyright (C) 2002, 2013, 2014 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_DSA_H_INCLUDED
#define NETTLE_DSA_H_INCLUDED
#include "nettle-types.h"
#include "bignum.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define dsa_params_init nettle_dsa_params_init
#define dsa_params_clear nettle_dsa_params_clear
#define dsa_signature_init nettle_dsa_signature_init
#define dsa_signature_clear nettle_dsa_signature_clear
#define dsa_sign nettle_dsa_sign
#define dsa_verify nettle_dsa_verify
#define dsa_generate_params nettle_dsa_generate_params
#define dsa_generate_keypair nettle_dsa_generate_keypair
#define dsa_signature_from_sexp nettle_dsa_signature_from_sexp
#define dsa_keypair_to_sexp nettle_dsa_keypair_to_sexp
#define dsa_keypair_from_sexp_alist nettle_dsa_keypair_from_sexp_alist
#define dsa_sha1_keypair_from_sexp nettle_dsa_sha1_keypair_from_sexp
#define dsa_sha256_keypair_from_sexp nettle_dsa_sha256_keypair_from_sexp
#define dsa_params_from_der_iterator nettle_dsa_params_from_der_iterator
#define dsa_public_key_from_der_iterator nettle_dsa_public_key_from_der_iterator
#define dsa_openssl_private_key_from_der_iterator nettle_dsa_openssl_private_key_from_der_iterator
#define dsa_openssl_private_key_from_der nettle_openssl_provate_key_from_der
#define _dsa_hash _nettle_dsa_hash
/* For FIPS approved parameters */
#define DSA_SHA1_MIN_P_BITS 512
#define DSA_SHA1_Q_OCTETS 20
#define DSA_SHA1_Q_BITS 160
#define DSA_SHA256_MIN_P_BITS 1024
#define DSA_SHA256_Q_OCTETS 32
#define DSA_SHA256_Q_BITS 256
struct dsa_params
{
/* Modulo */
mpz_t p;
/* Group order */
mpz_t q;
/* Generator */
mpz_t g;
};
void
dsa_params_init (struct dsa_params *params);
void
dsa_params_clear (struct dsa_params *params);
struct dsa_signature
{
mpz_t r;
mpz_t s;
};
/* Calls mpz_init to initialize bignum storage. */
void
dsa_signature_init(struct dsa_signature *signature);
/* Calls mpz_clear to deallocate bignum storage. */
void
dsa_signature_clear(struct dsa_signature *signature);
int
dsa_sign(const struct dsa_params *params,
const mpz_t x,
void *random_ctx, nettle_random_func *random,
size_t digest_size,
const uint8_t *digest,
struct dsa_signature *signature);
int
dsa_verify(const struct dsa_params *params,
const mpz_t y,
size_t digest_size,
const uint8_t *digest,
const struct dsa_signature *signature);
/* Key generation */
int
dsa_generate_params(struct dsa_params *params,
void *random_ctx, nettle_random_func *random,
void *progress_ctx, nettle_progress_func *progress,
unsigned p_bits, unsigned q_bits);
void
dsa_generate_keypair (const struct dsa_params *params,
mpz_t pub, mpz_t key,
void *random_ctx, nettle_random_func *random);
/* Keys in sexp form. */
struct nettle_buffer;
/* Generates a public-key expression if PRIV is NULL .*/
int
dsa_keypair_to_sexp(struct nettle_buffer *buffer,
const char *algorithm_name, /* NULL means "dsa" */
const struct dsa_params *params,
const mpz_t pub,
const mpz_t priv);
struct sexp_iterator;
int
dsa_signature_from_sexp(struct dsa_signature *rs,
struct sexp_iterator *i,
unsigned q_bits);
int
dsa_keypair_from_sexp_alist(struct dsa_params *params,
mpz_t pub,
mpz_t priv,
unsigned p_max_bits,
unsigned q_bits,
struct sexp_iterator *i);
/* If PRIV is NULL, expect a public-key expression. If PUB is NULL,
* expect a private key expression and ignore the parts not needed for
* the public key. */
/* Keys must be initialized before calling this function, as usual. */
int
dsa_sha1_keypair_from_sexp(struct dsa_params *params,
mpz_t pub,
mpz_t priv,
unsigned p_max_bits,
size_t length, const uint8_t *expr);
int
dsa_sha256_keypair_from_sexp(struct dsa_params *params,
mpz_t pub,
mpz_t priv,
unsigned p_max_bits,
size_t length, const uint8_t *expr);
/* Keys in X.509 andd OpenSSL format. */
struct asn1_der_iterator;
int
dsa_params_from_der_iterator(struct dsa_params *params,
unsigned max_bits, unsigned q_bits,
struct asn1_der_iterator *i);
int
dsa_public_key_from_der_iterator(const struct dsa_params *params,
mpz_t pub,
struct asn1_der_iterator *i);
int
dsa_openssl_private_key_from_der_iterator(struct dsa_params *params,
mpz_t pub,
mpz_t priv,
unsigned p_max_bits,
struct asn1_der_iterator *i);
int
dsa_openssl_private_key_from_der(struct dsa_params *params,
mpz_t pub,
mpz_t priv,
unsigned p_max_bits,
size_t length, const uint8_t *data);
/* Internal functions. */
void
_dsa_hash (mpz_t h, unsigned bit_size,
size_t length, const uint8_t *digest);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_DSA_H_INCLUDED */

View File

@ -1,149 +0,0 @@
/* eddsa.h
Copyright (C) 2014 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_EDDSA_H
#define NETTLE_EDDSA_H
#include "nettle-types.h"
#include "bignum.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define ed25519_sha512_set_private_key nettle_ed25519_sha512_set_private_key
#define ed25519_sha512_public_key nettle_ed25519_sha512_public_key
#define ed25519_sha512_sign nettle_ed25519_sha512_sign
#define ed25519_sha512_verify nettle_ed25519_sha512_verify
#define _eddsa_compress _nettle_eddsa_compress
#define _eddsa_compress_itch _nettle_eddsa_compress_itch
#define _eddsa_decompress _nettle_eddsa_decompress
#define _eddsa_decompress_itch _nettle_eddsa_decompress_itch
#define _eddsa_hash _nettle_eddsa_hash
#define _eddsa_expand_key _nettle_eddsa_expand_key
#define _eddsa_sign _nettle_eddsa_sign
#define _eddsa_sign_itch _nettle_eddsa_sign_itch
#define _eddsa_verify _nettle_eddsa_verify
#define _eddsa_verify_itch _nettle_eddsa_verify_itch
#define _eddsa_public_key_itch _nettle_eddsa_public_key_itch
#define _eddsa_public_key _nettle_eddsa_public_key
#define ED25519_KEY_SIZE 32
#define ED25519_SIGNATURE_SIZE 64
void
ed25519_sha512_public_key (uint8_t *pub, const uint8_t *priv);
void
ed25519_sha512_sign (const uint8_t *pub,
const uint8_t *priv,
size_t length, const uint8_t *msg,
uint8_t *signature);
int
ed25519_sha512_verify (const uint8_t *pub,
size_t length, const uint8_t *msg,
const uint8_t *signature);
/* Low-level internal functions */
struct ecc_curve;
struct ecc_modulo;
mp_size_t
_eddsa_compress_itch (const struct ecc_curve *ecc);
void
_eddsa_compress (const struct ecc_curve *ecc, uint8_t *r, mp_limb_t *p,
mp_limb_t *scratch);
mp_size_t
_eddsa_decompress_itch (const struct ecc_curve *ecc);
int
_eddsa_decompress (const struct ecc_curve *ecc, mp_limb_t *p,
const uint8_t *cp,
mp_limb_t *scratch);
void
_eddsa_hash (const struct ecc_modulo *m,
mp_limb_t *rp, const uint8_t *digest);
mp_size_t
_eddsa_sign_itch (const struct ecc_curve *ecc);
void
_eddsa_sign (const struct ecc_curve *ecc,
const struct nettle_hash *H,
const uint8_t *pub,
void *ctx,
const mp_limb_t *k2,
size_t length,
const uint8_t *msg,
uint8_t *signature,
mp_limb_t *scratch);
mp_size_t
_eddsa_verify_itch (const struct ecc_curve *ecc);
int
_eddsa_verify (const struct ecc_curve *ecc,
const struct nettle_hash *H,
const uint8_t *pub,
const mp_limb_t *A,
void *ctx,
size_t length,
const uint8_t *msg,
const uint8_t *signature,
mp_limb_t *scratch);
void
_eddsa_expand_key (const struct ecc_curve *ecc,
const struct nettle_hash *H,
void *ctx,
const uint8_t *key,
uint8_t *digest,
mp_limb_t *k2);
mp_size_t
_eddsa_public_key_itch (const struct ecc_curve *ecc);
void
_eddsa_public_key (const struct ecc_curve *ecc,
const mp_limb_t *k, uint8_t *pub, mp_limb_t *scratch);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_EDDSA_H */

View File

@ -1,164 +0,0 @@
/* gmp-glue.h
Copyright (C) 2013 Niels Möller
Copyright (C) 2013 Red Hat
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_GMP_GLUE_H_INCLUDED
#define NETTLE_GMP_GLUE_H_INCLUDED
#include "bignum.h"
#ifdef mpz_limbs_read
#define GMP_HAVE_mpz_limbs_read 1
#else
#define GMP_HAVE_mpz_limbs_read 0
#endif
/* Name mangling. */
#if !GMP_HAVE_mpz_limbs_read
#define mpz_limbs_read _nettle_mpz_limbs_read
#define mpz_limbs_write _nettle_mpz_limbs_write
#define mpz_limbs_modify _nettle_mpz_limbs_modify
#define mpz_limbs_finish _nettle_mpz_limbs_finish
#define mpz_roinit_n _nettle_mpz_roinit_n
#endif
#define cnd_swap _nettle_cnd_swap
#define mpz_limbs_cmp _nettle_mpz_limbs_cmp
#define mpz_limbs_read_n _nettle_mpz_limbs_read_n
#define mpz_limbs_copy _nettle_mpz_limbs_copy
#define mpz_set_n _nettle_mpz_set_n
#define mpn_set_base256 _nettle_mpn_set_base256
#define mpn_set_base256_le _nettle_mpn_set_base256_le
#define mpn_get_base256_le _nettle_mpn_get_base256_le
#define gmp_alloc_limbs _nettle_gmp_alloc_limbs
#define gmp_free_limbs _nettle_gmp_free_limbs
#define gmp_free _nettle_gmp_free
#define gmp_alloc _nettle_gmp_alloc
#define TMP_GMP_DECL(name, type) type *name; \
size_t tmp_##name##_size
#define TMP_GMP_ALLOC(name, size) do { \
tmp_##name##_size = (size); \
(name) = gmp_alloc(sizeof (*name) * (size)); \
} while (0)
#define TMP_GMP_FREE(name) (gmp_free(name, tmp_##name##_size))
/* Use only in-place operations, so we can fall back to addmul_1/submul_1 */
#ifdef mpn_cnd_add_n
# define cnd_add_n(cnd, rp, ap, n) mpn_cnd_add_n ((cnd), (rp), (rp), (ap), (n))
# define cnd_sub_n(cnd, rp, ap, n) mpn_cnd_sub_n ((cnd), (rp), (rp), (ap), (n))
#else
# define cnd_add_n(cnd, rp, ap, n) mpn_addmul_1 ((rp), (ap), (n), (cnd) != 0)
# define cnd_sub_n(cnd, rp, ap, n) mpn_submul_1 ((rp), (ap), (n), (cnd) != 0)
#endif
/* Some functions for interfacing between mpz and mpn code. Signs of
the mpz numbers are generally ignored. */
#if !GMP_HAVE_mpz_limbs_read
/* Read access to mpz numbers. */
/* Return limb pointer, for read-only operations. Use mpz_size to get
the number of limbs. */
const mp_limb_t *
mpz_limbs_read (const mpz_srcptr x);
/* Write access to mpz numbers. */
/* Get a limb pointer for writing, previous contents may be
destroyed. */
mp_limb_t *
mpz_limbs_write (mpz_ptr x, mp_size_t n);
/* Get a limb pointer for writing, previous contents is intact. */
mp_limb_t *
mpz_limbs_modify (mpz_ptr x, mp_size_t n);
/* Update size. */
void
mpz_limbs_finish (mpz_ptr x, mp_size_t n);
/* Using an mpn number as an mpz. Can be used for read-only access
only. x must not be cleared or reallocated. */
mpz_srcptr
mpz_roinit_n (mpz_ptr x, const mp_limb_t *xp, mp_size_t xs);
#endif /* !GMP_HAVE_mpz_limbs_read */
void
cnd_swap (mp_limb_t cnd, mp_limb_t *ap, mp_limb_t *bp, mp_size_t n);
/* Convenience functions */
int
mpz_limbs_cmp (mpz_srcptr a, const mp_limb_t *bp, mp_size_t bn);
/* Get a pointer to an n limb area, for read-only operation. n must be
greater or equal to the current size, and the mpz is zero-padded if
needed. */
const mp_limb_t *
mpz_limbs_read_n (mpz_ptr x, mp_size_t n);
/* Copy limbs, with zero-padding. */
/* FIXME: Reorder arguments, on the theory that the first argument of
an _mpz_* function should be an mpz_t? Or rename to _mpz_get_limbs,
with argument order consistent with mpz_get_*. */
void
mpz_limbs_copy (mp_limb_t *xp, mpz_srcptr x, mp_size_t n);
void
mpz_set_n (mpz_t r, const mp_limb_t *xp, mp_size_t xn);
/* Like mpn_set_str, but always writes rn limbs. If input is larger,
higher bits are ignored. */
void
mpn_set_base256 (mp_limb_t *rp, mp_size_t rn,
const uint8_t *xp, size_t xn);
void
mpn_set_base256_le (mp_limb_t *rp, mp_size_t rn,
const uint8_t *xp, size_t xn);
void
mpn_get_base256_le (uint8_t *rp, size_t rn,
const mp_limb_t *xp, mp_size_t xn);
mp_limb_t *
gmp_alloc_limbs (mp_size_t n);
void
gmp_free_limbs (mp_limb_t *p, mp_size_t n);
void *gmp_alloc(size_t n);
void gmp_free(void *p, size_t n);
#endif /* NETTLE_GMP_GLUE_H_INCLUDED */

View File

@ -1,79 +0,0 @@
/* md2.h
The MD2 hash function, described in RFC 1319.
Copyright (C) 2003 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_MD2_H_INCLUDED
#define NETTLE_MD2_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define md2_init nettle_md2_init
#define md2_update nettle_md2_update
#define md2_digest nettle_md2_digest
#define MD2_DIGEST_SIZE 16
#define MD2_BLOCK_SIZE 16
/* For backwards compatibility */
#define MD2_DATA_SIZE MD2_BLOCK_SIZE
struct md2_ctx
{
uint8_t C[MD2_BLOCK_SIZE];
uint8_t X[3 * MD2_BLOCK_SIZE];
uint8_t block[MD2_BLOCK_SIZE]; /* Block buffer */
unsigned index; /* Into buffer */
};
void
md2_init(struct md2_ctx *ctx);
void
md2_update(struct md2_ctx *ctx,
size_t length,
const uint8_t *data);
void
md2_digest(struct md2_ctx *ctx,
size_t length,
uint8_t *digest);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_MD2_H_INCLUDED */

View File

@ -1,86 +0,0 @@
/* md5.h
The MD5 hash function, described in RFC 1321.
Copyright (C) 2001 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_MD5_H_INCLUDED
#define NETTLE_MD5_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define md5_init nettle_md5_init
#define md5_update nettle_md5_update
#define md5_digest nettle_md5_digest
#define MD5_DIGEST_SIZE 16
#define MD5_BLOCK_SIZE 64
/* For backwards compatibility */
#define MD5_DATA_SIZE MD5_BLOCK_SIZE
/* Digest is kept internally as 4 32-bit words. */
#define _MD5_DIGEST_LENGTH 4
struct md5_ctx
{
uint32_t state[_MD5_DIGEST_LENGTH];
uint64_t count; /* Block count */
uint8_t block[MD5_BLOCK_SIZE]; /* Block buffer */
unsigned index; /* Into buffer */
};
void
md5_init(struct md5_ctx *ctx);
void
md5_update(struct md5_ctx *ctx,
size_t length,
const uint8_t *data);
void
md5_digest(struct md5_ctx *ctx,
size_t length,
uint8_t *digest);
/* Internal compression function. STATE points to 4 uint32_t words,
and DATA points to 64 bytes of input data, possibly unaligned. */
void
_nettle_md5_compress(uint32_t *state, const uint8_t *data);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_MD5_H_INCLUDED */

View File

@ -1,286 +0,0 @@
#ifndef __NETTLE_STDINT_H
#define __NETTLE_STDINT_H 1
#ifndef _GENERATED_STDINT_H
#define _GENERATED_STDINT_H " "
/* generated using gnu compiler x86_64-w64-mingw32-gcc (Gentoo 7.3.0 p1.0) 7.3.0 */
#define _STDINT_HAVE_STDINT_H 1
/* ................... shortcircuit part ........................... */
#if defined HAVE_STDINT_H || defined _STDINT_HAVE_STDINT_H
#include <stdint.h>
#else
#include <stddef.h>
/* .................... configured part ............................ */
/* whether we have a C99 compatible stdint header file */
/* #undef _STDINT_HEADER_INTPTR */
/* whether we have a C96 compatible inttypes header file */
/* #undef _STDINT_HEADER_UINT32 */
/* whether we have a BSD compatible inet types header */
/* #undef _STDINT_HEADER_U_INT32 */
/* which 64bit typedef has been found */
/* #undef _STDINT_HAVE_UINT64_T */
/* #undef _STDINT_HAVE_U_INT64_T */
/* which type model has been detected */
/* #undef _STDINT_CHAR_MODEL // skipped */
/* #undef _STDINT_LONG_MODEL // skipped */
/* whether int_least types were detected */
/* #undef _STDINT_HAVE_INT_LEAST32_T */
/* whether int_fast types were detected */
/* #undef _STDINT_HAVE_INT_FAST32_T */
/* whether intmax_t type was detected */
/* #undef _STDINT_HAVE_INTMAX_T */
/* .................... detections part ............................ */
/* whether we need to define bitspecific types from compiler base types */
#ifndef _STDINT_HEADER_INTPTR
#ifndef _STDINT_HEADER_UINT32
#ifndef _STDINT_HEADER_U_INT32
#define _STDINT_NEED_INT_MODEL_T
#else
#define _STDINT_HAVE_U_INT_TYPES
#endif
#endif
#endif
#ifdef _STDINT_HAVE_U_INT_TYPES
#undef _STDINT_NEED_INT_MODEL_T
#endif
#ifdef _STDINT_CHAR_MODEL
#if _STDINT_CHAR_MODEL+0 == 122 || _STDINT_CHAR_MODEL+0 == 124
#ifndef _STDINT_BYTE_MODEL
#define _STDINT_BYTE_MODEL 12
#endif
#endif
#endif
#ifndef _STDINT_HAVE_INT_LEAST32_T
#define _STDINT_NEED_INT_LEAST_T
#endif
#ifndef _STDINT_HAVE_INT_FAST32_T
#define _STDINT_NEED_INT_FAST_T
#endif
#ifndef _STDINT_HEADER_INTPTR
#define _STDINT_NEED_INTPTR_T
#ifndef _STDINT_HAVE_INTMAX_T
#define _STDINT_NEED_INTMAX_T
#endif
#endif
/* .................... definition part ............................ */
/* some system headers have good uint64_t */
#ifndef _HAVE_UINT64_T
#if defined _STDINT_HAVE_UINT64_T || defined HAVE_UINT64_T
#define _HAVE_UINT64_T
#elif defined _STDINT_HAVE_U_INT64_T || defined HAVE_U_INT64_T
#define _HAVE_UINT64_T
typedef u_int64_t uint64_t;
#endif
#endif
#ifndef _HAVE_UINT64_T
/* .. here are some common heuristics using compiler runtime specifics */
#if defined __STDC_VERSION__ && defined __STDC_VERSION__ >= 199901L
#define _HAVE_UINT64_T
typedef long long int64_t;
typedef unsigned long long uint64_t;
#elif !defined __STRICT_ANSI__
#if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__
#define _HAVE_UINT64_T
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__
/* note: all ELF-systems seem to have loff-support which needs 64-bit */
#if !defined _NO_LONGLONG
#define _HAVE_UINT64_T
typedef long long int64_t;
typedef unsigned long long uint64_t;
#endif
#elif defined __alpha || (defined __mips && defined _ABIN32)
#if !defined _NO_LONGLONG
typedef long int64_t;
typedef unsigned long uint64_t;
#endif
/* compiler/cpu type to define int64_t */
#endif
#endif
#endif
#if defined _STDINT_HAVE_U_INT_TYPES
/* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */
typedef u_int8_t uint8_t;
typedef u_int16_t uint16_t;
typedef u_int32_t uint32_t;
/* glibc compatibility */
#ifndef __int8_t_defined
#define __int8_t_defined
#endif
#endif
#ifdef _STDINT_NEED_INT_MODEL_T
/* we must guess all the basic types. Apart from byte-adressable system, */
/* there a few 32-bit-only dsp-systems that we guard with BYTE_MODEL 8-} */
/* (btw, those nibble-addressable systems are way off, or so we assume) */
#if defined _STDINT_BYTE_MODEL
#if _STDINT_LONG_MODEL+0 == 242
/* 2:4:2 = IP16 = a normal 16-bit system */
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned long uint32_t;
#ifndef __int8_t_defined
#define __int8_t_defined
typedef char int8_t;
typedef short int16_t;
typedef long int32_t;
#endif
#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL == 444
/* 2:4:4 = LP32 = a 32-bit system derived from a 16-bit */
/* 4:4:4 = ILP32 = a normal 32-bit system */
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#ifndef __int8_t_defined
#define __int8_t_defined
typedef char int8_t;
typedef short int16_t;
typedef int int32_t;
#endif
#elif _STDINT_LONG_MODEL+0 == 484 || _STDINT_LONG_MODEL+0 == 488
/* 4:8:4 = IP32 = a 32-bit system prepared for 64-bit */
/* 4:8:8 = LP64 = a normal 64-bit system */
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#ifndef __int8_t_defined
#define __int8_t_defined
typedef char int8_t;
typedef short int16_t;
typedef int int32_t;
#endif
/* this system has a "long" of 64bit */
#ifndef _HAVE_UINT64_T
#define _HAVE_UINT64_T
typedef unsigned long uint64_t;
typedef long int64_t;
#endif
#elif _STDINT_LONG_MODEL+0 == 448
/* LLP64 a 64-bit system derived from a 32-bit system */
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#ifndef __int8_t_defined
#define __int8_t_defined
typedef char int8_t;
typedef short int16_t;
typedef int int32_t;
#endif
/* assuming the system has a "long long" */
#ifndef _HAVE_UINT64_T
#define _HAVE_UINT64_T
typedef unsigned long long uint64_t;
typedef long long int64_t;
#endif
#else
#define _STDINT_NO_INT32_T
#endif
#else
#define _STDINT_NO_INT8_T
#define _STDINT_NO_INT32_T
#endif
#endif
/*
* quote from SunOS-5.8 sys/inttypes.h:
* Use at your own risk. As of February 1996, the committee is squarely
* behind the fixed sized types; the "least" and "fast" types are still being
* discussed. The probability that the "fast" types may be removed before
* the standard is finalized is high enough that they are not currently
* implemented.
*/
#if defined _STDINT_NEED_INT_LEAST_T
typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
typedef int32_t int_least32_t;
#ifdef _HAVE_UINT64_T
typedef int64_t int_least64_t;
#endif
typedef uint8_t uint_least8_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_least32_t;
#ifdef _HAVE_UINT64_T
typedef uint64_t uint_least64_t;
#endif
/* least types */
#endif
#if defined _STDINT_NEED_INT_FAST_T
typedef int8_t int_fast8_t;
typedef int int_fast16_t;
typedef int32_t int_fast32_t;
#ifdef _HAVE_UINT64_T
typedef int64_t int_fast64_t;
#endif
typedef uint8_t uint_fast8_t;
typedef unsigned uint_fast16_t;
typedef uint32_t uint_fast32_t;
#ifdef _HAVE_UINT64_T
typedef uint64_t uint_fast64_t;
#endif
/* fast types */
#endif
#ifdef _STDINT_NEED_INTMAX_T
#ifdef _HAVE_UINT64_T
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
#else
typedef long intmax_t;
typedef unsigned long uintmax_t;
#endif
#endif
#ifdef _STDINT_NEED_INTPTR_T
#ifndef __intptr_t_defined
#define __intptr_t_defined
/* we encourage using "long" to store pointer values, never use "int" ! */
#if _STDINT_LONG_MODEL+0 == 242 || _STDINT_LONG_MODEL+0 == 484
typedef unsigned int uintptr_t;
typedef int intptr_t;
#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL+0 == 444
typedef unsigned long uintptr_t;
typedef long intptr_t;
#elif _STDINT_LONG_MODEL+0 == 448 && defined _HAVE_UINT64_T
typedef uint64_t uintptr_t;
typedef int64_t intptr_t;
#else /* matches typical system types ILP32 and LP64 - but not IP16 or LLP64 */
typedef unsigned long uintptr_t;
typedef long intptr_t;
#endif
#endif
#endif
/* shortcircuit*/
#endif
/* once */
#endif
#endif

View File

@ -1,206 +0,0 @@
/* sha2.h
The sha2 family of hash functions.
Copyright (C) 2001, 2012 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_SHA2_H_INCLUDED
#define NETTLE_SHA2_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define sha224_init nettle_sha224_init
#define sha224_digest nettle_sha224_digest
#define sha256_init nettle_sha256_init
#define sha256_update nettle_sha256_update
#define sha256_digest nettle_sha256_digest
#define sha384_init nettle_sha384_init
#define sha384_digest nettle_sha384_digest
#define sha512_init nettle_sha512_init
#define sha512_update nettle_sha512_update
#define sha512_digest nettle_sha512_digest
#define sha512_224_init nettle_sha512_224_init
#define sha512_224_digest nettle_sha512_224_digest
#define sha512_256_init nettle_sha512_256_init
#define sha512_256_digest nettle_sha512_256_digest
/* For backwards compatibility */
#define SHA224_DATA_SIZE SHA256_BLOCK_SIZE
#define SHA256_DATA_SIZE SHA256_BLOCK_SIZE
#define SHA512_DATA_SIZE SHA512_BLOCK_SIZE
#define SHA384_DATA_SIZE SHA512_BLOCK_SIZE
/* SHA256 */
#define SHA256_DIGEST_SIZE 32
#define SHA256_BLOCK_SIZE 64
/* Digest is kept internally as 8 32-bit words. */
#define _SHA256_DIGEST_LENGTH 8
struct sha256_ctx
{
uint32_t state[_SHA256_DIGEST_LENGTH]; /* State variables */
uint64_t count; /* 64-bit block count */
uint8_t block[SHA256_BLOCK_SIZE]; /* SHA256 data buffer */
unsigned int index; /* index into buffer */
};
void
sha256_init(struct sha256_ctx *ctx);
void
sha256_update(struct sha256_ctx *ctx,
size_t length,
const uint8_t *data);
void
sha256_digest(struct sha256_ctx *ctx,
size_t length,
uint8_t *digest);
/* Internal compression function. STATE points to 8 uint32_t words,
DATA points to 64 bytes of input data, possibly unaligned, and K
points to the table of constants. */
void
_nettle_sha256_compress(uint32_t *state, const uint8_t *data, const uint32_t *k);
/* SHA224, a truncated SHA256 with different initial state. */
#define SHA224_DIGEST_SIZE 28
#define SHA224_BLOCK_SIZE SHA256_BLOCK_SIZE
#define sha224_ctx sha256_ctx
void
sha224_init(struct sha256_ctx *ctx);
#define sha224_update nettle_sha256_update
void
sha224_digest(struct sha256_ctx *ctx,
size_t length,
uint8_t *digest);
/* SHA512 */
#define SHA512_DIGEST_SIZE 64
#define SHA512_BLOCK_SIZE 128
/* Digest is kept internally as 8 64-bit words. */
#define _SHA512_DIGEST_LENGTH 8
struct sha512_ctx
{
uint64_t state[_SHA512_DIGEST_LENGTH]; /* State variables */
uint64_t count_low, count_high; /* 128-bit block count */
uint8_t block[SHA512_BLOCK_SIZE]; /* SHA512 data buffer */
unsigned int index; /* index into buffer */
};
void
sha512_init(struct sha512_ctx *ctx);
void
sha512_update(struct sha512_ctx *ctx,
size_t length,
const uint8_t *data);
void
sha512_digest(struct sha512_ctx *ctx,
size_t length,
uint8_t *digest);
/* Internal compression function. STATE points to 8 uint64_t words,
DATA points to 128 bytes of input data, possibly unaligned, and K
points to the table of constants. */
void
_nettle_sha512_compress(uint64_t *state, const uint8_t *data, const uint64_t *k);
/* SHA384, a truncated SHA512 with different initial state. */
#define SHA384_DIGEST_SIZE 48
#define SHA384_BLOCK_SIZE SHA512_BLOCK_SIZE
#define sha384_ctx sha512_ctx
void
sha384_init(struct sha512_ctx *ctx);
#define sha384_update nettle_sha512_update
void
sha384_digest(struct sha512_ctx *ctx,
size_t length,
uint8_t *digest);
/* SHA512_224 and SHA512_256, two truncated versions of SHA512
with different initial states. */
#define SHA512_224_DIGEST_SIZE 28
#define SHA512_224_BLOCK_SIZE SHA512_BLOCK_SIZE
#define sha512_224_ctx sha512_ctx
void
sha512_224_init(struct sha512_224_ctx *ctx);
#define sha512_224_update nettle_sha512_update
void
sha512_224_digest(struct sha512_224_ctx *ctx,
size_t length,
uint8_t *digest);
#define SHA512_256_DIGEST_SIZE 32
#define SHA512_256_BLOCK_SIZE SHA512_BLOCK_SIZE
#define sha512_256_ctx sha512_ctx
void
sha512_256_init(struct sha512_256_ctx *ctx);
#define sha512_256_update nettle_sha512_update
void
sha512_256_digest(struct sha512_256_ctx *ctx,
size_t length,
uint8_t *digest);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_SHA2_H_INCLUDED */

Binary file not shown.

View File

@ -1,401 +0,0 @@
EXPORTS
_nettle_cnd_copy @1
_nettle_cnd_swap @2
_nettle_curve25519 @3 DATA
_nettle_curve25519_eh_to_x @4
_nettle_dsa_hash @5
_nettle_ecc_a_to_j @6
_nettle_ecc_add_eh @7
_nettle_ecc_add_ehh @8
_nettle_ecc_add_jja @9
_nettle_ecc_add_jjj @10
_nettle_ecc_dup_eh @11
_nettle_ecc_dup_jj @12
_nettle_ecc_eh_to_a @13
_nettle_ecc_hash @14
_nettle_ecc_j_to_a @15
_nettle_ecc_mod @16
_nettle_ecc_mod_add @17
_nettle_ecc_mod_addmul_1 @18
_nettle_ecc_mod_inv @19
_nettle_ecc_mod_mul @20
_nettle_ecc_mod_mul_1 @21
_nettle_ecc_mod_random @22
_nettle_ecc_mod_sqr @23
_nettle_ecc_mod_sub @24
_nettle_ecc_mod_submul_1 @25
_nettle_ecc_mul_a @26
_nettle_ecc_mul_a_eh @27
_nettle_ecc_mul_g @28
_nettle_ecc_mul_g_eh @29
_nettle_ecc_pm1_redc @30
_nettle_ecc_pp1_redc @31
_nettle_eddsa_compress @32
_nettle_eddsa_compress_itch @33
_nettle_eddsa_decompress @34
_nettle_eddsa_decompress_itch @35
_nettle_eddsa_expand_key @36
_nettle_eddsa_hash @37
_nettle_eddsa_public_key @38
_nettle_eddsa_public_key_itch @39
_nettle_eddsa_sign @40
_nettle_eddsa_sign_itch @41
_nettle_eddsa_verify @42
_nettle_eddsa_verify_itch @43
_nettle_generate_pocklington_prime @44
_nettle_gmp_alloc @45
_nettle_gmp_alloc_limbs @46
_nettle_gmp_free @47
_nettle_gmp_free_limbs @48
_nettle_mpn_get_base256_le @49
_nettle_mpn_set_base256 @50
_nettle_mpn_set_base256_le @51
_nettle_mpz_limbs_cmp @52
_nettle_mpz_limbs_copy @53
_nettle_mpz_limbs_read_n @54
_nettle_mpz_set_n @55
_nettle_pkcs1_signature_prefix @56
_nettle_rsa_blind @57
_nettle_rsa_check_size @58
_nettle_rsa_unblind @59
_nettle_rsa_verify @60
_nettle_rsa_verify_recover @61
_nettle_sec_add_1 @62
_nettle_sec_sub_1 @63
_nettle_sec_tabselect @64
mp_bits_per_limb @65 DATA
mp_get_memory_functions @66
mp_set_memory_functions @67
mpn_add @68
mpn_add_1 @69
mpn_add_n @70
mpn_addmul_1 @71
mpn_cmp @72
mpn_com @73
mpn_copyd @74
mpn_copyi @75
mpn_get_str @76
mpn_invert_3by2 @77
mpn_lshift @78
mpn_mul @79
mpn_mul_1 @80
mpn_mul_n @81
mpn_neg @82
mpn_perfect_square_p @83
mpn_popcount @84
mpn_rshift @85
mpn_scan0 @86
mpn_scan1 @87
mpn_set_str @88
mpn_sqr @89
mpn_sqrtrem @90
mpn_sub @91
mpn_sub_1 @92
mpn_sub_n @93
mpn_submul_1 @94
mpn_zero @95
mpn_zero_p @96
mpz_abs @97
mpz_add @98
mpz_add_ui @99
mpz_addmul @100
mpz_addmul_ui @101
mpz_and @102
mpz_bin_uiui @103
mpz_cdiv_q @104
mpz_cdiv_q_2exp @105
mpz_cdiv_q_ui @106
mpz_cdiv_qr @107
mpz_cdiv_qr_ui @108
mpz_cdiv_r @109
mpz_cdiv_r_2exp @110
mpz_cdiv_r_ui @111
mpz_cdiv_ui @112
mpz_clear @113
mpz_clrbit @114
mpz_cmp @115
mpz_cmp_d @116
mpz_cmp_si @117
mpz_cmp_ui @118
mpz_cmpabs @119
mpz_cmpabs_d @120
mpz_cmpabs_ui @121
mpz_com @122
mpz_combit @123
mpz_congruent_p @124
mpz_divexact @125
mpz_divexact_ui @126
mpz_divisible_p @127
mpz_divisible_ui_p @128
mpz_export @129
mpz_fac_ui @130
mpz_fdiv_q @131
mpz_fdiv_q_2exp @132
mpz_fdiv_q_ui @133
mpz_fdiv_qr @134
mpz_fdiv_qr_ui @135
mpz_fdiv_r @136
mpz_fdiv_r_2exp @137
mpz_fdiv_r_ui @138
mpz_fdiv_ui @139
mpz_fits_slong_p @140
mpz_fits_ulong_p @141
mpz_gcd @142
mpz_gcd_ui @143
mpz_gcdext @144
mpz_get_d @145
mpz_get_si @146
mpz_get_str @147
mpz_get_ui @148
mpz_getlimbn @149
mpz_hamdist @150
mpz_import @151
mpz_init @152
mpz_init2 @153
mpz_init_set @154
mpz_init_set_d @155
mpz_init_set_si @156
mpz_init_set_str @157
mpz_init_set_ui @158
mpz_invert @159
mpz_ior @160
mpz_lcm @161
mpz_lcm_ui @162
mpz_limbs_finish @163
mpz_limbs_modify @164
mpz_limbs_read @165
mpz_limbs_write @166
mpz_mod @167
mpz_mod_ui @168
mpz_mul @169
mpz_mul_2exp @170
mpz_mul_si @171
mpz_mul_ui @172
mpz_neg @173
mpz_out_str @174
mpz_perfect_square_p @175
mpz_popcount @176
mpz_pow_ui @177
mpz_powm @178
mpz_powm_ui @179
mpz_probab_prime_p @180
mpz_realloc2 @181
mpz_roinit_n @182
mpz_root @183
mpz_rootrem @184
mpz_scan0 @185
mpz_scan1 @186
mpz_set @187
mpz_set_d @188
mpz_set_si @189
mpz_set_str @190
mpz_set_ui @191
mpz_setbit @192
mpz_sgn @193
mpz_size @194
mpz_sizeinbase @195
mpz_sqrt @196
mpz_sqrtrem @197
mpz_sub @198
mpz_sub_ui @199
mpz_submul @200
mpz_submul_ui @201
mpz_swap @202
mpz_tdiv_q @203
mpz_tdiv_q_2exp @204
mpz_tdiv_q_ui @205
mpz_tdiv_qr @206
mpz_tdiv_qr_ui @207
mpz_tdiv_r @208
mpz_tdiv_r_2exp @209
mpz_tdiv_r_ui @210
mpz_tdiv_ui @211
mpz_tstbit @212
mpz_ui_pow_ui @213
mpz_ui_sub @214
mpz_xor @215
nettle_asn1_der_decode_bitstring @216
nettle_asn1_der_decode_bitstring_last @217
nettle_asn1_der_decode_constructed @218
nettle_asn1_der_decode_constructed_last @219
nettle_asn1_der_get_bignum @220
nettle_asn1_der_get_uint32 @221
nettle_asn1_der_iterator_first @222
nettle_asn1_der_iterator_next @223
nettle_curve25519_mul @224
nettle_curve25519_mul_g @225
nettle_dsa_compat_generate_keypair @226
nettle_dsa_generate_keypair @227
nettle_dsa_generate_params @228
nettle_dsa_keypair_from_sexp_alist @229
nettle_dsa_keypair_to_sexp @230
nettle_dsa_openssl_private_key_from_der_iterator @231
nettle_dsa_params_clear @232
nettle_dsa_params_from_der_iterator @233
nettle_dsa_params_init @234
nettle_dsa_private_key_clear @235
nettle_dsa_private_key_init @236
nettle_dsa_public_key_clear @237
nettle_dsa_public_key_from_der_iterator @238
nettle_dsa_public_key_init @239
nettle_dsa_sha1_keypair_from_sexp @240
nettle_dsa_sha1_sign @241
nettle_dsa_sha1_sign_digest @242
nettle_dsa_sha1_verify @243
nettle_dsa_sha1_verify_digest @244
nettle_dsa_sha256_keypair_from_sexp @245
nettle_dsa_sha256_sign @246
nettle_dsa_sha256_sign_digest @247
nettle_dsa_sha256_verify @248
nettle_dsa_sha256_verify_digest @249
nettle_dsa_sign @250
nettle_dsa_signature_clear @251
nettle_dsa_signature_from_sexp @252
nettle_dsa_signature_init @253
nettle_dsa_verify @254
nettle_ecc_192_modp @255
nettle_ecc_25519_modp @256
nettle_ecc_256_redc @257
nettle_ecc_384_modp @258
nettle_ecc_bit_size @259
nettle_ecc_ecdsa_sign @260
nettle_ecc_ecdsa_sign_itch @261
nettle_ecc_ecdsa_verify @262
nettle_ecc_ecdsa_verify_itch @263
nettle_ecc_point_clear @264
nettle_ecc_point_get @265
nettle_ecc_point_init @266
nettle_ecc_point_mul @267
nettle_ecc_point_mul_g @268
nettle_ecc_point_set @269
nettle_ecc_scalar_clear @270
nettle_ecc_scalar_get @271
nettle_ecc_scalar_init @272
nettle_ecc_scalar_random @273
nettle_ecc_scalar_set @274
nettle_ecc_size @275
nettle_ecc_size_a @276
nettle_ecc_size_j @277
nettle_ecdsa_generate_keypair @278
nettle_ecdsa_sign @279
nettle_ecdsa_verify @280
nettle_ed25519_sha512_public_key @281
nettle_ed25519_sha512_sign @282
nettle_ed25519_sha512_verify @283
nettle_get_secp_192r1 @284
nettle_get_secp_224r1 @285
nettle_get_secp_256r1 @286
nettle_get_secp_384r1 @287
nettle_get_secp_521r1 @288
nettle_mpz_get_str_256 @289
nettle_mpz_init_set_str_256_s @290
nettle_mpz_init_set_str_256_u @291
nettle_mpz_random @292
nettle_mpz_random_size @293
nettle_mpz_set_sexp @294
nettle_mpz_set_str_256_s @295
nettle_mpz_set_str_256_u @296
nettle_mpz_sizeinbase_256_s @297
nettle_mpz_sizeinbase_256_u @298
nettle_openssl_provate_key_from_der @299
nettle_pgp_armor @300
nettle_pgp_crc24 @301
nettle_pgp_put_header @302
nettle_pgp_put_header_length @303
nettle_pgp_put_length @304
nettle_pgp_put_mpi @305
nettle_pgp_put_public_rsa_key @306
nettle_pgp_put_rsa_sha1_signature @307
nettle_pgp_put_string @308
nettle_pgp_put_sub_packet @309
nettle_pgp_put_uint16 @310
nettle_pgp_put_uint32 @311
nettle_pgp_put_userid @312
nettle_pgp_sub_packet_end @313
nettle_pgp_sub_packet_start @314
nettle_pkcs1_decrypt @315
nettle_pkcs1_encrypt @316
nettle_pkcs1_rsa_digest_encode @317
nettle_pkcs1_rsa_md5_encode @318
nettle_pkcs1_rsa_md5_encode_digest @319
nettle_pkcs1_rsa_sha1_encode @320
nettle_pkcs1_rsa_sha1_encode_digest @321
nettle_pkcs1_rsa_sha256_encode @322
nettle_pkcs1_rsa_sha256_encode_digest @323
nettle_pkcs1_rsa_sha512_encode @324
nettle_pkcs1_rsa_sha512_encode_digest @325
nettle_pss_encode_mgf1 @326
nettle_pss_mgf1 @327
nettle_pss_verify_mgf1 @328
nettle_random_prime @329
nettle_rsa_compute_root @330
nettle_rsa_compute_root_tr @331
nettle_rsa_decrypt @332
nettle_rsa_decrypt_tr @333
nettle_rsa_encrypt @334
nettle_rsa_generate_keypair @335
nettle_rsa_keypair_from_der @336
nettle_rsa_keypair_from_sexp @337
nettle_rsa_keypair_from_sexp_alist @338
nettle_rsa_keypair_to_openpgp @339
nettle_rsa_keypair_to_sexp @340
nettle_rsa_md5_sign @341
nettle_rsa_md5_sign_digest @342
nettle_rsa_md5_sign_digest_tr @343
nettle_rsa_md5_sign_tr @344
nettle_rsa_md5_verify @345
nettle_rsa_md5_verify_digest @346
nettle_rsa_pkcs1_sign @347
nettle_rsa_pkcs1_sign_tr @348
nettle_rsa_pkcs1_verify @349
nettle_rsa_private_key_clear @350
nettle_rsa_private_key_from_der_iterator @351
nettle_rsa_private_key_init @352
nettle_rsa_private_key_prepare @353
nettle_rsa_pss_sha256_sign_digest_tr @354
nettle_rsa_pss_sha256_verify_digest @355
nettle_rsa_pss_sha384_sign_digest_tr @356
nettle_rsa_pss_sha384_verify_digest @357
nettle_rsa_pss_sha512_sign_digest_tr @358
nettle_rsa_pss_sha512_verify_digest @359
nettle_rsa_public_key_clear @360
nettle_rsa_public_key_from_der_iterator @361
nettle_rsa_public_key_init @362
nettle_rsa_public_key_prepare @363
nettle_rsa_sha1_sign @364
nettle_rsa_sha1_sign_digest @365
nettle_rsa_sha1_sign_digest_tr @366
nettle_rsa_sha1_sign_tr @367
nettle_rsa_sha1_verify @368
nettle_rsa_sha1_verify_digest @369
nettle_rsa_sha256_sign @370
nettle_rsa_sha256_sign_digest @371
nettle_rsa_sha256_sign_digest_tr @372
nettle_rsa_sha256_sign_tr @373
nettle_rsa_sha256_verify @374
nettle_rsa_sha256_verify_digest @375
nettle_rsa_sha512_sign @376
nettle_rsa_sha512_sign_digest @377
nettle_rsa_sha512_sign_digest_tr @378
nettle_rsa_sha512_sign_tr @379
nettle_rsa_sha512_verify @380
nettle_rsa_sha512_verify_digest @381
nettle_secp_192r1 @382 DATA
nettle_secp_224r1 @383 DATA
nettle_secp_256r1 @384 DATA
nettle_secp_384r1 @385 DATA
nettle_secp_521r1 @386 DATA
nettle_sexp_format @387
nettle_sexp_iterator_assoc @388
nettle_sexp_iterator_check_type @389
nettle_sexp_iterator_check_types @390
nettle_sexp_iterator_enter_list @391
nettle_sexp_iterator_exit_list @392
nettle_sexp_iterator_first @393
nettle_sexp_iterator_get_uint32 @394
nettle_sexp_iterator_next @395
nettle_sexp_iterator_subexpr @396
nettle_sexp_transport_format @397
nettle_sexp_transport_iterator_first @398
nettle_sexp_transport_vformat @399
nettle_sexp_vformat @400

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,424 +0,0 @@
EXPORTS
_nettle_aes_decrypt @1
_nettle_aes_decrypt_aesni @2
_nettle_aes_decrypt_x86_64 @3
_nettle_aes_encrypt @4
_nettle_aes_encrypt_aesni @5
_nettle_aes_encrypt_table @6 DATA
_nettle_aes_encrypt_x86_64 @7
_nettle_aes_invert @8
_nettle_aes_set_key @9
_nettle_camellia_absorb @10
_nettle_camellia_crypt @11
_nettle_camellia_invert_key @12
_nettle_camellia_table @13 DATA
_nettle_chacha_core @14
_nettle_cpuid @15
_nettle_gcm_hash8 @16
_nettle_md5_compress @17
_nettle_memxor_sse2 @18
_nettle_memxor_x86_64 @19
_nettle_poly1305_block @20
_nettle_ripemd160_compress @21
_nettle_salsa20_core @22
_nettle_sha1_compress @23
_nettle_sha256_compress @24
_nettle_sha3_pad @25
_nettle_sha3_update @26
_nettle_sha512_compress @27
_nettle_umac_l2 @28
_nettle_umac_l2_final @29
_nettle_umac_l2_init @30
_nettle_umac_l3 @31
_nettle_umac_l3_init @32
_nettle_umac_nh @33
_nettle_umac_nh_n @34
_nettle_umac_poly128 @35
_nettle_umac_poly64 @36
_nettle_umac_set_key @37
_nettle_write_be32 @38
_nettle_write_le32 @39
_nettle_write_le64 @40
nettle_MD5Final @41
nettle_MD5Init @42
nettle_MD5Update @43
nettle_aeads @44 DATA
nettle_aes128 @45 DATA
nettle_aes128_decrypt @46
nettle_aes128_encrypt @47
nettle_aes128_invert_key @48
nettle_aes128_set_decrypt_key @49
nettle_aes128_set_encrypt_key @50
nettle_aes192 @51 DATA
nettle_aes192_decrypt @52
nettle_aes192_encrypt @53
nettle_aes192_invert_key @54
nettle_aes192_set_decrypt_key @55
nettle_aes192_set_encrypt_key @56
nettle_aes256 @57 DATA
nettle_aes256_decrypt @58
nettle_aes256_encrypt @59
nettle_aes256_invert_key @60
nettle_aes256_set_decrypt_key @61
nettle_aes256_set_encrypt_key @62
nettle_aes_decrypt @63
nettle_aes_encrypt @64
nettle_aes_invert_key @65
nettle_aes_set_decrypt_key @66
nettle_aes_set_encrypt_key @67
nettle_arcfour128_set_key @68
nettle_arcfour_crypt @69
nettle_arcfour_set_key @70
nettle_arctwo128 @71 DATA
nettle_arctwo128_set_key @72
nettle_arctwo128_set_key_gutmann @73
nettle_arctwo40 @74 DATA
nettle_arctwo40_set_key @75
nettle_arctwo64 @76 DATA
nettle_arctwo64_set_key @77
nettle_arctwo_decrypt @78
nettle_arctwo_encrypt @79
nettle_arctwo_gutmann128 @80 DATA
nettle_arctwo_set_key @81
nettle_arctwo_set_key_ekb @82
nettle_arctwo_set_key_gutmann @83
nettle_armors @84 DATA
nettle_base16 @85 DATA
nettle_base16_decode_final @86
nettle_base16_decode_init @87
nettle_base16_decode_single @88
nettle_base16_decode_update @89
nettle_base16_encode_single @90
nettle_base16_encode_update @91
nettle_base64 @92 DATA
nettle_base64_decode_final @93
nettle_base64_decode_init @94
nettle_base64_decode_single @95
nettle_base64_decode_update @96
nettle_base64_encode_final @97
nettle_base64_encode_group @98
nettle_base64_encode_init @99
nettle_base64_encode_raw @100
nettle_base64_encode_single @101
nettle_base64_encode_update @102
nettle_base64url @103 DATA
nettle_base64url_decode_init @104
nettle_base64url_encode_init @105
nettle_blowfish128_set_key @106
nettle_blowfish_decrypt @107
nettle_blowfish_encrypt @108
nettle_blowfish_set_key @109
nettle_buffer_clear @110
nettle_buffer_copy @111
nettle_buffer_grow @112
nettle_buffer_init @113
nettle_buffer_init_realloc @114
nettle_buffer_init_size @115
nettle_buffer_reset @116
nettle_buffer_space @117
nettle_buffer_write @118
nettle_camellia128 @119 DATA
nettle_camellia128_crypt @120
nettle_camellia128_invert_key @121
nettle_camellia128_set_encrypt_key @122
nettle_camellia192 @123 DATA
nettle_camellia192_set_decrypt_key @124
nettle_camellia192_set_encrypt_key @125
nettle_camellia256 @126 DATA
nettle_camellia256_crypt @127
nettle_camellia256_invert_key @128
nettle_camellia256_set_decrypt_key @129
nettle_camellia256_set_encrypt_key @130
nettle_camellia_set_decrypt_key @131
nettle_cast128 @132 DATA
nettle_cast128_decrypt @133
nettle_cast128_encrypt @134
nettle_cast128_set_key @135
nettle_cast5_set_key @136
nettle_cbc_decrypt @137
nettle_cbc_encrypt @138
nettle_ccm_aes128_decrypt @139
nettle_ccm_aes128_decrypt_message @140
nettle_ccm_aes128_digest @141
nettle_ccm_aes128_encrypt @142
nettle_ccm_aes128_encrypt_message @143
nettle_ccm_aes128_set_key @144
nettle_ccm_aes128_set_nonce @145
nettle_ccm_aes128_update @146
nettle_ccm_aes192_decrypt @147
nettle_ccm_aes192_decrypt_message @148
nettle_ccm_aes192_digest @149
nettle_ccm_aes192_encrypt @150
nettle_ccm_aes192_encrypt_message @151
nettle_ccm_aes192_set_key @152
nettle_ccm_aes192_set_nonce @153
nettle_ccm_aes192_update @154
nettle_ccm_aes256_decrypt @155
nettle_ccm_aes256_decrypt_message @156
nettle_ccm_aes256_digest @157
nettle_ccm_aes256_encrypt @158
nettle_ccm_aes256_encrypt_message @159
nettle_ccm_aes256_set_key @160
nettle_ccm_aes256_set_nonce @161
nettle_ccm_aes256_update @162
nettle_ccm_decrypt @163
nettle_ccm_decrypt_message @164
nettle_ccm_digest @165
nettle_ccm_encrypt @166
nettle_ccm_encrypt_message @167
nettle_ccm_set_nonce @168
nettle_ccm_update @169
nettle_cfb_decrypt @170
nettle_cfb_encrypt @171
nettle_chacha_crypt @172
nettle_chacha_poly1305 @173 DATA
nettle_chacha_poly1305_decrypt @174
nettle_chacha_poly1305_digest @175
nettle_chacha_poly1305_encrypt @176
nettle_chacha_poly1305_set_key @177
nettle_chacha_poly1305_set_nonce @178
nettle_chacha_poly1305_update @179
nettle_chacha_set_key @180
nettle_chacha_set_nonce @181
nettle_chacha_set_nonce96 @182
nettle_ciphers @183 DATA
nettle_ctr_crypt @184
nettle_des3_decrypt @185
nettle_des3_encrypt @186
nettle_des3_set_key @187
nettle_des_check_parity @188
nettle_des_decrypt @189
nettle_des_encrypt @190
nettle_des_fix_parity @191
nettle_des_set_key @192
nettle_eax_aes128 @193 DATA
nettle_eax_aes128_decrypt @194
nettle_eax_aes128_digest @195
nettle_eax_aes128_encrypt @196
nettle_eax_aes128_set_key @197
nettle_eax_aes128_set_nonce @198
nettle_eax_aes128_update @199
nettle_eax_decrypt @200
nettle_eax_digest @201
nettle_eax_encrypt @202
nettle_eax_set_key @203
nettle_eax_set_nonce @204
nettle_eax_update @205
nettle_gcm_aes128 @206 DATA
nettle_gcm_aes128_decrypt @207
nettle_gcm_aes128_digest @208
nettle_gcm_aes128_encrypt @209
nettle_gcm_aes128_set_iv @210
nettle_gcm_aes128_set_key @211
nettle_gcm_aes128_update @212
nettle_gcm_aes192 @213 DATA
nettle_gcm_aes192_decrypt @214
nettle_gcm_aes192_digest @215
nettle_gcm_aes192_encrypt @216
nettle_gcm_aes192_set_iv @217
nettle_gcm_aes192_set_key @218
nettle_gcm_aes192_update @219
nettle_gcm_aes256 @220 DATA
nettle_gcm_aes256_decrypt @221
nettle_gcm_aes256_digest @222
nettle_gcm_aes256_encrypt @223
nettle_gcm_aes256_set_iv @224
nettle_gcm_aes256_set_key @225
nettle_gcm_aes256_update @226
nettle_gcm_aes_decrypt @227
nettle_gcm_aes_digest @228
nettle_gcm_aes_encrypt @229
nettle_gcm_aes_set_iv @230
nettle_gcm_aes_set_key @231
nettle_gcm_aes_update @232
nettle_gcm_camellia128 @233 DATA
nettle_gcm_camellia128_decrypt @234
nettle_gcm_camellia128_digest @235
nettle_gcm_camellia128_encrypt @236
nettle_gcm_camellia128_set_iv @237
nettle_gcm_camellia128_set_key @238
nettle_gcm_camellia128_update @239
nettle_gcm_camellia256 @240 DATA
nettle_gcm_camellia256_decrypt @241
nettle_gcm_camellia256_digest @242
nettle_gcm_camellia256_encrypt @243
nettle_gcm_camellia256_set_iv @244
nettle_gcm_camellia256_set_key @245
nettle_gcm_camellia256_update @246
nettle_gcm_decrypt @247
nettle_gcm_digest @248
nettle_gcm_encrypt @249
nettle_gcm_set_iv @250
nettle_gcm_set_key @251
nettle_gcm_update @252
nettle_get_aeads @253
nettle_get_armors @254
nettle_get_ciphers @255
nettle_get_hashes @256
nettle_gosthash94 @257 DATA
nettle_gosthash94_digest @258
nettle_gosthash94_init @259
nettle_gosthash94_update @260
nettle_hashes @261 DATA
nettle_hkdf_expand @262
nettle_hkdf_extract @263
nettle_hmac_digest @264
nettle_hmac_md5_digest @265
nettle_hmac_md5_set_key @266
nettle_hmac_md5_update @267
nettle_hmac_ripemd160_digest @268
nettle_hmac_ripemd160_set_key @269
nettle_hmac_ripemd160_update @270
nettle_hmac_set_key @271
nettle_hmac_sha1_digest @272
nettle_hmac_sha1_set_key @273
nettle_hmac_sha1_update @274
nettle_hmac_sha224_digest @275
nettle_hmac_sha224_set_key @276
nettle_hmac_sha256_digest @277
nettle_hmac_sha256_set_key @278
nettle_hmac_sha256_update @279
nettle_hmac_sha384_digest @280
nettle_hmac_sha384_set_key @281
nettle_hmac_sha512_digest @282
nettle_hmac_sha512_set_key @283
nettle_hmac_sha512_update @284
nettle_hmac_update @285
nettle_knuth_lfib_get @286
nettle_knuth_lfib_get_array @287
nettle_knuth_lfib_init @288
nettle_knuth_lfib_random @289
nettle_lookup_hash @290
nettle_md2 @291 DATA
nettle_md2_digest @292
nettle_md2_init @293
nettle_md2_update @294
nettle_md4 @295 DATA
nettle_md4_digest @296
nettle_md4_init @297
nettle_md4_update @298
nettle_md5 @299 DATA
nettle_md5_digest @300
nettle_md5_init @301
nettle_md5_update @302
nettle_memeql_sec @303
nettle_memxor @304
nettle_memxor3 @305
nettle_openssl_des_cbc_cksum @306
nettle_openssl_des_cbc_encrypt @307
nettle_openssl_des_check_key @308 DATA
nettle_openssl_des_ecb3_encrypt @309
nettle_openssl_des_ecb_encrypt @310
nettle_openssl_des_ede3_cbc_encrypt @311
nettle_openssl_des_is_weak_key @312
nettle_openssl_des_key_sched @313
nettle_openssl_des_ncbc_encrypt @314
nettle_openssl_des_set_odd_parity @315
nettle_pbkdf2 @316
nettle_pbkdf2_hmac_sha1 @317
nettle_pbkdf2_hmac_sha256 @318
nettle_poly1305_aes_digest @319
nettle_poly1305_aes_set_key @320
nettle_poly1305_aes_set_nonce @321
nettle_poly1305_aes_update @322
nettle_poly1305_digest @323
nettle_poly1305_set_key @324
nettle_realloc @325
nettle_ripemd160 @326 DATA
nettle_ripemd160_digest @327
nettle_ripemd160_init @328
nettle_ripemd160_update @329
nettle_salsa20_128_set_key @330
nettle_salsa20_256_set_key @331
nettle_salsa20_crypt @332
nettle_salsa20_set_key @333
nettle_salsa20_set_nonce @334
nettle_salsa20r12_crypt @335
nettle_serpent128 @336 DATA
nettle_serpent128_set_key @337
nettle_serpent192 @338 DATA
nettle_serpent192_set_key @339
nettle_serpent256 @340 DATA
nettle_serpent256_set_key @341
nettle_serpent_decrypt @342
nettle_serpent_encrypt @343
nettle_serpent_set_key @344
nettle_sha1 @345 DATA
nettle_sha1_digest @346
nettle_sha1_init @347
nettle_sha1_update @348
nettle_sha224 @349 DATA
nettle_sha224_digest @350
nettle_sha224_init @351
nettle_sha256 @352 DATA
nettle_sha256_digest @353
nettle_sha256_init @354
nettle_sha256_update @355
nettle_sha384 @356 DATA
nettle_sha384_digest @357
nettle_sha384_init @358
nettle_sha3_224 @359 DATA
nettle_sha3_224_digest @360
nettle_sha3_224_init @361
nettle_sha3_224_update @362
nettle_sha3_256 @363 DATA
nettle_sha3_256_digest @364
nettle_sha3_256_init @365
nettle_sha3_256_update @366
nettle_sha3_384 @367 DATA
nettle_sha3_384_digest @368
nettle_sha3_384_init @369
nettle_sha3_384_update @370
nettle_sha3_512 @371 DATA
nettle_sha3_512_digest @372
nettle_sha3_512_init @373
nettle_sha3_512_update @374
nettle_sha3_permute @375
nettle_sha512 @376 DATA
nettle_sha512_224 @377 DATA
nettle_sha512_224_digest @378
nettle_sha512_224_init @379
nettle_sha512_256 @380 DATA
nettle_sha512_256_digest @381
nettle_sha512_256_init @382
nettle_sha512_digest @383
nettle_sha512_init @384
nettle_sha512_update @385
nettle_twofish128 @386 DATA
nettle_twofish128_set_key @387
nettle_twofish192 @388 DATA
nettle_twofish192_set_key @389
nettle_twofish256 @390 DATA
nettle_twofish256_set_key @391
nettle_twofish_decrypt @392
nettle_twofish_encrypt @393
nettle_twofish_set_key @394
nettle_umac128_digest @395
nettle_umac128_set_key @396
nettle_umac128_set_nonce @397
nettle_umac128_update @398
nettle_umac32_digest @399
nettle_umac32_set_key @400
nettle_umac32_set_nonce @401
nettle_umac32_update @402
nettle_umac64_digest @403
nettle_umac64_set_key @404
nettle_umac64_set_nonce @405
nettle_umac64_update @406
nettle_umac96_digest @407
nettle_umac96_set_key @408
nettle_umac96_set_nonce @409
nettle_umac96_update @410
nettle_version_major @411
nettle_version_minor @412
nettle_xrealloc @413
nettle_yarrow256_fast_reseed @414
nettle_yarrow256_init @415
nettle_yarrow256_is_seeded @416
nettle_yarrow256_needed_sources @417
nettle_yarrow256_random @418
nettle_yarrow256_seed @419
nettle_yarrow256_slow_reseed @420
nettle_yarrow256_update @421
nettle_yarrow_key_event_estimate @422
nettle_yarrow_key_event_init @423

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,177 +0,0 @@
/* aes.h
The aes/rijndael block cipher.
Copyright (C) 2001, 2013 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_AES_H_INCLUDED
#define NETTLE_AES_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define aes_set_encrypt_key nettle_aes_set_encrypt_key
#define aes_set_decrypt_key nettle_aes_set_decrypt_key
#define aes_invert_key nettle_aes_invert_key
#define aes_encrypt nettle_aes_encrypt
#define aes_decrypt nettle_aes_decrypt
#define aes128_set_encrypt_key nettle_aes128_set_encrypt_key
#define aes128_set_decrypt_key nettle_aes128_set_decrypt_key
#define aes128_invert_key nettle_aes128_invert_key
#define aes128_encrypt nettle_aes128_encrypt
#define aes128_decrypt nettle_aes128_decrypt
#define aes192_set_encrypt_key nettle_aes192_set_encrypt_key
#define aes192_set_decrypt_key nettle_aes192_set_decrypt_key
#define aes192_invert_key nettle_aes192_invert_key
#define aes192_encrypt nettle_aes192_encrypt
#define aes192_decrypt nettle_aes192_decrypt
#define aes256_set_encrypt_key nettle_aes256_set_encrypt_key
#define aes256_set_decrypt_key nettle_aes256_set_decrypt_key
#define aes256_invert_key nettle_aes256_invert_key
#define aes256_encrypt nettle_aes256_encrypt
#define aes256_decrypt nettle_aes256_decrypt
#define AES_BLOCK_SIZE 16
#define AES128_KEY_SIZE 16
#define AES192_KEY_SIZE 24
#define AES256_KEY_SIZE 32
#define _AES128_ROUNDS 10
#define _AES192_ROUNDS 12
#define _AES256_ROUNDS 14
/* Variable key size between 128 and 256 bits. But the only valid
* values are 16 (128 bits), 24 (192 bits) and 32 (256 bits). */
#define AES_MIN_KEY_SIZE AES128_KEY_SIZE
#define AES_MAX_KEY_SIZE AES256_KEY_SIZE
/* Older nettle-2.7 interface */
#define AES_KEY_SIZE 32
struct aes_ctx
{
unsigned rounds; /* number of rounds to use for our key size */
uint32_t keys[4*(_AES256_ROUNDS + 1)]; /* maximum size of key schedule */
};
void
aes_set_encrypt_key(struct aes_ctx *ctx,
size_t length, const uint8_t *key);
void
aes_set_decrypt_key(struct aes_ctx *ctx,
size_t length, const uint8_t *key);
void
aes_invert_key(struct aes_ctx *dst,
const struct aes_ctx *src);
void
aes_encrypt(const struct aes_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
void
aes_decrypt(const struct aes_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
struct aes128_ctx
{
uint32_t keys[4 * (_AES128_ROUNDS + 1)];
};
void
aes128_set_encrypt_key(struct aes128_ctx *ctx, const uint8_t *key);
void
aes128_set_decrypt_key(struct aes128_ctx *ctx, const uint8_t *key);
void
aes128_invert_key(struct aes128_ctx *dst,
const struct aes128_ctx *src);
void
aes128_encrypt(const struct aes128_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
void
aes128_decrypt(const struct aes128_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
struct aes192_ctx
{
uint32_t keys[4 * (_AES192_ROUNDS + 1)];
};
void
aes192_set_encrypt_key(struct aes192_ctx *ctx, const uint8_t *key);
void
aes192_set_decrypt_key(struct aes192_ctx *ctx, const uint8_t *key);
void
aes192_invert_key(struct aes192_ctx *dst,
const struct aes192_ctx *src);
void
aes192_encrypt(const struct aes192_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
void
aes192_decrypt(const struct aes192_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
struct aes256_ctx
{
uint32_t keys[4 * (_AES256_ROUNDS + 1)];
};
void
aes256_set_encrypt_key(struct aes256_ctx *ctx, const uint8_t *key);
void
aes256_set_decrypt_key(struct aes256_ctx *ctx, const uint8_t *key);
void
aes256_invert_key(struct aes256_ctx *dst,
const struct aes256_ctx *src);
void
aes256_encrypt(const struct aes256_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
void
aes256_decrypt(const struct aes256_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_AES_H_INCLUDED */

View File

@ -1,79 +0,0 @@
/* arcfour.h
The arcfour/rc4 stream cipher.
Copyright (C) 2001, 2014 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_ARCFOUR_H_INCLUDED
#define NETTLE_ARCFOUR_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define arcfour128_set_key nettle_arcfour128_set_key
#define arcfour_set_key nettle_arcfour_set_key
#define arcfour_crypt nettle_arcfour_crypt
/* Minimum and maximum keysizes, and a reasonable default. In
* octets.*/
#define ARCFOUR_MIN_KEY_SIZE 1
#define ARCFOUR_MAX_KEY_SIZE 256
#define ARCFOUR_KEY_SIZE 16
#define ARCFOUR128_KEY_SIZE 16
struct arcfour_ctx
{
uint8_t S[256];
uint8_t i;
uint8_t j;
};
void
arcfour_set_key(struct arcfour_ctx *ctx,
size_t length, const uint8_t *key);
void
arcfour128_set_key(struct arcfour_ctx *ctx, const uint8_t *key);
void
arcfour_crypt(struct arcfour_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_ARCFOUR_H_INCLUDED */

View File

@ -1,103 +0,0 @@
/* arctwo.h
The arctwo/rfc2268 block cipher.
Copyright (C) 2004 Simon Josefsson
Copyright (C) 2002, 2004, 2014 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_ARCTWO_H_INCLUDED
#define NETTLE_ARCTWO_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define arctwo_set_key nettle_arctwo_set_key
#define arctwo_set_key_ekb nettle_arctwo_set_key_ekb
#define arctwo_set_key_gutmann nettle_arctwo_set_key_gutmann
#define arctwo40_set_key nettle_arctwo40_set_key
#define arctwo64_set_key nettle_arctwo64_set_key
#define arctwo128_set_key nettle_arctwo128_set_key
#define arctwo128_set_key_gutmann nettle_arctwo128_set_key_gutmann
#define arctwo_encrypt nettle_arctwo_encrypt
#define arctwo_decrypt nettle_arctwo_decrypt
#define ARCTWO_BLOCK_SIZE 8
/* Variable key size from 1 byte to 128 bytes. */
#define ARCTWO_MIN_KEY_SIZE 1
#define ARCTWO_MAX_KEY_SIZE 128
#define ARCTWO_KEY_SIZE 8
struct arctwo_ctx
{
uint16_t S[64];
};
/* Key expansion function that takes the "effective key bits", 1-1024,
as an explicit argument. 0 means maximum key bits. */
void
arctwo_set_key_ekb (struct arctwo_ctx *ctx,
size_t length, const uint8_t * key, unsigned ekb);
/* Equvivalent to arctwo_set_key_ekb, with ekb = 8 * length */
void
arctwo_set_key (struct arctwo_ctx *ctx, size_t length, const uint8_t *key);
void
arctwo40_set_key (struct arctwo_ctx *ctx, const uint8_t *key);
void
arctwo64_set_key (struct arctwo_ctx *ctx, const uint8_t *key);
void
arctwo128_set_key (struct arctwo_ctx *ctx, const uint8_t *key);
/* Equvivalent to arctwo_set_key_ekb, with ekb = 1024 */
void
arctwo_set_key_gutmann (struct arctwo_ctx *ctx,
size_t length, const uint8_t *key);
void
arctwo128_set_key_gutmann (struct arctwo_ctx *ctx,
const uint8_t *key);
void
arctwo_encrypt (struct arctwo_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void
arctwo_decrypt (struct arctwo_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_ARCTWO_H_INCLUDED */

View File

@ -1,152 +0,0 @@
/* asn1.h
Limited support for ASN.1 DER decoding.
Copyright (C) 2005 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_ASN1_H_INCLUDED
#define NETTLE_ASN1_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define asn1_der_iterator_first nettle_asn1_der_iterator_first
#define asn1_der_iterator_next nettle_asn1_der_iterator_next
#define asn1_der_decode_constructed nettle_asn1_der_decode_constructed
#define asn1_der_decode_constructed_last nettle_asn1_der_decode_constructed_last
#define asn1_der_decode_bitstring nettle_asn1_der_decode_bitstring
#define asn1_der_decode_bitstring_last nettle_asn1_der_decode_bitstring_last
#define asn1_der_get_uint32 nettle_asn1_der_get_uint32
#define asn1_der_get_bignum nettle_asn1_der_get_bignum
/* enum asn1_type keeps the class number and the constructive in bits
13-14, and the constructive flag in bit 12. The remaining 14 bits
are the tag (although currently, only tags in the range 0-30 are
supported). */
enum
{
ASN1_TYPE_CONSTRUCTED = 1 << 12,
ASN1_CLASS_UNIVERSAL = 0,
ASN1_CLASS_APPLICATION = 1 << 13,
ASN1_CLASS_CONTEXT_SPECIFIC = 2 << 13,
ASN1_CLASS_PRIVATE = 3 << 13,
ASN1_CLASS_MASK = 3 << 13,
ASN1_CLASS_SHIFT = 13,
};
enum asn1_type
{
ASN1_BOOLEAN = 1,
ASN1_INTEGER = 2,
ASN1_BITSTRING = 3,
ASN1_OCTETSTRING = 4,
ASN1_NULL = 5,
ASN1_IDENTIFIER = 6,
ASN1_REAL = 9,
ASN1_ENUMERATED = 10,
ASN1_UTF8STRING = 12,
ASN1_SEQUENCE = 16 | ASN1_TYPE_CONSTRUCTED,
ASN1_SET = 17 | ASN1_TYPE_CONSTRUCTED,
ASN1_PRINTABLESTRING = 19,
ASN1_TELETEXSTRING = 20,
ASN1_IA5STRING = 22,
ASN1_UTC = 23,
ASN1_UNIVERSALSTRING = 28,
ASN1_BMPSTRING = 30,
};
enum asn1_iterator_result
{
ASN1_ITERATOR_ERROR,
ASN1_ITERATOR_PRIMITIVE,
ASN1_ITERATOR_CONSTRUCTED,
ASN1_ITERATOR_END,
};
/* Parsing DER objects. */
struct asn1_der_iterator
{
size_t buffer_length;
const uint8_t *buffer;
/* Next object to parse. */
size_t pos;
enum asn1_type type;
/* Pointer to the current object */
size_t length;
const uint8_t *data;
};
/* Initializes the iterator. */
enum asn1_iterator_result
asn1_der_iterator_first(struct asn1_der_iterator *iterator,
size_t length, const uint8_t *input);
enum asn1_iterator_result
asn1_der_iterator_next(struct asn1_der_iterator *iterator);
/* Starts parsing of a constructed object. */
enum asn1_iterator_result
asn1_der_decode_constructed(struct asn1_der_iterator *i,
struct asn1_der_iterator *contents);
/* For the common case that we have a sequence at the end of the
object. Checks that the current object is the final one, and then
reinitializes the iterator to parse its ontents. */
enum asn1_iterator_result
asn1_der_decode_constructed_last(struct asn1_der_iterator *i);
enum asn1_iterator_result
asn1_der_decode_bitstring(struct asn1_der_iterator *i,
struct asn1_der_iterator *contents);
enum asn1_iterator_result
asn1_der_decode_bitstring_last(struct asn1_der_iterator *i);
/* All these functions return 1 on success, 0 on failure */
int
asn1_der_get_uint32(struct asn1_der_iterator *i,
uint32_t *x);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_ASN1_H_INCLUDED */

View File

@ -1,110 +0,0 @@
/* base16.h
Hex encoding and decoding, following spki conventions (i.e.
allowing whitespace between digits).
Copyright (C) 2002 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_BASE16_H_INCLUDED
#define NETTLE_BASE16_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define base16_encode_single nettle_base16_encode_single
#define base16_encode_update nettle_base16_encode_update
#define base16_decode_init nettle_base16_decode_init
#define base16_decode_single nettle_base16_decode_single
#define base16_decode_update nettle_base16_decode_update
#define base16_decode_final nettle_base16_decode_final
/* Base16 encoding */
/* Maximum length of output for base16_encode_update. */
#define BASE16_ENCODE_LENGTH(length) ((length) * 2)
/* Encodes a single byte. Always stores two digits in dst[0] and dst[1]. */
void
base16_encode_single(char *dst,
uint8_t src);
/* Always stores BASE16_ENCODE_LENGTH(length) digits in dst. */
void
base16_encode_update(char *dst,
size_t length,
const uint8_t *src);
/* Base16 decoding */
/* Maximum length of output for base16_decode_update. */
/* We have at most 4 buffered bits, and a total of (length + 1) * 4 bits. */
#define BASE16_DECODE_LENGTH(length) (((length) + 1) / 2)
struct base16_decode_ctx
{
unsigned char word; /* Leftover bits */
unsigned char bits; /* Number buffered bits */
};
void
base16_decode_init(struct base16_decode_ctx *ctx);
/* Decodes a single byte. Returns amount of output (0 or 1), or -1 on
* errors. */
int
base16_decode_single(struct base16_decode_ctx *ctx,
uint8_t *dst,
char src);
/* Returns 1 on success, 0 on error. DST should point to an area of
* size at least BASE16_DECODE_LENGTH(length). The amount of data
* generated is returned in *DST_LENGTH. */
int
base16_decode_update(struct base16_decode_ctx *ctx,
size_t *dst_length,
uint8_t *dst,
size_t src_length,
const char *src);
/* Returns 1 on success. */
int
base16_decode_final(struct base16_decode_ctx *ctx);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_BASE16_H_INCLUDED */

View File

@ -1,172 +0,0 @@
/* base64.h
Base-64 encoding and decoding.
Copyright (C) 2002 Niels Möller, Dan Egnor
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_BASE64_H_INCLUDED
#define NETTLE_BASE64_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define base64_encode_init nettle_base64_encode_init
#define base64url_encode_init nettle_base64url_encode_init
#define base64_encode_single nettle_base64_encode_single
#define base64_encode_update nettle_base64_encode_update
#define base64_encode_final nettle_base64_encode_final
#define base64_encode_raw nettle_base64_encode_raw
#define base64_encode_group nettle_base64_encode_group
#define base64_decode_init nettle_base64_decode_init
#define base64url_decode_init nettle_base64url_decode_init
#define base64_decode_single nettle_base64_decode_single
#define base64_decode_update nettle_base64_decode_update
#define base64_decode_final nettle_base64_decode_final
#define BASE64_BINARY_BLOCK_SIZE 3
#define BASE64_TEXT_BLOCK_SIZE 4
/* Base64 encoding */
/* Maximum length of output for base64_encode_update. NOTE: Doesn't
* include any padding that base64_encode_final may add. */
/* We have at most 4 buffered bits, and a total of (4 + length * 8) bits. */
#define BASE64_ENCODE_LENGTH(length) (((length) * 8 + 4)/6)
/* Maximum length of output generated by base64_encode_final. */
#define BASE64_ENCODE_FINAL_LENGTH 3
/* Exact length of output generated by base64_encode_raw, including
* padding. */
#define BASE64_ENCODE_RAW_LENGTH(length) ((((length) + 2)/3)*4)
struct base64_encode_ctx
{
const char *alphabet; /* Alphabet to use for encoding */
unsigned short word; /* Leftover bits */
unsigned char bits; /* Number of bits, always 0, 2, or 4. */
};
/* Initialize encoding context for base-64 */
void
base64_encode_init(struct base64_encode_ctx *ctx);
/* Initialize encoding context for URL safe alphabet, RFC 4648. */
void
base64url_encode_init(struct base64_encode_ctx *ctx);
/* Encodes a single byte. Returns amount of output (always 1 or 2). */
size_t
base64_encode_single(struct base64_encode_ctx *ctx,
char *dst,
uint8_t src);
/* Returns the number of output characters. DST should point to an
* area of size at least BASE64_ENCODE_LENGTH(length). */
size_t
base64_encode_update(struct base64_encode_ctx *ctx,
char *dst,
size_t length,
const uint8_t *src);
/* DST should point to an area of size at least
* BASE64_ENCODE_FINAL_LENGTH */
size_t
base64_encode_final(struct base64_encode_ctx *ctx,
char *dst);
/* Lower level functions */
/* Encodes a string in one go, including any padding at the end.
* Generates exactly BASE64_ENCODE_RAW_LENGTH(length) bytes of output.
* Supports overlapped operation, if src <= dst. FIXME: Use of overlap
* is deprecated, if needed there should be a separate public fucntion
* to do that.*/
void
base64_encode_raw(char *dst, size_t length, const uint8_t *src);
void
base64_encode_group(char *dst, uint32_t group);
/* Base64 decoding */
/* Maximum length of output for base64_decode_update. */
/* We have at most 6 buffered bits, and a total of (length + 1) * 6 bits. */
#define BASE64_DECODE_LENGTH(length) ((((length) + 1) * 6) / 8)
struct base64_decode_ctx
{
const signed char *table; /* Decoding table */
unsigned short word; /* Leftover bits */
unsigned char bits; /* Number buffered bits */
/* Number of padding characters encountered */
unsigned char padding;
};
/* Initialize decoding context for base-64 */
void
base64_decode_init(struct base64_decode_ctx *ctx);
/* Initialize encoding context for URL safe alphabet, RFC 4648. */
void
base64url_decode_init(struct base64_decode_ctx *ctx);
/* Decodes a single byte. Returns amount of output (0 or 1), or -1 on
* errors. */
int
base64_decode_single(struct base64_decode_ctx *ctx,
uint8_t *dst,
char src);
/* Returns 1 on success, 0 on error. DST should point to an area of
* size at least BASE64_DECODE_LENGTH(length). The amount of data
* generated is returned in *DST_LENGTH. */
int
base64_decode_update(struct base64_decode_ctx *ctx,
size_t *dst_length,
uint8_t *dst,
size_t src_length,
const char *src);
/* Returns 1 on success. */
int
base64_decode_final(struct base64_decode_ctx *ctx);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_BASE64_H_INCLUDED */

View File

@ -1,140 +0,0 @@
/* bignum.h
Bignum operations that are missing from gmp.
Copyright (C) 2001 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_BIGNUM_H_INCLUDED
#define NETTLE_BIGNUM_H_INCLUDED
#include "nettle-meta.h"
#include "nettle-types.h"
/* For NETTLE_USE_MINI_GMP */
#include "version.h"
#if NETTLE_USE_MINI_GMP
# include "mini-gmp.h"
# define GMP_NUMB_MASK (~(mp_limb_t) 0)
/* Function missing in older gmp versions, and checked for with ifdef */
# define mpz_limbs_read mpz_limbs_read
/* Side-channel silent powm not available in mini-gmp. */
# define mpz_powm_sec mpz_powm
#else
# include <gmp.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Size needed for signed encoding, including extra sign byte if
* necessary. */
size_t
nettle_mpz_sizeinbase_256_s(const mpz_t x);
/* Size needed for unsigned encoding */
size_t
nettle_mpz_sizeinbase_256_u(const mpz_t x);
/* Writes an integer as length octets, using big endian byte order,
* and two's complement for negative numbers. */
void
nettle_mpz_get_str_256(size_t length, uint8_t *s, const mpz_t x);
/* Reads a big endian, two's complement, integer. */
void
nettle_mpz_set_str_256_s(mpz_t x,
size_t length, const uint8_t *s);
void
nettle_mpz_init_set_str_256_s(mpz_t x,
size_t length, const uint8_t *s);
/* Similar, but for unsigned format. These function don't interpret
* the most significant bit as the sign. */
void
nettle_mpz_set_str_256_u(mpz_t x,
size_t length, const uint8_t *s);
void
nettle_mpz_init_set_str_256_u(mpz_t x,
size_t length, const uint8_t *s);
/* Returns a uniformly distributed random number 0 <= x < 2^n */
void
nettle_mpz_random_size(mpz_t x,
void *ctx, nettle_random_func *random,
unsigned bits);
/* Returns a number x, almost uniformly random in the range
* 0 <= x < n. */
void
nettle_mpz_random(mpz_t x,
void *ctx, nettle_random_func *random,
const mpz_t n);
void
nettle_random_prime(mpz_t p, unsigned bits, int top_bits_set,
void *ctx, nettle_random_func *random,
void *progress_ctx, nettle_progress_func *progress);
void
_nettle_generate_pocklington_prime (mpz_t p, mpz_t r,
unsigned bits, int top_bits_set,
void *ctx, nettle_random_func *random,
const mpz_t p0,
const mpz_t q,
const mpz_t p0q);
/* sexp parsing */
struct sexp_iterator;
/* If LIMIT is non-zero, the number must be at most LIMIT bits.
* Implies sexp_iterator_next. */
int
nettle_mpz_set_sexp(mpz_t x, unsigned limit, struct sexp_iterator *i);
/* der parsing */
struct asn1_der_iterator;
int
nettle_asn1_der_get_bignum(struct asn1_der_iterator *iterator,
mpz_t x, unsigned max_bits);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_BIGNUM_H_INCLUDED */

View File

@ -1,89 +0,0 @@
/* blowfish.h
Blowfish block cipher.
Copyright (C) 2014 Niels Möller
Copyright (C) 1998, 2001 FSF, Ray Dassen, Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_BLOWFISH_H_INCLUDED
#define NETTLE_BLOWFISH_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define blowfish_set_key nettle_blowfish_set_key
#define blowfish128_set_key nettle_blowfish128_set_key
#define blowfish_encrypt nettle_blowfish_encrypt
#define blowfish_decrypt nettle_blowfish_decrypt
#define BLOWFISH_BLOCK_SIZE 8
/* Variable key size between 64 and 448 bits. */
#define BLOWFISH_MIN_KEY_SIZE 8
#define BLOWFISH_MAX_KEY_SIZE 56
/* Default to 128 bits */
#define BLOWFISH_KEY_SIZE 16
#define BLOWFISH128_KEY_SIZE 16
#define _BLOWFISH_ROUNDS 16
struct blowfish_ctx
{
uint32_t s[4][256];
uint32_t p[_BLOWFISH_ROUNDS+2];
};
/* Returns 0 for weak keys, otherwise 1. */
int
blowfish_set_key(struct blowfish_ctx *ctx,
size_t length, const uint8_t *key);
int
blowfish128_set_key(struct blowfish_ctx *ctx, const uint8_t *key);
void
blowfish_encrypt(const struct blowfish_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
void
blowfish_decrypt(const struct blowfish_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_BLOWFISH_H_INCLUDED */

View File

@ -1,106 +0,0 @@
/* buffer.h
A bare-bones string stream.
Copyright (C) 2002 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_BUFFER_H_INCLUDED
#define NETTLE_BUFFER_H_INCLUDED
#include "realloc.h"
#ifdef __cplusplus
extern "C" {
#endif
struct nettle_buffer
{
uint8_t *contents;
/* Allocated size */
size_t alloc;
void *realloc_ctx;
nettle_realloc_func *realloc;
/* Current size */
size_t size;
};
/* Initializes a buffer that uses plain realloc */
void
nettle_buffer_init(struct nettle_buffer *buffer);
void
nettle_buffer_init_realloc(struct nettle_buffer *buffer,
void *realloc_ctx,
nettle_realloc_func *realloc);
/* Initializes a buffer of fix size */
void
nettle_buffer_init_size(struct nettle_buffer *buffer,
size_t length, uint8_t *space);
void
nettle_buffer_clear(struct nettle_buffer *buffer);
/* Resets the buffer, without freeing the buffer space. */
void
nettle_buffer_reset(struct nettle_buffer *buffer);
int
nettle_buffer_grow(struct nettle_buffer *buffer,
size_t length);
#define NETTLE_BUFFER_PUTC(buffer, c) \
( (((buffer)->size < (buffer)->alloc) || nettle_buffer_grow((buffer), 1)) \
&& ((buffer)->contents[(buffer)->size++] = (c), 1) )
int
nettle_buffer_write(struct nettle_buffer *buffer,
size_t length, const uint8_t *data);
/* Like nettle_buffer_write, but instead of copying data to the
* buffer, it returns a pointer to the area where the caller can copy
* the data. The pointer is valid only until the next call that can
* reallocate the buffer. */
uint8_t *
nettle_buffer_space(struct nettle_buffer *buffer,
size_t length);
/* Copy the contents of SRC to the end of DST. */
int
nettle_buffer_copy(struct nettle_buffer *dst,
const struct nettle_buffer *src);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_BUFFER_H_INCLUDED */

View File

@ -1,143 +0,0 @@
/* camellia.h
Copyright (C) 2006,2007 NTT
(Nippon Telegraph and Telephone Corporation).
Copyright (C) 2010, 2013 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_CAMELLIA_H_INCLUDED
#define NETTLE_CAMELLIA_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define camellia128_set_encrypt_key nettle_camellia128_set_encrypt_key
#define camellia128_set_decrypt_key nettle_camellia_set_decrypt_key
#define camellia128_invert_key nettle_camellia128_invert_key
#define camellia128_crypt nettle_camellia128_crypt
#define camellia192_set_encrypt_key nettle_camellia192_set_encrypt_key
#define camellia192_set_decrypt_key nettle_camellia192_set_decrypt_key
#define camellia256_set_encrypt_key nettle_camellia256_set_encrypt_key
#define camellia256_set_decrypt_key nettle_camellia256_set_decrypt_key
#define camellia256_invert_key nettle_camellia256_invert_key
#define camellia256_crypt nettle_camellia256_crypt
#define CAMELLIA_BLOCK_SIZE 16
/* Valid key sizes are 128, 192 or 256 bits (16, 24 or 32 bytes) */
#define CAMELLIA128_KEY_SIZE 16
#define CAMELLIA192_KEY_SIZE 24
#define CAMELLIA256_KEY_SIZE 32
/* For 128-bit keys, there are 18 regular rounds, pre- and
post-whitening, and two FL and FLINV rounds, using a total of 26
subkeys, each of 64 bit. For 192- and 256-bit keys, there are 6
additional regular rounds and one additional FL and FLINV, using a
total of 34 subkeys. */
/* The clever combination of subkeys imply one of the pre- and
post-whitening keys is folded with the round keys, so that subkey
#1 and the last one (#25 or #33) is not used. The result is that we
have only 24 or 32 subkeys at the end of key setup. */
#define _CAMELLIA128_NKEYS 24
#define _CAMELLIA256_NKEYS 32
struct camellia128_ctx
{
uint64_t keys[_CAMELLIA128_NKEYS];
};
void
camellia128_set_encrypt_key(struct camellia128_ctx *ctx,
const uint8_t *key);
void
camellia128_set_decrypt_key(struct camellia128_ctx *ctx,
const uint8_t *key);
void
camellia128_invert_key(struct camellia128_ctx *dst,
const struct camellia128_ctx *src);
void
camellia128_crypt(const struct camellia128_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
struct camellia256_ctx
{
uint64_t keys[_CAMELLIA256_NKEYS];
};
void
camellia256_set_encrypt_key(struct camellia256_ctx *ctx,
const uint8_t *key);
void
camellia256_set_decrypt_key(struct camellia256_ctx *ctx,
const uint8_t *key);
void
camellia256_invert_key(struct camellia256_ctx *dst,
const struct camellia256_ctx *src);
void
camellia256_crypt(const struct camellia256_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
/* camellia192 is the same as camellia256, except for the key
schedule. */
/* Slightly ugly with a #define on a struct tag, since it might cause
surprises if also used as a name of a variable. */
#define camellia192_ctx camellia256_ctx
void
camellia192_set_encrypt_key(struct camellia256_ctx *ctx,
const uint8_t *key);
void
camellia192_set_decrypt_key(struct camellia256_ctx *ctx,
const uint8_t *key);
#define camellia192_invert_key camellia256_invert_key
#define camellia192_crypt camellia256_crypt
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_CAMELLIA_H_INCLUDED */

View File

@ -1,86 +0,0 @@
/* cast128.h
The CAST-128 block cipher.
Copyright (C) 2001, 2014 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_CAST128_H_INCLUDED
#define NETTLE_CAST128_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define cast5_set_key nettle_cast5_set_key
#define cast128_set_key nettle_cast128_set_key
#define cast128_encrypt nettle_cast128_encrypt
#define cast128_decrypt nettle_cast128_decrypt
#define CAST128_BLOCK_SIZE 8
/* Variable key size between 40 and 128. */
#define CAST5_MIN_KEY_SIZE 5
#define CAST5_MAX_KEY_SIZE 16
#define CAST128_KEY_SIZE 16
struct cast128_ctx
{
unsigned rounds; /* Number of rounds to use, 12 or 16 */
/* Expanded key, rotations (5 bits only) and 32-bit masks. */
unsigned char Kr[16];
uint32_t Km[16];
};
/* Using variable key size. */
void
cast5_set_key(struct cast128_ctx *ctx,
size_t length, const uint8_t *key);
void
cast128_set_key(struct cast128_ctx *ctx, const uint8_t *key);
void
cast128_encrypt(const struct cast128_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
void
cast128_decrypt(const struct cast128_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_CAST128_H_INCLUDED */

View File

@ -1,86 +0,0 @@
/* cbc.h
Cipher block chaining mode.
Copyright (C) 2001 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_CBC_H_INCLUDED
#define NETTLE_CBC_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define cbc_encrypt nettle_cbc_encrypt
#define cbc_decrypt nettle_cbc_decrypt
void
cbc_encrypt(const void *ctx, nettle_cipher_func *f,
size_t block_size, uint8_t *iv,
size_t length, uint8_t *dst,
const uint8_t *src);
void
cbc_decrypt(const void *ctx, nettle_cipher_func *f,
size_t block_size, uint8_t *iv,
size_t length, uint8_t *dst,
const uint8_t *src);
#define CBC_CTX(type, size) \
{ type ctx; uint8_t iv[size]; }
#define CBC_SET_IV(ctx, data) \
memcpy((ctx)->iv, (data), sizeof((ctx)->iv))
/* NOTE: Avoid using NULL, as we don't include anything defining it. */
#define CBC_ENCRYPT(self, f, length, dst, src) \
(0 ? ((f)(&(self)->ctx, ~(size_t) 0, \
(uint8_t *) 0, (const uint8_t *) 0)) \
: cbc_encrypt((void *) &(self)->ctx, \
(nettle_cipher_func *) (f), \
sizeof((self)->iv), (self)->iv, \
(length), (dst), (src)))
#define CBC_DECRYPT(self, f, length, dst, src) \
(0 ? ((f)(&(self)->ctx, ~(size_t) 0, \
(uint8_t *) 0, (const uint8_t *) 0)) \
: cbc_decrypt((void *) &(self)->ctx, \
(nettle_cipher_func *) (f), \
sizeof((self)->iv), (self)->iv, \
(length), (dst), (src)))
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_CBC_H_INCLUDED */

View File

@ -1,302 +0,0 @@
/* ccm.h
Counter with CBC-MAC mode, specified by NIST,
http://csrc.nist.gov/publications/nistpubs/800-38C/SP800-38C_updated-July20_2007.pdf
Copyright (C) 2014 Exegin Technologies Limited
Copyright (C) 2014 Owen Kirby
Contributed to GNU Nettle by Owen Kirby
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
/* NIST SP800-38C doesn't specify the particular formatting and
* counter generation algorithm for CCM, but it does include an
* example algorithm. This example has become the de-factor standard,
* and has been adopted by both the IETF and IEEE across a wide
* variety of protocols.
*/
#ifndef NETTLE_CCM_H_INCLUDED
#define NETTLE_CCM_H_INCLUDED
#include "aes.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define ccm_set_nonce nettle_ccm_set_nonce
#define ccm_update nettle_ccm_update
#define ccm_encrypt nettle_ccm_encrypt
#define ccm_decrypt nettle_ccm_decrypt
#define ccm_digest nettle_ccm_digest
#define ccm_encrypt_message nettle_ccm_encrypt_message
#define ccm_decrypt_message nettle_ccm_decrypt_message
#define ccm_aes128_set_key nettle_ccm_aes128_set_key
#define ccm_aes128_set_nonce nettle_ccm_aes128_set_nonce
#define ccm_aes128_update nettle_ccm_aes128_update
#define ccm_aes128_encrypt nettle_ccm_aes128_encrypt
#define ccm_aes128_decrypt nettle_ccm_aes128_decrypt
#define ccm_aes128_digest nettle_ccm_aes128_digest
#define ccm_aes128_encrypt_message nettle_ccm_aes128_encrypt_message
#define ccm_aes128_decrypt_message nettle_ccm_aes128_decrypt_message
#define ccm_aes192_set_key nettle_ccm_aes192_set_key
#define ccm_aes192_set_nonce nettle_ccm_aes192_set_nonce
#define ccm_aes192_update nettle_ccm_aes192_update
#define ccm_aes192_encrypt nettle_ccm_aes192_encrypt
#define ccm_aes192_decrypt nettle_ccm_aes192_decrypt
#define ccm_aes192_digest nettle_ccm_aes192_digest
#define ccm_aes192_encrypt_message nettle_ccm_aes192_encrypt_message
#define ccm_aes192_decrypt_message nettle_ccm_aes192_decrypt_message
#define ccm_aes256_set_key nettle_ccm_aes256_set_key
#define ccm_aes256_set_nonce nettle_ccm_aes256_set_nonce
#define ccm_aes256_update nettle_ccm_aes256_update
#define ccm_aes256_encrypt nettle_ccm_aes256_encrypt
#define ccm_aes256_decrypt nettle_ccm_aes256_decrypt
#define ccm_aes256_digest nettle_ccm_aes256_digest
#define ccm_aes256_encrypt_message nettle_ccm_aes256_encrypt_message
#define ccm_aes256_decrypt_message nettle_ccm_aes256_decrypt_message
/* For CCM, the block size of the block cipher shall be 128 bits. */
#define CCM_BLOCK_SIZE 16
#define CCM_DIGEST_SIZE 16
#define CCM_MIN_NONCE_SIZE 7
#define CCM_MAX_NONCE_SIZE 14
/* Maximum cleartext message size, as a function of the nonce size N.
The length field is L octets, with L = 15 - N, and then the maximum
size M = 2^{8L} - 1. */
#define CCM_MAX_MSG_SIZE(N) \
((sizeof(size_t) + (N) <= 15) \
? ~(size_t) 0 \
: ((size_t) 1 << (8*(15 - N))) - 1)
/* Per-message state */
struct ccm_ctx {
union nettle_block16 ctr; /* Counter for CTR encryption. */
union nettle_block16 tag; /* CBC-MAC message tag. */
/* Length of data processed by the CBC-MAC modulus the block size */
unsigned int blength;
};
/*
* CCM mode requires the adata and message lengths when building the IV, which
* prevents streaming processing and it incompatible with the AEAD API.
*/
void
ccm_set_nonce(struct ccm_ctx *ctx, const void *cipher, nettle_cipher_func *f,
size_t noncelen, const uint8_t *nonce,
size_t authlen, size_t msglen, size_t taglen);
void
ccm_update(struct ccm_ctx *ctx, const void *cipher, nettle_cipher_func *f,
size_t length, const uint8_t *data);
void
ccm_encrypt(struct ccm_ctx *ctx, const void *cipher, nettle_cipher_func *f,
size_t length, uint8_t *dst, const uint8_t *src);
void
ccm_decrypt(struct ccm_ctx *ctx, const void *cipher, nettle_cipher_func *f,
size_t length, uint8_t *dst, const uint8_t *src);
void
ccm_digest(struct ccm_ctx *ctx, const void *cipher, nettle_cipher_func *f,
size_t length, uint8_t *digest);
/*
* All-in-one encryption and decryption API:
* tlength = sizeof(digest)
* mlength = sizeof(cleartext)
* clength = sizeof(ciphertext) = mlength + tlength
*
* The ciphertext will contain the encrypted payload with the message digest
* appended to the end.
*/
void
ccm_encrypt_message(const void *cipher, nettle_cipher_func *f,
size_t nlength, const uint8_t *nonce,
size_t alength, const uint8_t *adata,
size_t tlength,
size_t clength, uint8_t *dst, const uint8_t *src);
/*
* The decryption function will write the plaintext to dst and parse the digest
* from the final tlength bytes of the ciphertext. If the digest matched the
* value computed during decryption then this will return 1, or it will return
* 0 if the digest was invalid.
*/
int
ccm_decrypt_message(const void *cipher, nettle_cipher_func *f,
size_t nlength, const uint8_t *nonce,
size_t alength, const uint8_t *adata,
size_t tlength,
size_t mlength, uint8_t *dst, const uint8_t *src);
/* CCM Mode with AES-128 */
struct ccm_aes128_ctx {
struct ccm_ctx ccm;
struct aes128_ctx cipher;
};
void
ccm_aes128_set_key(struct ccm_aes128_ctx *ctx, const uint8_t *key);
void
ccm_aes128_set_nonce(struct ccm_aes128_ctx *ctx,
size_t length, const uint8_t *nonce,
size_t authlen, size_t msglen, size_t taglen);
void
ccm_aes128_update (struct ccm_aes128_ctx *ctx,
size_t length, const uint8_t *data);
void
ccm_aes128_encrypt(struct ccm_aes128_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void
ccm_aes128_decrypt(struct ccm_aes128_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void
ccm_aes128_digest(struct ccm_aes128_ctx *ctx,
size_t length, uint8_t *digest);
void
ccm_aes128_encrypt_message(struct ccm_aes128_ctx *ctx,
size_t nlength, const uint8_t *nonce,
size_t alength, const uint8_t *adata,
size_t tlength,
size_t clength, uint8_t *dst, const uint8_t *src);
int
ccm_aes128_decrypt_message(struct ccm_aes128_ctx *ctx,
size_t nlength, const uint8_t *nonce,
size_t alength, const uint8_t *adata,
size_t tlength,
size_t mlength, uint8_t *dst, const uint8_t *src);
struct ccm_aes192_ctx {
struct ccm_ctx ccm;
struct aes192_ctx cipher;
};
/* CCM Mode with AES-192 */
void
ccm_aes192_set_key(struct ccm_aes192_ctx *ctx, const uint8_t *key);
void
ccm_aes192_set_nonce(struct ccm_aes192_ctx *ctx,
size_t length, const uint8_t *nonce,
size_t authlen, size_t msglen, size_t taglen);
void
ccm_aes192_update(struct ccm_aes192_ctx *ctx,
size_t length, const uint8_t *data);
void
ccm_aes192_encrypt(struct ccm_aes192_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void
ccm_aes192_decrypt(struct ccm_aes192_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void
ccm_aes192_digest(struct ccm_aes192_ctx *ctx,
size_t length, uint8_t *digest);
void
ccm_aes192_encrypt_message(struct ccm_aes192_ctx *ctx,
size_t nlength, const uint8_t *nonce,
size_t alength, const uint8_t *adata,
size_t tlength,
size_t clength, uint8_t *dst, const uint8_t *src);
int
ccm_aes192_decrypt_message(struct ccm_aes192_ctx *ctx,
size_t nlength, const uint8_t *nonce,
size_t alength, const uint8_t *adata,
size_t tlength,
size_t mlength, uint8_t *dst, const uint8_t *src);
/* CCM Mode with AES-256 */
struct ccm_aes256_ctx {
struct ccm_ctx ccm;
struct aes256_ctx cipher;
};
void
ccm_aes256_set_key(struct ccm_aes256_ctx *ctx, const uint8_t *key);
void
ccm_aes256_set_nonce(struct ccm_aes256_ctx *ctx,
size_t length, const uint8_t *nonce,
size_t authlen, size_t msglen, size_t taglen);
void
ccm_aes256_update(struct ccm_aes256_ctx *ctx,
size_t length, const uint8_t *data);
void
ccm_aes256_encrypt(struct ccm_aes256_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void
ccm_aes256_decrypt(struct ccm_aes256_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void
ccm_aes256_digest(struct ccm_aes256_ctx *ctx,
size_t length, uint8_t *digest);
void
ccm_aes256_encrypt_message(struct ccm_aes256_ctx *ctx,
size_t nlength, const uint8_t *nonce,
size_t alength, const uint8_t *adata,
size_t tlength,
size_t clength, uint8_t *dst, const uint8_t *src);
int
ccm_aes256_decrypt_message(struct ccm_aes256_ctx *ctx,
size_t nlength, const uint8_t *nonce,
size_t alength, const uint8_t *adata,
size_t tlength,
size_t mlength, uint8_t *dst, const uint8_t *src);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_CCM_H_INCLUDED */

View File

@ -1,98 +0,0 @@
/* chacha-poly1305.h
AEAD mechanism based on chacha and poly1305.
See draft-agl-tls-chacha20poly1305-04.
Copyright (C) 2014 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_CHACHA_POLY1305_H_INCLUDED
#define NETTLE_CHACHA_POLY1305_H_INCLUDED
#include "chacha.h"
#include "poly1305.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define chacha_poly1305_set_key nettle_chacha_poly1305_set_key
#define chacha_poly1305_set_nonce nettle_chacha_poly1305_set_nonce
#define chacha_poly1305_update nettle_chacha_poly1305_update
#define chacha_poly1305_decrypt nettle_chacha_poly1305_decrypt
#define chacha_poly1305_encrypt nettle_chacha_poly1305_encrypt
#define chacha_poly1305_digest nettle_chacha_poly1305_digest
#define CHACHA_POLY1305_BLOCK_SIZE 64
/* FIXME: Any need for 128-bit variant? */
#define CHACHA_POLY1305_KEY_SIZE 32
#define CHACHA_POLY1305_NONCE_SIZE CHACHA_NONCE96_SIZE
#define CHACHA_POLY1305_DIGEST_SIZE 16
struct chacha_poly1305_ctx
{
struct chacha_ctx chacha;
struct poly1305_ctx poly1305;
union nettle_block16 s;
uint64_t auth_size;
uint64_t data_size;
/* poly1305 block */
uint8_t block[POLY1305_BLOCK_SIZE];
unsigned index;
};
void
chacha_poly1305_set_key (struct chacha_poly1305_ctx *ctx,
const uint8_t *key);
void
chacha_poly1305_set_nonce (struct chacha_poly1305_ctx *ctx,
const uint8_t *nonce);
void
chacha_poly1305_update (struct chacha_poly1305_ctx *ctx,
size_t length, const uint8_t *data);
void
chacha_poly1305_encrypt (struct chacha_poly1305_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void
chacha_poly1305_decrypt (struct chacha_poly1305_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void
chacha_poly1305_digest (struct chacha_poly1305_ctx *ctx,
size_t length, uint8_t *digest);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_CHACHA_POLY1305_H_INCLUDED */

View File

@ -1,71 +0,0 @@
/* ctr.h
Counter mode, using an network byte order incremented counter,
matching the testcases of NIST 800-38A.
Copyright (C) 2005 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_CTR_H_INCLUDED
#define NETTLE_CTR_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define ctr_crypt nettle_ctr_crypt
void
ctr_crypt(const void *ctx, nettle_cipher_func *f,
size_t block_size, uint8_t *ctr,
size_t length, uint8_t *dst,
const uint8_t *src);
#define CTR_CTX(type, size) \
{ type ctx; uint8_t ctr[size]; }
#define CTR_SET_COUNTER(ctx, data) \
memcpy((ctx)->ctr, (data), sizeof((ctx)->ctr))
#define CTR_CRYPT(self, f, length, dst, src) \
(0 ? ((f)(&(self)->ctx, ~(size_t) 0, \
(uint8_t *) 0, (const uint8_t *) 0)) \
: ctr_crypt((void *) &(self)->ctx, \
(nettle_cipher_func *) (f), \
sizeof((self)->ctr), (self)->ctr, \
(length), (dst), (src)))
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_CTR_H_INCLUDED */

View File

@ -1,162 +0,0 @@
/* des-compat.h
The des block cipher, old libdes/openssl-style interface.
Copyright (C) 2001 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_DES_COMPAT_H_INCLUDED
#define NETTLE_DES_COMPAT_H_INCLUDED
/* According to Assar, des_set_key, des_set_key_odd_parity,
* des_is_weak_key, plus the encryption functions (des_*_encrypt and
* des_cbc_cksum) would be a pretty useful subset. */
/* NOTE: This is quite experimental, and not all functions are
* implemented. Contributions, in particular test cases are welcome. */
#include "des.h"
#ifdef __cplusplus
extern "C" {
#endif
/* We use some name mangling, to avoid collisions with either other
* nettle functions or with libcrypto. */
#define des_ecb3_encrypt nettle_openssl_des_ecb3_encrypt
#define des_cbc_cksum nettle_openssl_des_cbc_cksum
#define des_ncbc_encrypt nettle_openssl_des_ncbc_encrypt
#define des_cbc_encrypt nettle_openssl_des_cbc_encrypt
#define des_ecb_encrypt nettle_openssl_des_ecb_encrypt
#define des_ede3_cbc_encrypt nettle_openssl_des_ede3_cbc_encrypt
#define des_set_odd_parity nettle_openssl_des_set_odd_parity
#define des_check_key nettle_openssl_des_check_key
#define des_key_sched nettle_openssl_des_key_sched
#define des_is_weak_key nettle_openssl_des_is_weak_key
/* An extra alias */
#undef des_set_key
#define des_set_key nettle_openssl_des_key_sched
enum { DES_DECRYPT = 0, DES_ENCRYPT = 1 };
/* Types */
typedef uint32_t DES_LONG;
/* Note: Typedef:ed arrays should be avoided, but they're used here
* for compatibility. */
typedef struct des_ctx des_key_schedule[1];
typedef uint8_t des_cblock[DES_BLOCK_SIZE];
/* Note: The proper definition,
typedef const uint8_t const_des_cblock[DES_BLOCK_SIZE];
would have worked, *if* all the prototypes had used arguments like
foo(const_des_cblock src, des_cblock dst), letting argument arrays
"decay" into pointers of type uint8_t * and const uint8_t *.
But since openssl's prototypes use *pointers* const_des_cblock *src,
des_cblock *dst, this ends up in type conflicts, and the workaround
is to not use const at all.
*/
#define const_des_cblock des_cblock
/* Aliases */
#define des_ecb2_encrypt(i,o,k1,k2,e) \
des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
/* Global flag */
extern int des_check_key;
/* Prototypes */
/* Typing is a little confusing. Since both des_cblock and
des_key_schedule are typedef:ed arrays, it automatically decay to
a pointers.
But the functions are declared taking pointers to des_cblock, i.e.
pointers to arrays. And on the other hand, they take plain
des_key_schedule arguments, which is equivalent to pointers to
struct des_ctx. */
void
des_ecb3_encrypt(const_des_cblock *src, des_cblock *dst,
des_key_schedule k1,
des_key_schedule k2,
des_key_schedule k3, int enc);
/* des_cbc_cksum in libdes returns a 32 bit integer, representing the
* latter half of the output block, using little endian byte order. */
uint32_t
des_cbc_cksum(const uint8_t *src, des_cblock *dst,
long length, des_key_schedule ctx,
const_des_cblock *iv);
/* NOTE: Doesn't update iv. */
void
des_cbc_encrypt(const_des_cblock *src, des_cblock *dst, long length,
des_key_schedule ctx, const_des_cblock *iv,
int enc);
/* Similar, but updates iv. */
void
des_ncbc_encrypt(const_des_cblock *src, des_cblock *dst, long length,
des_key_schedule ctx, des_cblock *iv,
int enc);
void
des_ecb_encrypt(const_des_cblock *src, des_cblock *dst,
des_key_schedule ctx, int enc);
void
des_ede3_cbc_encrypt(const_des_cblock *src, des_cblock *dst, long length,
des_key_schedule k1,
des_key_schedule k2,
des_key_schedule k3,
des_cblock *iv,
int enc);
int
des_set_odd_parity(des_cblock *key);
int
des_key_sched(const_des_cblock *key, des_key_schedule ctx);
int
des_is_weak_key(const_des_cblock *key);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_DES_COMPAT_H_INCLUDED */

View File

@ -1,120 +0,0 @@
/* des.h
The des block cipher. And triple des.
Copyright (C) 1992 Dana L. How
Copyright (C) 2001 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
/*
* des - fast & portable DES encryption & decryption.
* Copyright (C) 1992 Dana L. How
* Please see the file `../lib/descore.README' for the complete copyright
* notice.
*
* Slightly edited by Niels Möller, 1997
*/
#ifndef NETTLE_DES_H_INCLUDED
#define NETTLE_DES_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Namespace mangling */
#define des_set_key nettle_des_set_key
#define des_encrypt nettle_des_encrypt
#define des_decrypt nettle_des_decrypt
#define des_check_parity nettle_des_check_parity
#define des_fix_parity nettle_des_fix_parity
#define des3_set_key nettle_des3_set_key
#define des3_encrypt nettle_des3_encrypt
#define des3_decrypt nettle_des3_decrypt
#define DES_KEY_SIZE 8
#define DES_BLOCK_SIZE 8
/* Expanded key length */
#define _DES_KEY_LENGTH 32
struct des_ctx
{
uint32_t key[_DES_KEY_LENGTH];
};
/* Returns 1 for good keys and 0 for weak keys. */
int
des_set_key(struct des_ctx *ctx, const uint8_t *key);
void
des_encrypt(const struct des_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
void
des_decrypt(const struct des_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
int
des_check_parity(size_t length, const uint8_t *key);
void
des_fix_parity(size_t length, uint8_t *dst,
const uint8_t *src);
#define DES3_KEY_SIZE 24
#define DES3_BLOCK_SIZE DES_BLOCK_SIZE
struct des3_ctx
{
struct des_ctx des[3];
};
/* Returns 1 for good keys and 0 for weak keys. */
int
des3_set_key(struct des3_ctx *ctx, const uint8_t *key);
void
des3_encrypt(const struct des3_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
void
des3_decrypt(const struct des3_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_DES_H_INCLUDED */

View File

@ -1,183 +0,0 @@
/* dsa-compat.h
Old DSA publickey interface.
Copyright (C) 2002, 2013, 2014 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_DSA_COMPAT_H_INCLUDED
#define NETTLE_DSA_COMPAT_H_INCLUDED
#include "dsa.h"
#include "sha1.h"
#include "sha2.h"
/* Name mangling */
#define dsa_public_key_init nettle_dsa_public_key_init
#define dsa_public_key_clear nettle_dsa_public_key_clear
#define dsa_private_key_init nettle_dsa_private_key_init
#define dsa_private_key_clear nettle_dsa_private_key_clear
#define dsa_sha1_sign nettle_dsa_sha1_sign
#define dsa_sha1_verify nettle_dsa_sha1_verify
#define dsa_sha256_sign nettle_dsa_sha256_sign
#define dsa_sha256_verify nettle_dsa_sha256_verify
#define dsa_sha1_sign_digest nettle_dsa_sha1_sign_digest
#define dsa_sha1_verify_digest nettle_dsa_sha1_verify_digest
#define dsa_sha256_sign_digest nettle_dsa_sha256_sign_digest
#define dsa_sha256_verify_digest nettle_dsa_sha256_verify_digest
#define dsa_compat_generate_keypair nettle_dsa_compat_generate_keypair
/* Switch meaning of dsa_generate_keypair */
#undef dsa_generate_keypair
#define dsa_generate_keypair nettle_dsa_compat_generate_keypair
#ifdef __cplusplus
extern "C" {
#endif
struct dsa_public_key
{
/* Same as struct dsa_params, but can't use that struct here without
breaking backwards compatibility. Layout must be identical, since
this is cast to a struct dsa_param pointer for calling _dsa_sign
and _dsa_verify */
mpz_t p;
mpz_t q;
mpz_t g;
/* Public value */
mpz_t y;
};
struct dsa_private_key
{
/* Unlike an rsa public key, private key operations will need both
* the private and the public information. */
mpz_t x;
};
/* Signing a message works as follows:
*
* Store the private key in a dsa_private_key struct.
*
* Initialize a hashing context, by callling
* sha1_init
*
* Hash the message by calling
* sha1_update
*
* Create the signature by calling
* dsa_sha1_sign
*
* The signature is represented as a struct dsa_signature. This call also
* resets the hashing context.
*
* When done with the key and signature, don't forget to call
* dsa_signature_clear.
*/
/* Calls mpz_init to initialize bignum storage. */
void
dsa_public_key_init(struct dsa_public_key *key);
/* Calls mpz_clear to deallocate bignum storage. */
void
dsa_public_key_clear(struct dsa_public_key *key);
/* Calls mpz_init to initialize bignum storage. */
void
dsa_private_key_init(struct dsa_private_key *key);
/* Calls mpz_clear to deallocate bignum storage. */
void
dsa_private_key_clear(struct dsa_private_key *key);
int
dsa_sha1_sign(const struct dsa_public_key *pub,
const struct dsa_private_key *key,
void *random_ctx, nettle_random_func *random,
struct sha1_ctx *hash,
struct dsa_signature *signature);
int
dsa_sha256_sign(const struct dsa_public_key *pub,
const struct dsa_private_key *key,
void *random_ctx, nettle_random_func *random,
struct sha256_ctx *hash,
struct dsa_signature *signature);
int
dsa_sha1_verify(const struct dsa_public_key *key,
struct sha1_ctx *hash,
const struct dsa_signature *signature);
int
dsa_sha256_verify(const struct dsa_public_key *key,
struct sha256_ctx *hash,
const struct dsa_signature *signature);
int
dsa_sha1_sign_digest(const struct dsa_public_key *pub,
const struct dsa_private_key *key,
void *random_ctx, nettle_random_func *random,
const uint8_t *digest,
struct dsa_signature *signature);
int
dsa_sha256_sign_digest(const struct dsa_public_key *pub,
const struct dsa_private_key *key,
void *random_ctx, nettle_random_func *random,
const uint8_t *digest,
struct dsa_signature *signature);
int
dsa_sha1_verify_digest(const struct dsa_public_key *key,
const uint8_t *digest,
const struct dsa_signature *signature);
int
dsa_sha256_verify_digest(const struct dsa_public_key *key,
const uint8_t *digest,
const struct dsa_signature *signature);
/* Key generation */
int
dsa_generate_keypair(struct dsa_public_key *pub,
struct dsa_private_key *key,
void *random_ctx, nettle_random_func *random,
void *progress_ctx, nettle_progress_func *progress,
unsigned p_bits, unsigned q_bits);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_DSA_COMPAT_H_INCLUDED */

View File

@ -1,185 +0,0 @@
/* eax.h
EAX mode, see http://www.cs.ucdavis.edu/~rogaway/papers/eax.pdf
Copyright (C) 2013 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_EAX_H_INCLUDED
#define NETTLE_EAX_H_INCLUDED
#include "aes.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define eax_set_key nettle_eax_set_key
#define eax_set_nonce nettle_eax_set_nonce
#define eax_update nettle_eax_update
#define eax_encrypt nettle_eax_encrypt
#define eax_decrypt nettle_eax_decrypt
#define eax_digest nettle_eax_digest
#define eax_aes128_set_key nettle_eax_aes128_set_key
#define eax_aes128_set_nonce nettle_eax_aes128_set_nonce
#define eax_aes128_update nettle_eax_aes128_update
#define eax_aes128_encrypt nettle_eax_aes128_encrypt
#define eax_aes128_decrypt nettle_eax_aes128_decrypt
#define eax_aes128_digest nettle_eax_aes128_digest
/* Restricted to block ciphers with 128 bit block size. FIXME: Reflect
this in naming? */
#define EAX_BLOCK_SIZE 16
#define EAX_DIGEST_SIZE 16
/* FIXME: Reasonable default? */
#define EAX_IV_SIZE 16
/* Values independent of message and nonce */
struct eax_key
{
union nettle_block16 pad_block;
union nettle_block16 pad_partial;
};
struct eax_ctx
{
union nettle_block16 omac_nonce;
union nettle_block16 omac_data;
union nettle_block16 omac_message;
union nettle_block16 ctr;
};
void
eax_set_key (struct eax_key *key, const void *cipher, nettle_cipher_func *f);
void
eax_set_nonce (struct eax_ctx *eax, const struct eax_key *key,
const void *cipher, nettle_cipher_func *f,
size_t nonce_length, const uint8_t *nonce);
void
eax_update (struct eax_ctx *eax, const struct eax_key *key,
const void *cipher, nettle_cipher_func *f,
size_t data_length, const uint8_t *data);
void
eax_encrypt (struct eax_ctx *eax, const struct eax_key *key,
const void *cipher, nettle_cipher_func *f,
size_t length, uint8_t *dst, const uint8_t *src);
void
eax_decrypt (struct eax_ctx *eax, const struct eax_key *key,
const void *cipher, nettle_cipher_func *f,
size_t length, uint8_t *dst, const uint8_t *src);
void
eax_digest (struct eax_ctx *eax, const struct eax_key *key,
const void *cipher, nettle_cipher_func *f,
size_t length, uint8_t *digest);
/* Put the cipher last, to get cipher-independent offsets for the EAX
* state. */
#define EAX_CTX(type) \
{ struct eax_key key; struct eax_ctx eax; type cipher; }
#define EAX_SET_KEY(ctx, set_key, encrypt, data) \
do { \
(set_key)(&(ctx)->cipher, (data)); \
if (0) (encrypt) (&(ctx)->cipher, ~(size_t) 0, \
(uint8_t *) 0, (const uint8_t *) 0); \
eax_set_key (&(ctx)->key, &(ctx)->cipher, (nettle_cipher_func *) encrypt); \
} while (0)
#define EAX_SET_NONCE(ctx, encrypt, length, nonce) \
(0 ? (encrypt) (&(ctx)->cipher, ~(size_t) 0, \
(uint8_t *) 0, (const uint8_t *) 0) \
: eax_set_nonce (&(ctx)->eax, &(ctx)->key, \
&(ctx)->cipher, (nettle_cipher_func *) (encrypt), \
(length), (nonce)))
#define EAX_UPDATE(ctx, encrypt, length, data) \
(0 ? (encrypt) (&(ctx)->cipher, ~(size_t) 0, \
(uint8_t *) 0, (const uint8_t *) 0) \
: eax_update (&(ctx)->eax, &(ctx)->key, \
&(ctx)->cipher, (nettle_cipher_func *) (encrypt), \
(length), (data)))
#define EAX_ENCRYPT(ctx, encrypt, length, dst, src) \
(0 ? (encrypt) (&(ctx)->cipher, ~(size_t) 0, \
(uint8_t *) 0, (const uint8_t *) 0) \
: eax_encrypt (&(ctx)->eax, &(ctx)->key, \
&(ctx)->cipher, (nettle_cipher_func *) (encrypt), \
(length), (dst), (src)))
#define EAX_DECRYPT(ctx, encrypt, length, dst, src) \
(0 ? (encrypt) (&(ctx)->cipher, ~(size_t) 0, \
(uint8_t *) 0, (const uint8_t *) 0) \
: eax_decrypt (&(ctx)->eax, &(ctx)->key, \
&(ctx)->cipher, (nettle_cipher_func *) (encrypt), \
(length), (dst), (src)))
#define EAX_DIGEST(ctx, encrypt, length, digest) \
(0 ? (encrypt) (&(ctx)->cipher, ~(size_t) 0, \
(uint8_t *) 0, (const uint8_t *) 0) \
: eax_digest (&(ctx)->eax, &(ctx)->key, \
&(ctx)->cipher, (nettle_cipher_func *) (encrypt), \
(length), (digest)))
struct eax_aes128_ctx EAX_CTX(struct aes128_ctx);
void
eax_aes128_set_key(struct eax_aes128_ctx *ctx, const uint8_t *key);
void
eax_aes128_set_nonce(struct eax_aes128_ctx *ctx,
size_t length, const uint8_t *iv);
void
eax_aes128_update(struct eax_aes128_ctx *ctx,
size_t length, const uint8_t *data);
void
eax_aes128_encrypt(struct eax_aes128_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void
eax_aes128_decrypt(struct eax_aes128_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void
eax_aes128_digest(struct eax_aes128_ctx *ctx, size_t length, uint8_t *digest);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_EAX_H_INCLUDED */

View File

@ -1,71 +0,0 @@
/* ecc-curve.h
Copyright (C) 2013 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
/* Development of Nettle's ECC support was funded by the .SE Internet Fund. */
#ifndef NETTLE_ECC_CURVE_H_INCLUDED
#define NETTLE_ECC_CURVE_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
/* The contents of this struct is internal. */
struct ecc_curve;
/* FIXME: Rename with leading underscore. Due to ABI subtleties,
applications should not refer to these directly, but use the below
accessor functions. */
extern const struct ecc_curve nettle_secp_192r1;
extern const struct ecc_curve nettle_secp_224r1;
extern const struct ecc_curve nettle_secp_256r1;
extern const struct ecc_curve nettle_secp_384r1;
extern const struct ecc_curve nettle_secp_521r1;
#ifdef __GNUC__
#define NETTLE_PURE __attribute__((pure))
#else
#define NETTLE_PURE
#endif
const struct ecc_curve * NETTLE_PURE nettle_get_secp_192r1(void);
const struct ecc_curve * NETTLE_PURE nettle_get_secp_224r1(void);
const struct ecc_curve * NETTLE_PURE nettle_get_secp_256r1(void);
const struct ecc_curve * NETTLE_PURE nettle_get_secp_384r1(void);
const struct ecc_curve * NETTLE_PURE nettle_get_secp_521r1(void);
#undef NETTLE_PURE
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_ECC_CURVE_H_INCLUDED */

View File

@ -1,159 +0,0 @@
/* ecc.h
Copyright (C) 2013 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
/* Development of Nettle's ECC support was funded by the .SE Internet Fund. */
#ifndef NETTLE_ECC_H_INCLUDED
#define NETTLE_ECC_H_INCLUDED
#include "nettle-types.h"
#include "bignum.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define ecc_point_init nettle_ecc_point_init
#define ecc_point_clear nettle_ecc_point_clear
#define ecc_point_set nettle_ecc_point_set
#define ecc_point_get nettle_ecc_point_get
#define ecc_point_mul nettle_ecc_point_mul
#define ecc_point_mul_g nettle_ecc_point_mul_g
#define ecc_scalar_init nettle_ecc_scalar_init
#define ecc_scalar_clear nettle_ecc_scalar_clear
#define ecc_scalar_set nettle_ecc_scalar_set
#define ecc_scalar_get nettle_ecc_scalar_get
#define ecc_scalar_random nettle_ecc_scalar_random
#define ecc_point_mul nettle_ecc_point_mul
#define ecc_bit_size nettle_ecc_bit_size
#define ecc_size nettle_ecc_size
#define ecc_size_a nettle_ecc_size_a
#define ecc_size_j nettle_ecc_size_j
struct ecc_curve;
/* High level interface, for ECDSA, DH, etc */
/* Represents a point on the ECC curve */
struct ecc_point
{
const struct ecc_curve *ecc;
/* Allocated using the same allocation function as GMP. */
mp_limb_t *p;
};
/* Represents a non-zero scalar, an element of Z_q^*, where q is the
group order of the curve. */
struct ecc_scalar
{
const struct ecc_curve *ecc;
/* Allocated using the same allocation function as GMP. */
mp_limb_t *p;
};
void
ecc_point_init (struct ecc_point *p, const struct ecc_curve *ecc);
void
ecc_point_clear (struct ecc_point *p);
/* Fails and returns zero if the point is not on the curve. */
int
ecc_point_set (struct ecc_point *p, const mpz_t x, const mpz_t y);
void
ecc_point_get (const struct ecc_point *p, mpz_t x, mpz_t y);
void
ecc_scalar_init (struct ecc_scalar *s, const struct ecc_curve *ecc);
void
ecc_scalar_clear (struct ecc_scalar *s);
/* Fails and returns zero if the scalar is not in the proper range. */
int
ecc_scalar_set (struct ecc_scalar *s, const mpz_t z);
void
ecc_scalar_get (const struct ecc_scalar *s, mpz_t z);
/* Generates a random scalar, suitable as an ECDSA private key or a
ECDH exponent. */
void
ecc_scalar_random (struct ecc_scalar *s,
void *random_ctx, nettle_random_func *random);
/* Computes r = n p */
void
ecc_point_mul (struct ecc_point *r, const struct ecc_scalar *n,
const struct ecc_point *p);
/* Computes r = n g */
void
ecc_point_mul_g (struct ecc_point *r, const struct ecc_scalar *n);
/* Low-level interface */
/* Points on a curve are represented as arrays of mp_limb_t, with
curve-specific representation. For the secp curves, we use Jacobian
coordinates (possibly in Montgomery form for mod multiplication).
For curve25519 we use homogeneous coordinates on an equivalent
Edwards curve. The suffix "_h" denotes this internal
representation.
Since we use additive notation for the groups, the infinity point
on the curve is denoted 0. The infinity point can be represented
with x = y = 0 in affine coordinates, and Z = 0 in Jacobian
coordinates. However, note that most of the ECC functions do *not*
support infinity as an input or output.
*/
/* Returns the bit size of a single coordinate (and of the prime p). */
unsigned
ecc_bit_size (const struct ecc_curve *ecc);
/* Returns the size of a single coordinate. */
mp_size_t
ecc_size (const struct ecc_curve *ecc);
/* Size of a point, using affine coordinates x, y. */
mp_size_t
ecc_size_a (const struct ecc_curve *ecc);
/* Size of a point, using jacobian coordinates X, Y and Z. */
mp_size_t
ecc_size_j (const struct ecc_curve *ecc);
/* FIXME: Define a generic ecc_dup, ecc_add, for any type of curve. Do
they need to handle infinity points? */
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_ECC_H_INCLUDED */

View File

@ -1,103 +0,0 @@
/* ecdsa.h
Copyright (C) 2013 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
/* Development of Nettle's ECC support was funded by the .SE Internet Fund. */
#ifndef NETTLE_ECDSA_H_INCLUDED
#define NETTLE_ECDSA_H_INCLUDED
#include "ecc.h"
#include "dsa.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define ecdsa_sign nettle_ecdsa_sign
#define ecdsa_verify nettle_ecdsa_verify
#define ecdsa_generate_keypair nettle_ecdsa_generate_keypair
#define ecc_ecdsa_sign nettle_ecc_ecdsa_sign
#define ecc_ecdsa_sign_itch nettle_ecc_ecdsa_sign_itch
#define ecc_ecdsa_verify nettle_ecc_ecdsa_verify
#define ecc_ecdsa_verify_itch nettle_ecc_ecdsa_verify_itch
/* High level ECDSA functions.
*
* A public key is represented as a struct ecc_point, and a private
* key as a struct ecc_scalar. FIXME: Introduce some aliases? */
void
ecdsa_sign (const struct ecc_scalar *key,
void *random_ctx, nettle_random_func *random,
size_t digest_length,
const uint8_t *digest,
struct dsa_signature *signature);
int
ecdsa_verify (const struct ecc_point *pub,
size_t length, const uint8_t *digest,
const struct dsa_signature *signature);
void
ecdsa_generate_keypair (struct ecc_point *pub,
struct ecc_scalar *key,
void *random_ctx, nettle_random_func *random);
/* Low-level ECDSA functions. */
mp_size_t
ecc_ecdsa_sign_itch (const struct ecc_curve *ecc);
void
ecc_ecdsa_sign (const struct ecc_curve *ecc,
const mp_limb_t *zp,
/* Random nonce, must be invertible mod ecc group
order. */
const mp_limb_t *kp,
size_t length, const uint8_t *digest,
mp_limb_t *rp, mp_limb_t *sp,
mp_limb_t *scratch);
mp_size_t
ecc_ecdsa_verify_itch (const struct ecc_curve *ecc);
int
ecc_ecdsa_verify (const struct ecc_curve *ecc,
const mp_limb_t *pp, /* Public key */
size_t length, const uint8_t *digest,
const mp_limb_t *rp, const mp_limb_t *sp,
mp_limb_t *scratch);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_ECDSA_H_INCLUDED */

View File

@ -1,149 +0,0 @@
/* eddsa.h
Copyright (C) 2014 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_EDDSA_H
#define NETTLE_EDDSA_H
#include "nettle-types.h"
#include "bignum.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define ed25519_sha512_set_private_key nettle_ed25519_sha512_set_private_key
#define ed25519_sha512_public_key nettle_ed25519_sha512_public_key
#define ed25519_sha512_sign nettle_ed25519_sha512_sign
#define ed25519_sha512_verify nettle_ed25519_sha512_verify
#define _eddsa_compress _nettle_eddsa_compress
#define _eddsa_compress_itch _nettle_eddsa_compress_itch
#define _eddsa_decompress _nettle_eddsa_decompress
#define _eddsa_decompress_itch _nettle_eddsa_decompress_itch
#define _eddsa_hash _nettle_eddsa_hash
#define _eddsa_expand_key _nettle_eddsa_expand_key
#define _eddsa_sign _nettle_eddsa_sign
#define _eddsa_sign_itch _nettle_eddsa_sign_itch
#define _eddsa_verify _nettle_eddsa_verify
#define _eddsa_verify_itch _nettle_eddsa_verify_itch
#define _eddsa_public_key_itch _nettle_eddsa_public_key_itch
#define _eddsa_public_key _nettle_eddsa_public_key
#define ED25519_KEY_SIZE 32
#define ED25519_SIGNATURE_SIZE 64
void
ed25519_sha512_public_key (uint8_t *pub, const uint8_t *priv);
void
ed25519_sha512_sign (const uint8_t *pub,
const uint8_t *priv,
size_t length, const uint8_t *msg,
uint8_t *signature);
int
ed25519_sha512_verify (const uint8_t *pub,
size_t length, const uint8_t *msg,
const uint8_t *signature);
/* Low-level internal functions */
struct ecc_curve;
struct ecc_modulo;
mp_size_t
_eddsa_compress_itch (const struct ecc_curve *ecc);
void
_eddsa_compress (const struct ecc_curve *ecc, uint8_t *r, mp_limb_t *p,
mp_limb_t *scratch);
mp_size_t
_eddsa_decompress_itch (const struct ecc_curve *ecc);
int
_eddsa_decompress (const struct ecc_curve *ecc, mp_limb_t *p,
const uint8_t *cp,
mp_limb_t *scratch);
void
_eddsa_hash (const struct ecc_modulo *m,
mp_limb_t *rp, const uint8_t *digest);
mp_size_t
_eddsa_sign_itch (const struct ecc_curve *ecc);
void
_eddsa_sign (const struct ecc_curve *ecc,
const struct nettle_hash *H,
const uint8_t *pub,
void *ctx,
const mp_limb_t *k2,
size_t length,
const uint8_t *msg,
uint8_t *signature,
mp_limb_t *scratch);
mp_size_t
_eddsa_verify_itch (const struct ecc_curve *ecc);
int
_eddsa_verify (const struct ecc_curve *ecc,
const struct nettle_hash *H,
const uint8_t *pub,
const mp_limb_t *A,
void *ctx,
size_t length,
const uint8_t *msg,
const uint8_t *signature,
mp_limb_t *scratch);
void
_eddsa_expand_key (const struct ecc_curve *ecc,
const struct nettle_hash *H,
void *ctx,
const uint8_t *key,
uint8_t *digest,
mp_limb_t *k2);
mp_size_t
_eddsa_public_key_itch (const struct ecc_curve *ecc);
void
_eddsa_public_key (const struct ecc_curve *ecc,
const mp_limb_t *k, uint8_t *pub, mp_limb_t *scratch);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_EDDSA_H */

View File

@ -1,327 +0,0 @@
/* gcm.h
Galois counter mode, specified by NIST,
http://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf
Copyright (C) 2011 Katholieke Universiteit Leuven
Copyright (C) 2011, 2014 Niels Möller
Contributed by Nikos Mavrogiannopoulos
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_GCM_H_INCLUDED
#define NETTLE_GCM_H_INCLUDED
#include "aes.h"
#include "camellia.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define gcm_set_key nettle_gcm_set_key
#define gcm_set_iv nettle_gcm_set_iv
#define gcm_update nettle_gcm_update
#define gcm_encrypt nettle_gcm_encrypt
#define gcm_decrypt nettle_gcm_decrypt
#define gcm_digest nettle_gcm_digest
#define gcm_aes128_set_key nettle_gcm_aes128_set_key
#define gcm_aes128_set_iv nettle_gcm_aes128_set_iv
#define gcm_aes128_update nettle_gcm_aes128_update
#define gcm_aes128_encrypt nettle_gcm_aes128_encrypt
#define gcm_aes128_decrypt nettle_gcm_aes128_decrypt
#define gcm_aes128_digest nettle_gcm_aes128_digest
#define gcm_aes192_set_key nettle_gcm_aes192_set_key
#define gcm_aes192_set_iv nettle_gcm_aes192_set_iv
#define gcm_aes192_update nettle_gcm_aes192_update
#define gcm_aes192_encrypt nettle_gcm_aes192_encrypt
#define gcm_aes192_decrypt nettle_gcm_aes192_decrypt
#define gcm_aes192_digest nettle_gcm_aes192_digest
#define gcm_aes256_set_key nettle_gcm_aes256_set_key
#define gcm_aes256_set_iv nettle_gcm_aes256_set_iv
#define gcm_aes256_update nettle_gcm_aes256_update
#define gcm_aes256_encrypt nettle_gcm_aes256_encrypt
#define gcm_aes256_decrypt nettle_gcm_aes256_decrypt
#define gcm_aes256_digest nettle_gcm_aes256_digest
#define gcm_aes_set_key nettle_gcm_aes_set_key
#define gcm_aes_set_iv nettle_gcm_aes_set_iv
#define gcm_aes_update nettle_gcm_aes_update
#define gcm_aes_encrypt nettle_gcm_aes_encrypt
#define gcm_aes_decrypt nettle_gcm_aes_decrypt
#define gcm_aes_digest nettle_gcm_aes_digest
#define gcm_camellia128_set_key nettle_gcm_camellia128_set_key
#define gcm_camellia128_set_iv nettle_gcm_camellia128_set_iv
#define gcm_camellia128_update nettle_gcm_camellia128_update
#define gcm_camellia128_encrypt nettle_gcm_camellia128_encrypt
#define gcm_camellia128_decrypt nettle_gcm_camellia128_decrypt
#define gcm_camellia128_digest nettle_gcm_camellia128_digest
#define gcm_camellia256_set_key nettle_gcm_camellia256_set_key
#define gcm_camellia256_set_iv nettle_gcm_camellia256_set_iv
#define gcm_camellia256_update nettle_gcm_camellia256_update
#define gcm_camellia256_encrypt nettle_gcm_camellia256_encrypt
#define gcm_camellia256_decrypt nettle_gcm_camellia256_decrypt
#define gcm_camellia256_digest nettle_gcm_camellia256_digest
#define GCM_BLOCK_SIZE 16
#define GCM_IV_SIZE (GCM_BLOCK_SIZE - 4)
#define GCM_DIGEST_SIZE 16
#define GCM_TABLE_BITS 8
/* Hashing subkey */
struct gcm_key
{
union nettle_block16 h[1 << GCM_TABLE_BITS];
};
/* Per-message state, depending on the iv */
struct gcm_ctx {
/* Original counter block */
union nettle_block16 iv;
/* Updated for each block. */
union nettle_block16 ctr;
/* Hashing state */
union nettle_block16 x;
uint64_t auth_size;
uint64_t data_size;
};
void
gcm_set_key(struct gcm_key *key,
const void *cipher, nettle_cipher_func *f);
void
gcm_set_iv(struct gcm_ctx *ctx, const struct gcm_key *key,
size_t length, const uint8_t *iv);
void
gcm_update(struct gcm_ctx *ctx, const struct gcm_key *key,
size_t length, const uint8_t *data);
void
gcm_encrypt(struct gcm_ctx *ctx, const struct gcm_key *key,
const void *cipher, nettle_cipher_func *f,
size_t length, uint8_t *dst, const uint8_t *src);
void
gcm_decrypt(struct gcm_ctx *ctx, const struct gcm_key *key,
const void *cipher, nettle_cipher_func *f,
size_t length, uint8_t *dst, const uint8_t *src);
void
gcm_digest(struct gcm_ctx *ctx, const struct gcm_key *key,
const void *cipher, nettle_cipher_func *f,
size_t length, uint8_t *digest);
/* Convenience macrology (not sure how useful it is) */
/* All-in-one context, with hash subkey, message state, and cipher. */
#define GCM_CTX(type) \
{ struct gcm_key key; struct gcm_ctx gcm; type cipher; }
/* NOTE: Avoid using NULL, as we don't include anything defining it. */
#define GCM_SET_KEY(ctx, set_key, encrypt, gcm_key) \
do { \
(set_key)(&(ctx)->cipher, (gcm_key)); \
if (0) (encrypt)(&(ctx)->cipher, ~(size_t) 0, \
(uint8_t *) 0, (const uint8_t *) 0); \
gcm_set_key(&(ctx)->key, &(ctx)->cipher, \
(nettle_cipher_func *) (encrypt)); \
} while (0)
#define GCM_SET_IV(ctx, length, data) \
gcm_set_iv(&(ctx)->gcm, &(ctx)->key, (length), (data))
#define GCM_UPDATE(ctx, length, data) \
gcm_update(&(ctx)->gcm, &(ctx)->key, (length), (data))
#define GCM_ENCRYPT(ctx, encrypt, length, dst, src) \
(0 ? (encrypt)(&(ctx)->cipher, ~(size_t) 0, \
(uint8_t *) 0, (const uint8_t *) 0) \
: gcm_encrypt(&(ctx)->gcm, &(ctx)->key, &(ctx)->cipher, \
(nettle_cipher_func *) (encrypt), \
(length), (dst), (src)))
#define GCM_DECRYPT(ctx, encrypt, length, dst, src) \
(0 ? (encrypt)(&(ctx)->cipher, ~(size_t) 0, \
(uint8_t *) 0, (const uint8_t *) 0) \
: gcm_decrypt(&(ctx)->gcm, &(ctx)->key, &(ctx)->cipher, \
(nettle_cipher_func *) (encrypt), \
(length), (dst), (src)))
#define GCM_DIGEST(ctx, encrypt, length, digest) \
(0 ? (encrypt)(&(ctx)->cipher, ~(size_t) 0, \
(uint8_t *) 0, (const uint8_t *) 0) \
: gcm_digest(&(ctx)->gcm, &(ctx)->key, &(ctx)->cipher, \
(nettle_cipher_func *) (encrypt), \
(length), (digest)))
struct gcm_aes128_ctx GCM_CTX(struct aes128_ctx);
void
gcm_aes128_set_key(struct gcm_aes128_ctx *ctx, const uint8_t *key);
/* FIXME: Define _update and _set_iv as some kind of aliaes,
there's nothing aes-specific. */
void
gcm_aes128_update (struct gcm_aes128_ctx *ctx,
size_t length, const uint8_t *data);
void
gcm_aes128_set_iv (struct gcm_aes128_ctx *ctx,
size_t length, const uint8_t *iv);
void
gcm_aes128_encrypt(struct gcm_aes128_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void
gcm_aes128_decrypt(struct gcm_aes128_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void
gcm_aes128_digest(struct gcm_aes128_ctx *ctx,
size_t length, uint8_t *digest);
struct gcm_aes192_ctx GCM_CTX(struct aes192_ctx);
void
gcm_aes192_set_key(struct gcm_aes192_ctx *ctx, const uint8_t *key);
void
gcm_aes192_update (struct gcm_aes192_ctx *ctx,
size_t length, const uint8_t *data);
void
gcm_aes192_set_iv (struct gcm_aes192_ctx *ctx,
size_t length, const uint8_t *iv);
void
gcm_aes192_encrypt(struct gcm_aes192_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void
gcm_aes192_decrypt(struct gcm_aes192_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void
gcm_aes192_digest(struct gcm_aes192_ctx *ctx,
size_t length, uint8_t *digest);
struct gcm_aes256_ctx GCM_CTX(struct aes256_ctx);
void
gcm_aes256_set_key(struct gcm_aes256_ctx *ctx, const uint8_t *key);
void
gcm_aes256_update (struct gcm_aes256_ctx *ctx,
size_t length, const uint8_t *data);
void
gcm_aes256_set_iv (struct gcm_aes256_ctx *ctx,
size_t length, const uint8_t *iv);
void
gcm_aes256_encrypt(struct gcm_aes256_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void
gcm_aes256_decrypt(struct gcm_aes256_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void
gcm_aes256_digest(struct gcm_aes256_ctx *ctx,
size_t length, uint8_t *digest);
/* Old aes interface, for backwards compatibility */
struct gcm_aes_ctx GCM_CTX(struct aes_ctx);
void
gcm_aes_set_key(struct gcm_aes_ctx *ctx,
size_t length, const uint8_t *key);
void
gcm_aes_set_iv(struct gcm_aes_ctx *ctx,
size_t length, const uint8_t *iv);
void
gcm_aes_update(struct gcm_aes_ctx *ctx,
size_t length, const uint8_t *data);
void
gcm_aes_encrypt(struct gcm_aes_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void
gcm_aes_decrypt(struct gcm_aes_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void
gcm_aes_digest(struct gcm_aes_ctx *ctx, size_t length, uint8_t *digest);
struct gcm_camellia128_ctx GCM_CTX(struct camellia128_ctx);
void gcm_camellia128_set_key(struct gcm_camellia128_ctx *ctx,
const uint8_t *key);
void gcm_camellia128_set_iv(struct gcm_camellia128_ctx *ctx,
size_t length, const uint8_t *iv);
void gcm_camellia128_update(struct gcm_camellia128_ctx *ctx,
size_t length, const uint8_t *data);
void gcm_camellia128_encrypt(struct gcm_camellia128_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void gcm_camellia128_decrypt(struct gcm_camellia128_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void gcm_camellia128_digest(struct gcm_camellia128_ctx *ctx,
size_t length, uint8_t *digest);
struct gcm_camellia256_ctx GCM_CTX(struct camellia256_ctx);
void gcm_camellia256_set_key(struct gcm_camellia256_ctx *ctx,
const uint8_t *key);
void gcm_camellia256_set_iv(struct gcm_camellia256_ctx *ctx,
size_t length, const uint8_t *iv);
void gcm_camellia256_update(struct gcm_camellia256_ctx *ctx,
size_t length, const uint8_t *data);
void gcm_camellia256_encrypt(struct gcm_camellia256_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void gcm_camellia256_decrypt(struct gcm_camellia256_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void gcm_camellia256_digest(struct gcm_camellia256_ctx *ctx,
size_t length, uint8_t *digest);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_GCM_H_INCLUDED */

View File

@ -1,164 +0,0 @@
/* gmp-glue.h
Copyright (C) 2013 Niels Möller
Copyright (C) 2013 Red Hat
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_GMP_GLUE_H_INCLUDED
#define NETTLE_GMP_GLUE_H_INCLUDED
#include "bignum.h"
#ifdef mpz_limbs_read
#define GMP_HAVE_mpz_limbs_read 1
#else
#define GMP_HAVE_mpz_limbs_read 0
#endif
/* Name mangling. */
#if !GMP_HAVE_mpz_limbs_read
#define mpz_limbs_read _nettle_mpz_limbs_read
#define mpz_limbs_write _nettle_mpz_limbs_write
#define mpz_limbs_modify _nettle_mpz_limbs_modify
#define mpz_limbs_finish _nettle_mpz_limbs_finish
#define mpz_roinit_n _nettle_mpz_roinit_n
#endif
#define cnd_swap _nettle_cnd_swap
#define mpz_limbs_cmp _nettle_mpz_limbs_cmp
#define mpz_limbs_read_n _nettle_mpz_limbs_read_n
#define mpz_limbs_copy _nettle_mpz_limbs_copy
#define mpz_set_n _nettle_mpz_set_n
#define mpn_set_base256 _nettle_mpn_set_base256
#define mpn_set_base256_le _nettle_mpn_set_base256_le
#define mpn_get_base256_le _nettle_mpn_get_base256_le
#define gmp_alloc_limbs _nettle_gmp_alloc_limbs
#define gmp_free_limbs _nettle_gmp_free_limbs
#define gmp_free _nettle_gmp_free
#define gmp_alloc _nettle_gmp_alloc
#define TMP_GMP_DECL(name, type) type *name; \
size_t tmp_##name##_size
#define TMP_GMP_ALLOC(name, size) do { \
tmp_##name##_size = (size); \
(name) = gmp_alloc(sizeof (*name) * (size)); \
} while (0)
#define TMP_GMP_FREE(name) (gmp_free(name, tmp_##name##_size))
/* Use only in-place operations, so we can fall back to addmul_1/submul_1 */
#ifdef mpn_cnd_add_n
# define cnd_add_n(cnd, rp, ap, n) mpn_cnd_add_n ((cnd), (rp), (rp), (ap), (n))
# define cnd_sub_n(cnd, rp, ap, n) mpn_cnd_sub_n ((cnd), (rp), (rp), (ap), (n))
#else
# define cnd_add_n(cnd, rp, ap, n) mpn_addmul_1 ((rp), (ap), (n), (cnd) != 0)
# define cnd_sub_n(cnd, rp, ap, n) mpn_submul_1 ((rp), (ap), (n), (cnd) != 0)
#endif
/* Some functions for interfacing between mpz and mpn code. Signs of
the mpz numbers are generally ignored. */
#if !GMP_HAVE_mpz_limbs_read
/* Read access to mpz numbers. */
/* Return limb pointer, for read-only operations. Use mpz_size to get
the number of limbs. */
const mp_limb_t *
mpz_limbs_read (const mpz_srcptr x);
/* Write access to mpz numbers. */
/* Get a limb pointer for writing, previous contents may be
destroyed. */
mp_limb_t *
mpz_limbs_write (mpz_ptr x, mp_size_t n);
/* Get a limb pointer for writing, previous contents is intact. */
mp_limb_t *
mpz_limbs_modify (mpz_ptr x, mp_size_t n);
/* Update size. */
void
mpz_limbs_finish (mpz_ptr x, mp_size_t n);
/* Using an mpn number as an mpz. Can be used for read-only access
only. x must not be cleared or reallocated. */
mpz_srcptr
mpz_roinit_n (mpz_ptr x, const mp_limb_t *xp, mp_size_t xs);
#endif /* !GMP_HAVE_mpz_limbs_read */
void
cnd_swap (mp_limb_t cnd, mp_limb_t *ap, mp_limb_t *bp, mp_size_t n);
/* Convenience functions */
int
mpz_limbs_cmp (mpz_srcptr a, const mp_limb_t *bp, mp_size_t bn);
/* Get a pointer to an n limb area, for read-only operation. n must be
greater or equal to the current size, and the mpz is zero-padded if
needed. */
const mp_limb_t *
mpz_limbs_read_n (mpz_ptr x, mp_size_t n);
/* Copy limbs, with zero-padding. */
/* FIXME: Reorder arguments, on the theory that the first argument of
an _mpz_* function should be an mpz_t? Or rename to _mpz_get_limbs,
with argument order consistent with mpz_get_*. */
void
mpz_limbs_copy (mp_limb_t *xp, mpz_srcptr x, mp_size_t n);
void
mpz_set_n (mpz_t r, const mp_limb_t *xp, mp_size_t xn);
/* Like mpn_set_str, but always writes rn limbs. If input is larger,
higher bits are ignored. */
void
mpn_set_base256 (mp_limb_t *rp, mp_size_t rn,
const uint8_t *xp, size_t xn);
void
mpn_set_base256_le (mp_limb_t *rp, mp_size_t rn,
const uint8_t *xp, size_t xn);
void
mpn_get_base256_le (uint8_t *rp, size_t rn,
const mp_limb_t *xp, mp_size_t xn);
mp_limb_t *
gmp_alloc_limbs (mp_size_t n);
void
gmp_free_limbs (mp_limb_t *p, mp_size_t n);
void *gmp_alloc(size_t n);
void gmp_free(void *p, size_t n);
#endif /* NETTLE_GMP_GLUE_H_INCLUDED */

View File

@ -1,98 +0,0 @@
/* gosthash94.h
The GOST R 34.11-94 hash function, described in RFC 5831.
Copyright (C) 2012 Nikos Mavrogiannopoulos, Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
/* Based on rhash gost.h. */
/* Copyright: 2009-2012 Aleksey Kravchenko <rhash.admin@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Ported to nettle by Nikos Mavrogiannopoulos.
*/
#ifndef NETTLE_GOSTHASH94_H_INCLUDED
#define NETTLE_GOSTHASH94_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
#define gosthash94_init nettle_gosthash94_init
#define gosthash94_update nettle_gosthash94_update
#define gosthash94_digest nettle_gosthash94_digest
#define GOSTHASH94_BLOCK_SIZE 32
#define GOSTHASH94_DIGEST_SIZE 32
/* For backwards compatibility */
#define GOSTHASH94_DATA_SIZE GOSTHASH94_BLOCK_SIZE
struct gosthash94_ctx
{
uint32_t hash[8]; /* algorithm 256-bit state */
uint32_t sum[8]; /* sum of processed message blocks */
uint8_t message[GOSTHASH94_BLOCK_SIZE]; /* 256-bit buffer for leftovers */
uint64_t length; /* number of processed bytes */
};
void gosthash94_init(struct gosthash94_ctx *ctx);
void gosthash94_update(struct gosthash94_ctx *ctx,
size_t length, const uint8_t *msg);
void gosthash94_digest(struct gosthash94_ctx *ctx,
size_t length, uint8_t *result);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_GOSTHASH94_H_INCLUDED */

View File

@ -1,67 +0,0 @@
/* hkdf.h
TLS PRF code (RFC-5246, RFC-2246).
Copyright (C) 2017 Red Hat, Inc.
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_HKDF_H_INCLUDED
#define NETTLE_HKDF_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Namespace mangling */
#define hkdf_extract nettle_hkdf_extract
#define hkdf_expand nettle_hkdf_expand
void
hkdf_extract(void *mac_ctx,
nettle_hash_update_func *update,
nettle_hash_digest_func *digest,
size_t digest_size,
size_t secret_size, const uint8_t *secret,
uint8_t *dst);
void
hkdf_expand(void *mac_ctx,
nettle_hash_update_func *update,
nettle_hash_digest_func *digest,
size_t digest_size,
size_t info_size, const uint8_t *info,
size_t length, uint8_t *dst);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_HKDF_H_INCLUDED */

View File

@ -1,210 +0,0 @@
/* hmac.h
HMAC message authentication code (RFC-2104).
Copyright (C) 2001, 2002 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_HMAC_H_INCLUDED
#define NETTLE_HMAC_H_INCLUDED
#include "nettle-meta.h"
#include "md5.h"
#include "ripemd160.h"
#include "sha1.h"
#include "sha2.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Namespace mangling */
#define hmac_set_key nettle_hmac_set_key
#define hmac_update nettle_hmac_update
#define hmac_digest nettle_hmac_digest
#define hmac_md5_set_key nettle_hmac_md5_set_key
#define hmac_md5_update nettle_hmac_md5_update
#define hmac_md5_digest nettle_hmac_md5_digest
#define hmac_ripemd160_set_key nettle_hmac_ripemd160_set_key
#define hmac_ripemd160_update nettle_hmac_ripemd160_update
#define hmac_ripemd160_digest nettle_hmac_ripemd160_digest
#define hmac_sha1_set_key nettle_hmac_sha1_set_key
#define hmac_sha1_update nettle_hmac_sha1_update
#define hmac_sha1_digest nettle_hmac_sha1_digest
#define hmac_sha224_set_key nettle_hmac_sha224_set_key
#define hmac_sha224_digest nettle_hmac_sha224_digest
#define hmac_sha256_set_key nettle_hmac_sha256_set_key
#define hmac_sha256_update nettle_hmac_sha256_update
#define hmac_sha256_digest nettle_hmac_sha256_digest
#define hmac_sha384_set_key nettle_hmac_sha384_set_key
#define hmac_sha384_digest nettle_hmac_sha384_digest
#define hmac_sha512_set_key nettle_hmac_sha512_set_key
#define hmac_sha512_update nettle_hmac_sha512_update
#define hmac_sha512_digest nettle_hmac_sha512_digest
void
hmac_set_key(void *outer, void *inner, void *state,
const struct nettle_hash *hash,
size_t length, const uint8_t *key);
/* This function is not strictly needed, it's s just the same as the
* hash update function. */
void
hmac_update(void *state,
const struct nettle_hash *hash,
size_t length, const uint8_t *data);
void
hmac_digest(const void *outer, const void *inner, void *state,
const struct nettle_hash *hash,
size_t length, uint8_t *digest);
#define HMAC_CTX(type) \
{ type outer; type inner; type state; }
#define HMAC_SET_KEY(ctx, hash, length, key) \
hmac_set_key( &(ctx)->outer, &(ctx)->inner, &(ctx)->state, \
(hash), (length), (key) )
#define HMAC_DIGEST(ctx, hash, length, digest) \
hmac_digest( &(ctx)->outer, &(ctx)->inner, &(ctx)->state, \
(hash), (length), (digest) )
/* HMAC using specific hash functions */
/* hmac-md5 */
struct hmac_md5_ctx HMAC_CTX(struct md5_ctx);
void
hmac_md5_set_key(struct hmac_md5_ctx *ctx,
size_t key_length, const uint8_t *key);
void
hmac_md5_update(struct hmac_md5_ctx *ctx,
size_t length, const uint8_t *data);
void
hmac_md5_digest(struct hmac_md5_ctx *ctx,
size_t length, uint8_t *digest);
/* hmac-ripemd160 */
struct hmac_ripemd160_ctx HMAC_CTX(struct ripemd160_ctx);
void
hmac_ripemd160_set_key(struct hmac_ripemd160_ctx *ctx,
size_t key_length, const uint8_t *key);
void
hmac_ripemd160_update(struct hmac_ripemd160_ctx *ctx,
size_t length, const uint8_t *data);
void
hmac_ripemd160_digest(struct hmac_ripemd160_ctx *ctx,
size_t length, uint8_t *digest);
/* hmac-sha1 */
struct hmac_sha1_ctx HMAC_CTX(struct sha1_ctx);
void
hmac_sha1_set_key(struct hmac_sha1_ctx *ctx,
size_t key_length, const uint8_t *key);
void
hmac_sha1_update(struct hmac_sha1_ctx *ctx,
size_t length, const uint8_t *data);
void
hmac_sha1_digest(struct hmac_sha1_ctx *ctx,
size_t length, uint8_t *digest);
/* hmac-sha256 */
struct hmac_sha256_ctx HMAC_CTX(struct sha256_ctx);
void
hmac_sha256_set_key(struct hmac_sha256_ctx *ctx,
size_t key_length, const uint8_t *key);
void
hmac_sha256_update(struct hmac_sha256_ctx *ctx,
size_t length, const uint8_t *data);
void
hmac_sha256_digest(struct hmac_sha256_ctx *ctx,
size_t length, uint8_t *digest);
/* hmac-sha224 */
#define hmac_sha224_ctx hmac_sha256_ctx
void
hmac_sha224_set_key(struct hmac_sha224_ctx *ctx,
size_t key_length, const uint8_t *key);
#define hmac_sha224_update nettle_hmac_sha256_update
void
hmac_sha224_digest(struct hmac_sha224_ctx *ctx,
size_t length, uint8_t *digest);
/* hmac-sha512 */
struct hmac_sha512_ctx HMAC_CTX(struct sha512_ctx);
void
hmac_sha512_set_key(struct hmac_sha512_ctx *ctx,
size_t key_length, const uint8_t *key);
void
hmac_sha512_update(struct hmac_sha512_ctx *ctx,
size_t length, const uint8_t *data);
void
hmac_sha512_digest(struct hmac_sha512_ctx *ctx,
size_t length, uint8_t *digest);
/* hmac-sha384 */
#define hmac_sha384_ctx hmac_sha512_ctx
void
hmac_sha384_set_key(struct hmac_sha512_ctx *ctx,
size_t key_length, const uint8_t *key);
#define hmac_sha384_update nettle_hmac_sha512_update
void
hmac_sha384_digest(struct hmac_sha512_ctx *ctx,
size_t length, uint8_t *digest);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_HMAC_H_INCLUDED */

View File

@ -1,80 +0,0 @@
/* knuth-lfib.h
The "lagged fibonacci" pseudorandomness generator, described in
Knuth, TAoCP, 3.6
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
/* NOTE: This generator is totally inappropriate for cryptographic
* applications. It is useful for generating deterministic but
* random-looking test data, and is used by the Nettle testsuite. */
#ifndef NETTLE_KNUTH_LFIB_H_INCLUDED
#define NETTLE_KNUTH_LFIB_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Namespace mangling */
#define knuth_lfib_init nettle_knuth_lfib_init
#define knuth_lfib_get nettle_knuth_lfib_get
#define knuth_lfib_get_array nettle_knuth_lfib_get_array
#define knuth_lfib_random nettle_knuth_lfib_random
#define _KNUTH_LFIB_KK 100
struct knuth_lfib_ctx
{
uint32_t x[_KNUTH_LFIB_KK];
unsigned index;
};
void
knuth_lfib_init(struct knuth_lfib_ctx *ctx, uint32_t seed);
/* Get's a single number in the range 0 ... 2^30-1 */
uint32_t
knuth_lfib_get(struct knuth_lfib_ctx *ctx);
/* Get an array of numbers */
void
knuth_lfib_get_array(struct knuth_lfib_ctx *ctx,
size_t n, uint32_t *a);
/* Get an array of octets. */
void
knuth_lfib_random(struct knuth_lfib_ctx *ctx,
size_t n, uint8_t *dst);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_KNUTH_LFIB_H_INCLUDED */

View File

@ -1,245 +0,0 @@
/* macros.h
Copyright (C) 2001, 2010 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_MACROS_H_INCLUDED
#define NETTLE_MACROS_H_INCLUDED
/* Reads a 64-bit integer, in network, big-endian, byte order */
#define READ_UINT64(p) \
( (((uint64_t) (p)[0]) << 56) \
| (((uint64_t) (p)[1]) << 48) \
| (((uint64_t) (p)[2]) << 40) \
| (((uint64_t) (p)[3]) << 32) \
| (((uint64_t) (p)[4]) << 24) \
| (((uint64_t) (p)[5]) << 16) \
| (((uint64_t) (p)[6]) << 8) \
| ((uint64_t) (p)[7]))
#define WRITE_UINT64(p, i) \
do { \
(p)[0] = ((i) >> 56) & 0xff; \
(p)[1] = ((i) >> 48) & 0xff; \
(p)[2] = ((i) >> 40) & 0xff; \
(p)[3] = ((i) >> 32) & 0xff; \
(p)[4] = ((i) >> 24) & 0xff; \
(p)[5] = ((i) >> 16) & 0xff; \
(p)[6] = ((i) >> 8) & 0xff; \
(p)[7] = (i) & 0xff; \
} while(0)
/* Reads a 32-bit integer, in network, big-endian, byte order */
#define READ_UINT32(p) \
( (((uint32_t) (p)[0]) << 24) \
| (((uint32_t) (p)[1]) << 16) \
| (((uint32_t) (p)[2]) << 8) \
| ((uint32_t) (p)[3]))
#define WRITE_UINT32(p, i) \
do { \
(p)[0] = ((i) >> 24) & 0xff; \
(p)[1] = ((i) >> 16) & 0xff; \
(p)[2] = ((i) >> 8) & 0xff; \
(p)[3] = (i) & 0xff; \
} while(0)
/* Analogous macros, for 24 and 16 bit numbers */
#define READ_UINT24(p) \
( (((uint32_t) (p)[0]) << 16) \
| (((uint32_t) (p)[1]) << 8) \
| ((uint32_t) (p)[2]))
#define WRITE_UINT24(p, i) \
do { \
(p)[0] = ((i) >> 16) & 0xff; \
(p)[1] = ((i) >> 8) & 0xff; \
(p)[2] = (i) & 0xff; \
} while(0)
#define READ_UINT16(p) \
( (((uint32_t) (p)[0]) << 8) \
| ((uint32_t) (p)[1]))
#define WRITE_UINT16(p, i) \
do { \
(p)[0] = ((i) >> 8) & 0xff; \
(p)[1] = (i) & 0xff; \
} while(0)
/* And the other, little-endian, byteorder */
#define LE_READ_UINT64(p) \
( (((uint64_t) (p)[7]) << 56) \
| (((uint64_t) (p)[6]) << 48) \
| (((uint64_t) (p)[5]) << 40) \
| (((uint64_t) (p)[4]) << 32) \
| (((uint64_t) (p)[3]) << 24) \
| (((uint64_t) (p)[2]) << 16) \
| (((uint64_t) (p)[1]) << 8) \
| ((uint64_t) (p)[0]))
#define LE_WRITE_UINT64(p, i) \
do { \
(p)[7] = ((i) >> 56) & 0xff; \
(p)[6] = ((i) >> 48) & 0xff; \
(p)[5] = ((i) >> 40) & 0xff; \
(p)[4] = ((i) >> 32) & 0xff; \
(p)[3] = ((i) >> 24) & 0xff; \
(p)[2] = ((i) >> 16) & 0xff; \
(p)[1] = ((i) >> 8) & 0xff; \
(p)[0] = (i) & 0xff; \
} while (0)
#define LE_READ_UINT32(p) \
( (((uint32_t) (p)[3]) << 24) \
| (((uint32_t) (p)[2]) << 16) \
| (((uint32_t) (p)[1]) << 8) \
| ((uint32_t) (p)[0]))
#define LE_WRITE_UINT32(p, i) \
do { \
(p)[3] = ((i) >> 24) & 0xff; \
(p)[2] = ((i) >> 16) & 0xff; \
(p)[1] = ((i) >> 8) & 0xff; \
(p)[0] = (i) & 0xff; \
} while(0)
/* Analogous macros, for 16 bit numbers */
#define LE_READ_UINT16(p) \
( (((uint32_t) (p)[1]) << 8) \
| ((uint32_t) (p)[0]))
#define LE_WRITE_UINT16(p, i) \
do { \
(p)[1] = ((i) >> 8) & 0xff; \
(p)[0] = (i) & 0xff; \
} while(0)
/* Macro to make it easier to loop over several blocks. */
#define FOR_BLOCKS(length, dst, src, blocksize) \
assert( !((length) % (blocksize))); \
for (; (length); ((length) -= (blocksize), \
(dst) += (blocksize), \
(src) += (blocksize)) )
/* The masking of the right shift is needed to allow n == 0 (using
just 32 - n and 64 - n results in undefined behaviour). Most uses
of these macros use a constant and non-zero rotation count. */
#define ROTL32(n,x) (((x)<<(n)) | ((x)>>((-(n)&31))))
#define ROTL64(n,x) (((x)<<(n)) | ((x)>>((-(n))&63)))
/* Requires that size > 0 */
#define INCREMENT(size, ctr) \
do { \
unsigned increment_i = (size) - 1; \
if (++(ctr)[increment_i] == 0) \
while (increment_i > 0 \
&& ++(ctr)[--increment_i] == 0 ) \
; \
} while (0)
/* Helper macro for Merkle-Damgård hash functions. Assumes the context
structs includes the following fields:
uint8_t block[...]; // Buffer holding one block
unsigned int index; // Index into block
*/
/* Currently used by sha512 (and sha384) only. */
#define MD_INCR(ctx) ((ctx)->count_high += !++(ctx)->count_low)
/* Takes the compression function f as argument. NOTE: also clobbers
length and data. */
#define MD_UPDATE(ctx, length, data, f, incr) \
do { \
if ((ctx)->index) \
{ \
/* Try to fill partial block */ \
unsigned __md_left = sizeof((ctx)->block) - (ctx)->index; \
if ((length) < __md_left) \
{ \
memcpy((ctx)->block + (ctx)->index, (data), (length)); \
(ctx)->index += (length); \
goto __md_done; /* Finished */ \
} \
else \
{ \
memcpy((ctx)->block + (ctx)->index, (data), __md_left); \
\
f((ctx), (ctx)->block); \
(incr); \
\
(data) += __md_left; \
(length) -= __md_left; \
} \
} \
while ((length) >= sizeof((ctx)->block)) \
{ \
f((ctx), (data)); \
(incr); \
\
(data) += sizeof((ctx)->block); \
(length) -= sizeof((ctx)->block); \
} \
memcpy ((ctx)->block, (data), (length)); \
(ctx)->index = (length); \
__md_done: \
; \
} while (0)
/* Pads the block to a block boundary with the bit pattern 1 0*,
leaving size octets for the length field at the end. If needed,
compresses the block and starts a new one. */
#define MD_PAD(ctx, size, f) \
do { \
unsigned __md_i; \
__md_i = (ctx)->index; \
\
/* Set the first char of padding to 0x80. This is safe since there \
is always at least one byte free */ \
\
assert(__md_i < sizeof((ctx)->block)); \
(ctx)->block[__md_i++] = 0x80; \
\
if (__md_i > (sizeof((ctx)->block) - (size))) \
{ /* No room for length in this block. Process it and \
pad with another one */ \
memset((ctx)->block + __md_i, 0, sizeof((ctx)->block) - __md_i); \
\
f((ctx), (ctx)->block); \
__md_i = 0; \
} \
memset((ctx)->block + __md_i, 0, \
sizeof((ctx)->block) - (size) - __md_i); \
\
} while (0)
#endif /* NETTLE_MACROS_H_INCLUDED */

View File

@ -1,83 +0,0 @@
/* md4.h
The MD4 hash function, described in RFC 1320.
Copyright (C) 2003 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_MD4_H_INCLUDED
#define NETTLE_MD4_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define md4_init nettle_md4_init
#define md4_update nettle_md4_update
#define md4_digest nettle_md4_digest
#define MD4_DIGEST_SIZE 16
#define MD4_BLOCK_SIZE 64
/* For backwards compatibility */
#define MD4_DATA_SIZE MD4_BLOCK_SIZE
/* Digest is kept internally as 4 32-bit words. */
#define _MD4_DIGEST_LENGTH 4
/* FIXME: Identical to md5_ctx */
struct md4_ctx
{
uint32_t state[_MD4_DIGEST_LENGTH];
uint64_t count; /* Block count */
uint8_t block[MD4_BLOCK_SIZE]; /* Block buffer */
unsigned index; /* Into buffer */
};
void
md4_init(struct md4_ctx *ctx);
void
md4_update(struct md4_ctx *ctx,
size_t length,
const uint8_t *data);
void
md4_digest(struct md4_ctx *ctx,
size_t length,
uint8_t *digest);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_MD4_H_INCLUDED */

View File

@ -1,58 +0,0 @@
/* md5-compat.h
The md5 hash function, RFC 1321-style interface.
Copyright (C) 2001 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_MD5_COMPAT_H_INCLUDED
#define NETTLE_MD5_COMPAT_H_INCLUDED
#include "md5.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define MD5Init nettle_MD5Init
#define MD5Update nettle_MD5Update
#define MD5Final nettle_MD5Final
typedef struct md5_ctx MD5_CTX;
void MD5Init(MD5_CTX *ctx);
void MD5Update(MD5_CTX *ctx, const unsigned char *data, unsigned int length);
void MD5Final(unsigned char *out, MD5_CTX *ctx);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_MD5_COMPAT_H_INCLUDED */

View File

@ -1,51 +0,0 @@
/* memops.h
Copyright (C) 2016 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_MEMOPS_H_INCLUDED
#define NETTLE_MEMOPS_H_INCLUDED
#include "memxor.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define memeql_sec nettle_memeql_sec
int
memeql_sec (const void *a, const void *b, size_t n);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_MEMOPS_H_INCLUDED */

View File

@ -1,25 +0,0 @@
/* memxor.h
*
*/
#ifndef NETTLE_MEMXOR_H_INCLUDED
#define NETTLE_MEMXOR_H_INCLUDED
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define memxor nettle_memxor
#define memxor3 nettle_memxor3
void *memxor(void *dst, const void *src, size_t n);
void *memxor3(void *dst, const void *a, const void *b, size_t n);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_MEMXOR_H_INCLUDED */

View File

@ -1,298 +0,0 @@
/* mini-gmp, a minimalistic implementation of a GNU GMP subset.
Copyright 2011-2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
or both in parallel, as here.
The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received copies of the GNU General Public License and the
GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
/* About mini-gmp: This is a minimal implementation of a subset of the
GMP interface. It is intended for inclusion into applications which
have modest bignums needs, as a fallback when the real GMP library
is not installed.
This file defines the public interface. */
#ifndef __MINI_GMP_H__
#define __MINI_GMP_H__
/* For size_t */
#include <stddef.h>
#if defined (__cplusplus)
extern "C" {
#endif
void mp_set_memory_functions (void *(*) (size_t),
void *(*) (void *, size_t, size_t),
void (*) (void *, size_t));
void mp_get_memory_functions (void *(**) (size_t),
void *(**) (void *, size_t, size_t),
void (**) (void *, size_t));
typedef unsigned long mp_limb_t;
typedef long mp_size_t;
typedef unsigned long mp_bitcnt_t;
typedef mp_limb_t *mp_ptr;
typedef const mp_limb_t *mp_srcptr;
typedef struct
{
int _mp_alloc; /* Number of *limbs* allocated and pointed
to by the _mp_d field. */
int _mp_size; /* abs(_mp_size) is the number of limbs the
last field points to. If _mp_size is
negative this is a negative number. */
mp_limb_t *_mp_d; /* Pointer to the limbs. */
} __mpz_struct;
typedef __mpz_struct mpz_t[1];
typedef __mpz_struct *mpz_ptr;
typedef const __mpz_struct *mpz_srcptr;
extern const int mp_bits_per_limb;
void mpn_copyi (mp_ptr, mp_srcptr, mp_size_t);
void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
void mpn_zero (mp_ptr, mp_size_t);
int mpn_cmp (mp_srcptr, mp_srcptr, mp_size_t);
int mpn_zero_p (mp_srcptr, mp_size_t);
mp_limb_t mpn_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
mp_limb_t mpn_add_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
mp_limb_t mpn_add (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
mp_limb_t mpn_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
mp_limb_t mpn_sub_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
mp_limb_t mpn_sub (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
mp_limb_t mpn_mul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
mp_limb_t mpn_addmul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
mp_limb_t mpn_submul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
mp_limb_t mpn_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
void mpn_mul_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
void mpn_sqr (mp_ptr, mp_srcptr, mp_size_t);
int mpn_perfect_square_p (mp_srcptr, mp_size_t);
mp_size_t mpn_sqrtrem (mp_ptr, mp_ptr, mp_srcptr, mp_size_t);
mp_limb_t mpn_lshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
mp_limb_t mpn_rshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
mp_bitcnt_t mpn_scan0 (mp_srcptr, mp_bitcnt_t);
mp_bitcnt_t mpn_scan1 (mp_srcptr, mp_bitcnt_t);
void mpn_com (mp_ptr, mp_srcptr, mp_size_t);
mp_limb_t mpn_neg (mp_ptr, mp_srcptr, mp_size_t);
mp_bitcnt_t mpn_popcount (mp_srcptr, mp_size_t);
mp_limb_t mpn_invert_3by2 (mp_limb_t, mp_limb_t);
#define mpn_invert_limb(x) mpn_invert_3by2 ((x), 0)
size_t mpn_get_str (unsigned char *, int, mp_ptr, mp_size_t);
mp_size_t mpn_set_str (mp_ptr, const unsigned char *, size_t, int);
void mpz_init (mpz_t);
void mpz_init2 (mpz_t, mp_bitcnt_t);
void mpz_clear (mpz_t);
#define mpz_odd_p(z) (((z)->_mp_size != 0) & (int) (z)->_mp_d[0])
#define mpz_even_p(z) (! mpz_odd_p (z))
int mpz_sgn (const mpz_t);
int mpz_cmp_si (const mpz_t, long);
int mpz_cmp_ui (const mpz_t, unsigned long);
int mpz_cmp (const mpz_t, const mpz_t);
int mpz_cmpabs_ui (const mpz_t, unsigned long);
int mpz_cmpabs (const mpz_t, const mpz_t);
int mpz_cmp_d (const mpz_t, double);
int mpz_cmpabs_d (const mpz_t, double);
void mpz_abs (mpz_t, const mpz_t);
void mpz_neg (mpz_t, const mpz_t);
void mpz_swap (mpz_t, mpz_t);
void mpz_add_ui (mpz_t, const mpz_t, unsigned long);
void mpz_add (mpz_t, const mpz_t, const mpz_t);
void mpz_sub_ui (mpz_t, const mpz_t, unsigned long);
void mpz_ui_sub (mpz_t, unsigned long, const mpz_t);
void mpz_sub (mpz_t, const mpz_t, const mpz_t);
void mpz_mul_si (mpz_t, const mpz_t, long int);
void mpz_mul_ui (mpz_t, const mpz_t, unsigned long int);
void mpz_mul (mpz_t, const mpz_t, const mpz_t);
void mpz_mul_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
void mpz_addmul_ui (mpz_t, const mpz_t, unsigned long int);
void mpz_addmul (mpz_t, const mpz_t, const mpz_t);
void mpz_submul_ui (mpz_t, const mpz_t, unsigned long int);
void mpz_submul (mpz_t, const mpz_t, const mpz_t);
void mpz_cdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
void mpz_fdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
void mpz_tdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
void mpz_cdiv_q (mpz_t, const mpz_t, const mpz_t);
void mpz_fdiv_q (mpz_t, const mpz_t, const mpz_t);
void mpz_tdiv_q (mpz_t, const mpz_t, const mpz_t);
void mpz_cdiv_r (mpz_t, const mpz_t, const mpz_t);
void mpz_fdiv_r (mpz_t, const mpz_t, const mpz_t);
void mpz_tdiv_r (mpz_t, const mpz_t, const mpz_t);
void mpz_cdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
void mpz_fdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
void mpz_tdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
void mpz_cdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
void mpz_fdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
void mpz_tdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
void mpz_mod (mpz_t, const mpz_t, const mpz_t);
void mpz_divexact (mpz_t, const mpz_t, const mpz_t);
int mpz_divisible_p (const mpz_t, const mpz_t);
int mpz_congruent_p (const mpz_t, const mpz_t, const mpz_t);
unsigned long mpz_cdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
unsigned long mpz_fdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
unsigned long mpz_tdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
unsigned long mpz_cdiv_q_ui (mpz_t, const mpz_t, unsigned long);
unsigned long mpz_fdiv_q_ui (mpz_t, const mpz_t, unsigned long);
unsigned long mpz_tdiv_q_ui (mpz_t, const mpz_t, unsigned long);
unsigned long mpz_cdiv_r_ui (mpz_t, const mpz_t, unsigned long);
unsigned long mpz_fdiv_r_ui (mpz_t, const mpz_t, unsigned long);
unsigned long mpz_tdiv_r_ui (mpz_t, const mpz_t, unsigned long);
unsigned long mpz_cdiv_ui (const mpz_t, unsigned long);
unsigned long mpz_fdiv_ui (const mpz_t, unsigned long);
unsigned long mpz_tdiv_ui (const mpz_t, unsigned long);
unsigned long mpz_mod_ui (mpz_t, const mpz_t, unsigned long);
void mpz_divexact_ui (mpz_t, const mpz_t, unsigned long);
int mpz_divisible_ui_p (const mpz_t, unsigned long);
unsigned long mpz_gcd_ui (mpz_t, const mpz_t, unsigned long);
void mpz_gcd (mpz_t, const mpz_t, const mpz_t);
void mpz_gcdext (mpz_t, mpz_t, mpz_t, const mpz_t, const mpz_t);
void mpz_lcm_ui (mpz_t, const mpz_t, unsigned long);
void mpz_lcm (mpz_t, const mpz_t, const mpz_t);
int mpz_invert (mpz_t, const mpz_t, const mpz_t);
void mpz_sqrtrem (mpz_t, mpz_t, const mpz_t);
void mpz_sqrt (mpz_t, const mpz_t);
int mpz_perfect_square_p (const mpz_t);
void mpz_pow_ui (mpz_t, const mpz_t, unsigned long);
void mpz_ui_pow_ui (mpz_t, unsigned long, unsigned long);
void mpz_powm (mpz_t, const mpz_t, const mpz_t, const mpz_t);
void mpz_powm_ui (mpz_t, const mpz_t, unsigned long, const mpz_t);
void mpz_rootrem (mpz_t, mpz_t, const mpz_t, unsigned long);
int mpz_root (mpz_t, const mpz_t, unsigned long);
void mpz_fac_ui (mpz_t, unsigned long);
void mpz_bin_uiui (mpz_t, unsigned long, unsigned long);
int mpz_probab_prime_p (const mpz_t, int);
int mpz_tstbit (const mpz_t, mp_bitcnt_t);
void mpz_setbit (mpz_t, mp_bitcnt_t);
void mpz_clrbit (mpz_t, mp_bitcnt_t);
void mpz_combit (mpz_t, mp_bitcnt_t);
void mpz_com (mpz_t, const mpz_t);
void mpz_and (mpz_t, const mpz_t, const mpz_t);
void mpz_ior (mpz_t, const mpz_t, const mpz_t);
void mpz_xor (mpz_t, const mpz_t, const mpz_t);
mp_bitcnt_t mpz_popcount (const mpz_t);
mp_bitcnt_t mpz_hamdist (const mpz_t, const mpz_t);
mp_bitcnt_t mpz_scan0 (const mpz_t, mp_bitcnt_t);
mp_bitcnt_t mpz_scan1 (const mpz_t, mp_bitcnt_t);
int mpz_fits_slong_p (const mpz_t);
int mpz_fits_ulong_p (const mpz_t);
long int mpz_get_si (const mpz_t);
unsigned long int mpz_get_ui (const mpz_t);
double mpz_get_d (const mpz_t);
size_t mpz_size (const mpz_t);
mp_limb_t mpz_getlimbn (const mpz_t, mp_size_t);
void mpz_realloc2 (mpz_t, mp_bitcnt_t);
mp_srcptr mpz_limbs_read (mpz_srcptr);
mp_ptr mpz_limbs_modify (mpz_t, mp_size_t);
mp_ptr mpz_limbs_write (mpz_t, mp_size_t);
void mpz_limbs_finish (mpz_t, mp_size_t);
mpz_srcptr mpz_roinit_n (mpz_t, mp_srcptr, mp_size_t);
#define MPZ_ROINIT_N(xp, xs) {{0, (xs),(xp) }}
void mpz_set_si (mpz_t, signed long int);
void mpz_set_ui (mpz_t, unsigned long int);
void mpz_set (mpz_t, const mpz_t);
void mpz_set_d (mpz_t, double);
void mpz_init_set_si (mpz_t, signed long int);
void mpz_init_set_ui (mpz_t, unsigned long int);
void mpz_init_set (mpz_t, const mpz_t);
void mpz_init_set_d (mpz_t, double);
size_t mpz_sizeinbase (const mpz_t, int);
char *mpz_get_str (char *, int, const mpz_t);
int mpz_set_str (mpz_t, const char *, int);
int mpz_init_set_str (mpz_t, const char *, int);
/* This long list taken from gmp.h. */
/* For reference, "defined(EOF)" cannot be used here. In g++ 2.95.4,
<iostream> defines EOF but not FILE. */
#if defined (FILE) \
|| defined (H_STDIO) \
|| defined (_H_STDIO) /* AIX */ \
|| defined (_STDIO_H) /* glibc, Sun, SCO */ \
|| defined (_STDIO_H_) /* BSD, OSF */ \
|| defined (__STDIO_H) /* Borland */ \
|| defined (__STDIO_H__) /* IRIX */ \
|| defined (_STDIO_INCLUDED) /* HPUX */ \
|| defined (__dj_include_stdio_h_) /* DJGPP */ \
|| defined (_FILE_DEFINED) /* Microsoft */ \
|| defined (__STDIO__) /* Apple MPW MrC */ \
|| defined (_MSL_STDIO_H) /* Metrowerks */ \
|| defined (_STDIO_H_INCLUDED) /* QNX4 */ \
|| defined (_ISO_STDIO_ISO_H) /* Sun C++ */ \
|| defined (__STDIO_LOADED) /* VMS */
size_t mpz_out_str (FILE *, int, const mpz_t);
#endif
void mpz_import (mpz_t, size_t, int, size_t, int, size_t, const void *);
void *mpz_export (void *, size_t *, int, size_t, int, size_t, const mpz_t);
#if defined (__cplusplus)
}
#endif
#endif /* __MINI_GMP_H__ */

View File

@ -1,277 +0,0 @@
/* nettle-meta.h
Information about algorithms.
Copyright (C) 2002, 2014 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_META_H_INCLUDED
#define NETTLE_META_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
struct nettle_cipher
{
const char *name;
unsigned context_size;
/* Zero for stream ciphers */
unsigned block_size;
/* Suggested key size; other sizes are sometimes possible. */
unsigned key_size;
nettle_set_key_func *set_encrypt_key;
nettle_set_key_func *set_decrypt_key;
nettle_cipher_func *encrypt;
nettle_cipher_func *decrypt;
};
/* FIXME: Rename with leading underscore, but keep current name (and
size!) for now, for ABI compatibility with nettle-3.1, soname
libnettle.so.6. */
/* null-terminated list of ciphers implemented by this version of nettle */
extern const struct nettle_cipher * const nettle_ciphers[];
const struct nettle_cipher * const *
#ifdef __GNUC__
__attribute__((pure))
#endif
nettle_get_ciphers (void);
#define nettle_ciphers (nettle_get_ciphers())
extern const struct nettle_cipher nettle_aes128;
extern const struct nettle_cipher nettle_aes192;
extern const struct nettle_cipher nettle_aes256;
extern const struct nettle_cipher nettle_camellia128;
extern const struct nettle_cipher nettle_camellia192;
extern const struct nettle_cipher nettle_camellia256;
extern const struct nettle_cipher nettle_cast128;
extern const struct nettle_cipher nettle_serpent128;
extern const struct nettle_cipher nettle_serpent192;
extern const struct nettle_cipher nettle_serpent256;
extern const struct nettle_cipher nettle_twofish128;
extern const struct nettle_cipher nettle_twofish192;
extern const struct nettle_cipher nettle_twofish256;
extern const struct nettle_cipher nettle_arctwo40;
extern const struct nettle_cipher nettle_arctwo64;
extern const struct nettle_cipher nettle_arctwo128;
extern const struct nettle_cipher nettle_arctwo_gutmann128;
struct nettle_hash
{
const char *name;
/* Size of the context struct */
unsigned context_size;
/* Size of digests */
unsigned digest_size;
/* Internal block size */
unsigned block_size;
nettle_hash_init_func *init;
nettle_hash_update_func *update;
nettle_hash_digest_func *digest;
};
#define _NETTLE_HASH(name, NAME) { \
#name, \
sizeof(struct name##_ctx), \
NAME##_DIGEST_SIZE, \
NAME##_BLOCK_SIZE, \
(nettle_hash_init_func *) name##_init, \
(nettle_hash_update_func *) name##_update, \
(nettle_hash_digest_func *) name##_digest \
}
/* FIXME: Rename with leading underscore, but keep current name (and
size!) for now, for ABI compatibility with nettle-3.1, soname
libnettle.so.6. */
/* null-terminated list of digests implemented by this version of nettle */
extern const struct nettle_hash * const nettle_hashes[];
const struct nettle_hash * const *
#ifdef __GNUC__
__attribute__((pure))
#endif
nettle_get_hashes (void);
#define nettle_hashes (nettle_get_hashes())
const struct nettle_hash *
nettle_lookup_hash (const char *name);
extern const struct nettle_hash nettle_md2;
extern const struct nettle_hash nettle_md4;
extern const struct nettle_hash nettle_md5;
extern const struct nettle_hash nettle_gosthash94;
extern const struct nettle_hash nettle_ripemd160;
extern const struct nettle_hash nettle_sha1;
extern const struct nettle_hash nettle_sha224;
extern const struct nettle_hash nettle_sha256;
extern const struct nettle_hash nettle_sha384;
extern const struct nettle_hash nettle_sha512;
extern const struct nettle_hash nettle_sha512_224;
extern const struct nettle_hash nettle_sha512_256;
extern const struct nettle_hash nettle_sha3_224;
extern const struct nettle_hash nettle_sha3_256;
extern const struct nettle_hash nettle_sha3_384;
extern const struct nettle_hash nettle_sha3_512;
struct nettle_aead
{
const char *name;
unsigned context_size;
/* Block size for encrypt and decrypt. */
unsigned block_size;
unsigned key_size;
unsigned nonce_size;
unsigned digest_size;
nettle_set_key_func *set_encrypt_key;
nettle_set_key_func *set_decrypt_key;
nettle_set_key_func *set_nonce;
nettle_hash_update_func *update;
nettle_crypt_func *encrypt;
nettle_crypt_func *decrypt;
/* FIXME: Drop length argument? */
nettle_hash_digest_func *digest;
};
/* FIXME: Rename with leading underscore, but keep current name (and
size!) for now, for ABI compatibility with nettle-3.1, soname
libnettle.so.6. */
/* null-terminated list of aead constructions implemented by this
version of nettle */
extern const struct nettle_aead * const nettle_aeads[];
const struct nettle_aead * const *
#ifdef __GNUC__
__attribute__((pure))
#endif
nettle_get_aeads (void);
#define nettle_aeads (nettle_get_aeads())
extern const struct nettle_aead nettle_gcm_aes128;
extern const struct nettle_aead nettle_gcm_aes192;
extern const struct nettle_aead nettle_gcm_aes256;
extern const struct nettle_aead nettle_gcm_camellia128;
extern const struct nettle_aead nettle_gcm_camellia256;
extern const struct nettle_aead nettle_eax_aes128;
extern const struct nettle_aead nettle_chacha_poly1305;
struct nettle_armor
{
const char *name;
unsigned encode_context_size;
unsigned decode_context_size;
unsigned encode_final_length;
nettle_armor_init_func *encode_init;
nettle_armor_length_func *encode_length;
nettle_armor_encode_update_func *encode_update;
nettle_armor_encode_final_func *encode_final;
nettle_armor_init_func *decode_init;
nettle_armor_length_func *decode_length;
nettle_armor_decode_update_func *decode_update;
nettle_armor_decode_final_func *decode_final;
};
#define _NETTLE_ARMOR(name, NAME) { \
#name, \
sizeof(struct name##_encode_ctx), \
sizeof(struct name##_decode_ctx), \
NAME##_ENCODE_FINAL_LENGTH, \
(nettle_armor_init_func *) name##_encode_init, \
(nettle_armor_length_func *) name##_encode_length, \
(nettle_armor_encode_update_func *) name##_encode_update, \
(nettle_armor_encode_final_func *) name##_encode_final, \
(nettle_armor_init_func *) name##_decode_init, \
(nettle_armor_length_func *) name##_decode_length, \
(nettle_armor_decode_update_func *) name##_decode_update, \
(nettle_armor_decode_final_func *) name##_decode_final, \
}
#define _NETTLE_ARMOR_0(name, NAME) { \
#name, \
0, \
sizeof(struct name##_decode_ctx), \
NAME##_ENCODE_FINAL_LENGTH, \
(nettle_armor_init_func *) name##_encode_init, \
(nettle_armor_length_func *) name##_encode_length, \
(nettle_armor_encode_update_func *) name##_encode_update, \
(nettle_armor_encode_final_func *) name##_encode_final, \
(nettle_armor_init_func *) name##_decode_init, \
(nettle_armor_length_func *) name##_decode_length, \
(nettle_armor_decode_update_func *) name##_decode_update, \
(nettle_armor_decode_final_func *) name##_decode_final, \
}
/* FIXME: Rename with leading underscore, but keep current name (and
size!) for now, for ABI compatibility with nettle-3.1, soname
libnettle.so.6. */
/* null-terminated list of armor schemes implemented by this version of nettle */
extern const struct nettle_armor * const nettle_armors[];
const struct nettle_armor * const *
#ifdef __GNUC__
__attribute__((pure))
#endif
nettle_get_armors (void);
#define nettle_armors (nettle_get_armors())
extern const struct nettle_armor nettle_base64;
extern const struct nettle_armor nettle_base64url;
extern const struct nettle_armor nettle_base16;
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_META_H_INCLUDED */

View File

@ -1,286 +0,0 @@
#ifndef __NETTLE_STDINT_H
#define __NETTLE_STDINT_H 1
#ifndef _GENERATED_STDINT_H
#define _GENERATED_STDINT_H " "
/* generated using gnu compiler i686-w64-mingw32-gcc (Gentoo 7.3.0 p1.0) 7.3.0 */
#define _STDINT_HAVE_STDINT_H 1
/* ................... shortcircuit part ........................... */
#if defined HAVE_STDINT_H || defined _STDINT_HAVE_STDINT_H
#include <stdint.h>
#else
#include <stddef.h>
/* .................... configured part ............................ */
/* whether we have a C99 compatible stdint header file */
/* #undef _STDINT_HEADER_INTPTR */
/* whether we have a C96 compatible inttypes header file */
/* #undef _STDINT_HEADER_UINT32 */
/* whether we have a BSD compatible inet types header */
/* #undef _STDINT_HEADER_U_INT32 */
/* which 64bit typedef has been found */
/* #undef _STDINT_HAVE_UINT64_T */
/* #undef _STDINT_HAVE_U_INT64_T */
/* which type model has been detected */
/* #undef _STDINT_CHAR_MODEL // skipped */
/* #undef _STDINT_LONG_MODEL // skipped */
/* whether int_least types were detected */
/* #undef _STDINT_HAVE_INT_LEAST32_T */
/* whether int_fast types were detected */
/* #undef _STDINT_HAVE_INT_FAST32_T */
/* whether intmax_t type was detected */
/* #undef _STDINT_HAVE_INTMAX_T */
/* .................... detections part ............................ */
/* whether we need to define bitspecific types from compiler base types */
#ifndef _STDINT_HEADER_INTPTR
#ifndef _STDINT_HEADER_UINT32
#ifndef _STDINT_HEADER_U_INT32
#define _STDINT_NEED_INT_MODEL_T
#else
#define _STDINT_HAVE_U_INT_TYPES
#endif
#endif
#endif
#ifdef _STDINT_HAVE_U_INT_TYPES
#undef _STDINT_NEED_INT_MODEL_T
#endif
#ifdef _STDINT_CHAR_MODEL
#if _STDINT_CHAR_MODEL+0 == 122 || _STDINT_CHAR_MODEL+0 == 124
#ifndef _STDINT_BYTE_MODEL
#define _STDINT_BYTE_MODEL 12
#endif
#endif
#endif
#ifndef _STDINT_HAVE_INT_LEAST32_T
#define _STDINT_NEED_INT_LEAST_T
#endif
#ifndef _STDINT_HAVE_INT_FAST32_T
#define _STDINT_NEED_INT_FAST_T
#endif
#ifndef _STDINT_HEADER_INTPTR
#define _STDINT_NEED_INTPTR_T
#ifndef _STDINT_HAVE_INTMAX_T
#define _STDINT_NEED_INTMAX_T
#endif
#endif
/* .................... definition part ............................ */
/* some system headers have good uint64_t */
#ifndef _HAVE_UINT64_T
#if defined _STDINT_HAVE_UINT64_T || defined HAVE_UINT64_T
#define _HAVE_UINT64_T
#elif defined _STDINT_HAVE_U_INT64_T || defined HAVE_U_INT64_T
#define _HAVE_UINT64_T
typedef u_int64_t uint64_t;
#endif
#endif
#ifndef _HAVE_UINT64_T
/* .. here are some common heuristics using compiler runtime specifics */
#if defined __STDC_VERSION__ && defined __STDC_VERSION__ >= 199901L
#define _HAVE_UINT64_T
typedef long long int64_t;
typedef unsigned long long uint64_t;
#elif !defined __STRICT_ANSI__
#if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__
#define _HAVE_UINT64_T
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__
/* note: all ELF-systems seem to have loff-support which needs 64-bit */
#if !defined _NO_LONGLONG
#define _HAVE_UINT64_T
typedef long long int64_t;
typedef unsigned long long uint64_t;
#endif
#elif defined __alpha || (defined __mips && defined _ABIN32)
#if !defined _NO_LONGLONG
typedef long int64_t;
typedef unsigned long uint64_t;
#endif
/* compiler/cpu type to define int64_t */
#endif
#endif
#endif
#if defined _STDINT_HAVE_U_INT_TYPES
/* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */
typedef u_int8_t uint8_t;
typedef u_int16_t uint16_t;
typedef u_int32_t uint32_t;
/* glibc compatibility */
#ifndef __int8_t_defined
#define __int8_t_defined
#endif
#endif
#ifdef _STDINT_NEED_INT_MODEL_T
/* we must guess all the basic types. Apart from byte-adressable system, */
/* there a few 32-bit-only dsp-systems that we guard with BYTE_MODEL 8-} */
/* (btw, those nibble-addressable systems are way off, or so we assume) */
#if defined _STDINT_BYTE_MODEL
#if _STDINT_LONG_MODEL+0 == 242
/* 2:4:2 = IP16 = a normal 16-bit system */
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned long uint32_t;
#ifndef __int8_t_defined
#define __int8_t_defined
typedef char int8_t;
typedef short int16_t;
typedef long int32_t;
#endif
#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL == 444
/* 2:4:4 = LP32 = a 32-bit system derived from a 16-bit */
/* 4:4:4 = ILP32 = a normal 32-bit system */
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#ifndef __int8_t_defined
#define __int8_t_defined
typedef char int8_t;
typedef short int16_t;
typedef int int32_t;
#endif
#elif _STDINT_LONG_MODEL+0 == 484 || _STDINT_LONG_MODEL+0 == 488
/* 4:8:4 = IP32 = a 32-bit system prepared for 64-bit */
/* 4:8:8 = LP64 = a normal 64-bit system */
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#ifndef __int8_t_defined
#define __int8_t_defined
typedef char int8_t;
typedef short int16_t;
typedef int int32_t;
#endif
/* this system has a "long" of 64bit */
#ifndef _HAVE_UINT64_T
#define _HAVE_UINT64_T
typedef unsigned long uint64_t;
typedef long int64_t;
#endif
#elif _STDINT_LONG_MODEL+0 == 448
/* LLP64 a 64-bit system derived from a 32-bit system */
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#ifndef __int8_t_defined
#define __int8_t_defined
typedef char int8_t;
typedef short int16_t;
typedef int int32_t;
#endif
/* assuming the system has a "long long" */
#ifndef _HAVE_UINT64_T
#define _HAVE_UINT64_T
typedef unsigned long long uint64_t;
typedef long long int64_t;
#endif
#else
#define _STDINT_NO_INT32_T
#endif
#else
#define _STDINT_NO_INT8_T
#define _STDINT_NO_INT32_T
#endif
#endif
/*
* quote from SunOS-5.8 sys/inttypes.h:
* Use at your own risk. As of February 1996, the committee is squarely
* behind the fixed sized types; the "least" and "fast" types are still being
* discussed. The probability that the "fast" types may be removed before
* the standard is finalized is high enough that they are not currently
* implemented.
*/
#if defined _STDINT_NEED_INT_LEAST_T
typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
typedef int32_t int_least32_t;
#ifdef _HAVE_UINT64_T
typedef int64_t int_least64_t;
#endif
typedef uint8_t uint_least8_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_least32_t;
#ifdef _HAVE_UINT64_T
typedef uint64_t uint_least64_t;
#endif
/* least types */
#endif
#if defined _STDINT_NEED_INT_FAST_T
typedef int8_t int_fast8_t;
typedef int int_fast16_t;
typedef int32_t int_fast32_t;
#ifdef _HAVE_UINT64_T
typedef int64_t int_fast64_t;
#endif
typedef uint8_t uint_fast8_t;
typedef unsigned uint_fast16_t;
typedef uint32_t uint_fast32_t;
#ifdef _HAVE_UINT64_T
typedef uint64_t uint_fast64_t;
#endif
/* fast types */
#endif
#ifdef _STDINT_NEED_INTMAX_T
#ifdef _HAVE_UINT64_T
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
#else
typedef long intmax_t;
typedef unsigned long uintmax_t;
#endif
#endif
#ifdef _STDINT_NEED_INTPTR_T
#ifndef __intptr_t_defined
#define __intptr_t_defined
/* we encourage using "long" to store pointer values, never use "int" ! */
#if _STDINT_LONG_MODEL+0 == 242 || _STDINT_LONG_MODEL+0 == 484
typedef unsigned int uintptr_t;
typedef int intptr_t;
#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL+0 == 444
typedef unsigned long uintptr_t;
typedef long intptr_t;
#elif _STDINT_LONG_MODEL+0 == 448 && defined _HAVE_UINT64_T
typedef uint64_t uintptr_t;
typedef int64_t intptr_t;
#else /* matches typical system types ILP32 and LP64 - but not IP16 or LLP64 */
typedef unsigned long uintptr_t;
typedef long intptr_t;
#endif
#endif
#endif
/* shortcircuit*/
#endif
/* once */
#endif
#endif

View File

@ -1,110 +0,0 @@
/* nettle-types.h
Copyright (C) 2005, 2014 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_TYPES_H
#define NETTLE_TYPES_H
/* For size_t */
#include <stddef.h>
/* Pretend these types always exists. Nettle doesn't use them. */
#define _STDINT_HAVE_INT_FAST32_T 1
#include "nettle-stdint.h"
#ifdef __cplusplus
extern "C" {
#endif
/* An aligned 16-byte block. */
union nettle_block16
{
uint8_t b[16];
unsigned long w[16 / sizeof(unsigned long)];
};
/* Randomness. Used by key generation and dsa signature creation. */
typedef void nettle_random_func(void *ctx,
size_t length, uint8_t *dst);
/* Progress report function, mainly for key generation. */
typedef void nettle_progress_func(void *ctx, int c);
/* Realloc function, used by struct nettle_buffer. */
typedef void *nettle_realloc_func(void *ctx, void *p, size_t length);
/* Ciphers */
typedef void nettle_set_key_func(void *ctx, const uint8_t *key);
/* For block ciphers, const context. */
typedef void nettle_cipher_func(const void *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
/* Uses a void * for cipher contexts. Used for crypt operations where
the internal state changes during the encryption. */
typedef void nettle_crypt_func(void *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
/* Hash algorithms */
typedef void nettle_hash_init_func(void *ctx);
typedef void nettle_hash_update_func(void *ctx,
size_t length,
const uint8_t *src);
typedef void nettle_hash_digest_func(void *ctx,
size_t length, uint8_t *dst);
/* ASCII armor codecs. NOTE: Experimental and subject to change. */
typedef size_t nettle_armor_length_func(size_t length);
typedef void nettle_armor_init_func(void *ctx);
typedef size_t nettle_armor_encode_update_func(void *ctx,
char *dst,
size_t src_length,
const uint8_t *src);
typedef size_t nettle_armor_encode_final_func(void *ctx, char *dst);
typedef int nettle_armor_decode_update_func(void *ctx,
size_t *dst_length,
uint8_t *dst,
size_t src_length,
const char *src);
typedef int nettle_armor_decode_final_func(void *ctx);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_TYPES_H */

View File

@ -1,85 +0,0 @@
/* pbkdf2.h
PKCS #5 password-based key derivation function PBKDF2, see RFC 2898.
Copyright (C) 2012 Simon Josefsson
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_PBKDF2_H_INCLUDED
#define NETTLE_PBKDF2_H_INCLUDED
#include "nettle-meta.h"
#ifdef __cplusplus
extern "C"
{
#endif
/* Namespace mangling */
#define pbkdf2 nettle_pbkdf2
#define pbkdf2_hmac_sha1 nettle_pbkdf2_hmac_sha1
#define pbkdf2_hmac_sha256 nettle_pbkdf2_hmac_sha256
void
pbkdf2 (void *mac_ctx,
nettle_hash_update_func *update,
nettle_hash_digest_func *digest,
size_t digest_size, unsigned iterations,
size_t salt_length, const uint8_t *salt,
size_t length, uint8_t *dst);
#define PBKDF2(ctx, update, digest, digest_size, \
iterations, salt_length, salt, length, dst) \
(0 ? ((update)((ctx), 0, (uint8_t *) 0), \
(digest)((ctx), 0, (uint8_t *) 0)) \
: pbkdf2 ((ctx), \
(nettle_hash_update_func *)(update), \
(nettle_hash_digest_func *)(digest), \
(digest_size), (iterations), \
(salt_length), (salt), (length), (dst)))
/* PBKDF2 with specific PRFs. */
void
pbkdf2_hmac_sha1 (size_t key_length, const uint8_t *key,
unsigned iterations,
size_t salt_length, const uint8_t *salt,
size_t length, uint8_t *dst);
void
pbkdf2_hmac_sha256 (size_t key_length, const uint8_t *key,
unsigned iterations,
size_t salt_length, const uint8_t *salt,
size_t length, uint8_t *dst);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_PBKDF2_H_INCLUDED */

View File

@ -1,248 +0,0 @@
/* pgp.h
PGP related functions.
Copyright (C) 2001, 2002 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_PGP_H_INCLUDED
#define NETTLE_PGP_H_INCLUDED
#include <time.h>
#include "nettle-types.h"
#include "bignum.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define pgp_put_uint32 nettle_pgp_put_uint32
#define pgp_put_uint16 nettle_pgp_put_uint16
#define pgp_put_mpi nettle_pgp_put_mpi
#define pgp_put_string nettle_pgp_put_string
#define pgp_put_length nettle_pgp_put_length
#define pgp_put_header nettle_pgp_put_header
#define pgp_put_header_length nettle_pgp_put_header_length
#define pgp_sub_packet_start nettle_pgp_sub_packet_start
#define pgp_put_sub_packet nettle_pgp_put_sub_packet
#define pgp_sub_packet_end nettle_pgp_sub_packet_end
#define pgp_put_public_rsa_key nettle_pgp_put_public_rsa_key
#define pgp_put_rsa_sha1_signature nettle_pgp_put_rsa_sha1_signature
#define pgp_put_userid nettle_pgp_put_userid
#define pgp_crc24 nettle_pgp_crc24
#define pgp_armor nettle_pgp_armor
struct nettle_buffer;
struct rsa_public_key;
struct rsa_private_key;
struct sha1_ctx;
int
pgp_put_uint32(struct nettle_buffer *buffer, uint32_t i);
int
pgp_put_uint16(struct nettle_buffer *buffer, unsigned i);
int
pgp_put_mpi(struct nettle_buffer *buffer, const mpz_t x);
int
pgp_put_string(struct nettle_buffer *buffer,
unsigned length,
const uint8_t *s);
int
pgp_put_length(struct nettle_buffer *buffer,
unsigned length);
int
pgp_put_header(struct nettle_buffer *buffer,
unsigned tag, unsigned length);
void
pgp_put_header_length(struct nettle_buffer *buffer,
/* start of the header */
unsigned start,
unsigned field_size);
unsigned
pgp_sub_packet_start(struct nettle_buffer *buffer);
int
pgp_put_sub_packet(struct nettle_buffer *buffer,
unsigned type,
unsigned length,
const uint8_t *data);
void
pgp_sub_packet_end(struct nettle_buffer *buffer, unsigned start);
int
pgp_put_public_rsa_key(struct nettle_buffer *,
const struct rsa_public_key *key,
time_t timestamp);
int
pgp_put_rsa_sha1_signature(struct nettle_buffer *buffer,
const struct rsa_private_key *key,
const uint8_t *keyid,
unsigned type,
struct sha1_ctx *hash);
int
pgp_put_userid(struct nettle_buffer *buffer,
unsigned length,
const uint8_t *name);
uint32_t
pgp_crc24(unsigned length, const uint8_t *data);
int
pgp_armor(struct nettle_buffer *buffer,
const char *tag,
unsigned length,
const uint8_t *data);
/* Values that can be passed to pgp_put_header when the size of the
* length field, but not the length itself, is known. Also the minimum length
* for the given field size. */
enum pgp_lengths
{
PGP_LENGTH_ONE_OCTET = 0,
PGP_LENGTH_TWO_OCTETS = 192,
PGP_LENGTH_FOUR_OCTETS = 8384,
};
enum pgp_public_key_algorithm
{
PGP_RSA = 1,
PGP_RSA_ENCRYPT = 2,
PGP_RSA_SIGN = 3,
PGP_EL_GAMAL_ENCRYPT = 16,
PGP_DSA = 17,
PGP_EL_GAMAL = 20,
};
enum pgp_symmetric_algorithm
{
PGP_PLAINTEXT = 0,
PGP_IDEA = 1,
PGP_3DES = 2,
PGP_CAST5 = 3,
PGP_BLOWFISH = 4,
PGP_SAFER_SK = 5,
PGP_AES128 = 7,
PGP_AES192 = 8,
PGP_AES256 = 9,
};
enum pgp_compression_algorithm
{
PGP_UNCOMPRESSED = 0,
PGP_ZIP = 1,
PGP_ZLIB = 2,
};
enum pgp_hash_algorithm
{
PGP_MD5 = 1,
PGP_SHA1 = 2,
PGP_RIPEMD = 3,
PGP_MD2 = 5,
PGP_TIGER192 = 6,
PGP_HAVAL = 7,
};
enum pgp_tag
{
PGP_TAG_PUBLIC_SESSION_KEY = 1,
PGP_TAG_SIGNATURE = 2,
PGP_TAG_SYMMETRIC_SESSION_KEY = 3,
PGP_TAG_ONE_PASS_SIGNATURE = 4,
PGP_TAG_SECRET_KEY = 5,
PGP_TAG_PUBLIC_KEY = 6,
PGP_TAG_SECRET_SUBKEY = 7,
PGP_TAG_COMPRESSED = 8,
PGP_TAG_ENCRYPTED = 9,
PGP_TAG_MARKER = 10,
PGP_TAG_LITERAL = 11,
PGP_TAG_TRUST = 12,
PGP_TAG_USERID = 13,
PGP_TAG_PUBLIC_SUBKEY = 14,
};
enum pgp_signature_type
{
PGP_SIGN_BINARY = 0,
PGP_SIGN_TEXT = 1,
PGP_SIGN_STANDALONE = 2,
PGP_SIGN_CERTIFICATION = 0x10,
PGP_SIGN_CERTIFICATION_PERSONA = 0x11,
PGP_SIGN_CERTIFICATION_CASUAL = 0x12,
PGP_SIGN_CERTIFICATION_POSITIVE = 0x13,
PGP_SIGN_SUBKEY = 0x18,
PGP_SIGN_KEY = 0x1f,
PGP_SIGN_REVOCATION = 0x20,
PGP_SIGN_REVOCATION_SUBKEY = 0x28,
PGP_SIGN_REVOCATION_CERTIFICATE = 0x30,
PGP_SIGN_TIMESTAMP = 0x40,
};
enum pgp_subpacket_tag
{
PGP_SUBPACKET_CREATION_TIME = 2,
PGP_SUBPACKET_SIGNATURE_EXPIRATION_TIME = 3,
PGP_SUBPACKET_EXPORTABLE_CERTIFICATION = 4,
PGP_SUBPACKET_TRUST_SIGNATURE = 5,
PGP_SUBPACKET_REGULAR_EXPRESSION = 6,
PGP_SUBPACKET_REVOCABLE = 7,
PGP_SUBPACKET_KEY_EXPIRATION_TIME = 9,
PGP_SUBPACKET_PLACEHOLDER = 10 ,
PGP_SUBPACKET_PREFERRED_SYMMETRIC_ALGORITHMS = 11,
PGP_SUBPACKET_REVOCATION_KEY = 12,
PGP_SUBPACKET_ISSUER_KEY_ID = 16,
PGP_SUBPACKET_NOTATION_DATA = 20,
PGP_SUBPACKET_PREFERRED_HASH_ALGORITHMS = 21,
PGP_SUBPACKET_PREFERRED_COMPRESSION_ALGORITHMS = 22,
PGP_SUBPACKET_KEY_SERVER_PREFERENCES = 23,
PGP_SUBPACKET_PREFERRED_KEY_SERVER = 24,
PGP_SUBPACKET_PRIMARY_USER_ID = 25,
PGP_SUBPACKET_POLICY_URL = 26,
PGP_SUBPACKET_KEY_FLAGS = 27,
PGP_SUBPACKET_SIGNERS_USER_ID = 28,
PGP_SUBPACKET_REASON_FOR_REVOCATION = 29,
};
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_PGP_H_INCLUDED */

View File

@ -1,114 +0,0 @@
/* pkcs1.h
PKCS1 embedding.
Copyright (C) 2003 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_PKCS1_H_INCLUDED
#define NETTLE_PKCS1_H_INCLUDED
#include "nettle-types.h"
#include "bignum.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define _pkcs1_signature_prefix _nettle_pkcs1_signature_prefix
#define pkcs1_rsa_digest_encode nettle_pkcs1_rsa_digest_encode
#define pkcs1_rsa_md5_encode nettle_pkcs1_rsa_md5_encode
#define pkcs1_rsa_md5_encode_digest nettle_pkcs1_rsa_md5_encode_digest
#define pkcs1_rsa_sha1_encode nettle_pkcs1_rsa_sha1_encode
#define pkcs1_rsa_sha1_encode_digest nettle_pkcs1_rsa_sha1_encode_digest
#define pkcs1_rsa_sha256_encode nettle_pkcs1_rsa_sha256_encode
#define pkcs1_rsa_sha256_encode_digest nettle_pkcs1_rsa_sha256_encode_digest
#define pkcs1_rsa_sha512_encode nettle_pkcs1_rsa_sha512_encode
#define pkcs1_rsa_sha512_encode_digest nettle_pkcs1_rsa_sha512_encode_digest
#define pkcs1_encrypt nettle_pkcs1_encrypt
#define pkcs1_decrypt nettle_pkcs1_decrypt
struct md5_ctx;
struct sha1_ctx;
struct sha256_ctx;
struct sha512_ctx;
uint8_t *
_pkcs1_signature_prefix(unsigned key_size,
uint8_t *buffer,
unsigned id_size,
const uint8_t *id,
unsigned digest_size);
int
pkcs1_encrypt (size_t key_size,
/* For padding */
void *random_ctx, nettle_random_func *random,
size_t length, const uint8_t *message,
mpz_t m);
int
pkcs1_decrypt (size_t key_size,
const mpz_t m,
size_t *length, uint8_t *message);
int
pkcs1_rsa_digest_encode(mpz_t m, size_t key_size,
size_t di_length, const uint8_t *digest_info);
int
pkcs1_rsa_md5_encode(mpz_t m, size_t length, struct md5_ctx *hash);
int
pkcs1_rsa_md5_encode_digest(mpz_t m, size_t length, const uint8_t *digest);
int
pkcs1_rsa_sha1_encode(mpz_t m, size_t length, struct sha1_ctx *hash);
int
pkcs1_rsa_sha1_encode_digest(mpz_t m, size_t length, const uint8_t *digest);
int
pkcs1_rsa_sha256_encode(mpz_t m, size_t length, struct sha256_ctx *hash);
int
pkcs1_rsa_sha256_encode_digest(mpz_t m, size_t length, const uint8_t *digest);
int
pkcs1_rsa_sha512_encode(mpz_t m, size_t length, struct sha512_ctx *hash);
int
pkcs1_rsa_sha512_encode_digest(mpz_t m, size_t length, const uint8_t *digest);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_PKCS1_H_INCLUDED */

View File

@ -1,128 +0,0 @@
/* poly1305.h
Poly1305 message authentication code.
Copyright (C) 2013 Nikos Mavrogiannopoulos
Copyright (C) 2013, 2014 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_POLY1305_H_INCLUDED
#define NETTLE_POLY1305_H_INCLUDED
#include "aes.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define poly1305_set_key nettle_poly1305_set_key
#define poly1305_digest nettle_poly1305_digest
#define _poly1305_block _nettle_poly1305_block
#define poly1305_aes_set_key nettle_poly1305_aes_set_key
#define poly1305_aes_set_nonce nettle_poly1305_aes_set_nonce
#define poly1305_aes_update nettle_poly1305_aes_update
#define poly1305_aes_digest nettle_poly1305_aes_digest
/* Low level functions/macros for the poly1305 construction. */
#define POLY1305_DIGEST_SIZE 16
#define POLY1305_BLOCK_SIZE 16
#define POLY1305_KEY_SIZE 16
struct poly1305_ctx {
/* Key, 128-bit value and some cached multiples. */
union
{
uint32_t r32[6];
uint64_t r64[3];
} r;
uint32_t s32[3];
/* State, represented as words of 26, 32 or 64 bits, depending on
implementation. */
/* High bits first, to maintain alignment. */
uint32_t hh;
union
{
uint32_t h32[4];
uint64_t h64[2];
} h;
};
/* Low-level internal interface. */
void poly1305_set_key(struct poly1305_ctx *ctx, const uint8_t key[POLY1305_KEY_SIZE]);
/* Extracts digest, and adds it to s, the encrypted nonce. */
void poly1305_digest (struct poly1305_ctx *ctx, union nettle_block16 *s);
/* Internal function. Process one block. */
void _poly1305_block (struct poly1305_ctx *ctx, const uint8_t *m,
unsigned high);
/* poly1305-aes */
#define POLY1305_AES_KEY_SIZE 32
#define POLY1305_AES_DIGEST_SIZE 16
#define POLY1305_AES_NONCE_SIZE 16
struct poly1305_aes_ctx
{
/* Keep aes context last, to make it possible to use a general
poly1305_update if other variants are added. */
struct poly1305_ctx pctx;
uint8_t block[POLY1305_BLOCK_SIZE];
unsigned index;
uint8_t nonce[POLY1305_BLOCK_SIZE];
struct aes128_ctx aes;
};
/* Also initialize the nonce to zero. */
void
poly1305_aes_set_key (struct poly1305_aes_ctx *ctx, const uint8_t *key);
/* Optional, if not used, messages get incrementing nonces starting
from zero. */
void
poly1305_aes_set_nonce (struct poly1305_aes_ctx *ctx,
const uint8_t *nonce);
/* Update is not aes-specific, but since this is the only implemented
variant, we need no more general poly1305_update. */
void
poly1305_aes_update (struct poly1305_aes_ctx *ctx, size_t length, const uint8_t *data);
/* Also increments the nonce */
void
poly1305_aes_digest (struct poly1305_aes_ctx *ctx,
size_t length, uint8_t *digest);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_POLY1305_H_INCLUDED */

View File

@ -1,58 +0,0 @@
/* pss-mgf1.h
PKCS#1 mask generation function 1, used in RSA-PSS (RFC-3447).
Copyright (C) 2017 Daiki Ueno
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_PSS_MGF1_H_INCLUDED
#define NETTLE_PSS_MGF1_H_INCLUDED
#include "nettle-meta.h"
#include "sha1.h"
#include "sha2.h"
#ifdef __cplusplus
extern "C"
{
#endif
/* Namespace mangling */
#define pss_mgf1 nettle_pss_mgf1
void
pss_mgf1(const void *seed, const struct nettle_hash *hash,
size_t length, uint8_t *mask);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_PSS_MGF1_H_INCLUDED */

View File

@ -1,65 +0,0 @@
/* pss.h
PKCS#1 RSA-PSS (RFC-3447).
Copyright (C) 2017 Daiki Ueno
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_PSS_H_INCLUDED
#define NETTLE_PSS_H_INCLUDED
#include "nettle-types.h"
#include "bignum.h"
#ifdef __cplusplus
extern "C"
{
#endif
/* Namespace mangling */
#define pss_encode_mgf1 nettle_pss_encode_mgf1
#define pss_verify_mgf1 nettle_pss_verify_mgf1
int
pss_encode_mgf1(mpz_t m, size_t bits,
const struct nettle_hash *hash,
size_t salt_length, const uint8_t *salt,
const uint8_t *digest);
int
pss_verify_mgf1(const mpz_t m, size_t bits,
const struct nettle_hash *hash,
size_t salt_length,
const uint8_t *digest);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_PSS_H_INCLUDED */

View File

@ -1,48 +0,0 @@
/* realloc.h
Copyright (C) 2002 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_REALLOC_H_INCLUDED
#define NETTLE_REALLOC_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
nettle_realloc_func nettle_realloc;
nettle_realloc_func nettle_xrealloc;
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_REALLOC_H_INCLUDED */

View File

@ -1,88 +0,0 @@
/* ripemd160.h
RIPEMD-160 hash function.
Copyright (C) 2011 Andres Mejia
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_RIPEMD160_H_INCLUDED
#define NETTLE_RIPEMD160_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
#include "nettle-types.h"
/* Name mangling */
#define ripemd160_init nettle_ripemd160_init
#define ripemd160_update nettle_ripemd160_update
#define ripemd160_digest nettle_ripemd160_digest
/* RIPEMD160 */
#define RIPEMD160_DIGEST_SIZE 20
#define RIPEMD160_BLOCK_SIZE 64
/* For backwards compatibility */
#define RIPEMD160_DATA_SIZE RIPEMD160_BLOCK_SIZE
/* Digest is kept internally as 5 32-bit words. */
#define _RIPEMD160_DIGEST_LENGTH 5
struct ripemd160_ctx
{
uint32_t state[_RIPEMD160_DIGEST_LENGTH];
uint64_t count; /* 64-bit block count */
uint8_t block[RIPEMD160_BLOCK_SIZE];
unsigned int index;
};
void
ripemd160_init(struct ripemd160_ctx *ctx);
void
ripemd160_update(struct ripemd160_ctx *ctx,
size_t length,
const uint8_t *data);
void
ripemd160_digest(struct ripemd160_ctx *ctx,
size_t length,
uint8_t *digest);
/* Internal compression function. STATE points to 5 uint32_t words,
and DATA points to 64 bytes of input data, possibly unaligned. */
void
_nettle_ripemd160_compress(uint32_t *state, const uint8_t *data);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_RIPEMD160_H_INCLUDED */

View File

@ -1,554 +0,0 @@
/* rsa.h
The RSA publickey algorithm.
Copyright (C) 2001, 2002 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_RSA_H_INCLUDED
#define NETTLE_RSA_H_INCLUDED
#include "nettle-types.h"
#include "bignum.h"
#include "md5.h"
#include "sha1.h"
#include "sha2.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define rsa_public_key_init nettle_rsa_public_key_init
#define rsa_public_key_clear nettle_rsa_public_key_clear
#define rsa_public_key_prepare nettle_rsa_public_key_prepare
#define rsa_private_key_init nettle_rsa_private_key_init
#define rsa_private_key_clear nettle_rsa_private_key_clear
#define rsa_private_key_prepare nettle_rsa_private_key_prepare
#define rsa_pkcs1_verify nettle_rsa_pkcs1_verify
#define rsa_pkcs1_sign nettle_rsa_pkcs1_sign
#define rsa_pkcs1_sign_tr nettle_rsa_pkcs1_sign_tr
#define rsa_md5_sign nettle_rsa_md5_sign
#define rsa_md5_sign_tr nettle_rsa_md5_sign_tr
#define rsa_md5_verify nettle_rsa_md5_verify
#define rsa_sha1_sign nettle_rsa_sha1_sign
#define rsa_sha1_sign_tr nettle_rsa_sha1_sign_tr
#define rsa_sha1_verify nettle_rsa_sha1_verify
#define rsa_sha256_sign nettle_rsa_sha256_sign
#define rsa_sha256_sign_tr nettle_rsa_sha256_sign_tr
#define rsa_sha256_verify nettle_rsa_sha256_verify
#define rsa_sha512_sign nettle_rsa_sha512_sign
#define rsa_sha512_sign_tr nettle_rsa_sha512_sign_tr
#define rsa_sha512_verify nettle_rsa_sha512_verify
#define rsa_md5_sign_digest nettle_rsa_md5_sign_digest
#define rsa_md5_sign_digest_tr nettle_rsa_md5_sign_digest_tr
#define rsa_md5_verify_digest nettle_rsa_md5_verify_digest
#define rsa_sha1_sign_digest nettle_rsa_sha1_sign_digest
#define rsa_sha1_sign_digest_tr nettle_rsa_sha1_sign_digest_tr
#define rsa_sha1_verify_digest nettle_rsa_sha1_verify_digest
#define rsa_sha256_sign_digest nettle_rsa_sha256_sign_digest
#define rsa_sha256_sign_digest_tr nettle_rsa_sha256_sign_digest_tr
#define rsa_sha256_verify_digest nettle_rsa_sha256_verify_digest
#define rsa_sha512_sign_digest nettle_rsa_sha512_sign_digest
#define rsa_sha512_sign_digest_tr nettle_rsa_sha512_sign_digest_tr
#define rsa_sha512_verify_digest nettle_rsa_sha512_verify_digest
#define rsa_pss_sha256_sign_digest_tr nettle_rsa_pss_sha256_sign_digest_tr
#define rsa_pss_sha256_verify_digest nettle_rsa_pss_sha256_verify_digest
#define rsa_pss_sha384_sign_digest_tr nettle_rsa_pss_sha384_sign_digest_tr
#define rsa_pss_sha384_verify_digest nettle_rsa_pss_sha384_verify_digest
#define rsa_pss_sha512_sign_digest_tr nettle_rsa_pss_sha512_sign_digest_tr
#define rsa_pss_sha512_verify_digest nettle_rsa_pss_sha512_verify_digest
#define rsa_encrypt nettle_rsa_encrypt
#define rsa_decrypt nettle_rsa_decrypt
#define rsa_decrypt_tr nettle_rsa_decrypt_tr
#define rsa_compute_root nettle_rsa_compute_root
#define rsa_compute_root_tr nettle_rsa_compute_root_tr
#define rsa_generate_keypair nettle_rsa_generate_keypair
#define rsa_keypair_to_sexp nettle_rsa_keypair_to_sexp
#define rsa_keypair_from_sexp_alist nettle_rsa_keypair_from_sexp_alist
#define rsa_keypair_from_sexp nettle_rsa_keypair_from_sexp
#define rsa_public_key_from_der_iterator nettle_rsa_public_key_from_der_iterator
#define rsa_private_key_from_der_iterator nettle_rsa_private_key_from_der_iterator
#define rsa_keypair_from_der nettle_rsa_keypair_from_der
#define rsa_keypair_to_openpgp nettle_rsa_keypair_to_openpgp
#define _rsa_verify _nettle_rsa_verify
#define _rsa_verify_recover _nettle_rsa_verify_recover
#define _rsa_check_size _nettle_rsa_check_size
#define _rsa_blind _nettle_rsa_blind
#define _rsa_unblind _nettle_rsa_unblind
/* This limit is somewhat arbitrary. Technically, the smallest modulo
which makes sense at all is 15 = 3*5, phi(15) = 8, size 4 bits. But
for ridiculously small keys, not all odd e are possible (e.g., for
5 bits, the only possible modulo is 3*7 = 21, phi(21) = 12, and e =
3 don't work). The smallest size that makes sense with pkcs#1, and
which allows RSA encryption of one byte messages, is 12 octets, 89
bits. */
#define RSA_MINIMUM_N_OCTETS 12
#define RSA_MINIMUM_N_BITS (8*RSA_MINIMUM_N_OCTETS - 7)
struct rsa_public_key
{
/* Size of the modulo, in octets. This is also the size of all
* signatures that are created or verified with this key. */
size_t size;
/* Modulo */
mpz_t n;
/* Public exponent */
mpz_t e;
};
struct rsa_private_key
{
size_t size;
/* d is filled in by the key generation function; otherwise it's
* completely unused. */
mpz_t d;
/* The two factors */
mpz_t p; mpz_t q;
/* d % (p-1), i.e. a e = 1 (mod (p-1)) */
mpz_t a;
/* d % (q-1), i.e. b e = 1 (mod (q-1)) */
mpz_t b;
/* modular inverse of q , i.e. c q = 1 (mod p) */
mpz_t c;
};
/* Signing a message works as follows:
*
* Store the private key in a rsa_private_key struct.
*
* Call rsa_private_key_prepare. This initializes the size attribute
* to the length of a signature.
*
* Initialize a hashing context, by callling
* md5_init
*
* Hash the message by calling
* md5_update
*
* Create the signature by calling
* rsa_md5_sign
*
* The signature is represented as a mpz_t bignum. This call also
* resets the hashing context.
*
* When done with the key and signature, don't forget to call
* mpz_clear.
*/
/* Calls mpz_init to initialize bignum storage. */
void
rsa_public_key_init(struct rsa_public_key *key);
/* Calls mpz_clear to deallocate bignum storage. */
void
rsa_public_key_clear(struct rsa_public_key *key);
int
rsa_public_key_prepare(struct rsa_public_key *key);
/* Calls mpz_init to initialize bignum storage. */
void
rsa_private_key_init(struct rsa_private_key *key);
/* Calls mpz_clear to deallocate bignum storage. */
void
rsa_private_key_clear(struct rsa_private_key *key);
int
rsa_private_key_prepare(struct rsa_private_key *key);
/* PKCS#1 style signatures */
int
rsa_pkcs1_sign(const struct rsa_private_key *key,
size_t length, const uint8_t *digest_info,
mpz_t s);
int
rsa_pkcs1_sign_tr(const struct rsa_public_key *pub,
const struct rsa_private_key *key,
void *random_ctx, nettle_random_func *random,
size_t length, const uint8_t *digest_info,
mpz_t s);
int
rsa_pkcs1_verify(const struct rsa_public_key *key,
size_t length, const uint8_t *digest_info,
const mpz_t signature);
int
rsa_md5_sign(const struct rsa_private_key *key,
struct md5_ctx *hash,
mpz_t signature);
int
rsa_md5_sign_tr(const struct rsa_public_key *pub,
const struct rsa_private_key *key,
void *random_ctx, nettle_random_func *random,
struct md5_ctx *hash, mpz_t s);
int
rsa_md5_verify(const struct rsa_public_key *key,
struct md5_ctx *hash,
const mpz_t signature);
int
rsa_sha1_sign(const struct rsa_private_key *key,
struct sha1_ctx *hash,
mpz_t signature);
int
rsa_sha1_sign_tr(const struct rsa_public_key *pub,
const struct rsa_private_key *key,
void *random_ctx, nettle_random_func *random,
struct sha1_ctx *hash,
mpz_t s);
int
rsa_sha1_verify(const struct rsa_public_key *key,
struct sha1_ctx *hash,
const mpz_t signature);
int
rsa_sha256_sign(const struct rsa_private_key *key,
struct sha256_ctx *hash,
mpz_t signature);
int
rsa_sha256_sign_tr(const struct rsa_public_key *pub,
const struct rsa_private_key *key,
void *random_ctx, nettle_random_func *random,
struct sha256_ctx *hash,
mpz_t s);
int
rsa_sha256_verify(const struct rsa_public_key *key,
struct sha256_ctx *hash,
const mpz_t signature);
int
rsa_sha512_sign(const struct rsa_private_key *key,
struct sha512_ctx *hash,
mpz_t signature);
int
rsa_sha512_sign_tr(const struct rsa_public_key *pub,
const struct rsa_private_key *key,
void *random_ctx, nettle_random_func *random,
struct sha512_ctx *hash,
mpz_t s);
int
rsa_sha512_verify(const struct rsa_public_key *key,
struct sha512_ctx *hash,
const mpz_t signature);
/* Variants taking the digest as argument. */
int
rsa_md5_sign_digest(const struct rsa_private_key *key,
const uint8_t *digest,
mpz_t s);
int
rsa_md5_sign_digest_tr(const struct rsa_public_key *pub,
const struct rsa_private_key *key,
void *random_ctx, nettle_random_func *random,
const uint8_t *digest, mpz_t s);
int
rsa_md5_verify_digest(const struct rsa_public_key *key,
const uint8_t *digest,
const mpz_t signature);
int
rsa_sha1_sign_digest(const struct rsa_private_key *key,
const uint8_t *digest,
mpz_t s);
int
rsa_sha1_sign_digest_tr(const struct rsa_public_key *pub,
const struct rsa_private_key *key,
void *random_ctx, nettle_random_func *random,
const uint8_t *digest,
mpz_t s);
int
rsa_sha1_verify_digest(const struct rsa_public_key *key,
const uint8_t *digest,
const mpz_t signature);
int
rsa_sha256_sign_digest(const struct rsa_private_key *key,
const uint8_t *digest,
mpz_t s);
int
rsa_sha256_sign_digest_tr(const struct rsa_public_key *pub,
const struct rsa_private_key *key,
void *random_ctx, nettle_random_func *random,
const uint8_t *digest,
mpz_t s);
int
rsa_sha256_verify_digest(const struct rsa_public_key *key,
const uint8_t *digest,
const mpz_t signature);
int
rsa_sha512_sign_digest(const struct rsa_private_key *key,
const uint8_t *digest,
mpz_t s);
int
rsa_sha512_sign_digest_tr(const struct rsa_public_key *pub,
const struct rsa_private_key *key,
void *random_ctx, nettle_random_func *random,
const uint8_t *digest,
mpz_t s);
int
rsa_sha512_verify_digest(const struct rsa_public_key *key,
const uint8_t *digest,
const mpz_t signature);
/* PSS style signatures */
int
rsa_pss_sha256_sign_digest_tr(const struct rsa_public_key *pub,
const struct rsa_private_key *key,
void *random_ctx, nettle_random_func *random,
size_t salt_length, const uint8_t *salt,
const uint8_t *digest,
mpz_t s);
int
rsa_pss_sha256_verify_digest(const struct rsa_public_key *key,
size_t salt_length,
const uint8_t *digest,
const mpz_t signature);
int
rsa_pss_sha384_sign_digest_tr(const struct rsa_public_key *pub,
const struct rsa_private_key *key,
void *random_ctx, nettle_random_func *random,
size_t salt_length, const uint8_t *salt,
const uint8_t *digest,
mpz_t s);
int
rsa_pss_sha384_verify_digest(const struct rsa_public_key *key,
size_t salt_length,
const uint8_t *digest,
const mpz_t signature);
int
rsa_pss_sha512_sign_digest_tr(const struct rsa_public_key *pub,
const struct rsa_private_key *key,
void *random_ctx, nettle_random_func *random,
size_t salt_length, const uint8_t *salt,
const uint8_t *digest,
mpz_t s);
int
rsa_pss_sha512_verify_digest(const struct rsa_public_key *key,
size_t salt_length,
const uint8_t *digest,
const mpz_t signature);
/* RSA encryption, using PKCS#1 */
/* These functions uses the v1.5 padding. What should the v2 (OAEP)
* functions be called? */
/* Returns 1 on success, 0 on failure, which happens if the
* message is too long for the key. */
int
rsa_encrypt(const struct rsa_public_key *key,
/* For padding */
void *random_ctx, nettle_random_func *random,
size_t length, const uint8_t *cleartext,
mpz_t cipher);
/* Message must point to a buffer of size *LENGTH. KEY->size is enough
* for all valid messages. On success, *LENGTH is updated to reflect
* the actual length of the message. Returns 1 on success, 0 on
* failure, which happens if decryption failed or if the message
* didn't fit. */
int
rsa_decrypt(const struct rsa_private_key *key,
size_t *length, uint8_t *cleartext,
const mpz_t ciphertext);
/* Timing-resistant version, using randomized RSA blinding. */
int
rsa_decrypt_tr(const struct rsa_public_key *pub,
const struct rsa_private_key *key,
void *random_ctx, nettle_random_func *random,
size_t *length, uint8_t *message,
const mpz_t gibberish);
/* Compute x, the e:th root of m. Calling it with x == m is allowed. */
void
rsa_compute_root(const struct rsa_private_key *key,
mpz_t x, const mpz_t m);
/* Safer variant, using RSA blinding, and checking the result after
CRT. */
int
rsa_compute_root_tr(const struct rsa_public_key *pub,
const struct rsa_private_key *key,
void *random_ctx, nettle_random_func *random,
mpz_t x, const mpz_t m);
/* Key generation */
/* Note that the key structs must be initialized first. */
int
rsa_generate_keypair(struct rsa_public_key *pub,
struct rsa_private_key *key,
void *random_ctx, nettle_random_func *random,
void *progress_ctx, nettle_progress_func *progress,
/* Desired size of modulo, in bits */
unsigned n_size,
/* Desired size of public exponent, in bits. If
* zero, the passed in value pub->e is used. */
unsigned e_size);
#define RSA_SIGN(key, algorithm, ctx, length, data, signature) ( \
algorithm##_update(ctx, length, data), \
rsa_##algorithm##_sign(key, ctx, signature) \
)
#define RSA_VERIFY(key, algorithm, ctx, length, data, signature) ( \
algorithm##_update(ctx, length, data), \
rsa_##algorithm##_verify(key, ctx, signature) \
)
/* Keys in sexp form. */
struct nettle_buffer;
/* Generates a public-key expression if PRIV is NULL .*/
int
rsa_keypair_to_sexp(struct nettle_buffer *buffer,
const char *algorithm_name, /* NULL means "rsa" */
const struct rsa_public_key *pub,
const struct rsa_private_key *priv);
struct sexp_iterator;
int
rsa_keypair_from_sexp_alist(struct rsa_public_key *pub,
struct rsa_private_key *priv,
unsigned limit,
struct sexp_iterator *i);
/* If PRIV is NULL, expect a public-key expression. If PUB is NULL,
* expect a private key expression and ignore the parts not needed for
* the public key. */
/* Keys must be initialized before calling this function, as usual. */
int
rsa_keypair_from_sexp(struct rsa_public_key *pub,
struct rsa_private_key *priv,
unsigned limit,
size_t length, const uint8_t *expr);
/* Keys in PKCS#1 format. */
struct asn1_der_iterator;
int
rsa_public_key_from_der_iterator(struct rsa_public_key *pub,
unsigned limit,
struct asn1_der_iterator *i);
int
rsa_private_key_from_der_iterator(struct rsa_public_key *pub,
struct rsa_private_key *priv,
unsigned limit,
struct asn1_der_iterator *i);
/* For public keys, use PRIV == NULL */
int
rsa_keypair_from_der(struct rsa_public_key *pub,
struct rsa_private_key *priv,
unsigned limit,
size_t length, const uint8_t *data);
/* OpenPGP format. Experimental interface, subject to change. */
int
rsa_keypair_to_openpgp(struct nettle_buffer *buffer,
const struct rsa_public_key *pub,
const struct rsa_private_key *priv,
/* A single user id. NUL-terminated utf8. */
const char *userid);
/* Internal functions. */
int
_rsa_verify(const struct rsa_public_key *key,
const mpz_t m,
const mpz_t s);
int
_rsa_verify_recover(const struct rsa_public_key *key,
mpz_t m,
const mpz_t s);
size_t
_rsa_check_size(mpz_t n);
/* _rsa_blind and _rsa_unblind are deprecated, unused in the library,
and will likely be removed with the next ABI break. */
void
_rsa_blind (const struct rsa_public_key *pub,
void *random_ctx, nettle_random_func *random,
mpz_t c, mpz_t ri);
void
_rsa_unblind (const struct rsa_public_key *pub, mpz_t c, const mpz_t ri);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_RSA_H_INCLUDED */

View File

@ -1,114 +0,0 @@
/* salsa20.h
The Salsa20 stream cipher.
Copyright (C) 2012 Simon Josefsson
Copyright (C) 2001 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_SALSA20_H_INCLUDED
#define NETTLE_SALSA20_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define salsa20_set_key nettle_salsa20_set_key
#define salsa20_128_set_key nettle_salsa20_128_set_key
#define salsa20_256_set_key nettle_salsa20_256_set_key
#define salsa20_set_nonce nettle_salsa20_set_nonce
#define salsa20_crypt nettle_salsa20_crypt
#define _salsa20_core _nettle_salsa20_core
#define salsa20r12_crypt nettle_salsa20r12_crypt
/* Alias for backwards compatibility */
#define salsa20_set_iv nettle_salsa20_set_nonce
/* In octets.*/
#define SALSA20_128_KEY_SIZE 16
#define SALSA20_256_KEY_SIZE 32
#define SALSA20_BLOCK_SIZE 64
#define SALSA20_NONCE_SIZE 8
#define SALSA20_IV_SIZE SALSA20_NONCE_SIZE
/* Aliases */
#define SALSA20_MIN_KEY_SIZE 16
#define SALSA20_MAX_KEY_SIZE 32
#define SALSA20_KEY_SIZE 32
#define _SALSA20_INPUT_LENGTH 16
struct salsa20_ctx
{
/* Indices 1-4 and 11-14 holds the key (two identical copies for the
shorter key size), indices 0, 5, 10, 15 are constant, indices 6, 7
are the IV, and indices 8, 9 are the block counter:
C K K K
K C I I
B B C K
K K K C
*/
uint32_t input[_SALSA20_INPUT_LENGTH];
};
void
salsa20_128_set_key(struct salsa20_ctx *ctx, const uint8_t *key);
void
salsa20_256_set_key(struct salsa20_ctx *ctx, const uint8_t *key);
void
salsa20_set_key(struct salsa20_ctx *ctx,
size_t length, const uint8_t *key);
void
salsa20_set_nonce(struct salsa20_ctx *ctx, const uint8_t *nonce);
void
salsa20_crypt(struct salsa20_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
void
salsa20r12_crypt(struct salsa20_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
void
_salsa20_core(uint32_t *dst, const uint32_t *src, unsigned rounds);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_SALSA20_H_INCLUDED */

View File

@ -1,102 +0,0 @@
/* serpent.h
The serpent block cipher.
Copyright (C) 2001 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
/* Serpent is a 128-bit block cipher that accepts a key size of 256
* bits, designed by Ross Anderson, Eli Biham, and Lars Knudsen. See
* http://www.cl.cam.ac.uk/~rja14/serpent.html for details.
*/
#ifndef NETTLE_SERPENT_H_INCLUDED
#define NETTLE_SERPENT_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define serpent_set_key nettle_serpent_set_key
#define serpent128_set_key nettle_serpent128_set_key
#define serpent192_set_key nettle_serpent192_set_key
#define serpent256_set_key nettle_serpent256_set_key
#define serpent_encrypt nettle_serpent_encrypt
#define serpent_decrypt nettle_serpent_decrypt
#define SERPENT_BLOCK_SIZE 16
/* Other key lengths are possible, but the design of Serpent makes
* smaller key lengths quite pointless; they cheated with the AES
* requirements, using a 256-bit key length exclusively and just
* padding it out if the desired key length was less, so there really
* is no advantage to using key lengths less than 256 bits. */
#define SERPENT_KEY_SIZE 32
/* Allow keys of size 128 <= bits <= 256 */
#define SERPENT_MIN_KEY_SIZE 16
#define SERPENT_MAX_KEY_SIZE 32
#define SERPENT128_KEY_SIZE 16
#define SERPENT192_KEY_SIZE 24
#define SERPENT256_KEY_SIZE 32
struct serpent_ctx
{
uint32_t keys[33][4]; /* key schedule */
};
void
serpent_set_key(struct serpent_ctx *ctx,
size_t length, const uint8_t *key);
void
serpent128_set_key(struct serpent_ctx *ctx, const uint8_t *key);
void
serpent192_set_key(struct serpent_ctx *ctx, const uint8_t *key);
void
serpent256_set_key(struct serpent_ctx *ctx, const uint8_t *key);
void
serpent_encrypt(const struct serpent_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
void
serpent_decrypt(const struct serpent_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_SERPENT_H_INCLUDED */

View File

@ -1,213 +0,0 @@
/* sexp.h
Parsing s-expressions.
Copyright (C) 2002 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_SEXP_H_INCLUDED
#define NETTLE_SEXP_H_INCLUDED
#include <stdarg.h>
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define sexp_iterator_first nettle_sexp_iterator_first
#define sexp_transport_iterator_first nettle_sexp_transport_iterator_first
#define sexp_iterator_next nettle_sexp_iterator_next
#define sexp_iterator_enter_list nettle_sexp_iterator_enter_list
#define sexp_iterator_exit_list nettle_sexp_iterator_exit_list
#define sexp_iterator_subexpr nettle_sexp_iterator_subexpr
#define sexp_iterator_get_uint32 nettle_sexp_iterator_get_uint32
#define sexp_iterator_check_type nettle_sexp_iterator_check_type
#define sexp_iterator_check_types nettle_sexp_iterator_check_types
#define sexp_iterator_assoc nettle_sexp_iterator_assoc
#define sexp_format nettle_sexp_format
#define sexp_vformat nettle_sexp_vformat
#define sexp_transport_format nettle_sexp_transport_format
#define sexp_transport_vformat nettle_sexp_transport_vformat
#define sexp_token_chars nettle_sexp_token_chars
enum sexp_type
{ SEXP_ATOM, SEXP_LIST, SEXP_END };
struct sexp_iterator
{
size_t length;
const uint8_t *buffer;
/* Points at the start of the current sub expression. */
size_t start;
/* If type is SEXP_LIST, pos points at the start of the current
* element. Otherwise, it points at the end. */
size_t pos;
unsigned level;
enum sexp_type type;
size_t display_length;
const uint8_t *display;
size_t atom_length;
const uint8_t *atom;
};
/* All these functions return 1 on success, 0 on failure */
/* Initializes the iterator. */
int
sexp_iterator_first(struct sexp_iterator *iterator,
size_t length, const uint8_t *input);
/* NOTE: Decodes the input string in place */
int
sexp_transport_iterator_first(struct sexp_iterator *iterator,
size_t length, uint8_t *input);
int
sexp_iterator_next(struct sexp_iterator *iterator);
/* Current element must be a list. */
int
sexp_iterator_enter_list(struct sexp_iterator *iterator);
/* Skips the rest of the current list */
int
sexp_iterator_exit_list(struct sexp_iterator *iterator);
#if 0
/* Skips out of as many lists as necessary to get back to the given
* level. */
int
sexp_iterator_exit_lists(struct sexp_iterator *iterator,
unsigned level);
#endif
/* Gets start and length of the current subexpression. Implies
* sexp_iterator_next. */
const uint8_t *
sexp_iterator_subexpr(struct sexp_iterator *iterator,
size_t *length);
int
sexp_iterator_get_uint32(struct sexp_iterator *iterator,
uint32_t *x);
/* Checks the type of the current expression, which should be a list
*
* (<type> ...)
*/
int
sexp_iterator_check_type(struct sexp_iterator *iterator,
const char *type);
const char *
sexp_iterator_check_types(struct sexp_iterator *iterator,
unsigned ntypes,
const char * const *types);
/* Current element must be a list. Looks up element of type
*
* (key rest...)
*
* For a matching key, the corresponding iterator is initialized
* pointing at the start of REST.
*
* On success, exits the current list.
*/
int
sexp_iterator_assoc(struct sexp_iterator *iterator,
unsigned nkeys,
const char * const *keys,
struct sexp_iterator *values);
/* Output functions. What is a reasonable API for this? It seems
* ugly to have to reimplement string streams. */
/* Declared for real in buffer.h */
struct nettle_buffer;
/* Returns the number of output characters, or 0 on out of memory. If
* buffer == NULL, just compute length.
*
* Format strings can contained matched parentheses, tokens ("foo" in
* the format string is formatted as "3:foo"), whitespace (which
* separates tokens but is otherwise ignored) and the following
* formatting specifiers:
*
* %s String represented as size_t length, const uint8_t *data.
*
* %t Optional display type, represented as
* size_t display_length, const uint8_t *display,
* display == NULL means no display type.
*
* %i Non-negative small integer, uint32_t.
*
* %b Non-negative bignum, mpz_t.
*
* %l Literal string (no length added), typically a balanced
* subexpression. Represented as size_t length, const uint8_t
* *data.
*
* %(, %) Allows insertion of unbalanced parenthesis.
*
* Modifiers:
*
* %0 For %s, %t and %l, says that there's no length argument,
* instead the string is NUL-terminated, and there's only one
* const uint8_t * argument.
*/
size_t
sexp_format(struct nettle_buffer *buffer,
const char *format, ...);
size_t
sexp_vformat(struct nettle_buffer *buffer,
const char *format, va_list args);
size_t
sexp_transport_format(struct nettle_buffer *buffer,
const char *format, ...);
size_t
sexp_transport_vformat(struct nettle_buffer *buffer,
const char *format, va_list args);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_SEXP_H_INCLUDED */

View File

@ -1,42 +0,0 @@
/* sha.h
This file is deprecated, and provided only for backwards
compatibility with earlier versions of Nettle. Please use sha1.h
and/or sha2.h instead.
Copyright (C) 2001 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_SHA_H_INCLUDED
#define NETTLE_SHA_H_INCLUDED
#include "sha1.h"
#include "sha2.h"
#endif /* NETTLE_SHA_H_INCLUDED */

View File

@ -1,88 +0,0 @@
/* sha1.h
The sha1 hash function.
Copyright (C) 2001, 2012 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_SHA1_H_INCLUDED
#define NETTLE_SHA1_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define sha1_init nettle_sha1_init
#define sha1_update nettle_sha1_update
#define sha1_digest nettle_sha1_digest
/* SHA1 */
#define SHA1_DIGEST_SIZE 20
#define SHA1_BLOCK_SIZE 64
/* For backwards compatibility */
#define SHA1_DATA_SIZE SHA1_BLOCK_SIZE
/* Digest is kept internally as 5 32-bit words. */
#define _SHA1_DIGEST_LENGTH 5
struct sha1_ctx
{
uint32_t state[_SHA1_DIGEST_LENGTH]; /* State variables */
uint64_t count; /* 64-bit block count */
uint8_t block[SHA1_BLOCK_SIZE]; /* SHA1 data buffer */
unsigned int index; /* index into buffer */
};
void
sha1_init(struct sha1_ctx *ctx);
void
sha1_update(struct sha1_ctx *ctx,
size_t length,
const uint8_t *data);
void
sha1_digest(struct sha1_ctx *ctx,
size_t length,
uint8_t *digest);
/* Internal compression function. STATE points to 5 uint32_t words,
and DATA points to 64 bytes of input data, possibly unaligned. */
void
_nettle_sha1_compress(uint32_t *state, const uint8_t *data);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_SHA1_H_INCLUDED */

View File

@ -1,193 +0,0 @@
/* sha3.h
The sha3 hash function (aka Keccak).
Copyright (C) 2012 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_SHA3_H_INCLUDED
#define NETTLE_SHA3_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define sha3_permute nettle_sha3_permute
#define _sha3_update _nettle_sha3_update
#define _sha3_pad _nettle_sha3_pad
#define sha3_224_init nettle_sha3_224_init
#define sha3_224_update nettle_sha3_224_update
#define sha3_224_digest nettle_sha3_224_digest
#define sha3_256_init nettle_sha3_256_init
#define sha3_256_update nettle_sha3_256_update
#define sha3_256_digest nettle_sha3_256_digest
#define sha3_384_init nettle_sha3_384_init
#define sha3_384_update nettle_sha3_384_update
#define sha3_384_digest nettle_sha3_384_digest
#define sha3_512_init nettle_sha3_512_init
#define sha3_512_update nettle_sha3_512_update
#define sha3_512_digest nettle_sha3_512_digest
/* Indicates that SHA3 is the NIST FIPS 202 version. */
#define NETTLE_SHA3_FIPS202 1
/* The sha3 state is a 5x5 matrix of 64-bit words. In the notation of
Keccak description, S[x,y] is element x + 5*y, so if x is
interpreted as the row index and y the column index, it is stored
in column-major order. */
#define SHA3_STATE_LENGTH 25
/* The "width" is 1600 bits or 200 octets */
struct sha3_state
{
uint64_t a[SHA3_STATE_LENGTH];
};
void
sha3_permute (struct sha3_state *state);
unsigned
_sha3_update (struct sha3_state *state,
unsigned block_size, uint8_t *block,
unsigned pos,
size_t length, const uint8_t *data);
void
_sha3_pad (struct sha3_state *state,
unsigned block_size, uint8_t *block, unsigned pos);
/* The "capacity" is set to 2*(digest size), 512 bits or 64 octets.
The "rate" is the width - capacity, or width - 2 * (digest
size). */
#define SHA3_224_DIGEST_SIZE 28
#define SHA3_224_BLOCK_SIZE 144
#define SHA3_256_DIGEST_SIZE 32
#define SHA3_256_BLOCK_SIZE 136
#define SHA3_384_DIGEST_SIZE 48
#define SHA3_384_BLOCK_SIZE 104
#define SHA3_512_DIGEST_SIZE 64
#define SHA3_512_BLOCK_SIZE 72
/* For backwards compatibility */
#define SHA3_224_DATA_SIZE SHA3_224_BLOCK_SIZE
#define SHA3_256_DATA_SIZE SHA3_256_BLOCK_SIZE
#define SHA3_384_DATA_SIZE SHA3_384_BLOCK_SIZE
#define SHA3_512_DATA_SIZE SHA3_512_BLOCK_SIZE
struct sha3_224_ctx
{
struct sha3_state state;
unsigned index;
uint8_t block[SHA3_224_BLOCK_SIZE];
};
void
sha3_224_init (struct sha3_224_ctx *ctx);
void
sha3_224_update (struct sha3_224_ctx *ctx,
size_t length,
const uint8_t *data);
void
sha3_224_digest(struct sha3_224_ctx *ctx,
size_t length,
uint8_t *digest);
struct sha3_256_ctx
{
struct sha3_state state;
unsigned index;
uint8_t block[SHA3_256_BLOCK_SIZE];
};
void
sha3_256_init (struct sha3_256_ctx *ctx);
void
sha3_256_update (struct sha3_256_ctx *ctx,
size_t length,
const uint8_t *data);
void
sha3_256_digest(struct sha3_256_ctx *ctx,
size_t length,
uint8_t *digest);
struct sha3_384_ctx
{
struct sha3_state state;
unsigned index;
uint8_t block[SHA3_384_BLOCK_SIZE];
};
void
sha3_384_init (struct sha3_384_ctx *ctx);
void
sha3_384_update (struct sha3_384_ctx *ctx,
size_t length,
const uint8_t *data);
void
sha3_384_digest(struct sha3_384_ctx *ctx,
size_t length,
uint8_t *digest);
struct sha3_512_ctx
{
struct sha3_state state;
unsigned index;
uint8_t block[SHA3_512_BLOCK_SIZE];
};
void
sha3_512_init (struct sha3_512_ctx *ctx);
void
sha3_512_update (struct sha3_512_ctx *ctx,
size_t length,
const uint8_t *data);
void
sha3_512_digest(struct sha3_512_ctx *ctx,
size_t length,
uint8_t *digest);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_SHA3_H_INCLUDED */

View File

@ -1,98 +0,0 @@
/* twofish.h
The twofish block cipher.
Copyright (C) 2001, 2014 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
/*
* Twofish is a 128-bit block cipher that accepts a variable-length
* key up to 256 bits, designed by Bruce Schneier and others. See
* http://www.counterpane.com/twofish.html for details.
*/
#ifndef NETTLE_TWOFISH_H_INCLUDED
#define NETTLE_TWOFISH_H_INCLUDED
#include "nettle-types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define twofish_set_key nettle_twofish_set_key
#define twofish128_set_key nettle_twofish128_set_key
#define twofish192_set_key nettle_twofish192_set_key
#define twofish256_set_key nettle_twofish256_set_key
#define twofish_encrypt nettle_twofish_encrypt
#define twofish_decrypt nettle_twofish_decrypt
#define TWOFISH_BLOCK_SIZE 16
/* Variable key size between 128 and 256 bits. But the only valid
* values are 16 (128 bits), 24 (192 bits) and 32 (256 bits). */
#define TWOFISH_MIN_KEY_SIZE 16
#define TWOFISH_MAX_KEY_SIZE 32
#define TWOFISH_KEY_SIZE 32
#define TWOFISH128_KEY_SIZE 16
#define TWOFISH192_KEY_SIZE 24
#define TWOFISH256_KEY_SIZE 32
struct twofish_ctx
{
uint32_t keys[40];
uint32_t s_box[4][256];
};
void
twofish_set_key(struct twofish_ctx *ctx,
size_t length, const uint8_t *key);
void
twofish128_set_key(struct twofish_ctx *context, const uint8_t *key);
void
twofish192_set_key(struct twofish_ctx *context, const uint8_t *key);
void
twofish256_set_key(struct twofish_ctx *context, const uint8_t *key);
void
twofish_encrypt(const struct twofish_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
void
twofish_decrypt(const struct twofish_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_TWOFISH_H_INCLUDED */

View File

@ -1,253 +0,0 @@
/* umac.h
UMAC message authentication code (RFC-4418).
Copyright (C) 2013 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_UMAC_H_INCLUDED
#define NETTLE_UMAC_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
/* Namespace mangling */
#define umac32_set_key nettle_umac32_set_key
#define umac64_set_key nettle_umac64_set_key
#define umac96_set_key nettle_umac96_set_key
#define umac128_set_key nettle_umac128_set_key
#define umac32_set_nonce nettle_umac32_set_nonce
#define umac64_set_nonce nettle_umac64_set_nonce
#define umac96_set_nonce nettle_umac96_set_nonce
#define umac128_set_nonce nettle_umac128_set_nonce
#define umac32_update nettle_umac32_update
#define umac64_update nettle_umac64_update
#define umac96_update nettle_umac96_update
#define umac128_update nettle_umac128_update
#define umac32_digest nettle_umac32_digest
#define umac64_digest nettle_umac64_digest
#define umac96_digest nettle_umac96_digest
#define umac128_digest nettle_umac128_digest
#define _umac_set_key _nettle_umac_set_key
#define _umac_nh _nettle_umac_nh
#define _umac_nh_n _nettle_umac_nh_n
#define _umac_poly64 _nettle_umac_poly64
#define _umac_poly128 _nettle_umac_poly128
#define _umac_l2_init _nettle_umac_l2_init
#define _umac_l2 _nettle_umac_l2
#define _umac_l2_final _nettle_umac_l2_final
#define _umac_l3_init _nettle_umac_l3_init
#define _umac_l3 _nettle_umac_l3
#include "nettle-types.h"
#include "aes.h"
#define UMAC_KEY_SIZE AES128_KEY_SIZE
#define UMAC32_DIGEST_SIZE 4
#define UMAC64_DIGEST_SIZE 8
#define UMAC96_DIGEST_SIZE 12
#define UMAC128_DIGEST_SIZE 16
#define UMAC_BLOCK_SIZE 1024
#define UMAC_MIN_NONCE_SIZE 1
#define UMAC_MAX_NONCE_SIZE AES_BLOCK_SIZE
/* For backwards compatibility */
#define UMAC_DATA_SIZE UMAC_BLOCK_SIZE
/* Subkeys and state for UMAC with tag size 32*n bits. */
#define _UMAC_STATE(n) \
uint32_t l1_key[UMAC_BLOCK_SIZE/4 + 4*((n)-1)]; \
/* Keys in 32-bit pieces, high first */ \
uint32_t l2_key[6*(n)]; \
uint64_t l3_key1[8*(n)]; \
uint32_t l3_key2[(n)]; \
/* AES cipher for encrypting the nonce */ \
struct aes128_ctx pdf_key; \
/* The l2_state consists of 2*n uint64_t, for poly64 \
and poly128 hashing, followed by n additional \
uint64_t used as an input buffer. */ \
uint64_t l2_state[3*(n)]; \
/* Input to the pdf_key, zero-padded and low bits \
cleared if appropriate. */ \
uint8_t nonce[AES_BLOCK_SIZE]; \
unsigned short nonce_length /* For incrementing */
/* Buffering */
#define _UMAC_BUFFER \
unsigned index; \
/* Complete blocks processed */ \
uint64_t count; \
uint8_t block[UMAC_BLOCK_SIZE]
#define _UMAC_NONCE_CACHED 0x80
struct umac32_ctx
{
_UMAC_STATE(1);
/* Low bits and cache flag. */
unsigned short nonce_low;
/* Previous padding block */
uint32_t pad_cache[AES_BLOCK_SIZE / 4];
_UMAC_BUFFER;
};
struct umac64_ctx
{
_UMAC_STATE(2);
/* Low bit and cache flag. */
unsigned short nonce_low;
/* Previous padding block */
uint32_t pad_cache[AES_BLOCK_SIZE/4];
_UMAC_BUFFER;
};
struct umac96_ctx
{
_UMAC_STATE(3);
_UMAC_BUFFER;
};
struct umac128_ctx
{
_UMAC_STATE(4);
_UMAC_BUFFER;
};
/* The _set_key function initialize the nonce to zero. */
void
umac32_set_key (struct umac32_ctx *ctx, const uint8_t *key);
void
umac64_set_key (struct umac64_ctx *ctx, const uint8_t *key);
void
umac96_set_key (struct umac96_ctx *ctx, const uint8_t *key);
void
umac128_set_key (struct umac128_ctx *ctx, const uint8_t *key);
/* Optional, if not used, messages get incrementing nonces starting from zero. */
void
umac32_set_nonce (struct umac32_ctx *ctx,
size_t nonce_length, const uint8_t *nonce);
void
umac64_set_nonce (struct umac64_ctx *ctx,
size_t nonce_length, const uint8_t *nonce);
void
umac96_set_nonce (struct umac96_ctx *ctx,
size_t nonce_length, const uint8_t *nonce);
void
umac128_set_nonce (struct umac128_ctx *ctx,
size_t nonce_length, const uint8_t *nonce);
void
umac32_update (struct umac32_ctx *ctx,
size_t length, const uint8_t *data);
void
umac64_update (struct umac64_ctx *ctx,
size_t length, const uint8_t *data);
void
umac96_update (struct umac96_ctx *ctx,
size_t length, const uint8_t *data);
void
umac128_update (struct umac128_ctx *ctx,
size_t length, const uint8_t *data);
/* The _digest functions increment the nonce */
void
umac32_digest (struct umac32_ctx *ctx,
size_t length, uint8_t *digest);
void
umac64_digest (struct umac64_ctx *ctx,
size_t length, uint8_t *digest);
void
umac96_digest (struct umac96_ctx *ctx,
size_t length, uint8_t *digest);
void
umac128_digest (struct umac128_ctx *ctx,
size_t length, uint8_t *digest);
/* Internal functions */
#define UMAC_POLY64_BLOCKS 16384
#define UMAC_P64_OFFSET 59
#define UMAC_P64 (- (uint64_t) UMAC_P64_OFFSET)
#define UMAC_P128_OFFSET 159
#define UMAC_P128_HI (~(uint64_t) 0)
#define UMAC_P128_LO (-(uint64_t) UMAC_P128_OFFSET)
void
_umac_set_key (uint32_t *l1_key, uint32_t *l2_key,
uint64_t *l3_key1, uint32_t *l3_key2,
struct aes128_ctx *pad, const uint8_t *key, unsigned n);
uint64_t
_umac_nh (const uint32_t *key, unsigned length, const uint8_t *msg);
/* Equivalent to
for (i = 0; i < n; i++)
out[i] = _umac_nh (key + 4*i, length, msg);
but processing input only once.
*/
void
_umac_nh_n (uint64_t *out, unsigned n, const uint32_t *key,
unsigned length, const uint8_t *msg);
/* Returns y*k + m (mod p), including "marker" processing. Return
value is *not* in canonical representation, and must be normalized
before the output is used. */
uint64_t
_umac_poly64 (uint32_t kh, uint32_t kl, uint64_t y, uint64_t m);
void
_umac_poly128 (const uint32_t *k, uint64_t *y, uint64_t mh, uint64_t ml);
void
_umac_l2_init (unsigned size, uint32_t *k);
void
_umac_l2(const uint32_t *key, uint64_t *state, unsigned n,
uint64_t count, const uint64_t *m);
void
_umac_l2_final(const uint32_t *key, uint64_t *state, unsigned n,
uint64_t count);
void
_umac_l3_init (unsigned size, uint64_t *k);
uint32_t
_umac_l3 (const uint64_t *key, const uint64_t *m);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_UMAC_H_INCLUDED */

View File

@ -1,64 +0,0 @@
/* version.h
Information about library version.
Copyright (C) 2015 Red Hat, Inc.
Copyright (C) 2015 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_VERSION_H_INCLUDED
#define NETTLE_VERSION_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
/* Individual version numbers in decimal */
#define NETTLE_VERSION_MAJOR 3
#define NETTLE_VERSION_MINOR 4
#define NETTLE_USE_MINI_GMP 1
/* We need a preprocessor constant for GMP_NUMB_BITS, simply using
sizeof(mp_limb_t) * CHAR_BIT is not good enough. */
#if NETTLE_USE_MINI_GMP
# define GMP_NUMB_BITS 32
#endif
int
nettle_version_major (void);
int
nettle_version_minor (void);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_VERSION_H_INCLUDED */

View File

@ -1,145 +0,0 @@
/* yarrow.h
The yarrow pseudo-randomness generator.
Copyright (C) 2001 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_YARROW_H_INCLUDED
#define NETTLE_YARROW_H_INCLUDED
#include "aes.h"
#include "sha2.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name mangling */
#define yarrow256_init nettle_yarrow256_init
#define yarrow256_seed nettle_yarrow256_seed
#define yarrow256_update nettle_yarrow256_update
#define yarrow256_random nettle_yarrow256_random
#define yarrow256_is_seeded nettle_yarrow256_is_seeded
#define yarrow256_needed_sources nettle_yarrow256_needed_sources
#define yarrow256_fast_reseed nettle_yarrow256_fast_reseed
#define yarrow256_slow_reseed nettle_yarrow256_slow_reseed
#define yarrow_key_event_init nettle_yarrow_key_event_init
#define yarrow_key_event_estimate nettle_yarrow_key_event_estimate
/* Obsolete alias for backwards compatibility. Will be deleted in some
later version. */
#define yarrow256_force_reseed yarrow256_slow_reseed
enum yarrow_pool_id { YARROW_FAST = 0, YARROW_SLOW = 1 };
struct yarrow_source
{
/* Indexed by yarrow_pool_id */
uint32_t estimate[2];
/* The pool next sample should go to. */
enum yarrow_pool_id next;
};
#define YARROW256_SEED_FILE_SIZE (2 * AES_BLOCK_SIZE)
/* Yarrow-256, based on SHA-256 and AES-256 */
struct yarrow256_ctx
{
/* Indexed by yarrow_pool_id */
struct sha256_ctx pools[2];
int seeded;
/* The current key and counter block */
struct aes256_ctx key;
uint8_t counter[AES_BLOCK_SIZE];
/* The entropy sources */
unsigned nsources;
struct yarrow_source *sources;
};
void
yarrow256_init(struct yarrow256_ctx *ctx,
unsigned nsources,
struct yarrow_source *sources);
void
yarrow256_seed(struct yarrow256_ctx *ctx,
size_t length,
const uint8_t *seed_file);
/* Returns 1 on reseed */
int
yarrow256_update(struct yarrow256_ctx *ctx,
unsigned source, unsigned entropy,
size_t length, const uint8_t *data);
void
yarrow256_random(struct yarrow256_ctx *ctx, size_t length, uint8_t *dst);
int
yarrow256_is_seeded(struct yarrow256_ctx *ctx);
unsigned
yarrow256_needed_sources(struct yarrow256_ctx *ctx);
void
yarrow256_fast_reseed(struct yarrow256_ctx *ctx);
void
yarrow256_slow_reseed(struct yarrow256_ctx *ctx);
/* Key event estimator */
#define YARROW_KEY_EVENT_BUFFER 16
struct yarrow_key_event_ctx
{
/* Counter for initial priming of the state */
unsigned index;
unsigned chars[YARROW_KEY_EVENT_BUFFER];
unsigned previous;
};
void
yarrow_key_event_init(struct yarrow_key_event_ctx *ctx);
unsigned
yarrow_key_event_estimate(struct yarrow_key_event_ctx *ctx,
unsigned key, unsigned time);
#ifdef __cplusplus
}
#endif
#endif /* NETTLE_YARROW_H_INCLUDED */

Binary file not shown.

View File

@ -1,397 +0,0 @@
EXPORTS
_nettle_cnd_copy @1
_nettle_cnd_swap @2
_nettle_curve25519 @3 DATA
_nettle_curve25519_eh_to_x @4
_nettle_dsa_hash @5
_nettle_ecc_a_to_j @6
_nettle_ecc_add_eh @7
_nettle_ecc_add_ehh @8
_nettle_ecc_add_jja @9
_nettle_ecc_add_jjj @10
_nettle_ecc_dup_eh @11
_nettle_ecc_dup_jj @12
_nettle_ecc_eh_to_a @13
_nettle_ecc_hash @14
_nettle_ecc_j_to_a @15
_nettle_ecc_mod @16
_nettle_ecc_mod_add @17
_nettle_ecc_mod_addmul_1 @18
_nettle_ecc_mod_inv @19
_nettle_ecc_mod_mul @20
_nettle_ecc_mod_mul_1 @21
_nettle_ecc_mod_random @22
_nettle_ecc_mod_sqr @23
_nettle_ecc_mod_sub @24
_nettle_ecc_mod_submul_1 @25
_nettle_ecc_mul_a @26
_nettle_ecc_mul_a_eh @27
_nettle_ecc_mul_g @28
_nettle_ecc_mul_g_eh @29
_nettle_ecc_pm1_redc @30
_nettle_ecc_pp1_redc @31
_nettle_eddsa_compress @32
_nettle_eddsa_compress_itch @33
_nettle_eddsa_decompress @34
_nettle_eddsa_decompress_itch @35
_nettle_eddsa_expand_key @36
_nettle_eddsa_hash @37
_nettle_eddsa_public_key @38
_nettle_eddsa_public_key_itch @39
_nettle_eddsa_sign @40
_nettle_eddsa_sign_itch @41
_nettle_eddsa_verify @42
_nettle_eddsa_verify_itch @43
_nettle_generate_pocklington_prime @44
_nettle_gmp_alloc @45
_nettle_gmp_alloc_limbs @46
_nettle_gmp_free @47
_nettle_gmp_free_limbs @48
_nettle_mpn_get_base256_le @49
_nettle_mpn_set_base256 @50
_nettle_mpn_set_base256_le @51
_nettle_mpz_limbs_cmp @52
_nettle_mpz_limbs_copy @53
_nettle_mpz_limbs_read_n @54
_nettle_mpz_set_n @55
_nettle_pkcs1_signature_prefix @56
_nettle_rsa_blind @57
_nettle_rsa_check_size @58
_nettle_rsa_unblind @59
_nettle_rsa_verify @60
_nettle_rsa_verify_recover @61
_nettle_sec_add_1 @62
_nettle_sec_sub_1 @63
_nettle_sec_tabselect @64
mp_bits_per_limb @65 DATA
mp_get_memory_functions @66
mp_set_memory_functions @67
mpn_add @68
mpn_add_1 @69
mpn_add_n @70
mpn_addmul_1 @71
mpn_cmp @72
mpn_com @73
mpn_copyd @74
mpn_copyi @75
mpn_get_str @76
mpn_invert_3by2 @77
mpn_lshift @78
mpn_mul @79
mpn_mul_1 @80
mpn_mul_n @81
mpn_neg @82
mpn_perfect_square_p @83
mpn_popcount @84
mpn_rshift @85
mpn_scan0 @86
mpn_scan1 @87
mpn_set_str @88
mpn_sqr @89
mpn_sqrtrem @90
mpn_sub @91
mpn_sub_1 @92
mpn_sub_n @93
mpn_submul_1 @94
mpn_zero @95
mpn_zero_p @96
mpz_abs @97
mpz_add @98
mpz_add_ui @99
mpz_addmul @100
mpz_addmul_ui @101
mpz_and @102
mpz_bin_uiui @103
mpz_cdiv_q @104
mpz_cdiv_q_2exp @105
mpz_cdiv_q_ui @106
mpz_cdiv_qr @107
mpz_cdiv_qr_ui @108
mpz_cdiv_r @109
mpz_cdiv_r_2exp @110
mpz_cdiv_r_ui @111
mpz_cdiv_ui @112
mpz_clear @113
mpz_clrbit @114
mpz_cmp @115
mpz_cmp_d @116
mpz_cmp_si @117
mpz_cmp_ui @118
mpz_cmpabs @119
mpz_cmpabs_d @120
mpz_cmpabs_ui @121
mpz_com @122
mpz_combit @123
mpz_congruent_p @124
mpz_divexact @125
mpz_divexact_ui @126
mpz_divisible_p @127
mpz_divisible_ui_p @128
mpz_export @129
mpz_fac_ui @130
mpz_fdiv_q @131
mpz_fdiv_q_2exp @132
mpz_fdiv_q_ui @133
mpz_fdiv_qr @134
mpz_fdiv_qr_ui @135
mpz_fdiv_r @136
mpz_fdiv_r_2exp @137
mpz_fdiv_r_ui @138
mpz_fdiv_ui @139
mpz_fits_slong_p @140
mpz_fits_ulong_p @141
mpz_gcd @142
mpz_gcd_ui @143
mpz_gcdext @144
mpz_get_d @145
mpz_get_si @146
mpz_get_str @147
mpz_get_ui @148
mpz_getlimbn @149
mpz_hamdist @150
mpz_import @151
mpz_init @152
mpz_init2 @153
mpz_init_set @154
mpz_init_set_d @155
mpz_init_set_si @156
mpz_init_set_str @157
mpz_init_set_ui @158
mpz_invert @159
mpz_ior @160
mpz_lcm @161
mpz_lcm_ui @162
mpz_limbs_finish @163
mpz_limbs_modify @164
mpz_limbs_read @165
mpz_limbs_write @166
mpz_mod @167
mpz_mod_ui @168
mpz_mul @169
mpz_mul_2exp @170
mpz_mul_si @171
mpz_mul_ui @172
mpz_neg @173
mpz_out_str @174
mpz_perfect_square_p @175
mpz_popcount @176
mpz_pow_ui @177
mpz_powm @178
mpz_powm_ui @179
mpz_probab_prime_p @180
mpz_realloc2 @181
mpz_roinit_n @182
mpz_root @183
mpz_rootrem @184
mpz_scan0 @185
mpz_scan1 @186
mpz_set @187
mpz_set_d @188
mpz_set_si @189
mpz_set_str @190
mpz_set_ui @191
mpz_setbit @192
mpz_sgn @193
mpz_size @194
mpz_sizeinbase @195
mpz_sqrt @196
mpz_sqrtrem @197
mpz_sub @198
mpz_sub_ui @199
mpz_submul @200
mpz_submul_ui @201
mpz_swap @202
mpz_tdiv_q @203
mpz_tdiv_q_2exp @204
mpz_tdiv_q_ui @205
mpz_tdiv_qr @206
mpz_tdiv_qr_ui @207
mpz_tdiv_r @208
mpz_tdiv_r_2exp @209
mpz_tdiv_r_ui @210
mpz_tdiv_ui @211
mpz_tstbit @212
mpz_ui_pow_ui @213
mpz_ui_sub @214
mpz_xor @215
nettle_asn1_der_decode_bitstring @216
nettle_asn1_der_decode_bitstring_last @217
nettle_asn1_der_decode_constructed @218
nettle_asn1_der_decode_constructed_last @219
nettle_asn1_der_get_bignum @220
nettle_asn1_der_get_uint32 @221
nettle_asn1_der_iterator_first @222
nettle_asn1_der_iterator_next @223
nettle_curve25519_mul @224
nettle_curve25519_mul_g @225
nettle_dsa_compat_generate_keypair @226
nettle_dsa_generate_keypair @227
nettle_dsa_generate_params @228
nettle_dsa_keypair_from_sexp_alist @229
nettle_dsa_keypair_to_sexp @230
nettle_dsa_openssl_private_key_from_der_iterator @231
nettle_dsa_params_clear @232
nettle_dsa_params_from_der_iterator @233
nettle_dsa_params_init @234
nettle_dsa_private_key_clear @235
nettle_dsa_private_key_init @236
nettle_dsa_public_key_clear @237
nettle_dsa_public_key_from_der_iterator @238
nettle_dsa_public_key_init @239
nettle_dsa_sha1_keypair_from_sexp @240
nettle_dsa_sha1_sign @241
nettle_dsa_sha1_sign_digest @242
nettle_dsa_sha1_verify @243
nettle_dsa_sha1_verify_digest @244
nettle_dsa_sha256_keypair_from_sexp @245
nettle_dsa_sha256_sign @246
nettle_dsa_sha256_sign_digest @247
nettle_dsa_sha256_verify @248
nettle_dsa_sha256_verify_digest @249
nettle_dsa_sign @250
nettle_dsa_signature_clear @251
nettle_dsa_signature_from_sexp @252
nettle_dsa_signature_init @253
nettle_dsa_verify @254
nettle_ecc_bit_size @255
nettle_ecc_ecdsa_sign @256
nettle_ecc_ecdsa_sign_itch @257
nettle_ecc_ecdsa_verify @258
nettle_ecc_ecdsa_verify_itch @259
nettle_ecc_point_clear @260
nettle_ecc_point_get @261
nettle_ecc_point_init @262
nettle_ecc_point_mul @263
nettle_ecc_point_mul_g @264
nettle_ecc_point_set @265
nettle_ecc_scalar_clear @266
nettle_ecc_scalar_get @267
nettle_ecc_scalar_init @268
nettle_ecc_scalar_random @269
nettle_ecc_scalar_set @270
nettle_ecc_size @271
nettle_ecc_size_a @272
nettle_ecc_size_j @273
nettle_ecdsa_generate_keypair @274
nettle_ecdsa_sign @275
nettle_ecdsa_verify @276
nettle_ed25519_sha512_public_key @277
nettle_ed25519_sha512_sign @278
nettle_ed25519_sha512_verify @279
nettle_get_secp_192r1 @280
nettle_get_secp_224r1 @281
nettle_get_secp_256r1 @282
nettle_get_secp_384r1 @283
nettle_get_secp_521r1 @284
nettle_mpz_get_str_256 @285
nettle_mpz_init_set_str_256_s @286
nettle_mpz_init_set_str_256_u @287
nettle_mpz_random @288
nettle_mpz_random_size @289
nettle_mpz_set_sexp @290
nettle_mpz_set_str_256_s @291
nettle_mpz_set_str_256_u @292
nettle_mpz_sizeinbase_256_s @293
nettle_mpz_sizeinbase_256_u @294
nettle_openssl_provate_key_from_der @295
nettle_pgp_armor @296
nettle_pgp_crc24 @297
nettle_pgp_put_header @298
nettle_pgp_put_header_length @299
nettle_pgp_put_length @300
nettle_pgp_put_mpi @301
nettle_pgp_put_public_rsa_key @302
nettle_pgp_put_rsa_sha1_signature @303
nettle_pgp_put_string @304
nettle_pgp_put_sub_packet @305
nettle_pgp_put_uint16 @306
nettle_pgp_put_uint32 @307
nettle_pgp_put_userid @308
nettle_pgp_sub_packet_end @309
nettle_pgp_sub_packet_start @310
nettle_pkcs1_decrypt @311
nettle_pkcs1_encrypt @312
nettle_pkcs1_rsa_digest_encode @313
nettle_pkcs1_rsa_md5_encode @314
nettle_pkcs1_rsa_md5_encode_digest @315
nettle_pkcs1_rsa_sha1_encode @316
nettle_pkcs1_rsa_sha1_encode_digest @317
nettle_pkcs1_rsa_sha256_encode @318
nettle_pkcs1_rsa_sha256_encode_digest @319
nettle_pkcs1_rsa_sha512_encode @320
nettle_pkcs1_rsa_sha512_encode_digest @321
nettle_pss_encode_mgf1 @322
nettle_pss_mgf1 @323
nettle_pss_verify_mgf1 @324
nettle_random_prime @325
nettle_rsa_compute_root @326
nettle_rsa_compute_root_tr @327
nettle_rsa_decrypt @328
nettle_rsa_decrypt_tr @329
nettle_rsa_encrypt @330
nettle_rsa_generate_keypair @331
nettle_rsa_keypair_from_der @332
nettle_rsa_keypair_from_sexp @333
nettle_rsa_keypair_from_sexp_alist @334
nettle_rsa_keypair_to_openpgp @335
nettle_rsa_keypair_to_sexp @336
nettle_rsa_md5_sign @337
nettle_rsa_md5_sign_digest @338
nettle_rsa_md5_sign_digest_tr @339
nettle_rsa_md5_sign_tr @340
nettle_rsa_md5_verify @341
nettle_rsa_md5_verify_digest @342
nettle_rsa_pkcs1_sign @343
nettle_rsa_pkcs1_sign_tr @344
nettle_rsa_pkcs1_verify @345
nettle_rsa_private_key_clear @346
nettle_rsa_private_key_from_der_iterator @347
nettle_rsa_private_key_init @348
nettle_rsa_private_key_prepare @349
nettle_rsa_pss_sha256_sign_digest_tr @350
nettle_rsa_pss_sha256_verify_digest @351
nettle_rsa_pss_sha384_sign_digest_tr @352
nettle_rsa_pss_sha384_verify_digest @353
nettle_rsa_pss_sha512_sign_digest_tr @354
nettle_rsa_pss_sha512_verify_digest @355
nettle_rsa_public_key_clear @356
nettle_rsa_public_key_from_der_iterator @357
nettle_rsa_public_key_init @358
nettle_rsa_public_key_prepare @359
nettle_rsa_sha1_sign @360
nettle_rsa_sha1_sign_digest @361
nettle_rsa_sha1_sign_digest_tr @362
nettle_rsa_sha1_sign_tr @363
nettle_rsa_sha1_verify @364
nettle_rsa_sha1_verify_digest @365
nettle_rsa_sha256_sign @366
nettle_rsa_sha256_sign_digest @367
nettle_rsa_sha256_sign_digest_tr @368
nettle_rsa_sha256_sign_tr @369
nettle_rsa_sha256_verify @370
nettle_rsa_sha256_verify_digest @371
nettle_rsa_sha512_sign @372
nettle_rsa_sha512_sign_digest @373
nettle_rsa_sha512_sign_digest_tr @374
nettle_rsa_sha512_sign_tr @375
nettle_rsa_sha512_verify @376
nettle_rsa_sha512_verify_digest @377
nettle_secp_192r1 @378 DATA
nettle_secp_224r1 @379 DATA
nettle_secp_256r1 @380 DATA
nettle_secp_384r1 @381 DATA
nettle_secp_521r1 @382 DATA
nettle_sexp_format @383
nettle_sexp_iterator_assoc @384
nettle_sexp_iterator_check_type @385
nettle_sexp_iterator_check_types @386
nettle_sexp_iterator_enter_list @387
nettle_sexp_iterator_exit_list @388
nettle_sexp_iterator_first @389
nettle_sexp_iterator_get_uint32 @390
nettle_sexp_iterator_next @391
nettle_sexp_iterator_subexpr @392
nettle_sexp_transport_format @393
nettle_sexp_transport_iterator_first @394
nettle_sexp_transport_vformat @395
nettle_sexp_vformat @396

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,416 +0,0 @@
EXPORTS
_nettle_aes_decrypt @1
_nettle_aes_encrypt @2
_nettle_aes_encrypt_table @3 DATA
_nettle_aes_invert @4
_nettle_aes_set_key @5
_nettle_camellia_absorb @6
_nettle_camellia_crypt @7
_nettle_camellia_invert_key @8
_nettle_camellia_table @9 DATA
_nettle_chacha_core @10
_nettle_md5_compress @11
_nettle_poly1305_block @12
_nettle_ripemd160_compress @13
_nettle_salsa20_core @14
_nettle_sha1_compress @15
_nettle_sha256_compress @16
_nettle_sha3_pad @17
_nettle_sha3_update @18
_nettle_sha512_compress @19
_nettle_umac_l2 @20
_nettle_umac_l2_final @21
_nettle_umac_l2_init @22
_nettle_umac_l3 @23
_nettle_umac_l3_init @24
_nettle_umac_nh @25
_nettle_umac_nh_n @26
_nettle_umac_poly128 @27
_nettle_umac_poly64 @28
_nettle_umac_set_key @29
_nettle_write_be32 @30
_nettle_write_le32 @31
_nettle_write_le64 @32
nettle_MD5Final @33
nettle_MD5Init @34
nettle_MD5Update @35
nettle_aeads @36 DATA
nettle_aes128 @37 DATA
nettle_aes128_decrypt @38
nettle_aes128_encrypt @39
nettle_aes128_invert_key @40
nettle_aes128_set_decrypt_key @41
nettle_aes128_set_encrypt_key @42
nettle_aes192 @43 DATA
nettle_aes192_decrypt @44
nettle_aes192_encrypt @45
nettle_aes192_invert_key @46
nettle_aes192_set_decrypt_key @47
nettle_aes192_set_encrypt_key @48
nettle_aes256 @49 DATA
nettle_aes256_decrypt @50
nettle_aes256_encrypt @51
nettle_aes256_invert_key @52
nettle_aes256_set_decrypt_key @53
nettle_aes256_set_encrypt_key @54
nettle_aes_decrypt @55
nettle_aes_encrypt @56
nettle_aes_invert_key @57
nettle_aes_set_decrypt_key @58
nettle_aes_set_encrypt_key @59
nettle_arcfour128_set_key @60
nettle_arcfour_crypt @61
nettle_arcfour_set_key @62
nettle_arctwo128 @63 DATA
nettle_arctwo128_set_key @64
nettle_arctwo128_set_key_gutmann @65
nettle_arctwo40 @66 DATA
nettle_arctwo40_set_key @67
nettle_arctwo64 @68 DATA
nettle_arctwo64_set_key @69
nettle_arctwo_decrypt @70
nettle_arctwo_encrypt @71
nettle_arctwo_gutmann128 @72 DATA
nettle_arctwo_set_key @73
nettle_arctwo_set_key_ekb @74
nettle_arctwo_set_key_gutmann @75
nettle_armors @76 DATA
nettle_base16 @77 DATA
nettle_base16_decode_final @78
nettle_base16_decode_init @79
nettle_base16_decode_single @80
nettle_base16_decode_update @81
nettle_base16_encode_single @82
nettle_base16_encode_update @83
nettle_base64 @84 DATA
nettle_base64_decode_final @85
nettle_base64_decode_init @86
nettle_base64_decode_single @87
nettle_base64_decode_update @88
nettle_base64_encode_final @89
nettle_base64_encode_group @90
nettle_base64_encode_init @91
nettle_base64_encode_raw @92
nettle_base64_encode_single @93
nettle_base64_encode_update @94
nettle_base64url @95 DATA
nettle_base64url_decode_init @96
nettle_base64url_encode_init @97
nettle_blowfish128_set_key @98
nettle_blowfish_decrypt @99
nettle_blowfish_encrypt @100
nettle_blowfish_set_key @101
nettle_buffer_clear @102
nettle_buffer_copy @103
nettle_buffer_grow @104
nettle_buffer_init @105
nettle_buffer_init_realloc @106
nettle_buffer_init_size @107
nettle_buffer_reset @108
nettle_buffer_space @109
nettle_buffer_write @110
nettle_camellia128 @111 DATA
nettle_camellia128_crypt @112
nettle_camellia128_invert_key @113
nettle_camellia128_set_encrypt_key @114
nettle_camellia192 @115 DATA
nettle_camellia192_set_decrypt_key @116
nettle_camellia192_set_encrypt_key @117
nettle_camellia256 @118 DATA
nettle_camellia256_crypt @119
nettle_camellia256_invert_key @120
nettle_camellia256_set_decrypt_key @121
nettle_camellia256_set_encrypt_key @122
nettle_camellia_set_decrypt_key @123
nettle_cast128 @124 DATA
nettle_cast128_decrypt @125
nettle_cast128_encrypt @126
nettle_cast128_set_key @127
nettle_cast5_set_key @128
nettle_cbc_decrypt @129
nettle_cbc_encrypt @130
nettle_ccm_aes128_decrypt @131
nettle_ccm_aes128_decrypt_message @132
nettle_ccm_aes128_digest @133
nettle_ccm_aes128_encrypt @134
nettle_ccm_aes128_encrypt_message @135
nettle_ccm_aes128_set_key @136
nettle_ccm_aes128_set_nonce @137
nettle_ccm_aes128_update @138
nettle_ccm_aes192_decrypt @139
nettle_ccm_aes192_decrypt_message @140
nettle_ccm_aes192_digest @141
nettle_ccm_aes192_encrypt @142
nettle_ccm_aes192_encrypt_message @143
nettle_ccm_aes192_set_key @144
nettle_ccm_aes192_set_nonce @145
nettle_ccm_aes192_update @146
nettle_ccm_aes256_decrypt @147
nettle_ccm_aes256_decrypt_message @148
nettle_ccm_aes256_digest @149
nettle_ccm_aes256_encrypt @150
nettle_ccm_aes256_encrypt_message @151
nettle_ccm_aes256_set_key @152
nettle_ccm_aes256_set_nonce @153
nettle_ccm_aes256_update @154
nettle_ccm_decrypt @155
nettle_ccm_decrypt_message @156
nettle_ccm_digest @157
nettle_ccm_encrypt @158
nettle_ccm_encrypt_message @159
nettle_ccm_set_nonce @160
nettle_ccm_update @161
nettle_cfb_decrypt @162
nettle_cfb_encrypt @163
nettle_chacha_crypt @164
nettle_chacha_poly1305 @165 DATA
nettle_chacha_poly1305_decrypt @166
nettle_chacha_poly1305_digest @167
nettle_chacha_poly1305_encrypt @168
nettle_chacha_poly1305_set_key @169
nettle_chacha_poly1305_set_nonce @170
nettle_chacha_poly1305_update @171
nettle_chacha_set_key @172
nettle_chacha_set_nonce @173
nettle_chacha_set_nonce96 @174
nettle_ciphers @175 DATA
nettle_ctr_crypt @176
nettle_des3_decrypt @177
nettle_des3_encrypt @178
nettle_des3_set_key @179
nettle_des_check_parity @180
nettle_des_decrypt @181
nettle_des_encrypt @182
nettle_des_fix_parity @183
nettle_des_set_key @184
nettle_eax_aes128 @185 DATA
nettle_eax_aes128_decrypt @186
nettle_eax_aes128_digest @187
nettle_eax_aes128_encrypt @188
nettle_eax_aes128_set_key @189
nettle_eax_aes128_set_nonce @190
nettle_eax_aes128_update @191
nettle_eax_decrypt @192
nettle_eax_digest @193
nettle_eax_encrypt @194
nettle_eax_set_key @195
nettle_eax_set_nonce @196
nettle_eax_update @197
nettle_gcm_aes128 @198 DATA
nettle_gcm_aes128_decrypt @199
nettle_gcm_aes128_digest @200
nettle_gcm_aes128_encrypt @201
nettle_gcm_aes128_set_iv @202
nettle_gcm_aes128_set_key @203
nettle_gcm_aes128_update @204
nettle_gcm_aes192 @205 DATA
nettle_gcm_aes192_decrypt @206
nettle_gcm_aes192_digest @207
nettle_gcm_aes192_encrypt @208
nettle_gcm_aes192_set_iv @209
nettle_gcm_aes192_set_key @210
nettle_gcm_aes192_update @211
nettle_gcm_aes256 @212 DATA
nettle_gcm_aes256_decrypt @213
nettle_gcm_aes256_digest @214
nettle_gcm_aes256_encrypt @215
nettle_gcm_aes256_set_iv @216
nettle_gcm_aes256_set_key @217
nettle_gcm_aes256_update @218
nettle_gcm_aes_decrypt @219
nettle_gcm_aes_digest @220
nettle_gcm_aes_encrypt @221
nettle_gcm_aes_set_iv @222
nettle_gcm_aes_set_key @223
nettle_gcm_aes_update @224
nettle_gcm_camellia128 @225 DATA
nettle_gcm_camellia128_decrypt @226
nettle_gcm_camellia128_digest @227
nettle_gcm_camellia128_encrypt @228
nettle_gcm_camellia128_set_iv @229
nettle_gcm_camellia128_set_key @230
nettle_gcm_camellia128_update @231
nettle_gcm_camellia256 @232 DATA
nettle_gcm_camellia256_decrypt @233
nettle_gcm_camellia256_digest @234
nettle_gcm_camellia256_encrypt @235
nettle_gcm_camellia256_set_iv @236
nettle_gcm_camellia256_set_key @237
nettle_gcm_camellia256_update @238
nettle_gcm_decrypt @239
nettle_gcm_digest @240
nettle_gcm_encrypt @241
nettle_gcm_set_iv @242
nettle_gcm_set_key @243
nettle_gcm_update @244
nettle_get_aeads @245
nettle_get_armors @246
nettle_get_ciphers @247
nettle_get_hashes @248
nettle_gosthash94 @249 DATA
nettle_gosthash94_digest @250
nettle_gosthash94_init @251
nettle_gosthash94_update @252
nettle_hashes @253 DATA
nettle_hkdf_expand @254
nettle_hkdf_extract @255
nettle_hmac_digest @256
nettle_hmac_md5_digest @257
nettle_hmac_md5_set_key @258
nettle_hmac_md5_update @259
nettle_hmac_ripemd160_digest @260
nettle_hmac_ripemd160_set_key @261
nettle_hmac_ripemd160_update @262
nettle_hmac_set_key @263
nettle_hmac_sha1_digest @264
nettle_hmac_sha1_set_key @265
nettle_hmac_sha1_update @266
nettle_hmac_sha224_digest @267
nettle_hmac_sha224_set_key @268
nettle_hmac_sha256_digest @269
nettle_hmac_sha256_set_key @270
nettle_hmac_sha256_update @271
nettle_hmac_sha384_digest @272
nettle_hmac_sha384_set_key @273
nettle_hmac_sha512_digest @274
nettle_hmac_sha512_set_key @275
nettle_hmac_sha512_update @276
nettle_hmac_update @277
nettle_knuth_lfib_get @278
nettle_knuth_lfib_get_array @279
nettle_knuth_lfib_init @280
nettle_knuth_lfib_random @281
nettle_lookup_hash @282
nettle_md2 @283 DATA
nettle_md2_digest @284
nettle_md2_init @285
nettle_md2_update @286
nettle_md4 @287 DATA
nettle_md4_digest @288
nettle_md4_init @289
nettle_md4_update @290
nettle_md5 @291 DATA
nettle_md5_digest @292
nettle_md5_init @293
nettle_md5_update @294
nettle_memeql_sec @295
nettle_memxor @296
nettle_memxor3 @297
nettle_openssl_des_cbc_cksum @298
nettle_openssl_des_cbc_encrypt @299
nettle_openssl_des_check_key @300 DATA
nettle_openssl_des_ecb3_encrypt @301
nettle_openssl_des_ecb_encrypt @302
nettle_openssl_des_ede3_cbc_encrypt @303
nettle_openssl_des_is_weak_key @304
nettle_openssl_des_key_sched @305
nettle_openssl_des_ncbc_encrypt @306
nettle_openssl_des_set_odd_parity @307
nettle_pbkdf2 @308
nettle_pbkdf2_hmac_sha1 @309
nettle_pbkdf2_hmac_sha256 @310
nettle_poly1305_aes_digest @311
nettle_poly1305_aes_set_key @312
nettle_poly1305_aes_set_nonce @313
nettle_poly1305_aes_update @314
nettle_poly1305_digest @315
nettle_poly1305_set_key @316
nettle_realloc @317
nettle_ripemd160 @318 DATA
nettle_ripemd160_digest @319
nettle_ripemd160_init @320
nettle_ripemd160_update @321
nettle_salsa20_128_set_key @322
nettle_salsa20_256_set_key @323
nettle_salsa20_crypt @324
nettle_salsa20_set_key @325
nettle_salsa20_set_nonce @326
nettle_salsa20r12_crypt @327
nettle_serpent128 @328 DATA
nettle_serpent128_set_key @329
nettle_serpent192 @330 DATA
nettle_serpent192_set_key @331
nettle_serpent256 @332 DATA
nettle_serpent256_set_key @333
nettle_serpent_decrypt @334
nettle_serpent_encrypt @335
nettle_serpent_set_key @336
nettle_sha1 @337 DATA
nettle_sha1_digest @338
nettle_sha1_init @339
nettle_sha1_update @340
nettle_sha224 @341 DATA
nettle_sha224_digest @342
nettle_sha224_init @343
nettle_sha256 @344 DATA
nettle_sha256_digest @345
nettle_sha256_init @346
nettle_sha256_update @347
nettle_sha384 @348 DATA
nettle_sha384_digest @349
nettle_sha384_init @350
nettle_sha3_224 @351 DATA
nettle_sha3_224_digest @352
nettle_sha3_224_init @353
nettle_sha3_224_update @354
nettle_sha3_256 @355 DATA
nettle_sha3_256_digest @356
nettle_sha3_256_init @357
nettle_sha3_256_update @358
nettle_sha3_384 @359 DATA
nettle_sha3_384_digest @360
nettle_sha3_384_init @361
nettle_sha3_384_update @362
nettle_sha3_512 @363 DATA
nettle_sha3_512_digest @364
nettle_sha3_512_init @365
nettle_sha3_512_update @366
nettle_sha3_permute @367
nettle_sha512 @368 DATA
nettle_sha512_224 @369 DATA
nettle_sha512_224_digest @370
nettle_sha512_224_init @371
nettle_sha512_256 @372 DATA
nettle_sha512_256_digest @373
nettle_sha512_256_init @374
nettle_sha512_digest @375
nettle_sha512_init @376
nettle_sha512_update @377
nettle_twofish128 @378 DATA
nettle_twofish128_set_key @379
nettle_twofish192 @380 DATA
nettle_twofish192_set_key @381
nettle_twofish256 @382 DATA
nettle_twofish256_set_key @383
nettle_twofish_decrypt @384
nettle_twofish_encrypt @385
nettle_twofish_set_key @386
nettle_umac128_digest @387
nettle_umac128_set_key @388
nettle_umac128_set_nonce @389
nettle_umac128_update @390
nettle_umac32_digest @391
nettle_umac32_set_key @392
nettle_umac32_set_nonce @393
nettle_umac32_update @394
nettle_umac64_digest @395
nettle_umac64_set_key @396
nettle_umac64_set_nonce @397
nettle_umac64_update @398
nettle_umac96_digest @399
nettle_umac96_set_key @400
nettle_umac96_set_nonce @401
nettle_umac96_update @402
nettle_version_major @403
nettle_version_minor @404
nettle_xrealloc @405
nettle_yarrow256_fast_reseed @406
nettle_yarrow256_init @407
nettle_yarrow256_is_seeded @408
nettle_yarrow256_needed_sources @409
nettle_yarrow256_random @410
nettle_yarrow256_seed @411
nettle_yarrow256_slow_reseed @412
nettle_yarrow256_update @413
nettle_yarrow_key_event_estimate @414
nettle_yarrow_key_event_init @415

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -71,42 +71,6 @@ extern "C" {
#define _AES192_ROUNDS 12
#define _AES256_ROUNDS 14
/* Variable key size between 128 and 256 bits. But the only valid
* values are 16 (128 bits), 24 (192 bits) and 32 (256 bits). */
#define AES_MIN_KEY_SIZE AES128_KEY_SIZE
#define AES_MAX_KEY_SIZE AES256_KEY_SIZE
/* Older nettle-2.7 interface */
#define AES_KEY_SIZE 32
struct aes_ctx
{
unsigned rounds; /* number of rounds to use for our key size */
uint32_t keys[4*(_AES256_ROUNDS + 1)]; /* maximum size of key schedule */
};
void
aes_set_encrypt_key(struct aes_ctx *ctx,
size_t length, const uint8_t *key);
void
aes_set_decrypt_key(struct aes_ctx *ctx,
size_t length, const uint8_t *key);
void
aes_invert_key(struct aes_ctx *dst,
const struct aes_ctx *src);
void
aes_encrypt(const struct aes_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
void
aes_decrypt(const struct aes_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
struct aes128_ctx
{
uint32_t keys[4 * (_AES128_ROUNDS + 1)];
@ -170,6 +134,50 @@ aes256_decrypt(const struct aes256_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
/* The older nettle-2.7 AES interface is deprecated, please migrate to
the newer interface where each algorithm has a fixed key size. */
/* Variable key size between 128 and 256 bits. But the only valid
* values are 16 (128 bits), 24 (192 bits) and 32 (256 bits). */
#define AES_MIN_KEY_SIZE AES128_KEY_SIZE
#define AES_MAX_KEY_SIZE AES256_KEY_SIZE
#define AES_KEY_SIZE 32
struct aes_ctx
{
unsigned key_size; /* In octets */
union {
struct aes128_ctx ctx128;
struct aes192_ctx ctx192;
struct aes256_ctx ctx256;
} u;
};
void
aes_set_encrypt_key(struct aes_ctx *ctx,
size_t length, const uint8_t *key)
_NETTLE_ATTRIBUTE_DEPRECATED;
void
aes_set_decrypt_key(struct aes_ctx *ctx,
size_t length, const uint8_t *key)
_NETTLE_ATTRIBUTE_DEPRECATED;
void
aes_invert_key(struct aes_ctx *dst,
const struct aes_ctx *src)
_NETTLE_ATTRIBUTE_DEPRECATED;
void
aes_encrypt(const struct aes_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src) _NETTLE_ATTRIBUTE_DEPRECATED;
void
aes_decrypt(const struct aes_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src) _NETTLE_ATTRIBUTE_DEPRECATED;
#ifdef __cplusplus
}
#endif

View File

@ -109,13 +109,6 @@ nettle_random_prime(mpz_t p, unsigned bits, int top_bits_set,
void *ctx, nettle_random_func *random,
void *progress_ctx, nettle_progress_func *progress);
void
_nettle_generate_pocklington_prime (mpz_t p, mpz_t r,
unsigned bits, int top_bits_set,
void *ctx, nettle_random_func *random,
const mpz_t p0,
const mpz_t q,
const mpz_t p0q);
/* sexp parsing */
struct sexp_iterator;

Some files were not shown because too many files have changed in this diff Show More