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
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:
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;
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);
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);
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);
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);
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);
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);
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);
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);
* 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;
#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
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,
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));