Catch up with toolchain changes.

This commit is contained in:
Dag-Erling Smørgrav 2022-09-16 11:01:22 +02:00
parent 96a5cef4ba
commit 7885f54152
18 changed files with 84 additions and 75 deletions

View file

@ -1,5 +1,5 @@
AC_PREREQ([2.63]) AC_PREREQ([2.69])
AC_INIT([cryb.to], [0.20190326], [des@des.no], [cryb-to], [http://cryb.to/]) AC_INIT([cryb.to], [0.20220916], [des@des.no], [cryb-to], [http://cryb.to/])
AC_CONFIG_SRCDIR([include/cryb/core.h]) AC_CONFIG_SRCDIR([include/cryb/core.h])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-xz]) AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-xz])
@ -14,10 +14,9 @@ AM_MAINTAINER_MODE([enable])
# C compiler and features # C compiler and features
AC_LANG(C) AC_LANG(C)
AC_PROG_CC([clang gcc cc]) AC_PROG_CC([clang gcc cc])
AC_PROG_CC_STDC
AC_PROG_CPP AC_PROG_CPP
AC_PROG_CXX([clang++ g++ c++]) AC_PROG_CXX([clang++ g++ c++])
AC_GNU_SOURCE AC_USE_SYSTEM_EXTENSIONS
AC_C_CONST AC_C_CONST
AC_C_RESTRICT AC_C_RESTRICT
AC_C_VOLATILE AC_C_VOLATILE

View file

@ -623,10 +623,10 @@ cipher_algorithm aes128_cipher = {
.contextlen = sizeof(aes_ctx), .contextlen = sizeof(aes_ctx),
.blocklen = AES_BLOCK_LEN, .blocklen = AES_BLOCK_LEN,
.keylen = 128 / 8, .keylen = 128 / 8,
.init = (cipher_init_func)aes_init, .init = (cipher_init_func)(void *)aes_init,
.encrypt = (cipher_encrypt_func)aes_encrypt, .encrypt = (cipher_encrypt_func)(void *)aes_encrypt,
.decrypt = (cipher_decrypt_func)aes_decrypt, .decrypt = (cipher_decrypt_func)(void *)aes_decrypt,
.finish = (cipher_finish_func)aes_finish, .finish = (cipher_finish_func)(void *)aes_finish,
}; };
cipher_algorithm aes192_cipher = { cipher_algorithm aes192_cipher = {
@ -634,10 +634,10 @@ cipher_algorithm aes192_cipher = {
.contextlen = sizeof(aes_ctx), .contextlen = sizeof(aes_ctx),
.blocklen = AES_BLOCK_LEN, .blocklen = AES_BLOCK_LEN,
.keylen = 192 / 8, .keylen = 192 / 8,
.init = (cipher_init_func)aes_init, .init = (cipher_init_func)(void *)aes_init,
.encrypt = (cipher_encrypt_func)aes_encrypt, .encrypt = (cipher_encrypt_func)(void *)aes_encrypt,
.decrypt = (cipher_decrypt_func)aes_decrypt, .decrypt = (cipher_decrypt_func)(void *)aes_decrypt,
.finish = (cipher_finish_func)aes_finish, .finish = (cipher_finish_func)(void *)aes_finish,
}; };
cipher_algorithm aes256_cipher = { cipher_algorithm aes256_cipher = {
@ -645,8 +645,8 @@ cipher_algorithm aes256_cipher = {
.contextlen = sizeof(aes_ctx), .contextlen = sizeof(aes_ctx),
.blocklen = AES_BLOCK_LEN, .blocklen = AES_BLOCK_LEN,
.keylen = 256 / 8, .keylen = 256 / 8,
.init = (cipher_init_func)aes_init, .init = (cipher_init_func)(void *)aes_init,
.encrypt = (cipher_encrypt_func)aes_encrypt, .encrypt = (cipher_encrypt_func)(void *)aes_encrypt,
.decrypt = (cipher_decrypt_func)aes_decrypt, .decrypt = (cipher_decrypt_func)(void *)aes_decrypt,
.finish = (cipher_finish_func)aes_finish, .finish = (cipher_finish_func)(void *)aes_finish,
}; };

View file

@ -194,9 +194,9 @@ cipher_algorithm chacha_cipher = {
.contextlen = sizeof(chacha_ctx), .contextlen = sizeof(chacha_ctx),
.blocklen = 64, .blocklen = 64,
.keylen = 32, .keylen = 32,
.init = (cipher_init_func)chacha_init, .init = (cipher_init_func)(void *)chacha_init,
.keystream = (cipher_keystream_func)chacha_keystream, .keystream = (cipher_keystream_func)(void *)chacha_keystream,
.encrypt = (cipher_encrypt_func)chacha_encrypt, .encrypt = (cipher_encrypt_func)(void *)chacha_encrypt,
.decrypt = (cipher_decrypt_func)chacha_decrypt, .decrypt = (cipher_decrypt_func)(void *)chacha_decrypt,
.finish = (cipher_finish_func)chacha_finish, .finish = (cipher_finish_func)(void *)chacha_finish,
}; };

View file

@ -440,10 +440,10 @@ cipher_algorithm des56_cipher = {
.contextlen = sizeof(des_ctx), .contextlen = sizeof(des_ctx),
.blocklen = DES_BLOCK_LEN, .blocklen = DES_BLOCK_LEN,
.keylen = DES_BLOCK_LEN, .keylen = DES_BLOCK_LEN,
.init = (cipher_init_func)des_init, .init = (cipher_init_func)(void *)des_init,
.encrypt = (cipher_encrypt_func)des_encrypt, .encrypt = (cipher_encrypt_func)(void *)des_encrypt,
.decrypt = (cipher_decrypt_func)des_decrypt, .decrypt = (cipher_decrypt_func)(void *)des_decrypt,
.finish = (cipher_finish_func)des_finish, .finish = (cipher_finish_func)(void *)des_finish,
}; };
cipher_algorithm des112_cipher = { cipher_algorithm des112_cipher = {
@ -451,10 +451,10 @@ cipher_algorithm des112_cipher = {
.contextlen = sizeof(des_ctx), .contextlen = sizeof(des_ctx),
.blocklen = DES_BLOCK_LEN, .blocklen = DES_BLOCK_LEN,
.keylen = DES_BLOCK_LEN * 2, .keylen = DES_BLOCK_LEN * 2,
.init = (cipher_init_func)des_init, .init = (cipher_init_func)(void *)des_init,
.encrypt = (cipher_encrypt_func)des_encrypt, .encrypt = (cipher_encrypt_func)(void *)des_encrypt,
.decrypt = (cipher_decrypt_func)des_decrypt, .decrypt = (cipher_decrypt_func)(void *)des_decrypt,
.finish = (cipher_finish_func)des_finish, .finish = (cipher_finish_func)(void *)des_finish,
}; };
cipher_algorithm des168_cipher = { cipher_algorithm des168_cipher = {
@ -462,8 +462,8 @@ cipher_algorithm des168_cipher = {
.contextlen = sizeof(des_ctx), .contextlen = sizeof(des_ctx),
.blocklen = DES_BLOCK_LEN, .blocklen = DES_BLOCK_LEN,
.keylen = DES_BLOCK_LEN * 3, .keylen = DES_BLOCK_LEN * 3,
.init = (cipher_init_func)des_init, .init = (cipher_init_func)(void *)des_init,
.encrypt = (cipher_encrypt_func)des_encrypt, .encrypt = (cipher_encrypt_func)(void *)des_encrypt,
.decrypt = (cipher_decrypt_func)des_decrypt, .decrypt = (cipher_decrypt_func)(void *)des_decrypt,
.finish = (cipher_finish_func)des_finish, .finish = (cipher_finish_func)(void *)des_finish,
}; };

View file

@ -116,9 +116,9 @@ cipher_algorithm rc4_cipher = {
.contextlen = sizeof(rc4_ctx), .contextlen = sizeof(rc4_ctx),
.blocklen = 1, .blocklen = 1,
.keylen = 0, .keylen = 0,
.init = (cipher_init_func)rc4_init, .init = (cipher_init_func)(void *)rc4_init,
.keystream = (cipher_keystream_func)rc4_keystream, .keystream = (cipher_keystream_func)(void *)rc4_keystream,
.encrypt = (cipher_encrypt_func)rc4_encrypt, .encrypt = (cipher_encrypt_func)(void *)rc4_encrypt,
.decrypt = (cipher_decrypt_func)rc4_decrypt, .decrypt = (cipher_decrypt_func)(void *)rc4_decrypt,
.finish = (cipher_finish_func)rc4_finish, .finish = (cipher_finish_func)(void *)rc4_finish,
}; };

View file

@ -194,9 +194,9 @@ cipher_algorithm salsa_cipher = {
.contextlen = sizeof(salsa_ctx), .contextlen = sizeof(salsa_ctx),
.blocklen = 64, .blocklen = 64,
.keylen = 32, .keylen = 32,
.init = (cipher_init_func)salsa_init, .init = (cipher_init_func)(void *)salsa_init,
.keystream = (cipher_keystream_func)salsa_keystream, .keystream = (cipher_keystream_func)(void *)salsa_keystream,
.encrypt = (cipher_encrypt_func)salsa_encrypt, .encrypt = (cipher_encrypt_func)(void *)salsa_encrypt,
.decrypt = (cipher_decrypt_func)salsa_decrypt, .decrypt = (cipher_decrypt_func)(void *)salsa_decrypt,
.finish = (cipher_finish_func)salsa_finish, .finish = (cipher_finish_func)(void *)salsa_finish,
}; };

View file

@ -174,8 +174,8 @@ digest_algorithm md2_digest = {
.contextlen = sizeof(md2_ctx), .contextlen = sizeof(md2_ctx),
.blocklen = MD2_BLOCK_LEN, .blocklen = MD2_BLOCK_LEN,
.digestlen = MD2_DIGEST_LEN, .digestlen = MD2_DIGEST_LEN,
.init = (digest_init_func)md2_init, .init = (digest_init_func)(void *)md2_init,
.update = (digest_update_func)md2_update, .update = (digest_update_func)(void *)md2_update,
.final = (digest_final_func)md2_final, .final = (digest_final_func)(void *)md2_final,
.complete = (digest_complete_func)md2_complete, .complete = (digest_complete_func)(void *)md2_complete,
}; };

View file

@ -196,8 +196,8 @@ digest_algorithm md4_digest = {
.contextlen = sizeof(md4_ctx), .contextlen = sizeof(md4_ctx),
.blocklen = MD4_BLOCK_LEN, .blocklen = MD4_BLOCK_LEN,
.digestlen = MD4_DIGEST_LEN, .digestlen = MD4_DIGEST_LEN,
.init = (digest_init_func)md4_init, .init = (digest_init_func)(void *)md4_init,
.update = (digest_update_func)md4_update, .update = (digest_update_func)(void *)md4_update,
.final = (digest_final_func)md4_final, .final = (digest_final_func)(void *)md4_final,
.complete = (digest_complete_func)md4_complete, .complete = (digest_complete_func)(void *)md4_complete,
}; };

View file

@ -243,8 +243,8 @@ digest_algorithm md5_digest = {
.contextlen = sizeof(md5_ctx), .contextlen = sizeof(md5_ctx),
.blocklen = MD5_BLOCK_LEN, .blocklen = MD5_BLOCK_LEN,
.digestlen = MD5_DIGEST_LEN, .digestlen = MD5_DIGEST_LEN,
.init = (digest_init_func)md5_init, .init = (digest_init_func)(void *)md5_init,
.update = (digest_update_func)md5_update, .update = (digest_update_func)(void *)md5_update,
.final = (digest_final_func)md5_final, .final = (digest_final_func)(void *)md5_final,
.complete = (digest_complete_func)md5_complete, .complete = (digest_complete_func)(void *)md5_complete,
}; };

View file

@ -235,8 +235,8 @@ digest_algorithm sha1_digest = {
.contextlen = sizeof(sha1_ctx), .contextlen = sizeof(sha1_ctx),
.blocklen = SHA1_BLOCK_LEN, .blocklen = SHA1_BLOCK_LEN,
.digestlen = SHA1_DIGEST_LEN, .digestlen = SHA1_DIGEST_LEN,
.init = (digest_init_func)sha1_init, .init = (digest_init_func)(void *)sha1_init,
.update = (digest_update_func)sha1_update, .update = (digest_update_func)(void *)sha1_update,
.final = (digest_final_func)sha1_final, .final = (digest_final_func)(void *)sha1_final,
.complete = (digest_complete_func)sha1_complete, .complete = (digest_complete_func)(void *)sha1_complete,
}; };

View file

@ -290,8 +290,8 @@ digest_algorithm sha224_digest = {
.contextlen = sizeof(sha224_ctx), .contextlen = sizeof(sha224_ctx),
.blocklen = SHA224_BLOCK_LEN, .blocklen = SHA224_BLOCK_LEN,
.digestlen = SHA224_DIGEST_LEN, .digestlen = SHA224_DIGEST_LEN,
.init = (digest_init_func)sha224_init, .init = (digest_init_func)(void *)sha224_init,
.update = (digest_update_func)sha224_update, .update = (digest_update_func)(void *)sha224_update,
.final = (digest_final_func)sha224_final, .final = (digest_final_func)(void *)sha224_final,
.complete = (digest_complete_func)sha224_complete, .complete = (digest_complete_func)(void *)sha224_complete,
}; };

View file

@ -289,8 +289,8 @@ digest_algorithm sha256_digest = {
.contextlen = sizeof(sha256_ctx), .contextlen = sizeof(sha256_ctx),
.blocklen = SHA256_BLOCK_LEN, .blocklen = SHA256_BLOCK_LEN,
.digestlen = SHA256_DIGEST_LEN, .digestlen = SHA256_DIGEST_LEN,
.init = (digest_init_func)sha256_init, .init = (digest_init_func)(void *)sha256_init,
.update = (digest_update_func)sha256_update, .update = (digest_update_func)(void *)sha256_update,
.final = (digest_final_func)sha256_final, .final = (digest_final_func)(void *)sha256_final,
.complete = (digest_complete_func)sha256_complete, .complete = (digest_complete_func)(void *)sha256_complete,
}; };

View file

@ -291,8 +291,8 @@ digest_algorithm sha384_digest = {
.contextlen = sizeof(sha384_ctx), .contextlen = sizeof(sha384_ctx),
.blocklen = SHA384_BLOCK_LEN, .blocklen = SHA384_BLOCK_LEN,
.digestlen = SHA384_DIGEST_LEN, .digestlen = SHA384_DIGEST_LEN,
.init = (digest_init_func)sha384_init, .init = (digest_init_func)(void *)sha384_init,
.update = (digest_update_func)sha384_update, .update = (digest_update_func)(void *)sha384_update,
.final = (digest_final_func)sha384_final, .final = (digest_final_func)(void *)sha384_final,
.complete = (digest_complete_func)sha384_complete, .complete = (digest_complete_func)(void *)sha384_complete,
}; };

View file

@ -291,8 +291,8 @@ digest_algorithm sha512_digest = {
.contextlen = sizeof(sha512_ctx), .contextlen = sizeof(sha512_ctx),
.blocklen = SHA512_BLOCK_LEN, .blocklen = SHA512_BLOCK_LEN,
.digestlen = SHA512_DIGEST_LEN, .digestlen = SHA512_DIGEST_LEN,
.init = (digest_init_func)sha512_init, .init = (digest_init_func)(void *)sha512_init,
.update = (digest_update_func)sha512_update, .update = (digest_update_func)(void *)sha512_update,
.final = (digest_final_func)sha512_final, .final = (digest_final_func)(void *)sha512_final,
.complete = (digest_complete_func)sha512_complete, .complete = (digest_complete_func)(void *)sha512_complete,
}; };

View file

@ -75,12 +75,16 @@ base32_encode(const uint8_t *in, size_t ilen, char *out, size_t *olen)
switch (ilen) { switch (ilen) {
case 4: case 4:
bits |= (uint64_t)in[3] << 8; bits |= (uint64_t)in[3] << 8;
/* fall through */
case 3: case 3:
bits |= (uint64_t)in[2] << 16; bits |= (uint64_t)in[2] << 16;
/* fall through */
case 2: case 2:
bits |= (uint64_t)in[1] << 24; bits |= (uint64_t)in[1] << 24;
/* fall through */
case 1: case 1:
bits |= (uint64_t)in[0] << 32; bits |= (uint64_t)in[0] << 32;
break;
CRYB_NO_DEFAULT_CASE; CRYB_NO_DEFAULT_CASE;
} }
*out++ = b32enc[bits >> 35 & 0x1f]; *out++ = b32enc[bits >> 35 & 0x1f];

View file

@ -71,8 +71,10 @@ base64_encode(const uint8_t *in, size_t ilen, char *out, size_t *olen)
switch (ilen) { switch (ilen) {
case 2: case 2:
bits |= (uint32_t)in[1] << 8; bits |= (uint32_t)in[1] << 8;
/* fall through */
case 1: case 1:
bits |= (uint32_t)in[0] << 16; bits |= (uint32_t)in[0] << 16;
break;
CRYB_NO_DEFAULT_CASE; CRYB_NO_DEFAULT_CASE;
} }
*out++ = b64enc[bits >> 18 & 0x3f]; *out++ = b64enc[bits >> 18 & 0x3f];

View file

@ -78,8 +78,10 @@ murmur3_32_hash(const void *data, size_t len, uint32_t seed)
switch (res) { switch (res) {
case 3: case 3:
k |= bytes[2] << 16; k |= bytes[2] << 16;
/* fall through */
case 2: case 2:
k |= bytes[1] << 8; k |= bytes[1] << 8;
/* fall through */
case 1: case 1:
k |= bytes[0]; k |= bytes[0];
k *= 0xcc9e2d51; k *= 0xcc9e2d51;

View file

@ -63,8 +63,10 @@ mpi_load(cryb_mpi *X, const uint8_t *a, size_t len)
switch (len) { switch (len) {
case 3: case 3:
X->words[i] |= a[len - 3] << 16; X->words[i] |= a[len - 3] << 16;
/* fall through */
case 2: case 2:
X->words[i] |= a[len - 2] << 8; X->words[i] |= a[len - 2] << 8;
/* fall through */
case 1: case 1:
X->words[i] |= a[len - 1]; X->words[i] |= a[len - 1];
break; break;