Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions demos/aesgcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static void scan_hex(const char* str, uint8_t* bytes, size_t blen)
0x00, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00, /* `abcdefg */
};

for (pos = 0; ((pos < (blen*2)) && (pos < strlen(str))); pos += 2)
for (pos = 0; ((pos < (blen*2)) && (pos < XSTRLEN(str))); pos += 2)
{
idx0 = (uint8_t)(str[pos+0] & 0x1F) ^ 0x10;
idx1 = (uint8_t)(str[pos+1] & 0x1F) ^ 0x10;
Expand Down Expand Up @@ -118,7 +118,7 @@ int main(int argc, char **argv)

if (fsize(in_file) <= 0) die(__LINE__);

keylen = strlen(key_string);
keylen = XSTRLEN(key_string);
if (keylen != 96) die(__LINE__);

scan_hex(key_string, keybuf, sizeof(keybuf));
Expand Down
2 changes: 1 addition & 1 deletion demos/ltcrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ int main(int argc, char *argv[])
if(fgets((char *)tmpkey,sizeof(tmpkey), stdin) == NULL)
exit(-1);
outlen = sizeof(key);
if ((err = hash_memory(hash_idx,tmpkey,strlen((char *)tmpkey),key,&outlen)) != CRYPT_OK) {
if ((err = hash_memory(hash_idx,tmpkey,XSTRLEN((char *)tmpkey),key,&outlen)) != CRYPT_OK) {
printf("Error hashing key: %s\n", error_to_string(err));
exit(-1);
}
Expand Down
2 changes: 1 addition & 1 deletion demos/openssl-enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ int main(int argc, char *argv[]) {

/* Run the key derivation from the provided passphrase. This gets us
the key and iv. */
ret = pkcs_5_alg1_openssl((unsigned char*)argv[4], strlen(argv[4]), salt,
ret = pkcs_5_alg1_openssl((unsigned char*)argv[4], XSTRLEN(argv[4]), salt,
OPENSSL_ITERATIONS, hash, keyiv, &keyivlen );
if(ret != CRYPT_OK)
BARF("Could not derive key/iv from passphrase");
Expand Down
1 change: 1 addition & 0 deletions helper.pl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ sub check_source {
push @{$troubles->{unwanted_memcmp}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bmemcmp\s*\(/;
push @{$troubles->{unwanted_strcmp}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bstrcmp\s*\(/;
push @{$troubles->{unwanted_strcpy}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bstrcpy\s*\(/;
push @{$troubles->{unwanted_strlen}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bstrlen\s*\(/;
push @{$troubles->{unwanted_strncpy}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bstrncpy\s*\(/;
push @{$troubles->{unwanted_clock}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bclock\s*\(/;
push @{$troubles->{unwanted_qsort}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bqsort\s*\(/;
Expand Down
6 changes: 3 additions & 3 deletions src/ciphers/tea.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ int tea_test(void)
zeromem(&skey, sizeof(skey));

l = sizeof(key);
if ((err = base16_decode(tests[i].key, strlen(tests[i].key), key, &l)) != CRYPT) return err;
if ((err = base16_decode(tests[i].key, XSTRLEN(tests[i].key), key, &l)) != CRYPT) return err;
l = sizeof(ptct[0]);
if ((err = base16_decode(tests[i].pt, strlen(tests[i].pt), ptct[0], &l)) != CRYPT) return err;
if ((err = base16_decode(tests[i].pt, XSTRLEN(tests[i].pt), ptct[0], &l)) != CRYPT) return err;
l = sizeof(ptct[1]);
if ((err = base16_decode(tests[i].ct, strlen(tests[i].ct), ptct[1], &l)) != CRYPT) return err;
if ((err = base16_decode(tests[i].ct, XSTRLEN(tests[i].ct), ptct[1], &l)) != CRYPT) return err;

if ((err = tea_setup(key, 16, 0, &skey)) != CRYPT_OK) {
return err;
Expand Down
2 changes: 1 addition & 1 deletion src/encauth/chachapoly/chacha20poly1305_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int chacha20poly1305_test(void)
0x61, 0x16 };
unsigned char tag[] = { 0x1A, 0xE1, 0x0B, 0x59, 0x4F, 0x09, 0xE2, 0x6A, 0x7E, 0x90, 0x2E, 0xCB, 0xD0, 0x60, 0x06, 0x91 };
char m[] = "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it.";
unsigned long mlen = strlen(m);
unsigned long mlen = XSTRLEN(m);
unsigned long len;
unsigned char rfc7905_pt[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F };
unsigned char rfc7905_enc[] = { 0xE4, 0x62, 0x85, 0xB4, 0x29, 0x95, 0x34, 0x96, 0xAB, 0xFB, 0x67, 0xCD, 0xAE, 0xAC, 0x94, 0x1E };
Expand Down
8 changes: 4 additions & 4 deletions src/hashes/blake2b.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ int blake2b_512_test(void)

for (i = 0; tests[i].msg != NULL; i++) {
blake2b_512_init(&md);
blake2b_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
blake2b_process(&md, (unsigned char *)tests[i].msg, (unsigned long)XSTRLEN(tests[i].msg));
blake2b_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2B_512", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down Expand Up @@ -527,7 +527,7 @@ int blake2b_384_test(void)

for (i = 0; tests[i].msg != NULL; i++) {
blake2b_384_init(&md);
blake2b_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
blake2b_process(&md, (unsigned char *)tests[i].msg, (unsigned long)XSTRLEN(tests[i].msg));
blake2b_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2B_384", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down Expand Up @@ -580,7 +580,7 @@ int blake2b_256_test(void)

for (i = 0; tests[i].msg != NULL; i++) {
blake2b_256_init(&md);
blake2b_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
blake2b_process(&md, (unsigned char *)tests[i].msg, (unsigned long)XSTRLEN(tests[i].msg));
blake2b_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2B_256", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down Expand Up @@ -621,7 +621,7 @@ int blake2b_160_test(void)

for (i = 0; tests[i].msg != NULL; i++) {
blake2b_160_init(&md);
blake2b_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
blake2b_process(&md, (unsigned char *)tests[i].msg, (unsigned long)XSTRLEN(tests[i].msg));
blake2b_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2B_160", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down
8 changes: 4 additions & 4 deletions src/hashes/blake2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ int blake2s_256_test(void)

for (i = 0; tests[i].msg != NULL; i++) {
blake2s_256_init(&md);
blake2s_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
blake2s_process(&md, (unsigned char *)tests[i].msg, (unsigned long)XSTRLEN(tests[i].msg));
blake2s_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2S_256", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down Expand Up @@ -514,7 +514,7 @@ int blake2s_224_test(void)

for (i = 0; tests[i].msg != NULL; i++) {
blake2s_224_init(&md);
blake2s_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
blake2s_process(&md, (unsigned char *)tests[i].msg, (unsigned long)XSTRLEN(tests[i].msg));
blake2s_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2S_224", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down Expand Up @@ -556,7 +556,7 @@ int blake2s_160_test(void)

for (i = 0; tests[i].msg != NULL; i++) {
blake2s_160_init(&md);
blake2s_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
blake2s_process(&md, (unsigned char *)tests[i].msg, (unsigned long)XSTRLEN(tests[i].msg));
blake2s_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2S_160", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down Expand Up @@ -596,7 +596,7 @@ int blake2s_128_test(void)

for (i = 0; tests[i].msg != NULL; i++) {
blake2s_128_init(&md);
blake2s_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
blake2s_process(&md, (unsigned char *)tests[i].msg, (unsigned long)XSTRLEN(tests[i].msg));
blake2s_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2S_128", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down
2 changes: 1 addition & 1 deletion src/hashes/chc/chc.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ int chc_test(void)
if ((err = chc_init(&md)) != CRYPT_OK) {
return err;
}
if ((err = chc_process(&md, tests[i].msg, strlen((char *)tests[i].msg))) != CRYPT_OK) {
if ((err = chc_process(&md, tests[i].msg, XSTRLEN((char *)tests[i].msg))) != CRYPT_OK) {
return err;
}
if ((err = chc_done(&md, tmp)) != CRYPT_OK) {
Expand Down
2 changes: 1 addition & 1 deletion src/hashes/md2.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ int md2_test(void)

for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) {
md2_init(&md);
md2_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg));
md2_process(&md, (unsigned char*)tests[i].msg, (unsigned long)XSTRLEN(tests[i].msg));
md2_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "MD2", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down
2 changes: 1 addition & 1 deletion src/hashes/md4.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ int md4_test(void)

for(i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) {
md4_init(&md);
md4_process(&md, (unsigned char *)tests[i].input, (unsigned long)strlen(tests[i].input));
md4_process(&md, (unsigned char *)tests[i].input, (unsigned long)XSTRLEN(tests[i].input));
md4_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "MD4", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down
2 changes: 1 addition & 1 deletion src/hashes/md5.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ int md5_test(void)

for (i = 0; tests[i].msg != NULL; i++) {
md5_init(&md);
md5_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
md5_process(&md, (unsigned char *)tests[i].msg, (unsigned long)XSTRLEN(tests[i].msg));
md5_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "MD5", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down
2 changes: 1 addition & 1 deletion src/hashes/rmd128.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ int rmd128_test(void)

for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) {
rmd128_init(&md);
rmd128_process(&md, (unsigned char *)tests[i].msg, strlen(tests[i].msg));
rmd128_process(&md, (unsigned char *)tests[i].msg, XSTRLEN(tests[i].msg));
rmd128_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "RIPEMD128", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down
2 changes: 1 addition & 1 deletion src/hashes/rmd160.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ int rmd160_test(void)

for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) {
rmd160_init(&md);
rmd160_process(&md, (unsigned char *)tests[i].msg, strlen(tests[i].msg));
rmd160_process(&md, (unsigned char *)tests[i].msg, XSTRLEN(tests[i].msg));
rmd160_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "RIPEMD160", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down
2 changes: 1 addition & 1 deletion src/hashes/rmd256.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ int rmd256_test(void)

for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) {
rmd256_init(&md);
rmd256_process(&md, (unsigned char *)tests[i].msg, strlen(tests[i].msg));
rmd256_process(&md, (unsigned char *)tests[i].msg, XSTRLEN(tests[i].msg));
rmd256_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "RIPEMD256", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down
2 changes: 1 addition & 1 deletion src/hashes/rmd320.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ int rmd320_test(void)

for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) {
rmd320_init(&md);
rmd320_process(&md, (unsigned char *)tests[i].msg, strlen(tests[i].msg));
rmd320_process(&md, (unsigned char *)tests[i].msg, XSTRLEN(tests[i].msg));
rmd320_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "RIPEMD320", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down
2 changes: 1 addition & 1 deletion src/hashes/sha1.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ int sha1_test(void)

for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) {
sha1_init(&md);
sha1_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg));
sha1_process(&md, (unsigned char*)tests[i].msg, (unsigned long)XSTRLEN(tests[i].msg));
sha1_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "SHA1", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down
2 changes: 1 addition & 1 deletion src/hashes/sha2/sha224.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ int sha224_test(void)

for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) {
sha224_init(&md);
sha224_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg));
sha224_process(&md, (unsigned char*)tests[i].msg, (unsigned long)XSTRLEN(tests[i].msg));
sha224_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "SHA224", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down
2 changes: 1 addition & 1 deletion src/hashes/sha2/sha256.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ int sha256_test(void)

for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) {
sha256_init(&md);
sha256_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg));
sha256_process(&md, (unsigned char*)tests[i].msg, (unsigned long)XSTRLEN(tests[i].msg));
sha256_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "SHA256", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down
2 changes: 1 addition & 1 deletion src/hashes/sha2/sha384.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ int sha384_test(void)

for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) {
sha384_init(&md);
sha384_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg));
sha384_process(&md, (unsigned char*)tests[i].msg, (unsigned long)XSTRLEN(tests[i].msg));
sha384_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "SHA384", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down
2 changes: 1 addition & 1 deletion src/hashes/sha2/sha512.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ int sha512_test(void)

for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) {
sha512_init(&md);
sha512_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
sha512_process(&md, (unsigned char *)tests[i].msg, (unsigned long)XSTRLEN(tests[i].msg));
sha512_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "SHA512", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down
2 changes: 1 addition & 1 deletion src/hashes/sha2/sha512_224.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ int sha512_224_test(void)

for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) {
sha512_224_init(&md);
sha512_224_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg));
sha512_224_process(&md, (unsigned char*)tests[i].msg, (unsigned long)XSTRLEN(tests[i].msg));
sha512_224_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "SHA512-224", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down
2 changes: 1 addition & 1 deletion src/hashes/sha2/sha512_256.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ int sha512_256_test(void)

for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) {
sha512_256_init(&md);
sha512_256_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg));
sha512_256_process(&md, (unsigned char*)tests[i].msg, (unsigned long)XSTRLEN(tests[i].msg));
sha512_256_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "SHA512-265", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down
2 changes: 1 addition & 1 deletion src/hashes/tiger.c
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ int tiger_test(void)

for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) {
tiger_init(&md);
tiger_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
tiger_process(&md, (unsigned char *)tests[i].msg, (unsigned long)XSTRLEN(tests[i].msg));
tiger_done(&md, tmp);
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "TIGER", i)) {
return CRYPT_FAIL_TESTVECTOR;
Expand Down
6 changes: 5 additions & 1 deletion src/headers/tomcrypt_custom.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
#ifndef XSTRCMP
#define XSTRCMP strcmp
#endif
#ifndef XSTRLEN
#define XSTRLEN strlen
#endif
#ifndef XSTRNCPY
#define XSTRNCPY strncpy
#endif
Expand All @@ -59,7 +62,8 @@

#if ( defined(malloc) || defined(realloc) || defined(calloc) || defined(free) || \
defined(memset) || defined(memcpy) || defined(memcmp) || defined(strcmp) || \
defined(strncpy) || defined(clock) || defined(qsort) ) && !defined(LTC_NO_PROTOTYPES)
defined(strlen) || defined(strncpy) || defined(clock) || defined(qsort) ) \
&& !defined(LTC_NO_PROTOTYPES)
#define LTC_NO_PROTOTYPES
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/mac/poly1305/poly1305_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int poly1305_test(void)
unsigned char k[] = { 0x85, 0xd6, 0xbe, 0x78, 0x57, 0x55, 0x6d, 0x33, 0x7f, 0x44, 0x52, 0xfe, 0x42, 0xd5, 0x06, 0xa8, 0x01, 0x03, 0x80, 0x8a, 0xfb, 0x0d, 0xb2, 0xfd, 0x4a, 0xbf, 0xf6, 0xaf, 0x41, 0x49, 0xf5, 0x1b };
unsigned char tag[] = { 0xA8, 0x06, 0x1D, 0xC1, 0x30, 0x51, 0x36, 0xC6, 0xC2, 0x2B, 0x8B, 0xAF, 0x0C, 0x01, 0x27, 0xA9 };
char m[] = "Cryptographic Forum Research Group";
unsigned long len = 16, mlen = strlen(m);
unsigned long len = 16, mlen = XSTRLEN(m);
unsigned char out[1000];
poly1305_state st;
int err;
Expand Down
2 changes: 1 addition & 1 deletion src/math/gmp_desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ static int read_radix(void *a, const char *b, int radix)
char c, *tmp, *q;
const char *p;
int i;
tmp = XMALLOC (1 + 2 * strlen (b));
tmp = XMALLOC (1 + 2 * XSTRLEN (b));
if (tmp == NULL) {
return CRYPT_MEM;
}
Expand Down
Loading