2014-04-13 Niels Möller <nisse@lysator.liu.se>
+ * rsa-compat.c: Deleted file.
+ * rsa-compat.h: Deleted file.
+ * Makefile.in (hogweed_SOURCES): Deleted rsa-compat.c.
+ (HEADERS): Deleted rsa-compat.h.
+
* examples/next-prime.c: Deleted file.
* bignum-next-prime.c (nettle_next_prime): Deleted file and
function.
rsa-sha256-sign.c rsa-sha256-verify.c \
rsa-sha512-sign.c rsa-sha512-verify.c \
rsa-encrypt.c rsa-decrypt.c rsa-decrypt-tr.c \
- rsa-keygen.c rsa-compat.c rsa-blind.c \
+ rsa-keygen.c rsa-blind.c \
rsa2sexp.c sexp2rsa.c \
dsa.c dsa-compat.c dsa-compat-keygen.c dsa-gen-params.c \
dsa-sign.c dsa-verify.c dsa-keygen.c dsa-hash.c \
memxor.h \
nettle-meta.h nettle-types.h \
pbkdf2.h \
- pgp.h pkcs1.h realloc.h ripemd160.h rsa.h rsa-compat.h \
+ pgp.h pkcs1.h realloc.h ripemd160.h rsa.h \
salsa20.h sexp.h \
serpent.h sha.h sha1.h sha2.h sha3.h twofish.h \
umac.h yarrow.h poly1305.h
* The nettle_next_prime function has been deleted.
Applications should use GMP's mpz_nextprime instead.
+ * Deleted the RSAREF compatibility, including the header file
+ rsa-compat.h and everything declared therein.
+
Bug fixes:
* Building with ./configure --disable-static now works.
+++ /dev/null
-/* rsa-compat.c
-
- The RSA publickey algorithm, RSAREF compatible 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/.
-*/
-
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "rsa-compat.h"
-
-#include "bignum.h"
-#include "md5.h"
-
-int
-R_SignInit(R_SIGNATURE_CTX *ctx,
- int digestAlgorithm)
-{
- if (digestAlgorithm != DA_MD5)
- return RE_DIGEST_ALGORITHM;
-
- md5_init(&ctx->hash);
-
- return 0;
-}
-
-int
-R_SignUpdate(R_SIGNATURE_CTX *ctx,
- const uint8_t *data,
- /* Length is an unsigned char according to rsaref.txt,
- * but that must be a typo. */
- unsigned length)
-{
- md5_update(&ctx->hash, length, data);
-
- return RE_SUCCESS;
-}
-
-int
-R_SignFinal(R_SIGNATURE_CTX *ctx,
- uint8_t *signature,
- unsigned *length,
- R_RSA_PRIVATE_KEY *key)
-{
- struct rsa_private_key k;
- int res;
-
- nettle_mpz_init_set_str_256_u(k.p,
- MAX_RSA_MODULUS_LEN, key->prime[0]);
- nettle_mpz_init_set_str_256_u(k.q,
- MAX_RSA_MODULUS_LEN, key->prime[1]);
- nettle_mpz_init_set_str_256_u(k.a,
- MAX_RSA_MODULUS_LEN, key->primeExponent[0]);
- nettle_mpz_init_set_str_256_u(k.b,
- MAX_RSA_MODULUS_LEN, key->primeExponent[1]);
- nettle_mpz_init_set_str_256_u(k.c,
- MAX_RSA_MODULUS_LEN, key->coefficient);
-
- if (rsa_private_key_prepare(&k) && (k.size <= MAX_RSA_MODULUS_LEN))
- {
- mpz_t s;
- mpz_init(s);
-
- if (rsa_md5_sign(&k, &ctx->hash, s))
- {
- nettle_mpz_get_str_256(k.size, signature, s);
- *length = k.size;
-
- res = RE_SUCCESS;
- }
- else
- res = RE_PRIVATE_KEY;
-
- mpz_clear(s);
- }
- else
- res = RE_PRIVATE_KEY;
-
- mpz_clear(k.p);
- mpz_clear(k.q);
- mpz_clear(k.a);
- mpz_clear(k.b);
- mpz_clear(k.c);
-
- return res;
-}
-
-int
-R_VerifyInit(R_SIGNATURE_CTX *ctx,
- int digestAlgorithm)
-{
- return R_SignInit(ctx, digestAlgorithm);
-}
-
-int
-R_VerifyUpdate(R_SIGNATURE_CTX *ctx,
- const uint8_t *data,
- /* Length is an unsigned char according to rsaref.txt,
- * but that must be a typo. */
- unsigned length)
-{
- return R_SignUpdate(ctx, data, length);
-}
-
-int
-R_VerifyFinal(R_SIGNATURE_CTX *ctx,
- uint8_t *signature,
- unsigned length,
- R_RSA_PUBLIC_KEY *key)
-{
- struct rsa_public_key k;
- int res;
-
- nettle_mpz_init_set_str_256_u(k.n,
- MAX_RSA_MODULUS_LEN, key->modulus);
- nettle_mpz_init_set_str_256_u(k.e,
- MAX_RSA_MODULUS_LEN, key->exponent);
-
- if (rsa_public_key_prepare(&k) && (k.size == length))
- {
- mpz_t s;
-
- nettle_mpz_init_set_str_256_u(s,
- k.size, signature);
- res = rsa_md5_verify(&k, &ctx->hash, s)
- ? RE_SUCCESS : RE_SIGNATURE;
-
- mpz_clear(s);
- }
- else
- res = RE_PUBLIC_KEY;
-
- mpz_clear(k.n);
- mpz_clear(k.e);
-
- return res;
-}
+++ /dev/null
-/* rsa-compat.h
-
- The RSA publickey algorithm, RSAREF compatible 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_RSA_COMPAT_H_INCLUDED
-#define NETTLE_RSA_COMPAT_H_INCLUDED
-
-#include "rsa.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define R_SignInit nettle_R_SignInit
-#define R_SignUpdate nettle_R_SignUpdate
-#define R_SignFinal nettle_R_SignFinal
-#define R_VerifyInit nettle_R_VerifyInit
-#define R_VerifyUpdate nettle_R_VerifyUpdate
-#define R_VerifyFinal nettle_R_VerifyFinal
-
-/* 256 octets or 2048 bits */
-#define MAX_RSA_MODULUS_LEN 256
-
-typedef struct
-{
- unsigned bits;
- uint8_t modulus[MAX_RSA_MODULUS_LEN];
- uint8_t exponent[MAX_RSA_MODULUS_LEN];
-} R_RSA_PUBLIC_KEY;
-
-typedef struct
-{
- unsigned bits;
- uint8_t modulus[MAX_RSA_MODULUS_LEN];
- uint8_t publicExponent[MAX_RSA_MODULUS_LEN];
- uint8_t exponent[MAX_RSA_MODULUS_LEN];
- uint8_t prime[2][MAX_RSA_MODULUS_LEN];
- uint8_t primeExponent[2][MAX_RSA_MODULUS_LEN];
- uint8_t coefficient[MAX_RSA_MODULUS_LEN];
-} R_RSA_PRIVATE_KEY;
-
-/* Only MD5 is supported for now */
-typedef struct
-{
- struct md5_ctx hash;
-} R_SIGNATURE_CTX;
-
-/* Digest algorithms */
-/* DA_MD2 not implemented */
-enum { DA_MD5 = 1 };
-
-/* Return values */
-enum {
- RE_SUCCESS = 0,
- RE_CONTENT_ENCODING, /* encryptedContent has RFC 1421 encoding error */
- RE_DATA, /* other party's private value out of range */
- RE_DIGEST_ALGORITHM, /* message-digest algorithm is invalid */
- RE_ENCODING, /* encoded block has RFC 1421 encoding error */
- RE_ENCRYPTION_ALGORITHM, /* encryption algorithm is invalid */
- RE_KEY, /* recovered data encryption key cannot decrypt */
- RE_KEY_ENCODING, /* encrypted key has RFC 1421 encoding error */
- RE_LEN, /* signatureLen out of range */
- RE_MODULUS_LEN, /* modulus length invalid */
- RE_NEED_RANDOM, /* random structure is not seeded */
- RE_PRIVATE_KEY, /* private key cannot encrypt message digest, */
- RE_PUBLIC_KEY, /* publicKey cannot decrypt signature */
- RE_SIGNATURE, /* signature is incorrect */
- RE_SIGNATURE_ENCODING, /* encodedSignature has RFC 1421 encoding error */
-};
-
-int
-R_SignInit(R_SIGNATURE_CTX *ctx,
- int digestAlgorithm);
-
-int
-R_SignUpdate(R_SIGNATURE_CTX *ctx,
- const uint8_t *data,
- /* Length is an unsigned char according to rsaref.txt,
- * but that must be a typo. */
- unsigned length);
-
-int
-R_SignFinal(R_SIGNATURE_CTX *ctx,
- uint8_t *signature,
- unsigned *length,
- R_RSA_PRIVATE_KEY *key);
-
-int
-R_VerifyInit(R_SIGNATURE_CTX *ctx,
- int digestAlgorithm);
-
-int
-R_VerifyUpdate(R_SIGNATURE_CTX *ctx,
- const uint8_t *data,
- /* Length is an unsigned char according to rsaref.txt,
- * but that must be a typo. */
- unsigned length);
-
-int
-R_VerifyFinal(R_SIGNATURE_CTX *ctx,
- uint8_t *signature,
- unsigned length,
- R_RSA_PUBLIC_KEY *key);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NETTLE_RSA_COMPAT_H_INCLUDED */