Commit 4a4201f9 authored by Niels Möller's avatar Niels Möller

Renamed pkcs1_signature_prefix to _pkcs1_signature_prefix.

parent ba98962d
2012-06-25 Niels Möller <nisse@lysator.liu.se> 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 * bignum-next-prime.c (nettle_next_prime): Consistently use the
type nettle_random_func * (rather then just nettle_random_func) type nettle_random_func * (rather then just nettle_random_func)
when passing the function pointer as argument. Similar change for when passing the function pointer as argument. Similar change for
......
...@@ -4,9 +4,11 @@ NEWS for the 2.5 release ...@@ -4,9 +4,11 @@ NEWS for the 2.5 release
and MacOS. There are also a few new features. and MacOS. There are also a few new features.
* Warning: The undocumented, internal, function * Warning: The undocumented, internal, function
pkcs1_signature_prefix is changed. Since this is an internal pkcs1_signature_prefix has been renamed to
function, this is not considered a change of ABI or API. _pkcs1_signature_prefix, and with slightly different
Programs explicitly using this function will break. 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: New features:
......
...@@ -38,7 +38,7 @@ pkcs1_rsa_digest_encode(mpz_t m, unsigned key_size, ...@@ -38,7 +38,7 @@ pkcs1_rsa_digest_encode(mpz_t m, unsigned key_size,
TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE); TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE);
TMP_ALLOC(em, key_size); TMP_ALLOC(em, key_size);
if (pkcs1_signature_prefix(key_size, em, if (_pkcs1_signature_prefix(key_size, em,
di_length, digest_info, 0)) di_length, digest_info, 0))
{ {
nettle_mpz_set_str_256_u(m, key_size, em); nettle_mpz_set_str_256_u(m, key_size, em);
......
...@@ -68,7 +68,7 @@ pkcs1_rsa_md5_encode(mpz_t m, unsigned key_size, struct md5_ctx *hash) ...@@ -68,7 +68,7 @@ pkcs1_rsa_md5_encode(mpz_t m, unsigned key_size, struct md5_ctx *hash)
TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE); TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE);
TMP_ALLOC(em, key_size); TMP_ALLOC(em, key_size);
p = pkcs1_signature_prefix(key_size, em, p = _pkcs1_signature_prefix(key_size, em,
sizeof(md5_prefix), sizeof(md5_prefix),
md5_prefix, md5_prefix,
MD5_DIGEST_SIZE); MD5_DIGEST_SIZE);
...@@ -89,7 +89,7 @@ pkcs1_rsa_md5_encode_digest(mpz_t m, unsigned key_size, const uint8_t *digest) ...@@ -89,7 +89,7 @@ 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_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE);
TMP_ALLOC(em, key_size); TMP_ALLOC(em, key_size);
p = pkcs1_signature_prefix(key_size, em, p = _pkcs1_signature_prefix(key_size, em,
sizeof(md5_prefix), sizeof(md5_prefix),
md5_prefix, md5_prefix,
MD5_DIGEST_SIZE); MD5_DIGEST_SIZE);
......
...@@ -68,7 +68,7 @@ pkcs1_rsa_sha1_encode(mpz_t m, unsigned key_size, struct sha1_ctx *hash) ...@@ -68,7 +68,7 @@ pkcs1_rsa_sha1_encode(mpz_t m, unsigned key_size, struct sha1_ctx *hash)
TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE); TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE);
TMP_ALLOC(em, key_size); TMP_ALLOC(em, key_size);
p = pkcs1_signature_prefix(key_size, em, p = _pkcs1_signature_prefix(key_size, em,
sizeof(sha1_prefix), sizeof(sha1_prefix),
sha1_prefix, sha1_prefix,
SHA1_DIGEST_SIZE); SHA1_DIGEST_SIZE);
...@@ -89,7 +89,7 @@ pkcs1_rsa_sha1_encode_digest(mpz_t m, unsigned key_size, const uint8_t *digest) ...@@ -89,7 +89,7 @@ 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_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE);
TMP_ALLOC(em, key_size); TMP_ALLOC(em, key_size);
p = pkcs1_signature_prefix(key_size, em, p = _pkcs1_signature_prefix(key_size, em,
sizeof(sha1_prefix), sizeof(sha1_prefix),
sha1_prefix, sha1_prefix,
SHA1_DIGEST_SIZE); SHA1_DIGEST_SIZE);
......
...@@ -66,7 +66,7 @@ pkcs1_rsa_sha256_encode(mpz_t m, unsigned key_size, struct sha256_ctx *hash) ...@@ -66,7 +66,7 @@ pkcs1_rsa_sha256_encode(mpz_t m, unsigned key_size, struct sha256_ctx *hash)
TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE); TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE);
TMP_ALLOC(em, key_size); TMP_ALLOC(em, key_size);
p = pkcs1_signature_prefix(key_size, em, p = _pkcs1_signature_prefix(key_size, em,
sizeof(sha256_prefix), sizeof(sha256_prefix),
sha256_prefix, sha256_prefix,
SHA256_DIGEST_SIZE); SHA256_DIGEST_SIZE);
...@@ -87,7 +87,7 @@ pkcs1_rsa_sha256_encode_digest(mpz_t m, unsigned key_size, const uint8_t *digest ...@@ -87,7 +87,7 @@ 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_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE);
TMP_ALLOC(em, key_size); TMP_ALLOC(em, key_size);
p = pkcs1_signature_prefix(key_size, em, p = _pkcs1_signature_prefix(key_size, em,
sizeof(sha256_prefix), sizeof(sha256_prefix),
sha256_prefix, sha256_prefix,
SHA256_DIGEST_SIZE); SHA256_DIGEST_SIZE);
......
...@@ -66,7 +66,7 @@ pkcs1_rsa_sha512_encode(mpz_t m, unsigned key_size, struct sha512_ctx *hash) ...@@ -66,7 +66,7 @@ pkcs1_rsa_sha512_encode(mpz_t m, unsigned key_size, struct sha512_ctx *hash)
TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE); TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE);
TMP_ALLOC(em, key_size); TMP_ALLOC(em, key_size);
p = pkcs1_signature_prefix(key_size, em, p = _pkcs1_signature_prefix(key_size, em,
sizeof(sha512_prefix), sizeof(sha512_prefix),
sha512_prefix, sha512_prefix,
SHA512_DIGEST_SIZE); SHA512_DIGEST_SIZE);
...@@ -87,7 +87,7 @@ pkcs1_rsa_sha512_encode_digest(mpz_t m, unsigned key_size, const uint8_t *digest ...@@ -87,7 +87,7 @@ 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_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE);
TMP_ALLOC(em, key_size); TMP_ALLOC(em, key_size);
p = pkcs1_signature_prefix(key_size, em, p = _pkcs1_signature_prefix(key_size, em,
sizeof(sha512_prefix), sizeof(sha512_prefix),
sha512_prefix, sha512_prefix,
SHA512_DIGEST_SIZE); SHA512_DIGEST_SIZE);
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
* total size equals the octet size of n. * total size equals the octet size of n.
*/ */
uint8_t * uint8_t *
pkcs1_signature_prefix(unsigned key_size, _pkcs1_signature_prefix(unsigned key_size,
uint8_t *buffer, uint8_t *buffer,
unsigned id_size, unsigned id_size,
const uint8_t *id, const uint8_t *id,
......
...@@ -34,7 +34,7 @@ extern "C" { ...@@ -34,7 +34,7 @@ extern "C" {
#endif #endif
/* Name mangling */ /* 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_digest_encode nettle_pkcs1_rsa_digest_encode
#define pkcs1_rsa_md5_encode nettle_pkcs1_rsa_md5_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_md5_encode_digest nettle_pkcs1_rsa_md5_encode_digest
...@@ -53,7 +53,7 @@ struct sha256_ctx; ...@@ -53,7 +53,7 @@ struct sha256_ctx;
struct sha512_ctx; struct sha512_ctx;
uint8_t * uint8_t *
pkcs1_signature_prefix(unsigned key_size, _pkcs1_signature_prefix(unsigned key_size,
uint8_t *buffer, uint8_t *buffer,
unsigned id_size, unsigned id_size,
const uint8_t *id, const uint8_t *id,
......
...@@ -9,7 +9,7 @@ test_main(void) ...@@ -9,7 +9,7 @@ test_main(void)
uint8_t expected[16] = { 0, 1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, uint8_t expected[16] = { 0, 1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0, 'a', 'b', 'c' }; 0xff, 0xff, 0xff, 0xff, 0, 'a', 'b', 'c' };
pkcs1_signature_prefix(sizeof(buffer), buffer, _pkcs1_signature_prefix(sizeof(buffer), buffer,
3, "abc", 0); 3, "abc", 0);
ASSERT(MEMEQ(sizeof(buffer), buffer, expected)); ASSERT(MEMEQ(sizeof(buffer), buffer, expected));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment