Lines Matching refs:len

13 size_t ref_pkcs7_unpad(const uint8_t in[], size_t len)  in ref_pkcs7_unpad()  argument
15 if(len <= 2) in ref_pkcs7_unpad()
16 return len; in ref_pkcs7_unpad()
18 const size_t padding_length = in[len-1]; in ref_pkcs7_unpad()
20 if(padding_length == 0 || padding_length > len) in ref_pkcs7_unpad()
21 return len; in ref_pkcs7_unpad()
23 const size_t padding_start = len - padding_length; in ref_pkcs7_unpad()
25 for(size_t i = padding_start; i != len; ++i) in ref_pkcs7_unpad()
28 return len; in ref_pkcs7_unpad()
31 return len - padding_length; in ref_pkcs7_unpad()
34 size_t ref_x923_unpad(const uint8_t in[], size_t len) in ref_x923_unpad() argument
36 if(len <= 2) in ref_x923_unpad()
37 return len; in ref_x923_unpad()
39 const size_t padding_length = in[len-1]; in ref_x923_unpad()
41 if(padding_length == 0 || padding_length > len) in ref_x923_unpad()
42 return len; in ref_x923_unpad()
43 const size_t padding_start = len - padding_length; in ref_x923_unpad()
45 for(size_t i = padding_start; i != len - 1; ++i) in ref_x923_unpad()
49 return len; in ref_x923_unpad()
53 return len - padding_length; in ref_x923_unpad()
56 size_t ref_oneandzero_unpad(const uint8_t in[], size_t len) in ref_oneandzero_unpad() argument
58 if(len <= 2) in ref_oneandzero_unpad()
59 return len; in ref_oneandzero_unpad()
61 size_t idx = len - 1; in ref_oneandzero_unpad()
68 return len; in ref_oneandzero_unpad()
77 return len; in ref_oneandzero_unpad()
80 return len; in ref_oneandzero_unpad()
83 size_t ref_esp_unpad(const uint8_t in[], size_t len) in ref_esp_unpad() argument
85 if(len <= 2) in ref_esp_unpad()
86 return len; in ref_esp_unpad()
88 const size_t padding_bytes = in[len - 1]; in ref_esp_unpad()
90 if(padding_bytes == 0 || padding_bytes > len) in ref_esp_unpad()
92 return len; in ref_esp_unpad()
95 const size_t padding_start = len - padding_bytes; in ref_esp_unpad()
96 for(size_t i = padding_start; i != len; ++i) in ref_esp_unpad()
100 return len; in ref_esp_unpad()
104 return len - padding_bytes; in ref_esp_unpad()
107 uint16_t ref_tls_cbc_unpad(const uint8_t in[], size_t len) in ref_tls_cbc_unpad() argument
109 if(len == 0) in ref_tls_cbc_unpad()
112 const size_t padding_length = in[(len-1)]; in ref_tls_cbc_unpad()
114 if(padding_length >= len) in ref_tls_cbc_unpad()
123 if(in[(len-i-1)] != padding_length) in ref_tls_cbc_unpad()
131 void fuzz(const uint8_t in[], size_t len) in fuzz() argument
138 if(pkcs7.valid_blocksize(len)) in fuzz()
140 const size_t ct_pkcs7 = pkcs7.unpad(in, len); in fuzz()
141 const size_t ref_pkcs7 = ref_pkcs7_unpad(in, len); in fuzz()
145 if(x923.valid_blocksize(len)) in fuzz()
147 const size_t ct_x923 = x923.unpad(in, len); in fuzz()
148 const size_t ref_x923 = ref_x923_unpad(in, len); in fuzz()
152 if(oneandzero.valid_blocksize(len)) in fuzz()
154 const size_t ct_oneandzero = oneandzero.unpad(in, len); in fuzz()
155 const size_t ref_oneandzero = ref_oneandzero_unpad(in, len); in fuzz()
159 if(esp.valid_blocksize(len)) in fuzz()
161 const size_t ct_esp = esp.unpad(in, len); in fuzz()
162 const size_t ref_esp = ref_esp_unpad(in, len); in fuzz()
166 const uint16_t ct_cbc = Botan::TLS::check_tls_cbc_padding(in, len); in fuzz()
167 const uint16_t ref_cbc = ref_tls_cbc_unpad(in, len); in fuzz()