Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nettle
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Marcus Hoffmann
nettle
Commits
77b0bf6a
Commit
77b0bf6a
authored
Apr 23, 2012
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New constant NETTLE_MAX_BIGNUM_SIZE.
parent
8c4130e4
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
19 additions
and
12 deletions
+19
-12
ChangeLog
ChangeLog
+6
-0
bignum-random.c
bignum-random.c
+1
-1
nettle-internal.h
nettle-internal.h
+1
-0
pkcs1-decrypt.c
pkcs1-decrypt.c
+2
-2
pkcs1-rsa-md5.c
pkcs1-rsa-md5.c
+2
-2
pkcs1-rsa-sha1.c
pkcs1-rsa-sha1.c
+2
-2
pkcs1-rsa-sha256.c
pkcs1-rsa-sha256.c
+2
-2
pkcs1-rsa-sha512.c
pkcs1-rsa-sha512.c
+2
-2
rsa-encrypt.c
rsa-encrypt.c
+1
-1
No files found.
ChangeLog
View file @
77b0bf6a
2012-04-23 Niels Möller <nisse@lysator.liu.se>
* nettle-internal.h (NETTLE_MAX_BIGNUM_SIZE): New constant. Based
on NETTLE_MAX_BIGNUM_BITS, rounded upwards. Replaced all uses of
NETTLE_MAX_BIGNUM_BITS.
2012-04-19 Niels Möller <nisse@lysator.liu.se>
* list-obj-sizes.awk: Use decimal rather than hexadecimal output.
...
...
bignum-random.c
View file @
77b0bf6a
...
...
@@ -38,7 +38,7 @@ nettle_mpz_random_size(mpz_t x,
unsigned
bits
)
{
unsigned
length
=
(
bits
+
7
)
/
8
;
TMP_DECL
(
data
,
uint8_t
,
NETTLE_MAX_BIGNUM_
BITS
/
8
);
TMP_DECL
(
data
,
uint8_t
,
NETTLE_MAX_BIGNUM_
SIZE
);
TMP_ALLOC
(
data
,
length
);
random
(
ctx
,
length
,
data
);
...
...
nettle-internal.h
View file @
77b0bf6a
...
...
@@ -45,6 +45,7 @@ do { if (size > (sizeof(name) / sizeof(name[0]))) abort(); } while (0)
/* Arbitrary limits which apply to systems that don't have alloca */
#define NETTLE_MAX_BIGNUM_BITS 10000
#define NETTLE_MAX_BIGNUM_SIZE ((NETTLE_MAX_BIGNUM_BITS + 7)/8)
#define NETTLE_MAX_HASH_BLOCK_SIZE 128
#define NETTLE_MAX_HASH_DIGEST_SIZE 64
#define NETTLE_MAX_SEXP_ASSOC 17
...
...
pkcs1-decrypt.c
View file @
77b0bf6a
...
...
@@ -38,11 +38,11 @@ pkcs1_decrypt (unsigned key_size,
const
mpz_t
m
,
unsigned
*
length
,
uint8_t
*
message
)
{
TMP_DECL
(
em
,
uint8_t
,
NETTLE_MAX_BIGNUM_
BITS
/
8
);
TMP_DECL
(
em
,
uint8_t
,
NETTLE_MAX_BIGNUM_
SIZE
);
uint8_t
*
terminator
;
unsigned
padding
;
unsigned
message_length
;
TMP_ALLOC
(
em
,
key_size
);
nettle_mpz_get_str_256
(
key_size
,
em
,
m
);
...
...
pkcs1-rsa-md5.c
View file @
77b0bf6a
...
...
@@ -64,7 +64,7 @@ md5_prefix[] =
int
pkcs1_rsa_md5_encode
(
mpz_t
m
,
unsigned
size
,
struct
md5_ctx
*
hash
)
{
TMP_DECL
(
em
,
uint8_t
,
NETTLE_MAX_BIGNUM_
BITS
/
8
);
TMP_DECL
(
em
,
uint8_t
,
NETTLE_MAX_BIGNUM_
SIZE
);
TMP_ALLOC
(
em
,
size
);
if
(
pkcs1_signature_prefix
(
size
,
em
,
...
...
@@ -83,7 +83,7 @@ pkcs1_rsa_md5_encode(mpz_t m, unsigned size, struct md5_ctx *hash)
int
pkcs1_rsa_md5_encode_digest
(
mpz_t
m
,
unsigned
size
,
const
uint8_t
*
digest
)
{
TMP_DECL
(
em
,
uint8_t
,
NETTLE_MAX_BIGNUM_
BITS
/
8
);
TMP_DECL
(
em
,
uint8_t
,
NETTLE_MAX_BIGNUM_
SIZE
);
TMP_ALLOC
(
em
,
size
);
if
(
pkcs1_signature_prefix
(
size
,
em
,
...
...
pkcs1-rsa-sha1.c
View file @
77b0bf6a
...
...
@@ -64,7 +64,7 @@ sha1_prefix[] =
int
pkcs1_rsa_sha1_encode
(
mpz_t
m
,
unsigned
size
,
struct
sha1_ctx
*
hash
)
{
TMP_DECL
(
em
,
uint8_t
,
NETTLE_MAX_BIGNUM_
BITS
/
8
);
TMP_DECL
(
em
,
uint8_t
,
NETTLE_MAX_BIGNUM_
SIZE
);
TMP_ALLOC
(
em
,
size
);
if
(
pkcs1_signature_prefix
(
size
,
em
,
...
...
@@ -83,7 +83,7 @@ pkcs1_rsa_sha1_encode(mpz_t m, unsigned size, struct sha1_ctx *hash)
int
pkcs1_rsa_sha1_encode_digest
(
mpz_t
m
,
unsigned
size
,
const
uint8_t
*
digest
)
{
TMP_DECL
(
em
,
uint8_t
,
NETTLE_MAX_BIGNUM_
BITS
/
8
);
TMP_DECL
(
em
,
uint8_t
,
NETTLE_MAX_BIGNUM_
SIZE
);
TMP_ALLOC
(
em
,
size
);
if
(
pkcs1_signature_prefix
(
size
,
em
,
...
...
pkcs1-rsa-sha256.c
View file @
77b0bf6a
...
...
@@ -62,7 +62,7 @@ sha256_prefix[] =
int
pkcs1_rsa_sha256_encode
(
mpz_t
m
,
unsigned
size
,
struct
sha256_ctx
*
hash
)
{
TMP_DECL
(
em
,
uint8_t
,
NETTLE_MAX_BIGNUM_
BITS
/
8
);
TMP_DECL
(
em
,
uint8_t
,
NETTLE_MAX_BIGNUM_
SIZE
);
TMP_ALLOC
(
em
,
size
);
if
(
pkcs1_signature_prefix
(
size
,
em
,
...
...
@@ -81,7 +81,7 @@ pkcs1_rsa_sha256_encode(mpz_t m, unsigned size, struct sha256_ctx *hash)
int
pkcs1_rsa_sha256_encode_digest
(
mpz_t
m
,
unsigned
size
,
const
uint8_t
*
digest
)
{
TMP_DECL
(
em
,
uint8_t
,
NETTLE_MAX_BIGNUM_
BITS
/
8
);
TMP_DECL
(
em
,
uint8_t
,
NETTLE_MAX_BIGNUM_
SIZE
);
TMP_ALLOC
(
em
,
size
);
if
(
pkcs1_signature_prefix
(
size
,
em
,
...
...
pkcs1-rsa-sha512.c
View file @
77b0bf6a
...
...
@@ -62,7 +62,7 @@ sha512_prefix[] =
int
pkcs1_rsa_sha512_encode
(
mpz_t
m
,
unsigned
size
,
struct
sha512_ctx
*
hash
)
{
TMP_DECL
(
em
,
uint8_t
,
NETTLE_MAX_BIGNUM_
BITS
/
8
);
TMP_DECL
(
em
,
uint8_t
,
NETTLE_MAX_BIGNUM_
SIZE
);
TMP_ALLOC
(
em
,
size
);
if
(
pkcs1_signature_prefix
(
size
,
em
,
...
...
@@ -82,7 +82,7 @@ pkcs1_rsa_sha512_encode(mpz_t m, unsigned size, struct sha512_ctx *hash)
int
pkcs1_rsa_sha512_encode_digest
(
mpz_t
m
,
unsigned
size
,
const
uint8_t
*
digest
)
{
TMP_DECL
(
em
,
uint8_t
,
NETTLE_MAX_BIGNUM_
BITS
/
8
);
TMP_DECL
(
em
,
uint8_t
,
NETTLE_MAX_BIGNUM_
SIZE
);
TMP_ALLOC
(
em
,
size
);
if
(
pkcs1_signature_prefix
(
size
,
em
,
...
...
rsa-encrypt.c
View file @
77b0bf6a
...
...
@@ -43,7 +43,7 @@ rsa_encrypt(const struct rsa_public_key *key,
unsigned
length
,
const
uint8_t
*
message
,
mpz_t
gibbberish
)
{
TMP_DECL
(
em
,
uint8_t
,
NETTLE_MAX_BIGNUM_
BITS
/
8
);
TMP_DECL
(
em
,
uint8_t
,
NETTLE_MAX_BIGNUM_
SIZE
);
unsigned
padding
;
unsigned
i
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment