Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Wim Lewis
nettle
Commits
9c11e03e
Commit
9c11e03e
authored
Sep 03, 2016
by
Niels Möller
Browse files
Use LDATA macro for more constants.
parent
330a14f6
Changes
4
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
9c11e03e
2016-09-03 Niels Möller <nisse@lysator.liu.se>
* testsuite/eddsa-verify-test.c (test_eddsa): Use LDATA.
* testsuite/pbkdf2-test.c (test_main): Likewise.
* testsuite/pkcs1-test.c (test_main): Likewise.
* testsuite/testutils.h (US): New macro, for unsigned string
literals.
(LDATA): Use the US macro, to eliminate pointer signedness
...
...
testsuite/eddsa-verify-test.c
View file @
9c11e03e
...
...
@@ -90,7 +90,7 @@ test_eddsa (const struct ecc_curve *ecc,
if
(
msg
->
length
==
0
)
{
if
(
_eddsa_verify
(
ecc
,
H
,
pub
,
A
,
ctx
,
3
,
"foo"
,
signature
,
scratch
))
LDATA
(
"foo"
)
,
signature
,
scratch
))
{
fprintf
(
stderr
,
"ecdsa_verify unexpectedly succeeded with different message.
\n
"
);
...
...
testsuite/pbkdf2-test.c
View file @
9c11e03e
...
...
@@ -31,7 +31,7 @@ test_main (void)
/* Test vectors for PBKDF2 from RFC 6070. */
hmac_sha1_set_key
(
&
sha1ctx
,
8
,
"password"
);
hmac_sha1_set_key
(
&
sha1ctx
,
LDATA
(
"password"
)
)
;
PBKDF2_TEST
(
&
sha1ctx
,
hmac_sha1_update
,
hmac_sha1_digest
,
SHA1_DIGEST_SIZE
,
1
,
LDATA
(
"salt"
),
...
...
@@ -51,13 +51,13 @@ test_main (void)
SHEX("eefe3d61cd4da4e4e9945b3d6ba2158c2634e984"));
#endif
hmac_sha1_set_key
(
&
sha1ctx
,
24
,
"passwordPASSWORDpassword"
);
hmac_sha1_set_key
(
&
sha1ctx
,
LDATA
(
"passwordPASSWORDpassword"
)
)
;
PBKDF2_TEST
(
&
sha1ctx
,
hmac_sha1_update
,
hmac_sha1_digest
,
SHA1_DIGEST_SIZE
,
4096
,
LDATA
(
"saltSALTsaltSALTsaltSALTsaltSALTsalt"
),
SHEX
(
"3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038"
));
hmac_sha1_set_key
(
&
sha1ctx
,
9
,
"pass
\0
word"
);
hmac_sha1_set_key
(
&
sha1ctx
,
LDATA
(
"pass
\0
word"
)
)
;
PBKDF2_TEST
(
&
sha1ctx
,
hmac_sha1_update
,
hmac_sha1_digest
,
SHA1_DIGEST_SIZE
,
4096
,
LDATA
(
"sa
\0
lt"
),
...
...
@@ -66,13 +66,13 @@ test_main (void)
/* PBKDF2-HMAC-SHA-256 test vectors confirmed with another
implementation. */
hmac_sha256_set_key
(
&
sha256ctx
,
6
,
"passwd"
);
hmac_sha256_set_key
(
&
sha256ctx
,
LDATA
(
"passwd"
)
)
;
PBKDF2_TEST
(
&
sha256ctx
,
hmac_sha256_update
,
hmac_sha256_digest
,
SHA256_DIGEST_SIZE
,
1
,
LDATA
(
"salt"
),
SHEX
(
"55ac046e56e3089fec1691c22544b605"
));
hmac_sha256_set_key
(
&
sha256ctx
,
8
,
"Password"
);
hmac_sha256_set_key
(
&
sha256ctx
,
LDATA
(
"Password"
)
)
;
PBKDF2_TEST
(
&
sha256ctx
,
hmac_sha256_update
,
hmac_sha256_digest
,
SHA256_DIGEST_SIZE
,
80000
,
LDATA
(
"NaCl"
),
...
...
@@ -87,17 +87,17 @@ test_main (void)
>>> PBKDF2("password", "salt", 50, macmodule=HMAC, digestmodule=SHA512).read(64).encode('hex')
*/
hmac_sha512_set_key
(
&
sha512ctx
,
8
,
"password"
);
hmac_sha512_set_key
(
&
sha512ctx
,
LDATA
(
"password"
)
)
;
PBKDF2_TEST
(
&
sha512ctx
,
hmac_sha512_update
,
hmac_sha512_digest
,
SHA512_DIGEST_SIZE
,
1
,
LDATA
(
"NaCL"
),
SHEX
(
"73decfa58aa2e84f94771a75736bb88bd3c7b38270cfb50cb390ed78b305656af8148e52452b2216b2b8098b761fc6336060a09f76415e9f71ea47f9e9064306"
));
hmac_sha512_set_key
(
&
sha512ctx
,
9
,
"pass
\0
word"
);
hmac_sha512_set_key
(
&
sha512ctx
,
LDATA
(
"pass
\0
word"
)
)
;
PBKDF2_TEST
(
&
sha512ctx
,
hmac_sha512_update
,
hmac_sha512_digest
,
SHA512_DIGEST_SIZE
,
1
,
LDATA
(
"sa
\0
lt"
),
SHEX
(
"71a0ec842abd5c678bcfd145f09d83522f93361560563c4d0d63b88329871090e76604a49af08fe7c9f57156c8790996b20f06bc535e5ab5440df7e878296fa7"
));
hmac_sha512_set_key
(
&
sha512ctx
,
24
,
"passwordPASSWORDpassword"
);
hmac_sha512_set_key
(
&
sha512ctx
,
LDATA
(
"passwordPASSWORDpassword"
)
)
;
PBKDF2_TEST
(
&
sha512ctx
,
hmac_sha512_update
,
hmac_sha512_digest
,
SHA512_DIGEST_SIZE
,
50
,
LDATA
(
"salt
\0\0\0
"
),
SHEX
(
"016871a4c4b75f96857fd2b9f8ca28023b30ee2a39f5adcac8c9375f9bda1ccd1b6f0b2fc3adda505412e79d890056c62e524c7d51154b1a8534575bd02dee39"
));
...
...
testsuite/pkcs1-test.c
View file @
9c11e03e
...
...
@@ -10,7 +10,7 @@ test_main(void)
0xff
,
0xff
,
0xff
,
0xff
,
0
,
'a'
,
'b'
,
'c'
};
_pkcs1_signature_prefix
(
sizeof
(
buffer
),
buffer
,
3
,
"abc"
,
0
);
LDATA
(
"abc"
)
,
0
);
ASSERT
(
MEMEQ
(
sizeof
(
buffer
),
buffer
,
expected
));
}
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