From 75fa6750e109e9c8d33195e8ae302d0b1b979bdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se> Date: Fri, 15 Nov 2002 09:06:40 +0100 Subject: [PATCH] * bignum.c (nettle_mpz_sizeinbase_256_u): New name, was nettle_mpz_sizeinbase_256. Updated all callers. Rev: src/nettle/bignum-random.c:1.2 Rev: src/nettle/dsa-keygen.c:1.4 Rev: src/nettle/dsa.c:1.3 Rev: src/nettle/pgp-encode.c:1.3 Rev: src/nettle/rsa-compat.c:1.5 Rev: src/nettle/rsa-encrypt.c:1.3 Rev: src/nettle/rsa_md5.c:1.7 Rev: src/nettle/rsa_sha1.c:1.7 --- bignum-random.c | 2 +- dsa-keygen.c | 4 ++-- dsa.c | 2 +- pgp-encode.c | 2 +- rsa-compat.c | 32 ++++++++++++++++---------------- rsa-encrypt.c | 2 +- rsa_md5.c | 2 +- rsa_sha1.c | 2 +- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/bignum-random.c b/bignum-random.c index 24dd7c21..145ed9b0 100644 --- a/bignum-random.c +++ b/bignum-random.c @@ -43,7 +43,7 @@ nettle_mpz_random_size(mpz_t x, random(ctx, length, data); - nettle_mpz_set_str_256(x, length, data); + nettle_mpz_set_str_256_u(x, length, data); if (bits % 8) mpz_fdiv_r_2exp(x, x, bits); diff --git a/dsa-keygen.c b/dsa-keygen.c index f5ef6000..abadb4d8 100644 --- a/dsa-keygen.c +++ b/dsa-keygen.c @@ -102,7 +102,7 @@ dsa_nist_gen(mpz_t p, mpz_t q, h1[0] |= 0x80; h1[SHA1_DIGEST_SIZE - 1] |= 1; - nettle_mpz_set_str_256(q, SHA1_DIGEST_SIZE, h1); + nettle_mpz_set_str_256_u(q, SHA1_DIGEST_SIZE, h1); /* The spec says that we should use 18 iterations of * miller-rabin. For performance, we want to do some trial @@ -134,7 +134,7 @@ dsa_nist_gen(mpz_t p, mpz_t q, mpz_add_ui(t, t, j + k); hash(t, buffer + ( (n-k) * SHA1_DIGEST_SIZE)); } - nettle_mpz_set_str_256(p, size, buffer); + nettle_mpz_set_str_256_u(p, size, buffer); mpz_fdiv_r_2exp(p, p, L); mpz_setbit(p, L-1); diff --git a/dsa.c b/dsa.c index d259a233..1f759f60 100644 --- a/dsa.c +++ b/dsa.c @@ -85,7 +85,7 @@ _dsa_hash(mpz_t x, struct sha1_ctx *hash) uint8_t digest[SHA1_DIGEST_SIZE]; sha1_digest(hash, sizeof(digest), digest); - nettle_mpz_set_str_256(x, sizeof(digest), digest); + nettle_mpz_set_str_256_u(x, sizeof(digest), digest); } #endif /* WITH_PUBLIC_KEY */ diff --git a/pgp-encode.c b/pgp-encode.c index 297f20b5..744326ef 100644 --- a/pgp-encode.c +++ b/pgp-encode.c @@ -72,7 +72,7 @@ pgp_put_mpi(struct nettle_buffer *buffer, mpz_t x) if (!p) return 0; - nettle_mpz_set_str_256(x, octets, p); + nettle_mpz_set_str_256_u(x, octets, p); return 1; } diff --git a/rsa-compat.c b/rsa-compat.c index 29c29b8c..79e3858f 100644 --- a/rsa-compat.c +++ b/rsa-compat.c @@ -61,16 +61,16 @@ R_SignFinal(R_SIGNATURE_CTX *ctx, struct rsa_private_key k; int res; - nettle_mpz_init_set_str_256(k.p, - MAX_RSA_MODULUS_LEN, key->prime[0]); - nettle_mpz_init_set_str_256(k.q, - MAX_RSA_MODULUS_LEN, key->prime[1]); - nettle_mpz_init_set_str_256(k.a, - MAX_RSA_MODULUS_LEN, key->primeExponent[0]); - nettle_mpz_init_set_str_256(k.b, - MAX_RSA_MODULUS_LEN, key->primeExponent[1]); - nettle_mpz_init_set_str_256(k.c, - MAX_RSA_MODULUS_LEN, key->coefficient); + 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_prepare_private_key(&k) && (k.size <= MAX_RSA_MODULUS_LEN)) { @@ -124,17 +124,17 @@ R_VerifyFinal(R_SIGNATURE_CTX *ctx, struct rsa_public_key k; int res; - nettle_mpz_init_set_str_256(k.n, - MAX_RSA_MODULUS_LEN, key->modulus); - nettle_mpz_init_set_str_256(k.e, - MAX_RSA_MODULUS_LEN, key->exponent); + 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_prepare_public_key(&k) && (k.size == length)) { mpz_t s; - nettle_mpz_init_set_str_256(s, - k.size, signature); + nettle_mpz_init_set_str_256_u(s, + k.size, signature); res = rsa_md5_verify(&k, &ctx->hash, s) ? RE_SUCCESS : RE_SIGNATURE; diff --git a/rsa-encrypt.c b/rsa-encrypt.c index 285f974d..ef2e72f3 100644 --- a/rsa-encrypt.c +++ b/rsa-encrypt.c @@ -70,7 +70,7 @@ rsa_encrypt(const struct rsa_public_key *key, memcpy(em + 1 + padding, message, length); - nettle_mpz_set_str_256(gibbberish, key->size - 1, em); + nettle_mpz_set_str_256_u(gibbberish, key->size - 1, em); mpz_powm(gibbberish, gibbberish, key->e, key->n); return 1; diff --git a/rsa_md5.c b/rsa_md5.c index 32276172..bf8a893e 100644 --- a/rsa_md5.c +++ b/rsa_md5.c @@ -128,7 +128,7 @@ pkcs1_encode_md5(mpz_t m, unsigned length, struct md5_ctx *hash) em[0] = 1; memset(em + 1, 0xff, i - 1); - nettle_mpz_set_str_256(m, length, em); + nettle_mpz_set_str_256_u(m, length, em); } #endif /* WITH_PUBLIC_KEY */ diff --git a/rsa_sha1.c b/rsa_sha1.c index 52624d5e..d550290d 100644 --- a/rsa_sha1.c +++ b/rsa_sha1.c @@ -128,7 +128,7 @@ pkcs1_encode_sha1(mpz_t m, unsigned length, struct sha1_ctx *hash) em[0] = 1; memset(em + 1, 0xff, i - 1); - nettle_mpz_set_str_256(m, length, em); + nettle_mpz_set_str_256_u(m, length, em); } #endif /* WITH_PUBLIC_KEY */ -- GitLab