Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'libcrypto-at-least-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux

Pull 'at_least' array size update from Eric Biggers:
"C supports lower bounds on the sizes of array parameters, using the
static keyword as follows: 'void f(int a[static 32]);'. This allows
the compiler to warn about a too-small array being passed.

As discussed, this reuse of the 'static' keyword, while standard, is a
bit obscure. Therefore, add an alias 'at_least' to compiler_types.h.

Then, add this 'at_least' annotation to the array parameters of
various crypto library functions"

* tag 'libcrypto-at-least-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux:
lib/crypto: sha2: Add at_least decoration to fixed-size array params
lib/crypto: sha1: Add at_least decoration to fixed-size array params
lib/crypto: poly1305: Add at_least decoration to fixed-size array params
lib/crypto: md5: Add at_least decoration to fixed-size array params
lib/crypto: curve25519: Add at_least decoration to fixed-size array params
lib/crypto: chacha: Add at_least decoration to fixed-size array params
lib/crypto: chacha20poly1305: Statically check fixed array lengths
compiler_types: introduce at_least parameter decoration pseudo keyword
wifi: iwlwifi: trans: rename at_least variable to min_mode

+103 -71
+4 -4
drivers/net/wireless/intel/iwlwifi/iwl-trans.c
··· 129 129 iwl_trans_determine_restart_mode(struct iwl_trans *trans) 130 130 { 131 131 struct iwl_trans_dev_restart_data *data; 132 - enum iwl_reset_mode at_least = 0; 132 + enum iwl_reset_mode min_mode = 0; 133 133 unsigned int index; 134 134 static const enum iwl_reset_mode escalation_list_old[] = { 135 135 IWL_RESET_MODE_SW_RESET, ··· 173 173 } 174 174 175 175 if (trans->restart.during_reset) 176 - at_least = IWL_RESET_MODE_REPROBE; 176 + min_mode = IWL_RESET_MODE_REPROBE; 177 177 178 178 data = iwl_trans_get_restart_data(trans->dev); 179 179 if (!data) 180 - return at_least; 180 + return min_mode; 181 181 182 182 if (!data->backoff && 183 183 ktime_get_boottime_seconds() - data->last_error >= ··· 194 194 data->backoff = false; 195 195 } 196 196 197 - return max(at_least, escalation_list[index]); 197 + return max(min_mode, escalation_list[index]); 198 198 } 199 199 200 200 #define IWL_TRANS_TOP_FOLLOWER_WAIT 180 /* ms */
+6 -6
include/crypto/chacha.h
··· 38 38 }; 39 39 40 40 void chacha_block_generic(struct chacha_state *state, 41 - u8 out[CHACHA_BLOCK_SIZE], int nrounds); 41 + u8 out[at_least CHACHA_BLOCK_SIZE], int nrounds); 42 42 static inline void chacha20_block(struct chacha_state *state, 43 - u8 out[CHACHA_BLOCK_SIZE]) 43 + u8 out[at_least CHACHA_BLOCK_SIZE]) 44 44 { 45 45 chacha_block_generic(state, out, 20); 46 46 } 47 47 48 48 void hchacha_block_generic(const struct chacha_state *state, 49 - u32 out[HCHACHA_OUT_WORDS], int nrounds); 49 + u32 out[at_least HCHACHA_OUT_WORDS], int nrounds); 50 50 51 51 void hchacha_block(const struct chacha_state *state, 52 - u32 out[HCHACHA_OUT_WORDS], int nrounds); 52 + u32 out[at_least HCHACHA_OUT_WORDS], int nrounds); 53 53 54 54 enum chacha_constants { /* expand 32-byte k */ 55 55 CHACHA_CONSTANT_EXPA = 0x61707865U, ··· 67 67 } 68 68 69 69 static inline void chacha_init(struct chacha_state *state, 70 - const u32 key[CHACHA_KEY_WORDS], 71 - const u8 iv[CHACHA_IV_SIZE]) 70 + const u32 key[at_least CHACHA_KEY_WORDS], 71 + const u8 iv[at_least CHACHA_IV_SIZE]) 72 72 { 73 73 chacha_init_consts(state); 74 74 state->x[4] = key[0];
+10 -9
include/crypto/chacha20poly1305.h
··· 18 18 void chacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len, 19 19 const u8 *ad, const size_t ad_len, 20 20 const u64 nonce, 21 - const u8 key[CHACHA20POLY1305_KEY_SIZE]); 21 + const u8 key[at_least CHACHA20POLY1305_KEY_SIZE]); 22 22 23 23 bool __must_check 24 24 chacha20poly1305_decrypt(u8 *dst, const u8 *src, const size_t src_len, 25 25 const u8 *ad, const size_t ad_len, const u64 nonce, 26 - const u8 key[CHACHA20POLY1305_KEY_SIZE]); 26 + const u8 key[at_least CHACHA20POLY1305_KEY_SIZE]); 27 27 28 28 void xchacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len, 29 29 const u8 *ad, const size_t ad_len, 30 - const u8 nonce[XCHACHA20POLY1305_NONCE_SIZE], 31 - const u8 key[CHACHA20POLY1305_KEY_SIZE]); 30 + const u8 nonce[at_least XCHACHA20POLY1305_NONCE_SIZE], 31 + const u8 key[at_least CHACHA20POLY1305_KEY_SIZE]); 32 32 33 33 bool __must_check xchacha20poly1305_decrypt( 34 - u8 *dst, const u8 *src, const size_t src_len, const u8 *ad, 35 - const size_t ad_len, const u8 nonce[XCHACHA20POLY1305_NONCE_SIZE], 36 - const u8 key[CHACHA20POLY1305_KEY_SIZE]); 34 + u8 *dst, const u8 *src, const size_t src_len, 35 + const u8 *ad, const size_t ad_len, 36 + const u8 nonce[at_least XCHACHA20POLY1305_NONCE_SIZE], 37 + const u8 key[at_least CHACHA20POLY1305_KEY_SIZE]); 37 38 38 39 bool chacha20poly1305_encrypt_sg_inplace(struct scatterlist *src, size_t src_len, 39 40 const u8 *ad, const size_t ad_len, 40 41 const u64 nonce, 41 - const u8 key[CHACHA20POLY1305_KEY_SIZE]); 42 + const u8 key[at_least CHACHA20POLY1305_KEY_SIZE]); 42 43 43 44 bool chacha20poly1305_decrypt_sg_inplace(struct scatterlist *src, size_t src_len, 44 45 const u8 *ad, const size_t ad_len, 45 46 const u64 nonce, 46 - const u8 key[CHACHA20POLY1305_KEY_SIZE]); 47 + const u8 key[at_least CHACHA20POLY1305_KEY_SIZE]); 47 48 48 49 bool chacha20poly1305_selftest(void); 49 50
+14 -10
include/crypto/curve25519.h
··· 13 13 CURVE25519_KEY_SIZE = 32 14 14 }; 15 15 16 - void curve25519_generic(u8 out[CURVE25519_KEY_SIZE], 17 - const u8 scalar[CURVE25519_KEY_SIZE], 18 - const u8 point[CURVE25519_KEY_SIZE]); 16 + void curve25519_generic(u8 out[at_least CURVE25519_KEY_SIZE], 17 + const u8 scalar[at_least CURVE25519_KEY_SIZE], 18 + const u8 point[at_least CURVE25519_KEY_SIZE]); 19 19 20 - bool __must_check curve25519(u8 mypublic[CURVE25519_KEY_SIZE], 21 - const u8 secret[CURVE25519_KEY_SIZE], 22 - const u8 basepoint[CURVE25519_KEY_SIZE]); 20 + bool __must_check 21 + curve25519(u8 mypublic[at_least CURVE25519_KEY_SIZE], 22 + const u8 secret[at_least CURVE25519_KEY_SIZE], 23 + const u8 basepoint[at_least CURVE25519_KEY_SIZE]); 23 24 24 - bool __must_check curve25519_generate_public(u8 pub[CURVE25519_KEY_SIZE], 25 - const u8 secret[CURVE25519_KEY_SIZE]); 25 + bool __must_check 26 + curve25519_generate_public(u8 pub[at_least CURVE25519_KEY_SIZE], 27 + const u8 secret[at_least CURVE25519_KEY_SIZE]); 26 28 27 - static inline void curve25519_clamp_secret(u8 secret[CURVE25519_KEY_SIZE]) 29 + static inline void 30 + curve25519_clamp_secret(u8 secret[at_least CURVE25519_KEY_SIZE]) 28 31 { 29 32 secret[0] &= 248; 30 33 secret[31] = (secret[31] & 127) | 64; 31 34 } 32 35 33 - static inline void curve25519_generate_secret(u8 secret[CURVE25519_KEY_SIZE]) 36 + static inline void 37 + curve25519_generate_secret(u8 secret[at_least CURVE25519_KEY_SIZE]) 34 38 { 35 39 get_random_bytes_wait(secret, CURVE25519_KEY_SIZE); 36 40 curve25519_clamp_secret(secret);
+6 -5
include/crypto/md5.h
··· 76 76 * 77 77 * Context: Any context. 78 78 */ 79 - void md5_final(struct md5_ctx *ctx, u8 out[MD5_DIGEST_SIZE]); 79 + void md5_final(struct md5_ctx *ctx, u8 out[at_least MD5_DIGEST_SIZE]); 80 80 81 81 /** 82 82 * md5() - Compute MD5 message digest in one shot ··· 86 86 * 87 87 * Context: Any context. 88 88 */ 89 - void md5(const u8 *data, size_t len, u8 out[MD5_DIGEST_SIZE]); 89 + void md5(const u8 *data, size_t len, u8 out[at_least MD5_DIGEST_SIZE]); 90 90 91 91 /** 92 92 * struct hmac_md5_key - Prepared key for HMAC-MD5 ··· 173 173 * 174 174 * Context: Any context. 175 175 */ 176 - void hmac_md5_final(struct hmac_md5_ctx *ctx, u8 out[MD5_DIGEST_SIZE]); 176 + void hmac_md5_final(struct hmac_md5_ctx *ctx, u8 out[at_least MD5_DIGEST_SIZE]); 177 177 178 178 /** 179 179 * hmac_md5() - Compute HMAC-MD5 in one shot, using a prepared key ··· 187 187 * Context: Any context. 188 188 */ 189 189 void hmac_md5(const struct hmac_md5_key *key, 190 - const u8 *data, size_t data_len, u8 out[MD5_DIGEST_SIZE]); 190 + const u8 *data, size_t data_len, 191 + u8 out[at_least MD5_DIGEST_SIZE]); 191 192 192 193 /** 193 194 * hmac_md5_usingrawkey() - Compute HMAC-MD5 in one shot, using a raw key ··· 205 204 */ 206 205 void hmac_md5_usingrawkey(const u8 *raw_key, size_t raw_key_len, 207 206 const u8 *data, size_t data_len, 208 - u8 out[MD5_DIGEST_SIZE]); 207 + u8 out[at_least MD5_DIGEST_SIZE]); 209 208 210 209 #endif /* _CRYPTO_MD5_H */
+1 -1
include/crypto/poly1305.h
··· 59 59 }; 60 60 61 61 void poly1305_init(struct poly1305_desc_ctx *desc, 62 - const u8 key[POLY1305_KEY_SIZE]); 62 + const u8 key[at_least POLY1305_KEY_SIZE]); 63 63 void poly1305_update(struct poly1305_desc_ctx *desc, 64 64 const u8 *src, unsigned int nbytes); 65 65 void poly1305_final(struct poly1305_desc_ctx *desc, u8 *digest);
+7 -5
include/crypto/sha1.h
··· 84 84 * 85 85 * Context: Any context. 86 86 */ 87 - void sha1_final(struct sha1_ctx *ctx, u8 out[SHA1_DIGEST_SIZE]); 87 + void sha1_final(struct sha1_ctx *ctx, u8 out[at_least SHA1_DIGEST_SIZE]); 88 88 89 89 /** 90 90 * sha1() - Compute SHA-1 message digest in one shot ··· 94 94 * 95 95 * Context: Any context. 96 96 */ 97 - void sha1(const u8 *data, size_t len, u8 out[SHA1_DIGEST_SIZE]); 97 + void sha1(const u8 *data, size_t len, u8 out[at_least SHA1_DIGEST_SIZE]); 98 98 99 99 /** 100 100 * struct hmac_sha1_key - Prepared key for HMAC-SHA1 ··· 181 181 * 182 182 * Context: Any context. 183 183 */ 184 - void hmac_sha1_final(struct hmac_sha1_ctx *ctx, u8 out[SHA1_DIGEST_SIZE]); 184 + void hmac_sha1_final(struct hmac_sha1_ctx *ctx, 185 + u8 out[at_least SHA1_DIGEST_SIZE]); 185 186 186 187 /** 187 188 * hmac_sha1() - Compute HMAC-SHA1 in one shot, using a prepared key ··· 196 195 * Context: Any context. 197 196 */ 198 197 void hmac_sha1(const struct hmac_sha1_key *key, 199 - const u8 *data, size_t data_len, u8 out[SHA1_DIGEST_SIZE]); 198 + const u8 *data, size_t data_len, 199 + u8 out[at_least SHA1_DIGEST_SIZE]); 200 200 201 201 /** 202 202 * hmac_sha1_usingrawkey() - Compute HMAC-SHA1 in one shot, using a raw key ··· 214 212 */ 215 213 void hmac_sha1_usingrawkey(const u8 *raw_key, size_t raw_key_len, 216 214 const u8 *data, size_t data_len, 217 - u8 out[SHA1_DIGEST_SIZE]); 215 + u8 out[at_least SHA1_DIGEST_SIZE]); 218 216 219 217 #endif /* _CRYPTO_SHA1_H */
+31 -22
include/crypto/sha2.h
··· 190 190 * 191 191 * Context: Any context. 192 192 */ 193 - void sha224_final(struct sha224_ctx *ctx, u8 out[SHA224_DIGEST_SIZE]); 193 + void sha224_final(struct sha224_ctx *ctx, u8 out[at_least SHA224_DIGEST_SIZE]); 194 194 195 195 /** 196 196 * sha224() - Compute SHA-224 message digest in one shot ··· 200 200 * 201 201 * Context: Any context. 202 202 */ 203 - void sha224(const u8 *data, size_t len, u8 out[SHA224_DIGEST_SIZE]); 203 + void sha224(const u8 *data, size_t len, u8 out[at_least SHA224_DIGEST_SIZE]); 204 204 205 205 /** 206 206 * struct hmac_sha224_key - Prepared key for HMAC-SHA224 ··· 287 287 * 288 288 * Context: Any context. 289 289 */ 290 - void hmac_sha224_final(struct hmac_sha224_ctx *ctx, u8 out[SHA224_DIGEST_SIZE]); 290 + void hmac_sha224_final(struct hmac_sha224_ctx *ctx, 291 + u8 out[at_least SHA224_DIGEST_SIZE]); 291 292 292 293 /** 293 294 * hmac_sha224() - Compute HMAC-SHA224 in one shot, using a prepared key ··· 302 301 * Context: Any context. 303 302 */ 304 303 void hmac_sha224(const struct hmac_sha224_key *key, 305 - const u8 *data, size_t data_len, u8 out[SHA224_DIGEST_SIZE]); 304 + const u8 *data, size_t data_len, 305 + u8 out[at_least SHA224_DIGEST_SIZE]); 306 306 307 307 /** 308 308 * hmac_sha224_usingrawkey() - Compute HMAC-SHA224 in one shot, using a raw key ··· 320 318 */ 321 319 void hmac_sha224_usingrawkey(const u8 *raw_key, size_t raw_key_len, 322 320 const u8 *data, size_t data_len, 323 - u8 out[SHA224_DIGEST_SIZE]); 321 + u8 out[at_least SHA224_DIGEST_SIZE]); 324 322 325 323 /** 326 324 * struct sha256_ctx - Context for hashing a message with SHA-256 ··· 365 363 * 366 364 * Context: Any context. 367 365 */ 368 - void sha256_final(struct sha256_ctx *ctx, u8 out[SHA256_DIGEST_SIZE]); 366 + void sha256_final(struct sha256_ctx *ctx, u8 out[at_least SHA256_DIGEST_SIZE]); 369 367 370 368 /** 371 369 * sha256() - Compute SHA-256 message digest in one shot ··· 375 373 * 376 374 * Context: Any context. 377 375 */ 378 - void sha256(const u8 *data, size_t len, u8 out[SHA256_DIGEST_SIZE]); 376 + void sha256(const u8 *data, size_t len, u8 out[at_least SHA256_DIGEST_SIZE]); 379 377 380 378 /** 381 379 * sha256_finup_2x() - Compute two SHA-256 digests from a common initial ··· 392 390 * Context: Any context. 393 391 */ 394 392 void sha256_finup_2x(const struct sha256_ctx *ctx, const u8 *data1, 395 - const u8 *data2, size_t len, u8 out1[SHA256_DIGEST_SIZE], 396 - u8 out2[SHA256_DIGEST_SIZE]); 393 + const u8 *data2, size_t len, 394 + u8 out1[at_least SHA256_DIGEST_SIZE], 395 + u8 out2[at_least SHA256_DIGEST_SIZE]); 397 396 398 397 /** 399 398 * sha256_finup_2x_is_optimized() - Check if sha256_finup_2x() is using a real ··· 491 488 * 492 489 * Context: Any context. 493 490 */ 494 - void hmac_sha256_final(struct hmac_sha256_ctx *ctx, u8 out[SHA256_DIGEST_SIZE]); 491 + void hmac_sha256_final(struct hmac_sha256_ctx *ctx, 492 + u8 out[at_least SHA256_DIGEST_SIZE]); 495 493 496 494 /** 497 495 * hmac_sha256() - Compute HMAC-SHA256 in one shot, using a prepared key ··· 506 502 * Context: Any context. 507 503 */ 508 504 void hmac_sha256(const struct hmac_sha256_key *key, 509 - const u8 *data, size_t data_len, u8 out[SHA256_DIGEST_SIZE]); 505 + const u8 *data, size_t data_len, 506 + u8 out[at_least SHA256_DIGEST_SIZE]); 510 507 511 508 /** 512 509 * hmac_sha256_usingrawkey() - Compute HMAC-SHA256 in one shot, using a raw key ··· 524 519 */ 525 520 void hmac_sha256_usingrawkey(const u8 *raw_key, size_t raw_key_len, 526 521 const u8 *data, size_t data_len, 527 - u8 out[SHA256_DIGEST_SIZE]); 522 + u8 out[at_least SHA256_DIGEST_SIZE]); 528 523 529 524 /* State for the SHA-512 (and SHA-384) compression function */ 530 525 struct sha512_block_state { ··· 603 598 * 604 599 * Context: Any context. 605 600 */ 606 - void sha384_final(struct sha384_ctx *ctx, u8 out[SHA384_DIGEST_SIZE]); 601 + void sha384_final(struct sha384_ctx *ctx, u8 out[at_least SHA384_DIGEST_SIZE]); 607 602 608 603 /** 609 604 * sha384() - Compute SHA-384 message digest in one shot ··· 613 608 * 614 609 * Context: Any context. 615 610 */ 616 - void sha384(const u8 *data, size_t len, u8 out[SHA384_DIGEST_SIZE]); 611 + void sha384(const u8 *data, size_t len, u8 out[at_least SHA384_DIGEST_SIZE]); 617 612 618 613 /** 619 614 * struct hmac_sha384_key - Prepared key for HMAC-SHA384 ··· 700 695 * 701 696 * Context: Any context. 702 697 */ 703 - void hmac_sha384_final(struct hmac_sha384_ctx *ctx, u8 out[SHA384_DIGEST_SIZE]); 698 + void hmac_sha384_final(struct hmac_sha384_ctx *ctx, 699 + u8 out[at_least SHA384_DIGEST_SIZE]); 704 700 705 701 /** 706 702 * hmac_sha384() - Compute HMAC-SHA384 in one shot, using a prepared key ··· 715 709 * Context: Any context. 716 710 */ 717 711 void hmac_sha384(const struct hmac_sha384_key *key, 718 - const u8 *data, size_t data_len, u8 out[SHA384_DIGEST_SIZE]); 712 + const u8 *data, size_t data_len, 713 + u8 out[at_least SHA384_DIGEST_SIZE]); 719 714 720 715 /** 721 716 * hmac_sha384_usingrawkey() - Compute HMAC-SHA384 in one shot, using a raw key ··· 733 726 */ 734 727 void hmac_sha384_usingrawkey(const u8 *raw_key, size_t raw_key_len, 735 728 const u8 *data, size_t data_len, 736 - u8 out[SHA384_DIGEST_SIZE]); 729 + u8 out[at_least SHA384_DIGEST_SIZE]); 737 730 738 731 /** 739 732 * struct sha512_ctx - Context for hashing a message with SHA-512 ··· 778 771 * 779 772 * Context: Any context. 780 773 */ 781 - void sha512_final(struct sha512_ctx *ctx, u8 out[SHA512_DIGEST_SIZE]); 774 + void sha512_final(struct sha512_ctx *ctx, u8 out[at_least SHA512_DIGEST_SIZE]); 782 775 783 776 /** 784 777 * sha512() - Compute SHA-512 message digest in one shot ··· 788 781 * 789 782 * Context: Any context. 790 783 */ 791 - void sha512(const u8 *data, size_t len, u8 out[SHA512_DIGEST_SIZE]); 784 + void sha512(const u8 *data, size_t len, u8 out[at_least SHA512_DIGEST_SIZE]); 792 785 793 786 /** 794 787 * struct hmac_sha512_key - Prepared key for HMAC-SHA512 ··· 875 868 * 876 869 * Context: Any context. 877 870 */ 878 - void hmac_sha512_final(struct hmac_sha512_ctx *ctx, u8 out[SHA512_DIGEST_SIZE]); 871 + void hmac_sha512_final(struct hmac_sha512_ctx *ctx, 872 + u8 out[at_least SHA512_DIGEST_SIZE]); 879 873 880 874 /** 881 875 * hmac_sha512() - Compute HMAC-SHA512 in one shot, using a prepared key ··· 890 882 * Context: Any context. 891 883 */ 892 884 void hmac_sha512(const struct hmac_sha512_key *key, 893 - const u8 *data, size_t data_len, u8 out[SHA512_DIGEST_SIZE]); 885 + const u8 *data, size_t data_len, 886 + u8 out[at_least SHA512_DIGEST_SIZE]); 894 887 895 888 /** 896 889 * hmac_sha512_usingrawkey() - Compute HMAC-SHA512 in one shot, using a raw key ··· 908 899 */ 909 900 void hmac_sha512_usingrawkey(const u8 *raw_key, size_t raw_key_len, 910 901 const u8 *data, size_t data_len, 911 - u8 out[SHA512_DIGEST_SIZE]); 902 + u8 out[at_least SHA512_DIGEST_SIZE]); 912 903 913 904 #endif /* _CRYPTO_SHA2_H */
+15
include/linux/compiler_types.h
··· 393 393 #define __counted_by_be(member) __counted_by(member) 394 394 #endif 395 395 396 + /* 397 + * This designates the minimum number of elements a passed array parameter must 398 + * have. For example: 399 + * 400 + * void some_function(u8 param[at_least 7]); 401 + * 402 + * If a caller passes an array with fewer than 7 elements, the compiler will 403 + * emit a warning. 404 + */ 405 + #ifndef __CHECKER__ 406 + #define at_least static 407 + #else 408 + #define at_least 409 + #endif 410 + 396 411 /* Do not trap wrapping arithmetic within an annotated function. */ 397 412 #ifdef CONFIG_UBSAN_INTEGER_WRAP 398 413 # define __signed_wrap __attribute__((no_sanitize("signed-integer-overflow")))
+9 -9
lib/crypto/chacha20poly1305.c
··· 89 89 void chacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len, 90 90 const u8 *ad, const size_t ad_len, 91 91 const u64 nonce, 92 - const u8 key[CHACHA20POLY1305_KEY_SIZE]) 92 + const u8 key[at_least CHACHA20POLY1305_KEY_SIZE]) 93 93 { 94 94 struct chacha_state chacha_state; 95 95 u32 k[CHACHA_KEY_WORDS]; ··· 111 111 112 112 void xchacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len, 113 113 const u8 *ad, const size_t ad_len, 114 - const u8 nonce[XCHACHA20POLY1305_NONCE_SIZE], 115 - const u8 key[CHACHA20POLY1305_KEY_SIZE]) 114 + const u8 nonce[at_least XCHACHA20POLY1305_NONCE_SIZE], 115 + const u8 key[at_least CHACHA20POLY1305_KEY_SIZE]) 116 116 { 117 117 struct chacha_state chacha_state; 118 118 ··· 170 170 bool chacha20poly1305_decrypt(u8 *dst, const u8 *src, const size_t src_len, 171 171 const u8 *ad, const size_t ad_len, 172 172 const u64 nonce, 173 - const u8 key[CHACHA20POLY1305_KEY_SIZE]) 173 + const u8 key[at_least CHACHA20POLY1305_KEY_SIZE]) 174 174 { 175 175 struct chacha_state chacha_state; 176 176 u32 k[CHACHA_KEY_WORDS]; ··· 195 195 196 196 bool xchacha20poly1305_decrypt(u8 *dst, const u8 *src, const size_t src_len, 197 197 const u8 *ad, const size_t ad_len, 198 - const u8 nonce[XCHACHA20POLY1305_NONCE_SIZE], 199 - const u8 key[CHACHA20POLY1305_KEY_SIZE]) 198 + const u8 nonce[at_least XCHACHA20POLY1305_NONCE_SIZE], 199 + const u8 key[at_least CHACHA20POLY1305_KEY_SIZE]) 200 200 { 201 201 struct chacha_state chacha_state; 202 202 ··· 211 211 const size_t src_len, 212 212 const u8 *ad, const size_t ad_len, 213 213 const u64 nonce, 214 - const u8 key[CHACHA20POLY1305_KEY_SIZE], 214 + const u8 key[at_least CHACHA20POLY1305_KEY_SIZE], 215 215 int encrypt) 216 216 { 217 217 const u8 *pad0 = page_address(ZERO_PAGE(0)); ··· 335 335 bool chacha20poly1305_encrypt_sg_inplace(struct scatterlist *src, size_t src_len, 336 336 const u8 *ad, const size_t ad_len, 337 337 const u64 nonce, 338 - const u8 key[CHACHA20POLY1305_KEY_SIZE]) 338 + const u8 key[at_least CHACHA20POLY1305_KEY_SIZE]) 339 339 { 340 340 return chacha20poly1305_crypt_sg_inplace(src, src_len, ad, ad_len, 341 341 nonce, key, 1); ··· 345 345 bool chacha20poly1305_decrypt_sg_inplace(struct scatterlist *src, size_t src_len, 346 346 const u8 *ad, const size_t ad_len, 347 347 const u64 nonce, 348 - const u8 key[CHACHA20POLY1305_KEY_SIZE]) 348 + const u8 key[at_least CHACHA20POLY1305_KEY_SIZE]) 349 349 { 350 350 if (unlikely(src_len < POLY1305_DIGEST_SIZE)) 351 351 return false;