@@ -135,45 +135,71 @@ int test_hmac_create(ENGINE *e, void *data)
135135 if (ret == 0 ) {
136136 PRINT_MSG ("Testing with SHA224" );
137137 ret = test_hmac_create_helper (e , data , EVP_sha224 (), pswd , sizeof (pswd ));
138+ if (ret == 0 ) {
139+ /* EVP_PKEY_new_mac_key() can be called with -1, OpenSSL expects
140+ * engine implementations to use strlen() to find string length */
141+ ret = test_hmac_create_helper (e , data , EVP_sha224 (), pswd , -1 );
142+ }
138143 }
139144
140145 if (ret == 0 ) {
141146 PRINT_MSG ("Testing with SHA256" );
142147 ret = test_hmac_create_helper (e , data , EVP_sha256 (), pswd , sizeof (pswd ));
148+ if (ret == 0 ) {
149+ ret = test_hmac_create_helper (e , data , EVP_sha256 (), pswd , -1 );
150+ }
143151 }
144152
145153 if (ret == 0 ) {
146154 PRINT_MSG ("Testing with SHA384" );
147155 ret = test_hmac_create_helper (e , data , EVP_sha384 (), pswd , sizeof (pswd ));
156+ if (ret == 0 ) {
157+ ret = test_hmac_create_helper (e , data , EVP_sha384 (), pswd , -1 );
158+ }
148159 }
149160
150161 if (ret == 0 ) {
151162 PRINT_MSG ("Testing with SHA512" );
152163 ret = test_hmac_create_helper (e , data , EVP_sha512 (), pswd , sizeof (pswd ));
164+ if (ret == 0 ) {
165+ ret = test_hmac_create_helper (e , data , EVP_sha512 (), pswd , -1 );
166+ }
153167 }
154168
155169#ifdef WE_HAVE_SHA3_224
156170 if (ret == 0 ) {
157171 PRINT_MSG ("Testing with SHA3-224" );
158172 ret = test_hmac_create_helper (e , data , EVP_sha3_224 (), pswd , sizeof (pswd ));
173+ if (ret == 0 ) {
174+ ret = test_hmac_create_helper (e , data , EVP_sha3_224 (), pswd , -1 );
175+ }
159176 }
160177#endif
161178#ifdef WE_HAVE_SHA3_256
162179 if (ret == 0 ) {
163180 PRINT_MSG ("Testing with SHA3-256" );
164181 ret = test_hmac_create_helper (e , data , EVP_sha3_256 (), pswd , sizeof (pswd ));
182+ if (ret == 0 ) {
183+ ret = test_hmac_create_helper (e , data , EVP_sha3_256 (), pswd , -1 );
184+ }
165185 }
166186#endif
167187#ifdef WE_HAVE_SHA3_384
168188 if (ret == 0 ) {
169189 PRINT_MSG ("Testing with SHA3-384" );
170190 ret = test_hmac_create_helper (e , data , EVP_sha3_384 (), pswd , sizeof (pswd ));
191+ if (ret == 0 ) {
192+ ret = test_hmac_create_helper (e , data , EVP_sha3_384 (), pswd , -1 );
193+ }
171194 }
172195#endif
173196#ifdef WE_HAVE_SHA3_512
174197 if (ret == 0 ) {
175198 PRINT_MSG ("Testing with SHA3-512" );
176199 ret = test_hmac_create_helper (e , data , EVP_sha3_512 (), pswd , sizeof (pswd ));
200+ if (ret == 0 ) {
201+ ret = test_hmac_create_helper (e , data , EVP_sha3_512 (), pswd , -1 );
202+ }
177203 }
178204#endif
179205 return ret ;
0 commit comments