summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2012-06-25 22:52:16 +0200
committerNiels Möller <nisse@lysator.liu.se>2012-06-25 22:52:16 +0200
commit4a4201f95dd80e76473ae7682b16b2177c1949a4 (patch)
treed34fda87a685e27027e8bfd5498d8253706bce0e
parentba98962d5fb20ff238c5c77fa0206264b8c0bd64 (diff)
downloadnettle-4a4201f95dd80e76473ae7682b16b2177c1949a4.tar.gz
Renamed pkcs1_signature_prefix to _pkcs1_signature_prefix.
-rw-r--r--ChangeLog3
-rw-r--r--NEWS8
-rw-r--r--pkcs1-rsa-digest.c4
-rw-r--r--pkcs1-rsa-md5.c16
-rw-r--r--pkcs1-rsa-sha1.c16
-rw-r--r--pkcs1-rsa-sha256.c16
-rw-r--r--pkcs1-rsa-sha512.c16
-rw-r--r--pkcs1.c10
-rw-r--r--pkcs1.h12
-rw-r--r--testsuite/pkcs1-test.c4
10 files changed, 55 insertions, 50 deletions
diff --git a/ChangeLog b/ChangeLog
index ad88ece9..2f03dc47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2012-06-25 Niels Möller <nisse@lysator.liu.se>
+ * pkcs1.c (_pkcs1_signature_prefix): Renamed function, adding a
+ leading underscore. Updated all callers.
+
* bignum-next-prime.c (nettle_next_prime): Consistently use the
type nettle_random_func * (rather then just nettle_random_func)
when passing the function pointer as argument. Similar change for
diff --git a/NEWS b/NEWS
index 0f4cb3c7..e612b5cd 100644
--- a/NEWS
+++ b/NEWS
@@ -4,9 +4,11 @@ NEWS for the 2.5 release
and MacOS. There are also a few new features.
* Warning: The undocumented, internal, function
- pkcs1_signature_prefix is changed. Since this is an internal
- function, this is not considered a change of ABI or API.
- Programs explicitly using this function will break.
+ pkcs1_signature_prefix has been renamed to
+ _pkcs1_signature_prefix, and with slightly different
+ behavior. Since this is an internal function, this is not
+ considered a change of ABI or API. Programs explicitly using
+ this function will break.
New features:
diff --git a/pkcs1-rsa-digest.c b/pkcs1-rsa-digest.c
index e84db6d4..61461cdf 100644
--- a/pkcs1-rsa-digest.c
+++ b/pkcs1-rsa-digest.c
@@ -38,8 +38,8 @@ pkcs1_rsa_digest_encode(mpz_t m, unsigned key_size,
TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE);
TMP_ALLOC(em, key_size);
- if (pkcs1_signature_prefix(key_size, em,
- di_length, digest_info, 0))
+ if (_pkcs1_signature_prefix(key_size, em,
+ di_length, digest_info, 0))
{
nettle_mpz_set_str_256_u(m, key_size, em);
return 1;
diff --git a/pkcs1-rsa-md5.c b/pkcs1-rsa-md5.c
index d9259822..16a3f457 100644
--- a/pkcs1-rsa-md5.c
+++ b/pkcs1-rsa-md5.c
@@ -68,10 +68,10 @@ pkcs1_rsa_md5_encode(mpz_t m, unsigned key_size, struct md5_ctx *hash)
TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE);
TMP_ALLOC(em, key_size);
- p = pkcs1_signature_prefix(key_size, em,
- sizeof(md5_prefix),
- md5_prefix,
- MD5_DIGEST_SIZE);
+ p = _pkcs1_signature_prefix(key_size, em,
+ sizeof(md5_prefix),
+ md5_prefix,
+ MD5_DIGEST_SIZE);
if (p)
{
md5_digest(hash, MD5_DIGEST_SIZE, p);
@@ -89,10 +89,10 @@ pkcs1_rsa_md5_encode_digest(mpz_t m, unsigned key_size, const uint8_t *digest)
TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE);
TMP_ALLOC(em, key_size);
- p = pkcs1_signature_prefix(key_size, em,
- sizeof(md5_prefix),
- md5_prefix,
- MD5_DIGEST_SIZE);
+ p = _pkcs1_signature_prefix(key_size, em,
+ sizeof(md5_prefix),
+ md5_prefix,
+ MD5_DIGEST_SIZE);
if (p)
{
memcpy(p, digest, MD5_DIGEST_SIZE);
diff --git a/pkcs1-rsa-sha1.c b/pkcs1-rsa-sha1.c
index 427a5ade..6df6e9f0 100644
--- a/pkcs1-rsa-sha1.c
+++ b/pkcs1-rsa-sha1.c
@@ -68,10 +68,10 @@ pkcs1_rsa_sha1_encode(mpz_t m, unsigned key_size, struct sha1_ctx *hash)
TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE);
TMP_ALLOC(em, key_size);
- p = pkcs1_signature_prefix(key_size, em,
- sizeof(sha1_prefix),
- sha1_prefix,
- SHA1_DIGEST_SIZE);
+ p = _pkcs1_signature_prefix(key_size, em,
+ sizeof(sha1_prefix),
+ sha1_prefix,
+ SHA1_DIGEST_SIZE);
if (p)
{
sha1_digest(hash, SHA1_DIGEST_SIZE, p);
@@ -89,10 +89,10 @@ pkcs1_rsa_sha1_encode_digest(mpz_t m, unsigned key_size, const uint8_t *digest)
TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE);
TMP_ALLOC(em, key_size);
- p = pkcs1_signature_prefix(key_size, em,
- sizeof(sha1_prefix),
- sha1_prefix,
- SHA1_DIGEST_SIZE);
+ p = _pkcs1_signature_prefix(key_size, em,
+ sizeof(sha1_prefix),
+ sha1_prefix,
+ SHA1_DIGEST_SIZE);
if (p)
{
memcpy(p, digest, SHA1_DIGEST_SIZE);
diff --git a/pkcs1-rsa-sha256.c b/pkcs1-rsa-sha256.c
index e3f0797d..0d6c52c8 100644
--- a/pkcs1-rsa-sha256.c
+++ b/pkcs1-rsa-sha256.c
@@ -66,10 +66,10 @@ pkcs1_rsa_sha256_encode(mpz_t m, unsigned key_size, struct sha256_ctx *hash)
TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE);
TMP_ALLOC(em, key_size);
- p = pkcs1_signature_prefix(key_size, em,
- sizeof(sha256_prefix),
- sha256_prefix,
- SHA256_DIGEST_SIZE);
+ p = _pkcs1_signature_prefix(key_size, em,
+ sizeof(sha256_prefix),
+ sha256_prefix,
+ SHA256_DIGEST_SIZE);
if (p)
{
sha256_digest(hash, SHA256_DIGEST_SIZE, p);
@@ -87,10 +87,10 @@ pkcs1_rsa_sha256_encode_digest(mpz_t m, unsigned key_size, const uint8_t *digest
TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE);
TMP_ALLOC(em, key_size);
- p = pkcs1_signature_prefix(key_size, em,
- sizeof(sha256_prefix),
- sha256_prefix,
- SHA256_DIGEST_SIZE);
+ p = _pkcs1_signature_prefix(key_size, em,
+ sizeof(sha256_prefix),
+ sha256_prefix,
+ SHA256_DIGEST_SIZE);
if (p)
{
memcpy(p, digest, SHA256_DIGEST_SIZE);
diff --git a/pkcs1-rsa-sha512.c b/pkcs1-rsa-sha512.c
index ddf62769..767cd446 100644
--- a/pkcs1-rsa-sha512.c
+++ b/pkcs1-rsa-sha512.c
@@ -66,10 +66,10 @@ pkcs1_rsa_sha512_encode(mpz_t m, unsigned key_size, struct sha512_ctx *hash)
TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE);
TMP_ALLOC(em, key_size);
- p = pkcs1_signature_prefix(key_size, em,
- sizeof(sha512_prefix),
- sha512_prefix,
- SHA512_DIGEST_SIZE);
+ p = _pkcs1_signature_prefix(key_size, em,
+ sizeof(sha512_prefix),
+ sha512_prefix,
+ SHA512_DIGEST_SIZE);
if (p)
{
sha512_digest(hash, SHA512_DIGEST_SIZE, p);
@@ -87,10 +87,10 @@ pkcs1_rsa_sha512_encode_digest(mpz_t m, unsigned key_size, const uint8_t *digest
TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE);
TMP_ALLOC(em, key_size);
- p = pkcs1_signature_prefix(key_size, em,
- sizeof(sha512_prefix),
- sha512_prefix,
- SHA512_DIGEST_SIZE);
+ p = _pkcs1_signature_prefix(key_size, em,
+ sizeof(sha512_prefix),
+ sha512_prefix,
+ SHA512_DIGEST_SIZE);
if (p)
{
memcpy(p, digest, SHA512_DIGEST_SIZE);
diff --git a/pkcs1.c b/pkcs1.c
index 4b73d35c..9629d7d7 100644
--- a/pkcs1.c
+++ b/pkcs1.c
@@ -40,11 +40,11 @@
* total size equals the octet size of n.
*/
uint8_t *
-pkcs1_signature_prefix(unsigned key_size,
- uint8_t *buffer,
- unsigned id_size,
- const uint8_t *id,
- unsigned digest_size)
+_pkcs1_signature_prefix(unsigned key_size,
+ uint8_t *buffer,
+ unsigned id_size,
+ const uint8_t *id,
+ unsigned digest_size)
{
unsigned j;
diff --git a/pkcs1.h b/pkcs1.h
index d6e60539..49653b60 100644
--- a/pkcs1.h
+++ b/pkcs1.h
@@ -34,7 +34,7 @@ extern "C" {
#endif
/* Name mangling */
-#define pkcs1_signature_prefix nettle_pkcs1_signature_prefix
+#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
@@ -53,11 +53,11 @@ 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);
+_pkcs1_signature_prefix(unsigned key_size,
+ uint8_t *buffer,
+ unsigned id_size,
+ const uint8_t *id,
+ unsigned digest_size);
int
pkcs1_encrypt (unsigned key_size,
diff --git a/testsuite/pkcs1-test.c b/testsuite/pkcs1-test.c
index a0521b03..131c0b0a 100644
--- a/testsuite/pkcs1-test.c
+++ b/testsuite/pkcs1-test.c
@@ -9,8 +9,8 @@ test_main(void)
uint8_t expected[16] = { 0, 1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0, 'a', 'b', 'c' };
- pkcs1_signature_prefix(sizeof(buffer), buffer,
- 3, "abc", 0);
+ _pkcs1_signature_prefix(sizeof(buffer), buffer,
+ 3, "abc", 0);
ASSERT(MEMEQ(sizeof(buffer), buffer, expected));