]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
test: Silence warnings on Win64 builds
authorTomas Mraz <tomas@openssl.org>
Wed, 18 Jun 2025 09:59:04 +0000 (11:59 +0200)
committerTomas Mraz <tomas@openssl.org>
Wed, 2 Jul 2025 15:26:26 +0000 (17:26 +0200)
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27806)

92 files changed:
test/acvp_test.c
test/acvp_test.inc
test/algorithmid_test.c
test/asn1_encode_test.c
test/asn1_time_test.c
test/asynciotest.c
test/bad_dtls_test.c
test/bftest.c
test/bio_base64_test.c
test/bio_callback_test.c
test/bio_comp_test.c
test/bio_core_test.c
test/bio_dgram_test.c
test/bio_enc_test.c
test/bio_readbuffer_test.c
test/bntest.c
test/clienthellotest.c
test/cmactest.c
test/cmp_ctx_test.c
test/cmp_protect_test.c
test/cmsapitest.c
test/constant_time_test.c
test/crltest.c
test/danetest.c
test/decoder_propq_test.c
test/destest.c
test/dhkem_test.inc
test/dhtest.c
test/dsa_no_digest_size_test.c
test/dtls_mtu_test.c
test/ec_internal_test.c
test/ecdsatest.c
test/ectest.c
test/endecode_test.c
test/enginetest.c
test/evp_extra_test.c
test/evp_extra_test2.c
test/evp_fetch_prov_test.c
test/evp_libctx_test.c
test/evp_pkey_dhkem_test.c
test/evp_test.c
test/evp_xof_test.c
test/fake_rsaprov.c
test/fatalerrtest.c
test/fips_version_test.c
test/helpers/handshake.c
test/helpers/pkcs12.c
test/helpers/predefined_dhparams.c
test/helpers/quictestlib.c
test/helpers/ssltestlib.c
test/http_test.c
test/ideatest.c
test/igetest.c
test/keymgmt_internal_test.c
test/lhash_test.c
test/list_test.c
test/ml_dsa_test.c
test/modes_internal_test.c
test/params_test.c
test/pbetest.c
test/pemtest.c
test/pkcs7_test.c
test/quic_ackm_test.c
test/quic_multistream_test.c
test/quic_newcid_test.c
test/quic_txp_test.c
test/quic_wire_test.c
test/quicapitest.c
test/quicfaultstest.c
test/radix/quic_bindings.c
test/radix/quic_ops.c
test/servername_test.c
test/siphash_internal_test.c
test/slh_dsa_test.c
test/sm2_internal_test.c
test/ssl_old_test.c
test/sslapitest.c
test/testutil/format_output.c
test/testutil/testutil_init.c
test/threadpool_test.c
test/threadstest.c
test/time_offset_test.c
test/tls-provider.c
test/tls13ccstest.c
test/trace_api_test.c
test/uitest.c
test/v3ext.c
test/v3nametest.c
test/x509_acert_test.c
test/x509_dup_cert_test.c
test/x509_test.c
test/x509_time_test.c

index 2bcc886fd29044b2d5f6922db9773aeceb7b4ec4..9cf7383404ebbb6dfc4407fff8eab631337ecfe2 100644 (file)
@@ -237,9 +237,9 @@ static int get_ecdsa_sig_rs_bytes(const unsigned char *sig, size_t sig_len,
 {
     int ret = 0;
     unsigned char *rbuf = NULL, *sbuf = NULL;
-    size_t r1_len, s1_len;
+    int r1_len, s1_len;
     const BIGNUM *r1, *s1;
-    ECDSA_SIG *sign = d2i_ECDSA_SIG(NULL, &sig, sig_len);
+    ECDSA_SIG *sign = d2i_ECDSA_SIG(NULL, &sig, (long)sig_len);
 
     if (sign == NULL)
         return 0;
@@ -306,7 +306,7 @@ static int ecdsa_sigver_test(int id)
     EVP_PKEY *pkey = NULL;
     EVP_PKEY_CTX *pkey_ctx;
     ECDSA_SIG *sign = NULL;
-    size_t sig_len;
+    int sig_len;
     unsigned char *sig = NULL;
     BIGNUM *rbn = NULL, *sbn = NULL;
     const struct ecdsa_sigver_st *tst = &ecdsa_sigver_data[id];
@@ -316,8 +316,8 @@ static int ecdsa_sigver_test(int id)
         goto err;
 
     if (!TEST_ptr(sign = ECDSA_SIG_new())
-        || !TEST_ptr(rbn = BN_bin2bn(tst->r, tst->r_len, NULL))
-        || !TEST_ptr(sbn = BN_bin2bn(tst->s, tst->s_len, NULL))
+        || !TEST_ptr(rbn = BN_bin2bn(tst->r, (int)tst->r_len, NULL))
+        || !TEST_ptr(sbn = BN_bin2bn(tst->s, (int)tst->s_len, NULL))
         || !TEST_true(ECDSA_SIG_set0(sign, rbn, sbn)))
         goto err;
     rbn = sbn = NULL;
@@ -657,7 +657,7 @@ static int dsa_create_pkey(EVP_PKEY **pkey,
 
     if (!TEST_ptr(bld = OSSL_PARAM_BLD_new())
         || !TEST_ptr(p_bn = BN_CTX_get(bn_ctx))
-        || !TEST_ptr(BN_bin2bn(p, p_len, p_bn))
+        || !TEST_ptr(BN_bin2bn(p, (int)p_len, p_bn))
         || !TEST_true(OSSL_PARAM_BLD_push_int(bld,
                                               OSSL_PKEY_PARAM_FFC_VALIDATE_PQ,
                                               validate_pq))
@@ -666,13 +666,13 @@ static int dsa_create_pkey(EVP_PKEY **pkey,
                                               validate_g))
         || !TEST_true(OSSL_PARAM_BLD_push_BN(bld, OSSL_PKEY_PARAM_FFC_P, p_bn))
         || !TEST_ptr(q_bn = BN_CTX_get(bn_ctx))
-        || !TEST_ptr(BN_bin2bn(q, q_len, q_bn))
+        || !TEST_ptr(BN_bin2bn(q, (int)q_len, q_bn))
         || !TEST_true(OSSL_PARAM_BLD_push_BN(bld, OSSL_PKEY_PARAM_FFC_Q, q_bn)))
         goto err;
 
      if (g != NULL) {
          if (!TEST_ptr(g_bn = BN_CTX_get(bn_ctx))
-             || !TEST_ptr(BN_bin2bn(g, g_len, g_bn))
+             || !TEST_ptr(BN_bin2bn(g, (int)g_len, g_bn))
              || !TEST_true(OSSL_PARAM_BLD_push_BN(bld,
                                                   OSSL_PKEY_PARAM_FFC_G, g_bn)))
              goto err;
@@ -690,7 +690,7 @@ static int dsa_create_pkey(EVP_PKEY **pkey,
      }
      if (pub != NULL) {
          if (!TEST_ptr(pub_bn = BN_CTX_get(bn_ctx))
-             || !TEST_ptr(BN_bin2bn(pub, pub_len, pub_bn))
+             || !TEST_ptr(BN_bin2bn(pub, (int)pub_len, pub_bn))
              || !TEST_true(OSSL_PARAM_BLD_push_BN(bld,
                                                   OSSL_PKEY_PARAM_PUB_KEY,
                                                   pub_bn)))
@@ -746,9 +746,9 @@ static int get_dsa_sig_rs_bytes(const unsigned char *sig, size_t sig_len,
 {
     int ret = 0;
     unsigned char *rbuf = NULL, *sbuf = NULL;
-    size_t r1_len, s1_len;
+    int r1_len, s1_len;
     const BIGNUM *r1, *s1;
-    DSA_SIG *sign = d2i_DSA_SIG(NULL, &sig, sig_len);
+    DSA_SIG *sign = d2i_DSA_SIG(NULL, &sig, (long)sig_len);
 
     if (sign == NULL)
         return 0;
@@ -816,7 +816,7 @@ static int dsa_sigver_test(int id)
     EVP_PKEY_CTX *ctx = NULL;
     EVP_PKEY *pkey = NULL;
     DSA_SIG *sign = NULL;
-    size_t sig_len;
+    int sig_len;
     unsigned char *sig = NULL;
     BIGNUM *rbn = NULL, *sbn = NULL;
     EVP_MD *md = NULL;
@@ -833,8 +833,8 @@ static int dsa_sigver_test(int id)
         goto err;
 
     if (!TEST_ptr(sign = DSA_SIG_new())
-        || !TEST_ptr(rbn = BN_bin2bn(tst->r, tst->r_len, NULL))
-        || !TEST_ptr(sbn = BN_bin2bn(tst->s, tst->s_len, NULL))
+        || !TEST_ptr(rbn = BN_bin2bn(tst->r, (int)tst->r_len, NULL))
+        || !TEST_ptr(sbn = BN_bin2bn(tst->s, (int)tst->s_len, NULL))
         || !TEST_true(DSA_SIG_set0(sign, rbn, sbn)))
         goto err;
     rbn = sbn = NULL;
@@ -883,7 +883,7 @@ static int cipher_enc(const char *alg,
         || !TEST_ptr(cipher = EVP_CIPHER_fetch(libctx, alg, ""))
         || !TEST_true(EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, enc))
         || !TEST_true(EVP_CIPHER_CTX_set_padding(ctx, 0))
-        || !TEST_true(EVP_CipherUpdate(ctx, out, &len, pt, pt_len))
+        || !TEST_true(EVP_CipherUpdate(ctx, out, &len, pt, (int)pt_len))
         || !TEST_true(EVP_CipherFinal_ex(ctx, out + len, &out_len)))
         goto err;
     out_len += len;
@@ -932,15 +932,15 @@ static int aes_ccm_enc_dec(const char *alg,
     if (!TEST_ptr(ctx = EVP_CIPHER_CTX_new())
         || !TEST_ptr(cipher = EVP_CIPHER_fetch(libctx, alg, ""))
         || !TEST_true(EVP_CipherInit_ex(ctx, cipher, NULL, NULL, NULL, enc))
-        || !TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, iv_len,
-                                          NULL), 0)
-        || !TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, tag_len,
+        || !TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN,
+                                            (int)iv_len, NULL), 0)
+        || !TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, (int)tag_len,
                                           enc ? NULL : (void *)tag), 0)
         || !TEST_true(EVP_CipherInit_ex(ctx, NULL, NULL, key, iv, enc))
         || !TEST_true(EVP_CIPHER_CTX_set_padding(ctx, 0))
-        || !TEST_true(EVP_CipherUpdate(ctx, NULL, &len, NULL, pt_len))
-        || !TEST_true(EVP_CipherUpdate(ctx, NULL, &len, aad, aad_len))
-        || !TEST_int_eq(EVP_CipherUpdate(ctx, out, &len, pt, pt_len), pass))
+        || !TEST_true(EVP_CipherUpdate(ctx, NULL, &len, NULL, (int)pt_len))
+        || !TEST_true(EVP_CipherUpdate(ctx, NULL, &len, aad, (int)aad_len))
+        || !TEST_int_eq(EVP_CipherUpdate(ctx, out, &len, pt, (int)pt_len), pass))
         goto err;
 
     if (!pass) {
@@ -952,7 +952,7 @@ static int aes_ccm_enc_dec(const char *alg,
     if (enc) {
         out_len += len;
         if (!TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG,
-                                           tag_len, out + out_len), 0)
+                                             (int)tag_len, out + out_len), 0)
             || !TEST_mem_eq(out, out_len, ct, ct_len)
             || !TEST_mem_eq(out + out_len, tag_len, tag, tag_len))
             goto err;
@@ -1020,12 +1020,12 @@ static int aes_gcm_enc_dec(const char *alg,
     if (!TEST_ptr(ctx = EVP_CIPHER_CTX_new())
         || !TEST_ptr(cipher = EVP_CIPHER_fetch(libctx, alg, ""))
         || !TEST_true(EVP_CipherInit_ex(ctx, cipher, NULL, NULL, NULL, enc))
-        || !TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, iv_len,
-                                          NULL), 0))
+        || !TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN,
+                                            (int)iv_len, NULL), 0))
         goto err;
 
     if (!enc) {
-        if (!TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, tag_len,
+        if (!TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, (int)tag_len,
                                            (void *)tag), 0))
             goto err;
     }
@@ -1036,8 +1036,8 @@ static int aes_gcm_enc_dec(const char *alg,
      */
     if (!TEST_true(EVP_CipherInit_ex(ctx, NULL, NULL, key, iv, enc))
         || !TEST_true(EVP_CIPHER_CTX_set_padding(ctx, 0))
-        || !TEST_true(EVP_CipherUpdate(ctx, NULL, &len, aad, aad_len))
-        || !TEST_true(EVP_CipherUpdate(ctx, out, &len, pt, pt_len)))
+        || !TEST_true(EVP_CipherUpdate(ctx, NULL, &len, aad, (int)aad_len))
+        || !TEST_true(EVP_CipherUpdate(ctx, out, &len, pt, (int)pt_len)))
         goto err;
 
     if (!TEST_int_eq(EVP_CipherFinal_ex(ctx, out + len, &olen), pass))
@@ -1050,7 +1050,7 @@ static int aes_gcm_enc_dec(const char *alg,
     if (enc) {
         if ((ct != NULL && !TEST_mem_eq(out, olen, ct, ct_len))
                 || !TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG,
-                                                    tag_len, out + olen), 0)
+                                                    (int)tag_len, out + olen), 0)
                 || (tag != NULL
                     && !TEST_mem_eq(out + olen, tag_len, tag, tag_len)))
             goto err;
@@ -1155,14 +1155,14 @@ static int dh_create_pkey(EVP_PKEY **pkey, const char *group_name,
 
     if (pub != NULL) {
         if (!TEST_ptr(pub_bn = BN_CTX_get(bn_ctx))
-            || !TEST_ptr(BN_bin2bn(pub, pub_len, pub_bn))
+            || !TEST_ptr(BN_bin2bn(pub, (int)pub_len, pub_bn))
             || !TEST_true(OSSL_PARAM_BLD_push_BN(bld, OSSL_PKEY_PARAM_PUB_KEY,
                                                  pub_bn)))
             goto err;
     }
     if (priv != NULL) {
         if (!TEST_ptr(priv_bn = BN_CTX_get(bn_ctx))
-            || !TEST_ptr(BN_bin2bn(priv, priv_len, priv_bn))
+            || !TEST_ptr(BN_bin2bn(priv, (int)priv_len, priv_bn))
             || !TEST_true(OSSL_PARAM_BLD_push_BN(bld, OSSL_PKEY_PARAM_PRIV_KEY,
                                                  priv_bn)))
             goto err;
@@ -1259,20 +1259,20 @@ static int rsa_create_pkey(EVP_PKEY **pkey,
 
     if (!TEST_ptr(bld = OSSL_PARAM_BLD_new())
         || !TEST_ptr(n_bn = BN_CTX_get(bn_ctx))
-        || !TEST_ptr(BN_bin2bn(n, n_len, n_bn))
+        || !TEST_ptr(BN_bin2bn(n, (int)n_len, n_bn))
         || !TEST_true(OSSL_PARAM_BLD_push_BN(bld, OSSL_PKEY_PARAM_RSA_N, n_bn)))
         goto err;
 
     if (e != NULL) {
         if (!TEST_ptr(e_bn = BN_CTX_get(bn_ctx))
-            || !TEST_ptr(BN_bin2bn(e, e_len, e_bn))
+            || !TEST_ptr(BN_bin2bn(e, (int)e_len, e_bn))
             || !TEST_true(OSSL_PARAM_BLD_push_BN(bld, OSSL_PKEY_PARAM_RSA_E,
                           e_bn)))
             goto err;
     }
     if (d != NULL) {
         if (!TEST_ptr(d_bn = BN_CTX_get(bn_ctx))
-            || !TEST_ptr(BN_bin2bn(d, d_len, d_bn))
+            || !TEST_ptr(BN_bin2bn(d, (int)d_len, d_bn))
             || !TEST_true(OSSL_PARAM_BLD_push_BN(bld, OSSL_PKEY_PARAM_RSA_D,
                           d_bn)))
             goto err;
@@ -1311,12 +1311,12 @@ static int rsa_keygen_test(int id)
     const struct rsa_keygen_st *tst = &rsa_keygen_data[id];
 
     if (!TEST_ptr(bld = OSSL_PARAM_BLD_new())
-        || !TEST_ptr(xp1_bn = BN_bin2bn(tst->xp1, tst->xp1_len, NULL))
-        || !TEST_ptr(xp2_bn = BN_bin2bn(tst->xp2, tst->xp2_len, NULL))
-        || !TEST_ptr(xp_bn = BN_bin2bn(tst->xp, tst->xp_len, NULL))
-        || !TEST_ptr(xq1_bn = BN_bin2bn(tst->xq1, tst->xq1_len, NULL))
-        || !TEST_ptr(xq2_bn = BN_bin2bn(tst->xq2, tst->xq2_len, NULL))
-        || !TEST_ptr(xq_bn = BN_bin2bn(tst->xq, tst->xq_len, NULL))
+        || !TEST_ptr(xp1_bn = BN_bin2bn(tst->xp1, (int)tst->xp1_len, NULL))
+        || !TEST_ptr(xp2_bn = BN_bin2bn(tst->xp2, (int)tst->xp2_len, NULL))
+        || !TEST_ptr(xp_bn = BN_bin2bn(tst->xp, (int)tst->xp_len, NULL))
+        || !TEST_ptr(xq1_bn = BN_bin2bn(tst->xq1, (int)tst->xq1_len, NULL))
+        || !TEST_ptr(xq2_bn = BN_bin2bn(tst->xq2, (int)tst->xq2_len, NULL))
+        || !TEST_ptr(xq_bn = BN_bin2bn(tst->xq, (int)tst->xq_len, NULL))
         || !TEST_true(OSSL_PARAM_BLD_push_BN(bld, OSSL_PKEY_PARAM_RSA_TEST_XP1,
                                              xp1_bn))
         || !TEST_true(OSSL_PARAM_BLD_push_BN(bld, OSSL_PKEY_PARAM_RSA_TEST_XP2,
@@ -1333,7 +1333,7 @@ static int rsa_keygen_test(int id)
         goto err;
 
     if (!TEST_ptr(ctx = EVP_PKEY_CTX_new_from_name(libctx, "RSA", NULL))
-        || !TEST_ptr(e_bn = BN_bin2bn(tst->e, tst->e_len, NULL))
+        || !TEST_ptr(e_bn = BN_bin2bn(tst->e, (int)tst->e_len, NULL))
         || !TEST_int_gt(EVP_PKEY_keygen_init(ctx), 0)
         || !TEST_int_gt(EVP_PKEY_CTX_set_params(ctx, params), 0)
         || !TEST_int_gt(EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, tst->mod), 0)
@@ -1425,7 +1425,7 @@ static int rsa_siggen_test(int id)
                                         &salt_len);
     *p++ = OSSL_PARAM_construct_end();
 
-    if (!TEST_ptr(pkey = EVP_PKEY_Q_keygen(libctx, NULL, "RSA", tst->mod))
+    if (!TEST_ptr(pkey = EVP_PKEY_Q_keygen(libctx, NULL, "RSA", (size_t)tst->mod))
         || !TEST_true(pkey_get_bn_bytes(pkey, OSSL_PKEY_PARAM_RSA_N, &n, &n_len))
         || !TEST_true(pkey_get_bn_bytes(pkey, OSSL_PKEY_PARAM_RSA_E, &e, &e_len))
         || !TEST_true(sig_gen(pkey, params, tst->digest_alg,
index 67787f3740bb311e46dfd752714264088e21c377..6a891762403326cb3dfcf811a550f7a80cf70217 100644 (file)
@@ -387,8 +387,8 @@ static const struct ecdsa_pub_verify_st eddsa_pv_data[] = {
 #ifndef OPENSSL_NO_DSA
 
 struct dsa_paramgen_st {
-    size_t L;
-    size_t N;
+    int L;
+    int N;
 };
 
 struct dsa_pqver_st {
@@ -404,8 +404,8 @@ struct dsa_pqver_st {
 
 struct dsa_siggen_st {
     const char *digest_alg;
-    size_t L;
-    size_t N;
+    int L;
+    int N;
     const unsigned char *msg;
     size_t msg_len;
 };
@@ -1161,7 +1161,7 @@ static const struct dh_safe_prime_keyver_st dh_safe_prime_keyver_data[] = {
 #endif /* OPENSSL_NO_DH */
 
 struct rsa_keygen_st {
-    size_t mod;
+    int mod;
     const unsigned char *e;
     size_t e_len;
     const unsigned char *xp1;
@@ -1344,7 +1344,7 @@ static const struct rsa_keygen_st rsa_keygen_data[] = {
 #define NO_PSS_SALT_LEN -1
 struct rsa_siggen_st {
     const char *sig_pad_mode;
-    size_t mod;
+    int mod;
     const char *digest_alg;
     const unsigned char *msg;
     size_t msg_len;
@@ -1381,7 +1381,7 @@ static const struct rsa_siggen_st rsa_siggen_data[] = {
 
 struct rsa_sigver_st {
     const char *sig_pad_mode;
-    size_t mod;
+    int mod;
     const char *digest_alg;
     const unsigned char *msg;
     size_t msg_len;
index 0104425c1d4af35bcf0923f3e039b3bcbb4ab14c..816140d0a86cd749fae4ddcf073bddfd23de3547 100644 (file)
@@ -276,7 +276,8 @@ const OPTIONS *test_get_options(void)
 int setup_tests(void)
 {
     OPTION_CHOICE o;
-    int n, x509 = 0, spki = 0, testcount = 0;
+    size_t n;
+    int x509 = 0, spki = 0, testcount = 0;
 
     while ((o = opt_next()) != OPT_EOF) {
         switch (o) {
index 88899dc93779d6c6efd3557dd474b18d7bfe01ce..36e951de2e30a063942d5fd5846c50357c3b9d83 100644 (file)
@@ -681,7 +681,7 @@ static int do_decode_custom(const TEST_CUSTOM_DATA *custom_data,
     if (encoding_length == 0)
         return -1;
 
-    ret = do_decode(encoding, encoding_length, expected, expected_size,
+    ret = do_decode(encoding, (long)encoding_length, expected, expected_size,
                     package);
     OPENSSL_free(encoding);
 
@@ -797,7 +797,8 @@ static int test_intern(const TEST_PACKAGE *package)
         EXPECTED *expected
             = (EXPECTED *)&((unsigned char *)package->encdec_data)[pos];
 
-        switch (do_enc_dec(expected, package->encdec_data_elem_size, package)) {
+        switch (do_enc_dec(expected, (long)package->encdec_data_elem_size,
+                           package)) {
         case -1:
             if (expected->success) {
                 TEST_error("Failed encode/decode round trip %u of %s",
index 32bc4ff2adb1bf77a668e963075fbb7e427798eb..1903a3ce3e112770d0d6daaab6802bc0726c8a97 100644 (file)
@@ -167,7 +167,7 @@ static int test_table(struct testdata *tbl, int idx)
     int day, sec;
 
     atime.data = (unsigned char*)td->data;
-    atime.length = strlen((char*)atime.data);
+    atime.length = (int)strlen((char*)atime.data);
     atime.type = td->type;
     atime.flags = 0;
 
index 10c958f667fbdeb791cd8df4fb597db8a48a476d..49fe923ce3cb649e2317cbdd23fd12d154b5b86d 100644 (file)
@@ -125,7 +125,7 @@ static int async_write(BIO *bio, const char *in, int inl)
 {
     struct async_ctrs *ctrs;
     int ret = 0;
-    size_t written = 0;
+    int written = 0;
     BIO *next = BIO_next(bio);
 
     if (inl <= 0)
@@ -238,7 +238,7 @@ static int async_write(BIO *bio, const char *in, int inl)
         }
         /* Write any data we have left after fragmenting */
         ret = 0;
-        if ((int)written < inl) {
+        if (written < inl) {
             ret = BIO_write(next, in + written, inl - written);
         }
 
@@ -281,7 +281,7 @@ static int async_gets(BIO *bio, char *buf, int size)
 
 static int async_puts(BIO *bio, const char *str)
 {
-    return async_write(bio, str, strlen(str));
+    return async_write(bio, str, (int)strlen(str));
 }
 
 #define MAX_ATTEMPTS    100
index 1df8cd84fe012a9db40f2ca18d6c4f158a17fc1f..7e2dc21a8ba5cee8a63405757b3b9e97db2eace5 100644 (file)
@@ -335,7 +335,7 @@ static int send_record(BIO *rbio, unsigned char type, uint64_t seqnr,
             || !TEST_ptr(enc_ctx = EVP_CIPHER_CTX_new())
             || !TEST_true(EVP_CipherInit_ex(enc_ctx, EVP_aes_128_cbc(), NULL,
                                             enc_key, iv, 1))
-            || !TEST_int_ge(EVP_Cipher(enc_ctx, enc, enc, len), 0))
+            || !TEST_int_ge(EVP_Cipher(enc_ctx, enc, enc, (unsigned int)len), 0))
         goto end;
 
     /* Finally write header (from fragmented variables), IV and encrypted record */
@@ -348,7 +348,7 @@ static int send_record(BIO *rbio, unsigned char type, uint64_t seqnr,
     BIO_write(rbio, lenbytes, 2);
 
     BIO_write(rbio, iv, sizeof(iv));
-    BIO_write(rbio, enc, len);
+    BIO_write(rbio, enc, (int)len);
     ret = 1;
  end:
     EVP_MAC_free(hmac);
index 99e95edfc13da242ebae687fcdd877defbace146..469500aa1e1861ffc9f7c66527a5a87258bfd9c5 100644 (file)
@@ -298,7 +298,7 @@ static int test_bf_ecb_raw(int n)
     BF_KEY key;
     BF_LONG data[2];
 
-    BF_set_key(&key, strlen(bf_key[n]), (unsigned char *)bf_key[n]);
+    BF_set_key(&key, (int)strlen(bf_key[n]), (unsigned char *)bf_key[n]);
 
     data[0] = bf_plain[n][0];
     data[1] = bf_plain[n][1];
@@ -354,7 +354,7 @@ static int test_bf_cbc(void)
     BF_KEY key;
     BF_LONG len;
 
-    len = strlen(cbc_data) + 1;
+    len = (BF_LONG)(strlen(cbc_data) + 1);
 
     BF_set_key(&key, 16, cbc_key);
     memset(cbc_in, 0, sizeof(cbc_in));
@@ -380,7 +380,7 @@ static int test_bf_cfb64(void)
     BF_KEY key;
     BF_LONG len;
 
-    len = strlen(cbc_data) + 1;
+    len = (BF_LONG)(strlen(cbc_data) + 1);
 
     BF_set_key(&key, 16, cbc_key);
     memset(cbc_in, 0, 40);
@@ -412,7 +412,7 @@ static int test_bf_ofb64(void)
     BF_KEY key;
     BF_LONG len;
 
-    len = strlen(cbc_data) + 1;
+    len = (BF_LONG)(strlen(cbc_data) + 1);
 
     BF_set_key(&key, 16, cbc_key);
     memset(cbc_in, 0, 40);
index 8d6ca7b58e1ee63e21c98db2e754756ec077464f..40891ed72ae49bef1f64945d5f4bd7afd346a6bf 100644 (file)
@@ -100,7 +100,7 @@ static int encode(unsigned const char *buf, unsigned buflen, char *encoded,
 
     /* Use a verbatim encoding when provided */
     if (encoded != NULL) {
-        int elen = strlen(encoded);
+        int elen = (int)strlen(encoded);
 
         return BIO_write(mem, encoded, elen) == elen;
     }
@@ -152,8 +152,8 @@ static int genb64(char *prefix, char *suffix, unsigned const char *buf,
                   unsigned buflen, int trunc, char *encoded, unsigned llen,
                   unsigned wscnt, char **out)
 {
-    int preflen = strlen(prefix);
-    int sufflen = strlen(suffix);
+    int preflen = (int)strlen(prefix);
+    int sufflen = (int)strlen(suffix);
     int outlen;
     char newline = '\n';
     BUF_MEM *bptr;
@@ -174,7 +174,7 @@ static int genb64(char *prefix, char *suffix, unsigned const char *buf,
     /* Orphan the memory BIO's data buffer */
     BIO_get_mem_ptr(mem, &bptr);
     *out = bptr->data;
-    outlen = bptr->length;
+    outlen = (int)bptr->length;
     bptr->data = NULL;
     (void) BIO_set_close(mem, BIO_NOCLOSE);
     BIO_free(mem);
index c84346814e1455e2e4e6a767cf57acd76ffdcdef..7f37447850c569f22540f343e58a28ccdfb31fb9 100644 (file)
@@ -60,8 +60,8 @@ static int test_bio_callback_ex(void)
         goto err;
 
     BIO_set_callback_ex(bio, my_bio_cb_ex);
-    i = BIO_write(bio, test1, test1len);
-    if (!TEST_int_eq(i, test1len)
+    i = BIO_write(bio, test1, (int)test1len);
+    if (!TEST_int_eq(i, (int)test1len)
             || !TEST_int_eq(my_param_count, 2)
             || !TEST_ptr_eq(my_param_b[0], bio)
             || !TEST_int_eq(my_param_oper[0], BIO_CB_WRITE)
index 9f3bc9b6b1df77dc5bc851a4f102bbe505c31e22..bbc5ad0aae726448f0860ec3d74ce4bbed78bb3e 100644 (file)
@@ -51,8 +51,8 @@ static int do_bio_comp_test(const BIO_METHOD *meth, size_t size)
     if (!TEST_ptr(bmem = BIO_new(BIO_s_mem())))
         goto err;
     BIO_push(bcomp, bmem);
-    osize = BIO_write(bcomp, original, size);
-    if (!TEST_int_eq(osize, size)
+    osize = BIO_write(bcomp, original, (int)size);
+    if (!TEST_int_eq(osize, (int)size)
         || !TEST_true(BIO_flush(bcomp)))
         goto err;
     BIO_free(bcomp);
@@ -62,9 +62,9 @@ static int do_bio_comp_test(const BIO_METHOD *meth, size_t size)
     if (!TEST_ptr(bexp = BIO_new(meth)))
         goto err;
     BIO_push(bexp, bmem);
-    rsize = BIO_read(bexp, result, size);
+    rsize = BIO_read(bexp, result, (int)size);
 
-    if (!TEST_int_eq(size, rsize)
+    if (!TEST_int_eq((int)size, rsize)
         || !TEST_mem_eq(original, osize, result, rsize))
         goto err;
 
index be2ae49932e7790d9ce8d78ebfbae1669ef5dbd4..28b7f29c38a79eee02034a69aacead821fd00f7d 100644 (file)
@@ -93,7 +93,7 @@ static int test_bio_core(void)
         goto err;
 
     buf[0] = '\0';
-    if (!TEST_int_gt(BIO_write(cbio, msg, strlen(msg) + 1), 0)
+    if (!TEST_int_gt(BIO_write(cbio, msg, (int)(strlen(msg) + 1)), 0)
             || !TEST_int_gt(BIO_read(cbio, buf, sizeof(buf)), 0)
             || !TEST_str_eq(buf, msg))
         goto err;
index aca016ca95b07f50ba63b2f5b8999f18eb568c44..fa1f721aa864a46ad7ce8e6284cf4af6bb2d0049 100644 (file)
@@ -534,7 +534,7 @@ static int test_bio_dgram_pair(int idx)
          * set a buffer big enough for 9 full sized datagrams.
          */
         bufsz = 9 * (mtu1 + (sizeof(BIO_ADDR) * 2) + sizeof(size_t));
-        if (!TEST_true(BIO_set_write_buf_size(bio1, bufsz)))
+        if (!TEST_true(BIO_set_write_buf_size(bio1, (long)bufsz)))
             goto err;
     }
 
@@ -576,7 +576,7 @@ static int test_bio_dgram_pair(int idx)
      * the mtu. The default write buffer size is 9 * (sizeof(header) + mtu) so
      * we expect at least 9 maximally sized datagrams to fit in the buffer.
      */
-    if (!TEST_int_ge(i, 9))
+    if (!TEST_size_t_ge(i, 9))
         goto err;
 
     /* Check we read back the same data */
index df16341fcb5557c3387e26e3701e85161274fcad..22d88b688b06510392b2030c562c9ef4302e958c 100644 (file)
@@ -275,7 +275,7 @@ static int test_bio_enc_eof_read_flush(void)
     EVP_CIPHER_CTX *ctx = NULL;
     BIO *mem = NULL, *b64 = NULL, *cbio = NULL;
     unsigned char tag[16];
-    size_t key_size, iv_size;
+    int key_size, iv_size;
     int n, ret = 0;
 
     memset(tag, 0, sizeof(tag));
index 58a03c216365a04926755ff8d27bf255e41a819b..62eb3d7121a660fc5343cbd9b52916e7d697893e 100644 (file)
@@ -35,7 +35,7 @@ static int test_readbuffer_file_bio(int tstid)
     if (!TEST_ptr(in = BIO_new_file(filename, "r"))
         || !TEST_int_eq(BIO_read_ex(in, expected, sizeof(expected),
                                     &readbytes), 1)
-        || !TEST_int_lt(readbytes, sizeof(expected)))
+        || !TEST_size_t_lt(readbytes, sizeof(expected)))
         goto err;
     BIO_free(in);
     in = NULL;
@@ -86,7 +86,7 @@ static int test_readbuffer_file_bio(int tstid)
         count += bytes;
         len = sizeof(buf); /* fill the buffer on subsequent reads */
     }
-    if (!TEST_int_eq(count, readbytes))
+    if (!TEST_size_t_eq(count, readbytes))
         goto err;
     ret = 1;
 err:
index 3b3671a62259842a1b89177287d6fd6a20deaa23..9bb07936773ecbc56e610586a57efbdaa797d25f 100644 (file)
@@ -117,7 +117,7 @@ static int getint(STANZA *s, int *out, const char *attribute)
     int st = 0;
 
     if (!TEST_ptr(ret = getBN(s, attribute))
-            || !TEST_ulong_le(word = BN_get_word(ret), INT_MAX))
+            || !TEST_uint64_t_le(word = BN_get_word(ret), INT_MAX))
         goto err;
 
     *out = (int)word;
@@ -1808,7 +1808,7 @@ static int file_gcd(STANZA *s)
 static int test_bn2padded(void)
 {
     uint8_t zeros[256], out[256], reference[128];
-    size_t bytes;
+    int bytes;
     BIGNUM *n;
     int st = 0;
 
@@ -1941,7 +1941,7 @@ static int test_bn2signed(int i)
      * The interesting stuff happens in the last bytes of the buffers,
      * the beginning is just padding (i.e. sign extension).
      */
-    i = sizeof(scratch) - test->mpi_len;
+    i = (int)(sizeof(scratch) - test->mpi_len);
     if (!TEST_int_eq(BN_signed_bn2bin(bn, scratch, sizeof(scratch)),
                      sizeof(scratch))
         || !TEST_true(copy_reversed(reversed, scratch, sizeof(scratch)))
@@ -1968,7 +1968,7 @@ static int test_bn2signed(int i)
      * The interesting stuff happens in the first bytes of the buffers,
      * the end is just padding (i.e. sign extension).
      */
-    i = sizeof(reversed) - test->mpi_len;
+    i = (int)(sizeof(reversed) - test->mpi_len);
     if (!TEST_int_eq(BN_signed_bn2lebin(bn, scratch, sizeof(scratch)),
                      sizeof(scratch))
         || !TEST_true(copy_reversed(reversed, scratch, sizeof(scratch)))
@@ -2212,7 +2212,7 @@ static int test_mpi(int i)
             || !TEST_mem_eq(test->mpi, test->mpi_len, scratch, mpi_len))
         goto err;
 
-    if (!TEST_ptr(bn2 = BN_mpi2bn(scratch, mpi_len, NULL)))
+    if (!TEST_ptr(bn2 = BN_mpi2bn(scratch, (int)mpi_len, NULL)))
         goto err;
 
     if (!TEST_BN_eq(bn, bn2)) {
@@ -3358,7 +3358,8 @@ const OPTIONS *test_get_options(void)
 int setup_tests(void)
 {
     OPTION_CHOICE o;
-    int n, stochastic = 0;
+    size_t n;
+    int stochastic = 0;
 
     while ((o = opt_next()) != OPT_EOF) {
         switch (o) {
@@ -3372,7 +3373,7 @@ int setup_tests(void)
             return 0;
         }
     }
-    n  = test_get_argument_count();
+    n = test_get_argument_count();
 
     if (!TEST_ptr(ctx = BN_CTX_new()))
         return 0;
@@ -3425,7 +3426,7 @@ int setup_tests(void)
         if (stochastic)
             ADD_TEST(test_rand_range);
     } else {
-        ADD_ALL_TESTS(run_file_tests, n);
+        ADD_ALL_TESTS(run_file_tests, (int)n);
     }
     return 1;
 }
index 7fc21d9b12624ab63fbfb9bc1be94dea0e8a4112..c4077df5642a9fef4f0e10fa035be6fdc201fa44 100644 (file)
@@ -145,7 +145,7 @@ static int test_client_hello(int currtest)
 
     if (currtest == TEST_SET_SESSION_TICK_DATA_VER_NEG) {
         if (!TEST_true(SSL_set_session_ticket_ext(con, dummytick,
-                                                  strlen(dummytick))))
+                                                  (int)strlen(dummytick))))
             goto end;
     }
 
index a550d4edecd1b922e71ffe1f405ea93c0afd10a9..69067c6a5c31705d01bc40fe7ee6fc40f688d54c 100644 (file)
@@ -135,7 +135,7 @@ static struct test_st {
     },
 };
 
-static char *pt(unsigned char *md, unsigned int len);
+static char *pt(unsigned char *md, size_t len);
 
 static int test_cmac_bad(void)
 {
@@ -328,9 +328,9 @@ err:
 }
 
 #define OSSL_HEX_CHARS_PER_BYTE 2
-static char *pt(unsigned char *md, unsigned int len)
+static char *pt(unsigned char *md, size_t len)
 {
-    unsigned int i;
+    size_t i;
     static char buf[81];
 
     for (i = 0; i < len && (i + 1) * OSSL_HEX_CHARS_PER_BYTE < sizeof(buf); i++)
index f38493b33445c5a16c1773139a515ae77f6599eb..529c0b7aa2acf2663a6b326794f8574ee9b89ce2 100644 (file)
@@ -136,7 +136,7 @@ static int msg_total_size = 0;
 static int msg_total_size_log_cb(const char *func, const char *file, int line,
                                  OSSL_CMP_severity level, const char *msg)
 {
-    msg_total_size += strlen(msg);
+    msg_total_size += (int)strlen(msg);
     TEST_note("total=%d len=%zu msg='%s'\n", msg_total_size, strlen(msg), msg);
     return 1;
 }
@@ -171,28 +171,28 @@ static int execute_CTX_print_errors_test(OSSL_CMP_CTX_TEST_FIXTURE *fixture)
         res = 0;
     } else {
         ERR_raise(ERR_LIB_CMP, CMP_R_INVALID_ARGS);
-        base_err_msg_size = strlen("INVALID_ARGS");
+        base_err_msg_size = (int)strlen("INVALID_ARGS");
         ERR_raise(ERR_LIB_CMP, CMP_R_NULL_ARGUMENT);
-        base_err_msg_size += strlen("NULL_ARGUMENT");
+        base_err_msg_size += (int)strlen("NULL_ARGUMENT");
         expected_size = base_err_msg_size;
         ossl_cmp_add_error_data("data1"); /* should prepend separator ":" */
-        expected_size += strlen(":" "data1");
+        expected_size += (int)strlen(":" "data1");
         ossl_cmp_add_error_data("data2"); /* should prepend separator " : " */
-        expected_size += strlen(" : " "data2");
+        expected_size += (int)strlen(" : " "data2");
         ossl_cmp_add_error_line("new line"); /* should prepend separator "\n" */
-        expected_size += strlen("\n" "new line");
+        expected_size += (int)strlen("\n" "new line");
         OSSL_CMP_CTX_print_errors(ctx);
         if (!TEST_int_eq(msg_total_size, expected_size))
             res = 0;
 
         ERR_raise(ERR_LIB_CMP, CMP_R_INVALID_ARGS);
-        base_err_msg_size = strlen("INVALID_ARGS") + strlen(":");
+        base_err_msg_size = (int)(strlen("INVALID_ARGS") + strlen(":"));
         expected_size = base_err_msg_size;
         while (expected_size < 4096) { /* force split */
             ERR_add_error_txt(STR_SEP, max_str_literal);
-            expected_size += strlen(STR_SEP) + strlen(max_str_literal);
+            expected_size += (int)(strlen(STR_SEP) + strlen(max_str_literal));
         }
-        expected_size += base_err_msg_size - 2 * strlen(STR_SEP);
+        expected_size += base_err_msg_size - 2 * (int)strlen(STR_SEP);
         msg_total_size = 0;
         OSSL_CMP_CTX_print_errors(ctx);
         if (!TEST_int_eq(msg_total_size, expected_size))
@@ -609,7 +609,7 @@ typedef OSSL_HTTP_bio_cb_t OSSL_CMP_http_cb_t;
     static int OSSL_CMP_CTX_##SETN##_##FIELD##_str(CMP_CTX *ctx, char *val)\
     { \
         return OSSL_CMP_CTX_##SETN##_##FIELD(ctx, (unsigned char *)val, \
-                                             strlen(val));              \
+                                             (int)strlen(val));         \
     } \
     \
     static char *OSSL_CMP_CTX_get1_##FIELD##_str(const CMP_CTX *ctx) \
index 9b975b86c3a6da99415f3c8a3da3e2f9527e53ae..d54a5112072b993f1fea137cc57295acd46d634d 100644 (file)
@@ -211,7 +211,7 @@ static int test_MSG_protect_unprotected_request(void)
 
 static int test_MSG_protect_with_msg_sig_alg_protection_plus_rsa_key(void)
 {
-    const size_t size = sizeof(rand_data) / 2;
+    const int size = sizeof(rand_data) / 2;
 
     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
     fixture->expected = 1;
index 59dd7faeb28438ecb97f6601d9cd42966699a4c5..3d16162c1c3507c13b7f72c23c963a1a963b7041 100644 (file)
@@ -26,7 +26,7 @@ static int test_encrypt_decrypt(const EVP_CIPHER *cipher)
     int testresult = 0;
     STACK_OF(X509) *certstack = sk_X509_new_null();
     const char *msg = "Hello world";
-    BIO *msgbio = BIO_new_mem_buf(msg, strlen(msg));
+    BIO *msgbio = BIO_new_mem_buf(msg, (int)strlen(msg));
     BIO *outmsgbio = BIO_new(BIO_s_mem());
     CMS_ContentInfo* content = NULL;
     BIO *contentbio = NULL;
@@ -53,7 +53,7 @@ static int test_encrypt_decrypt(const EVP_CIPHER *cipher)
         goto end;
 
     /* Check we got the message we first started with */
-    if (!TEST_int_eq(BIO_gets(outmsgbio, buf, sizeof(buf)), strlen(msg))
+    if (!TEST_int_eq(BIO_gets(outmsgbio, buf, sizeof(buf)), (int)strlen(msg))
             || !TEST_int_eq(strcmp(buf, msg), 0))
         goto end;
 
index ad54dbef458feaf084088f415408e6bb66863ce8..f658ea5f1669b29db09e8b7e0a29f89feff52de9 100644 (file)
@@ -87,7 +87,7 @@ static int test_binary_op_s(size_t (*op) (size_t a, size_t b),
 {
     if (is_true && !TEST_size_t_eq(op(a, b), CONSTTIME_TRUE_S))
         return 0;
-    if (!is_true && !TEST_uint_eq(op(a, b), CONSTTIME_FALSE_S))
+    if (!is_true && !TEST_size_t_eq(op(a, b), CONSTTIME_FALSE_S))
         return 0;
     return 1;
 }
@@ -149,7 +149,7 @@ static int test_is_zero_s(int i)
 
     if (a == 0 && !TEST_size_t_eq(constant_time_is_zero_s(a), CONSTTIME_TRUE_S))
         return 0;
-    if (a != 0 && !TEST_uint_eq(constant_time_is_zero_s(a), CONSTTIME_FALSE_S))
+    if (a != 0 && !TEST_size_t_eq(constant_time_is_zero_s(a), CONSTTIME_FALSE_S))
         return 0;
     return 1;
 }
@@ -183,9 +183,9 @@ static int test_select_32(uint32_t a, uint32_t b)
 
 static int test_select_s(size_t a, size_t b)
 {
-    if (!TEST_uint_eq(constant_time_select_s(CONSTTIME_TRUE_S, a, b), a))
+    if (!TEST_size_t_eq(constant_time_select_s(CONSTTIME_TRUE_S, a, b), a))
         return 0;
-    if (!TEST_uint_eq(constant_time_select_s(CONSTTIME_FALSE_S, a, b), b))
+    if (!TEST_size_t_eq(constant_time_select_s(CONSTTIME_FALSE_S, a, b), b))
         return 0;
     return 1;
 }
@@ -229,7 +229,7 @@ static int test_eq_s(size_t a, size_t b)
 {
     if (a == b && !TEST_size_t_eq(constant_time_eq_s(a, b), CONSTTIME_TRUE_S))
         return 0;
-    if (a != b && !TEST_int_eq(constant_time_eq_s(a, b), CONSTTIME_FALSE_S))
+    if (a != b && !TEST_size_t_eq(constant_time_eq_s(a, b), CONSTTIME_FALSE_S))
         return 0;
     return 1;
 }
index c18448122024894fe5be67b077912fcfbacc1b9c..c4e30d14fca90ffb48137dd0adf1f63f56cbbea5 100644 (file)
@@ -199,7 +199,7 @@ static BIO *glue2bio(const char **pem, char **out)
     size_t s = 0;
 
     *out = glue_strings(pem, &s);
-    return BIO_new_mem_buf(*out, s);
+    return BIO_new_mem_buf(*out, (int)s);
 }
 
 /*
index d7ef87b6d2674f4a112dc81599ef9175ffa693bc..cce06f57fe1f4cafb02174390ff63a02a9d3d1d3 100644 (file)
@@ -115,7 +115,7 @@ static STACK_OF(X509) *load_chain(BIO *fp, int nelem)
             const unsigned char *p = data;
 
             if (!TEST_ptr(cert = d(0, &p, len))
-                    || !TEST_long_eq(p - data, len)) {
+                    || !TEST_long_eq((long)(p - data), len)) {
                 TEST_info("Certificate parsing error");
                 goto err;
             }
@@ -155,7 +155,7 @@ static char *read_to_eol(BIO *f)
     if (BIO_gets(f, buf, sizeof(buf)) <= 0)
         return NULL;
 
-    n = strlen(buf);
+    n = (int)strlen(buf);
     if (buf[n - 1] != '\n') {
         if (n + 1 == sizeof(buf))
             TEST_error("input too long");
index aa374da74c28bf523e6eda5eeddf897d289d950e..f6fe433219396608b70323cac17a9b284e85fa1a 100644 (file)
@@ -42,7 +42,7 @@ const OPTIONS *test_get_options(void)
 static int passcb(char *buf, int size, int rwflag, void *userdata)
 {
     strcpy(buf, "pass");
-    return strlen(buf);
+    return (int)strlen(buf);
 }
 
 static int test_decode_nonfipsalg(void)
index 7bc844ae88bdd093546f2495bbb26955fdde67d8..0b3bc6dd783cf2cac5c6b82da28f5ca16e1bf54b 100644 (file)
@@ -382,13 +382,13 @@ static int test_des_cbc(void)
     memset(cbc_out, 0, sizeof(cbc_out));
     memset(cbc_in, 0, sizeof(cbc_in));
     memcpy(iv3, cbc_iv, sizeof(cbc_iv));
-    DES_ncbc_encrypt(cbc_data, cbc_out, cbc_data_len + 1, &ks,
+    DES_ncbc_encrypt(cbc_data, cbc_out, (long)(cbc_data_len + 1), &ks,
                      &iv3, DES_ENCRYPT);
     if (!TEST_mem_eq(cbc_out, 32, cbc_ok, 32))
         return 0;
 
     memcpy(iv3, cbc_iv, sizeof(cbc_iv));
-    DES_ncbc_encrypt(cbc_out, cbc_in, cbc_data_len + 1, &ks,
+    DES_ncbc_encrypt(cbc_out, cbc_in, (long)(cbc_data_len + 1), &ks,
                      &iv3, DES_DECRYPT);
     return TEST_mem_eq(cbc_in, cbc_data_len, cbc_data, cbc_data_len);
 }
@@ -406,12 +406,12 @@ static int test_des_ede_cbc(void)
     memset(cbc_out, 0, sizeof(cbc_out));
     memset(cbc_in, 0, sizeof(cbc_in));
     memcpy(iv3, cbc_iv, sizeof(cbc_iv));
-    DES_xcbc_encrypt(cbc_data, cbc_out, n, &ks, &iv3, &cbc2_key, &cbc3_key,
+    DES_xcbc_encrypt(cbc_data, cbc_out, (long)n, &ks, &iv3, &cbc2_key, &cbc3_key,
                      DES_ENCRYPT);
     if (!TEST_mem_eq(cbc_out, sizeof(xcbc_ok), xcbc_ok, sizeof(xcbc_ok)))
         return 0;
     memcpy(iv3, cbc_iv, sizeof(cbc_iv));
-    DES_xcbc_encrypt(cbc_out, cbc_in, n, &ks, &iv3, &cbc2_key, &cbc3_key,
+    DES_xcbc_encrypt(cbc_out, cbc_in, (long)n, &ks, &iv3, &cbc2_key, &cbc3_key,
                      DES_DECRYPT);
     return TEST_mem_eq(cbc_data, n, cbc_data, n);
 }
@@ -437,13 +437,13 @@ static int test_ede_cbc(void)
 
     DES_ede3_cbc_encrypt(cbc_data, cbc_out, 16L, &ks, &ks2, &ks3, &iv3,
                          DES_ENCRYPT);
-    DES_ede3_cbc_encrypt(&cbc_data[16], &cbc_out[16], i - 16, &ks, &ks2,
+    DES_ede3_cbc_encrypt(&cbc_data[16], &cbc_out[16], (long)(i - 16), &ks, &ks2,
                          &ks3, &iv3, DES_ENCRYPT);
     if (!TEST_mem_eq(cbc_out, n, cbc3_ok, n))
         return 0;
 
     memcpy(iv3, cbc_iv, sizeof(cbc_iv));
-    DES_ede3_cbc_encrypt(cbc_out, cbc_in, i, &ks, &ks2, &ks3, &iv3,
+    DES_ede3_cbc_encrypt(cbc_out, cbc_in, (long)i, &ks, &ks2, &ks3, &iv3,
                          DES_DECRYPT);
     return TEST_mem_eq(cbc_in, i, cbc_data, i);
 }
@@ -459,7 +459,7 @@ static int test_input_align(int i)
     memcpy(iv, cbc_iv, sizeof(cbc_iv));
     if (!TEST_int_eq(DES_set_key_checked(&cbc_key, &ks), 0))
         return 0;
-    DES_ncbc_encrypt(&cbc_data[i], cbc_out, n, &ks, &iv, DES_ENCRYPT);
+    DES_ncbc_encrypt(&cbc_data[i], cbc_out, (long)n, &ks, &iv, DES_ENCRYPT);
     return 1;
 }
 
@@ -474,7 +474,7 @@ static int test_output_align(int i)
     memcpy(iv, cbc_iv, sizeof(cbc_iv));
     if (!TEST_int_eq(DES_set_key_checked(&cbc_key, &ks), 0))
         return 0;
-    DES_ncbc_encrypt(cbc_data, &cbc_out[i], n, &ks, &iv, DES_ENCRYPT);
+    DES_ncbc_encrypt(cbc_data, &cbc_out[i], (long)n, &ks, &iv, DES_ENCRYPT);
     return 1;
 }
 
@@ -499,7 +499,7 @@ static int test_des_pcbc(void)
     unsigned char cbc_in[40];
     unsigned char cbc_out[40];
     DES_key_schedule ks;
-    const int n = strlen((char *)cbc_data) + 1;
+    const int n = (int)(strlen((char *)cbc_data) + 1);
 
     if (!TEST_int_eq(DES_set_key_checked(&cbc_key, &ks), 0))
         return 0;
@@ -682,7 +682,7 @@ static int test_des_cbc_cksum(void)
     unsigned char cret[8];
 
     DES_set_key_checked(&cbc_key, &ks);
-    cs = DES_cbc_cksum(cbc_data, &cret, strlen((char *)cbc_data), &ks,
+    cs = DES_cbc_cksum(cbc_data, &cret, (long)strlen((char *)cbc_data), &ks,
                        &cbc_iv);
     if (!TEST_cs_eq(cs, cbc_cksum_ret))
         return 0;
index 8b4d36bbd01b0cb5995eda7f987a6ce2588a40ee..a7dbbf254892473640bb1ba6d01f171e15217347 100644 (file)
@@ -575,7 +575,7 @@ static EVP_PKEY *new_raw_private_key(const char *curvename,
                                              (char *)priv, privlen))
             goto err;
     } else {
-        privbn = BN_bin2bn(priv, privlen, NULL);
+        privbn = BN_bin2bn(priv, (int)privlen, NULL);
         if (privbn == NULL)
             goto err;
         if (!OSSL_PARAM_BLD_push_utf8_string(bld, OSSL_PKEY_PARAM_GROUP_NAME,
index 7b101df1a078bae84ad7eb7fa1caf109ecae1f21..3f98e3342febb7b59e04288784fe2381843279b7 100644 (file)
@@ -593,13 +593,13 @@ static int rfc5114_test(void)
                 || !TEST_ptr(dhB = td->get_param()))
             goto bad_err;
 
-        if (!TEST_ptr(priv_key = BN_bin2bn(td->xA, td->xA_len, NULL))
-                || !TEST_ptr(pub_key = BN_bin2bn(td->yA, td->yA_len, NULL))
+        if (!TEST_ptr(priv_key = BN_bin2bn(td->xA, (int)td->xA_len, NULL))
+                || !TEST_ptr(pub_key = BN_bin2bn(td->yA, (int)td->yA_len, NULL))
                 || !TEST_true(DH_set0_key(dhA, pub_key, priv_key)))
             goto bad_err;
 
-        if (!TEST_ptr(priv_key = BN_bin2bn(td->xB, td->xB_len, NULL))
-                || !TEST_ptr(pub_key = BN_bin2bn(td->yB, td->yB_len, NULL))
+        if (!TEST_ptr(priv_key = BN_bin2bn(td->xB, (int)td->xB_len, NULL))
+                || !TEST_ptr(pub_key = BN_bin2bn(td->yB, (int)td->yB_len, NULL))
                 || !TEST_true(DH_set0_key(dhB, pub_key, priv_key)))
             goto bad_err;
         priv_key = pub_key = NULL;
index 35bfa390394aa9585c09241c893f7edb2288c618..9712111dbbb32f97208b26f067bcbc6ec4a5852b 100644 (file)
@@ -190,12 +190,12 @@ static int sign_and_verify(int len)
     }
 
     /* Verify again using the raw DSA interface */
-    if (DSA_verify(0, dataToSign, len, signature, sigLength, dsakey) != 1) {
+    if (DSA_verify(0, dataToSign, len, signature, (int)sigLength, dsakey) != 1) {
         TEST_error("Verification with unpadded data failed, len=%d", len);
         goto end;
     }
 
-    if (DSA_verify(0, paddedData, digestlen, signature, sigLength, dsakey) != 1) {
+    if (DSA_verify(0, paddedData, digestlen, signature, (int)sigLength, dsakey) != 1) {
         TEST_error("verify with length %d failed\n", len);
         goto end;
     }
index f1b705fd59e68af72d6723abe9899e630e805037..c24efdac7bfc28c566283090b43871a493ea9dca 100644 (file)
@@ -102,7 +102,7 @@ static int mtu_test(SSL_CTX *ctx, const char *cs, int no_etm)
     for (s = mtus[0]; s <= mtus[29]; s++) {
         size_t reclen;
 
-        if (!TEST_int_eq(SSL_write(clnt_ssl, buf, s), (int)s))
+        if (!TEST_int_eq(SSL_write(clnt_ssl, buf, (int)s), (int)s))
             goto end;
         reclen = BIO_read(sc_bio, buf, sizeof(buf));
         if (debug)
index 0268142ae7fda7359e6f1dadf21f3fc12c0115e3..a8eb33b985e25d220616c94ef44ab845bd1e4038 100644 (file)
@@ -559,13 +559,13 @@ int setup_tests(void)
     ADD_TEST(ec2m_field_sanity);
     ADD_TEST(field_tests_ec2_simple);
 #endif
-    ADD_ALL_TESTS(field_tests_default, crv_len);
+    ADD_ALL_TESTS(field_tests_default, (int)crv_len);
 #ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
     ADD_TEST(underflow_test);
 #endif
     ADD_TEST(set_private_key);
     ADD_TEST(decoded_flag_test);
-    ADD_ALL_TESTS(ecpkparams_i2d2i_test, crv_len);
+    ADD_ALL_TESTS(ecpkparams_i2d2i_test, (int)crv_len);
     ADD_TEST(named_group_creation_test);
 
     return 1;
index 0ddbf6690dcace779c077008c03b9d427524c013..d79b02a9da53e6877cb65731e9608a7149c975f6 100644 (file)
@@ -45,8 +45,8 @@ static int fbytes(unsigned char *buf, size_t num, ossl_unused const char *name,
         || !TEST_int_lt(fbytes_counter, OSSL_NELEM(numbers))
         || !TEST_true(BN_hex2bn(&tmp, numbers[fbytes_counter]))
         /* tmp might need leading zeros so pad it out */
-        || !TEST_int_le(BN_num_bytes(tmp), num)
-        || !TEST_int_gt(BN_bn2binpad(tmp, buf, num), 0))
+        || !TEST_int_le(BN_num_bytes(tmp), (int)num)
+        || !TEST_int_gt(BN_bn2binpad(tmp, buf, (int)num), 0))
         goto err;
 
     fbytes_counter = (fbytes_counter + 1) % OSSL_NELEM(numbers);
@@ -122,7 +122,7 @@ static int x9_62_tests(int n)
         || !TEST_true(p_len = EC_KEY_key2buf(key, POINT_CONVERSION_UNCOMPRESSED,
                                              &pbuf, NULL))
         || !TEST_ptr(qbuf = OPENSSL_hexstr2buf(ecdsa_cavs_kats[n].Q, &q_len))
-        || !TEST_int_eq(q_len, p_len)
+        || !TEST_size_t_eq((size_t)q_len, p_len)
         || !TEST_mem_eq(qbuf, q_len, pbuf, p_len))
         goto err;
 
@@ -249,7 +249,7 @@ static int test_builtin(int n, int as)
         || !TEST_true(EVP_DigestSignInit(mctx, NULL, NULL, NULL, pkey))
         || (as == EVP_PKEY_SM2 && !set_sm2_id(mctx, pkey))
         || !TEST_true(EVP_DigestSign(mctx, sig, &sig_len, tbs, sizeof(tbs)))
-        || !TEST_int_le(sig_len, ECDSA_size(eckey))
+        || !TEST_size_t_le(sig_len, (size_t)ECDSA_size(eckey))
         || !TEST_true(EVP_MD_CTX_reset(mctx))
         /* negative test, verify with wrong key, 0 return */
         || !TEST_true(EVP_DigestVerifyInit(mctx, NULL, NULL, NULL, pkey_neg))
@@ -404,10 +404,10 @@ int setup_tests(void)
         fake_rand_finish(fake_rand);
         return 0;
     }
-    ADD_ALL_TESTS(test_builtin_as_ec, crv_len);
+    ADD_ALL_TESTS(test_builtin_as_ec, (int)crv_len);
     ADD_TEST(test_ecdsa_sig_NULL);
 # ifndef OPENSSL_NO_SM2
-    ADD_ALL_TESTS(test_builtin_as_sm2, crv_len);
+    ADD_ALL_TESTS(test_builtin_as_sm2, (int)crv_len);
 # endif
     ADD_ALL_TESTS(x9_62_tests, OSSL_NELEM(ecdsa_cavs_kats));
 #endif
index afbb852d7f78e2b040cafc6671f6b01730b0645a..24fc7e7d8ab402658d6370eb0ed8b8b9ef9fcb95 100644 (file)
@@ -168,8 +168,8 @@ static int prime_field_tests(void)
     const BIGNUM *scalars[4];
 #endif
     unsigned char buf[100];
-    size_t len, r = 0;
-    int k;
+    size_t len;
+    int k, r = 0;
 
     if (!TEST_ptr(ctx = BN_CTX_new())
         || !TEST_ptr(p = BN_new())
@@ -1576,8 +1576,8 @@ static int check_named_curve_test(int id)
     if (!TEST_int_eq(EC_GROUP_check_named_curve(group, 0, NULL), nid))
         goto err;
 
-    if (!TEST_int_eq(EC_GROUP_set_seed(group, invalid_seed, invalid_seed_len),
-                     invalid_seed_len))
+    if (!TEST_size_t_eq(EC_GROUP_set_seed(group, invalid_seed, invalid_seed_len),
+                        invalid_seed_len))
         goto err;
 
     if (has_seed) {
@@ -1596,7 +1596,7 @@ static int check_named_curve_test(int id)
             goto err;
     }
     /* Pass if the seed is unknown (as it is optional) */
-    if (!TEST_int_eq(EC_GROUP_set_seed(group, NULL, 0), 1)
+    if (!TEST_size_t_eq(EC_GROUP_set_seed(group, NULL, 0), 1)
         || !TEST_int_eq(EC_GROUP_check_named_curve(group, 0, NULL), nid))
         goto err;
 
@@ -1906,8 +1906,8 @@ static int check_named_curve_from_ecparameters(int id)
      * An invalid seed in the parameters should be ignored: expect a "named"
      * group.
      */
-    if (!TEST_int_eq(EC_GROUP_set_seed(tmpg, invalid_seed, invalid_seed_len),
-                     invalid_seed_len)
+    if (!TEST_size_t_eq(EC_GROUP_set_seed(tmpg, invalid_seed, invalid_seed_len),
+                        invalid_seed_len)
             || !TEST_ptr(other_params = *p_next++ =
                          EC_GROUP_get_ecparameters(tmpg, NULL))
             || !TEST_ptr(tgroup = *g_next++ =
@@ -1924,7 +1924,7 @@ static int check_named_curve_from_ecparameters(int id)
      * A null seed in the parameters should be ignored, as it is optional:
      * expect a "named" group.
      */
-    if (!TEST_int_eq(EC_GROUP_set_seed(tmpg, NULL, 0), 1)
+    if (!TEST_size_t_eq(EC_GROUP_set_seed(tmpg, NULL, 0), 1)
             || !TEST_ptr(other_params = *p_next++ =
                          EC_GROUP_get_ecparameters(tmpg, NULL))
             || !TEST_ptr(tgroup = *g_next++ =
@@ -2498,7 +2498,7 @@ static int ec_point_hex2point_test(int id)
 }
 
 static int do_test_custom_explicit_fromdata(EC_GROUP *group, BN_CTX *ctx,
-                                            unsigned char *gen, int gen_size)
+                                            unsigned char *gen, size_t gen_size)
 {
     int ret = 0, i_out;
     EVP_PKEY_CTX *pctx = NULL;
@@ -2722,7 +2722,8 @@ err:
  */
 static int custom_generator_test(int id)
 {
-    int ret = 0, nid, bsize;
+    int ret = 0, nid;
+    size_t bsize;
     EC_GROUP *group = NULL;
     EC_POINT *G2 = NULL, *Q1 = NULL, *Q2 = NULL;
     BN_CTX *ctx = NULL;
@@ -2741,7 +2742,7 @@ static int custom_generator_test(int id)
         goto err;
 
     /* expected byte length of encoded points */
-    bsize = (EC_GROUP_get_degree(group) + 7) / 8;
+    bsize = ((size_t)EC_GROUP_get_degree(group) + 7) / 8;
     bsize = 1 + 2 * bsize; /* UNCOMPRESSED_POINT format */
 
     if (!TEST_ptr(k = BN_CTX_get(ctx))
@@ -2755,13 +2756,13 @@ static int custom_generator_test(int id)
         /* Q1 := kG */
         || !TEST_true(EC_POINT_mul(group, Q1, k, NULL, NULL, ctx))
         /* pull out the bytes of that */
-        || !TEST_int_eq(EC_POINT_point2oct(group, Q1,
-                                           POINT_CONVERSION_UNCOMPRESSED, NULL,
-                                           0, ctx), bsize)
+        || !TEST_size_t_eq(EC_POINT_point2oct(group, Q1,
+                                              POINT_CONVERSION_UNCOMPRESSED, NULL,
+                                              0, ctx), bsize)
         || !TEST_ptr(b1 = OPENSSL_malloc(bsize))
-        || !TEST_int_eq(EC_POINT_point2oct(group, Q1,
-                                           POINT_CONVERSION_UNCOMPRESSED, b1,
-                                           bsize, ctx), bsize)
+        || !TEST_size_t_eq(EC_POINT_point2oct(group, Q1,
+                                              POINT_CONVERSION_UNCOMPRESSED, b1,
+                                              bsize, ctx), bsize)
         /* new generator is G2 := 2G */
         || !TEST_true(EC_POINT_dbl(group, G2, EC_GROUP_get0_generator(group),
                                    ctx))
@@ -2772,13 +2773,13 @@ static int custom_generator_test(int id)
         || !TEST_true(BN_rshift1(k, k))
         /* Q2 := k/2 G2 */
         || !TEST_true(EC_POINT_mul(group, Q2, k, NULL, NULL, ctx))
-        || !TEST_int_eq(EC_POINT_point2oct(group, Q2,
-                                           POINT_CONVERSION_UNCOMPRESSED, NULL,
-                                           0, ctx), bsize)
+        || !TEST_size_t_eq(EC_POINT_point2oct(group, Q2,
+                                              POINT_CONVERSION_UNCOMPRESSED, NULL,
+                                              0, ctx), bsize)
         || !TEST_ptr(b2 = OPENSSL_malloc(bsize))
-        || !TEST_int_eq(EC_POINT_point2oct(group, Q2,
-                                           POINT_CONVERSION_UNCOMPRESSED, b2,
-                                           bsize, ctx), bsize)
+        || !TEST_size_t_eq(EC_POINT_point2oct(group, Q2,
+                                              POINT_CONVERSION_UNCOMPRESSED, b2,
+                                              bsize, ctx), bsize)
         /* Q1 = kG = k/2 G2 = Q2 should hold */
         || !TEST_mem_eq(b1, bsize, b2, bsize))
         goto err;
@@ -2806,7 +2807,7 @@ static int custom_generator_test(int id)
  */
 static int custom_params_test(int id)
 {
-    int ret = 0, nid, bsize;
+    int ret = 0, nid;
     const char *curve_name = NULL;
     EC_GROUP *group = NULL, *altgroup = NULL;
     EC_POINT *G2 = NULL, *Q1 = NULL, *Q2 = NULL;
@@ -2820,7 +2821,7 @@ static int custom_params_test(int id)
     EC_KEY *eckey1 = NULL, *eckey2 = NULL;
     EVP_PKEY *pkey1 = NULL, *pkey2 = NULL;
     EVP_PKEY_CTX *pctx1 = NULL, *pctx2 = NULL, *dctx = NULL;
-    size_t sslen, t;
+    size_t sslen, t, bsize;
     unsigned char *pub1 = NULL , *pub2 = NULL;
     OSSL_PARAM_BLD *param_bld = NULL;
     OSSL_PARAM *params1 = NULL, *params2 = NULL;
@@ -2855,7 +2856,7 @@ static int custom_params_test(int id)
 #endif
 
     /* expected byte length of encoded points */
-    bsize = (EC_GROUP_get_degree(group) + 7) / 8;
+    bsize = ((size_t)EC_GROUP_get_degree(group) + 7) / 8;
     bsize = 1 + 2 * bsize; /* UNCOMPRESSED_POINT format */
 
     /* extract parameters from built-in curve */
@@ -2865,13 +2866,13 @@ static int custom_params_test(int id)
             || !TEST_true(EC_POINT_dbl(group, G2,
                                        EC_GROUP_get0_generator(group), ctx))
             /* pull out the bytes of that */
-            || !TEST_int_eq(EC_POINT_point2oct(group, G2,
-                                               POINT_CONVERSION_UNCOMPRESSED,
-                                               NULL, 0, ctx), bsize)
+            || !TEST_size_t_eq(EC_POINT_point2oct(group, G2,
+                                                  POINT_CONVERSION_UNCOMPRESSED,
+                                                  NULL, 0, ctx), bsize)
             || !TEST_ptr(buf1 = OPENSSL_malloc(bsize))
-            || !TEST_int_eq(EC_POINT_point2oct(group, G2,
-                                               POINT_CONVERSION_UNCOMPRESSED,
-                                               buf1, bsize, ctx), bsize)
+            || !TEST_size_t_eq(EC_POINT_point2oct(group, G2,
+                                                  POINT_CONVERSION_UNCOMPRESSED,
+                                                  buf1, bsize, ctx), bsize)
             || !TEST_ptr(z = EC_GROUP_get0_order(group))
             || !TEST_ptr(cof = EC_GROUP_get0_cofactor(group))
         )
@@ -2910,24 +2911,24 @@ static int custom_params_test(int id)
             /* Q1 := kG on group */
             || !TEST_true(EC_POINT_mul(group, Q1, k, NULL, NULL, ctx))
             /* pull out the bytes of that */
-            || !TEST_int_eq(EC_POINT_point2oct(group, Q1,
-                                               POINT_CONVERSION_UNCOMPRESSED,
-                                               NULL, 0, ctx), bsize)
-            || !TEST_int_eq(EC_POINT_point2oct(group, Q1,
-                                               POINT_CONVERSION_UNCOMPRESSED,
-                                               buf1, bsize, ctx), bsize)
+            || !TEST_size_t_eq(EC_POINT_point2oct(group, Q1,
+                                                  POINT_CONVERSION_UNCOMPRESSED,
+                                                  NULL, 0, ctx), bsize)
+            || !TEST_size_t_eq(EC_POINT_point2oct(group, Q1,
+                                                  POINT_CONVERSION_UNCOMPRESSED,
+                                                  buf1, bsize, ctx), bsize)
             /* k := k/2 */
             || !TEST_true(BN_rshift1(k, k))
             /* Q2 := k/2 G2 on altgroup */
             || !TEST_true(EC_POINT_mul(altgroup, Q2, k, NULL, NULL, ctx))
             /* pull out the bytes of that */
-            || !TEST_int_eq(EC_POINT_point2oct(altgroup, Q2,
-                                               POINT_CONVERSION_UNCOMPRESSED,
-                                               NULL, 0, ctx), bsize)
+            || !TEST_size_t_eq(EC_POINT_point2oct(altgroup, Q2,
+                                                  POINT_CONVERSION_UNCOMPRESSED,
+                                                  NULL, 0, ctx), bsize)
             || !TEST_ptr(buf2 = OPENSSL_malloc(bsize))
-            || !TEST_int_eq(EC_POINT_point2oct(altgroup, Q2,
-                                               POINT_CONVERSION_UNCOMPRESSED,
-                                               buf2, bsize, ctx), bsize)
+            || !TEST_size_t_eq(EC_POINT_point2oct(altgroup, Q2,
+                                                  POINT_CONVERSION_UNCOMPRESSED,
+                                                  buf2, bsize, ctx), bsize)
             /* Q1 = kG = k/2 G2 = Q2 should hold */
             || !TEST_mem_eq(buf1, bsize, buf2, bsize))
         goto err;
@@ -2952,24 +2953,24 @@ static int custom_params_test(int id)
      * define a provider key in the built-in group.
      */
     if (!TEST_true(EC_POINT_mul(group, Q1, priv1, NULL, NULL, ctx))
-            || !TEST_int_eq(EC_POINT_point2oct(group, Q1,
-                                               POINT_CONVERSION_UNCOMPRESSED,
-                                               NULL, 0, ctx), bsize)
+            || !TEST_size_t_eq(EC_POINT_point2oct(group, Q1,
+                                                  POINT_CONVERSION_UNCOMPRESSED,
+                                                  NULL, 0, ctx), bsize)
             || !TEST_ptr(pub1 = OPENSSL_malloc(bsize))
-            || !TEST_int_eq(EC_POINT_point2oct(group, Q1,
-                                               POINT_CONVERSION_UNCOMPRESSED,
-                                               pub1, bsize, ctx), bsize))
+            || !TEST_size_t_eq(EC_POINT_point2oct(group, Q1,
+                                                  POINT_CONVERSION_UNCOMPRESSED,
+                                                  pub1, bsize, ctx), bsize))
         goto err;
 
     /* retrieve bytes for pub2 for later */
     if (!TEST_ptr(Q = EC_KEY_get0_public_key(eckey2))
-            || !TEST_int_eq(EC_POINT_point2oct(altgroup, Q,
-                                               POINT_CONVERSION_UNCOMPRESSED,
-                                               NULL, 0, ctx), bsize)
+            || !TEST_size_t_eq(EC_POINT_point2oct(altgroup, Q,
+                                                  POINT_CONVERSION_UNCOMPRESSED,
+                                                  NULL, 0, ctx), bsize)
             || !TEST_ptr(pub2 = OPENSSL_malloc(bsize))
-            || !TEST_int_eq(EC_POINT_point2oct(altgroup, Q,
-                                               POINT_CONVERSION_UNCOMPRESSED,
-                                               pub2, bsize, ctx), bsize))
+            || !TEST_size_t_eq(EC_POINT_point2oct(altgroup, Q,
+                                                  POINT_CONVERSION_UNCOMPRESSED,
+                                                  pub2, bsize, ctx), bsize))
         goto err;
 
     /* create two `EVP_PKEY`s from the `EC_KEY`s */
@@ -2987,15 +2988,15 @@ static int custom_params_test(int id)
             || !TEST_int_eq(EVP_PKEY_derive_init(pctx1), 1)
             || !TEST_int_eq(EVP_PKEY_derive_set_peer(pctx1, pkey2), 1)
             || !TEST_int_eq(EVP_PKEY_derive(pctx1, NULL, &sslen), 1)
-            || !TEST_int_gt(bsize, sslen)
+            || !TEST_size_t_gt(bsize, sslen)
             || !TEST_int_eq(EVP_PKEY_derive(pctx1, buf1, &sslen), 1))
         goto err;
     if (!TEST_ptr(pctx2 = EVP_PKEY_CTX_new(pkey2, NULL))
             || !TEST_int_eq(EVP_PKEY_derive_init(pctx2), 1)
             || !TEST_int_eq(EVP_PKEY_derive_set_peer(pctx2, pkey1), 1)
             || !TEST_int_eq(EVP_PKEY_derive(pctx2, NULL, &t), 1)
-            || !TEST_int_gt(bsize, t)
-            || !TEST_int_le(sslen, t)
+            || !TEST_size_t_gt(bsize, t)
+            || !TEST_size_t_le(sslen, t)
             || !TEST_int_eq(EVP_PKEY_derive(pctx2, buf2, &t), 1))
         goto err;
 
@@ -3045,8 +3046,8 @@ static int custom_params_test(int id)
             || !TEST_ptr(dctx = EVP_PKEY_CTX_dup(pctx1))
             || !TEST_int_eq(EVP_PKEY_derive_set_peer_ex(dctx, pkey2, 1), 1)
             || !TEST_int_eq(EVP_PKEY_derive(dctx, NULL, &t), 1)
-            || !TEST_int_gt(bsize, t)
-            || !TEST_int_le(sslen, t)
+            || !TEST_size_t_gt(bsize, t)
+            || !TEST_size_t_le(sslen, t)
             || !TEST_int_eq(EVP_PKEY_derive(dctx, buf1, &t), 1)
             /* compare with previous result */
             || !TEST_mem_eq(buf1, t, buf2, sslen))
@@ -3131,7 +3132,7 @@ int setup_tests(void)
     ADD_TEST(parameter_test);
     ADD_TEST(ossl_parameter_test);
     ADD_TEST(cofactor_range_test);
-    ADD_ALL_TESTS(cardinality_test, crv_len);
+    ADD_ALL_TESTS(cardinality_test, (int)crv_len);
     ADD_TEST(prime_field_tests);
 #ifndef OPENSSL_NO_EC2M
     ADD_TEST(hybrid_point_encoding_test);
@@ -3139,16 +3140,16 @@ int setup_tests(void)
     ADD_ALL_TESTS(char2_curve_test, OSSL_NELEM(char2_curve_tests));
 #endif
     ADD_ALL_TESTS(nistp_single_test, OSSL_NELEM(nistp_tests_params));
-    ADD_ALL_TESTS(internal_curve_test, crv_len);
-    ADD_ALL_TESTS(internal_curve_test_method, crv_len);
+    ADD_ALL_TESTS(internal_curve_test, (int)crv_len);
+    ADD_ALL_TESTS(internal_curve_test_method, (int)crv_len);
     ADD_TEST(group_field_test);
-    ADD_ALL_TESTS(check_named_curve_test, crv_len);
-    ADD_ALL_TESTS(check_named_curve_lookup_test, crv_len);
-    ADD_ALL_TESTS(check_ec_key_field_public_range_test, crv_len);
-    ADD_ALL_TESTS(check_named_curve_from_ecparameters, crv_len);
-    ADD_ALL_TESTS(ec_point_hex2point_test, crv_len);
-    ADD_ALL_TESTS(custom_generator_test, crv_len);
-    ADD_ALL_TESTS(custom_params_test, crv_len);
+    ADD_ALL_TESTS(check_named_curve_test, (int)crv_len);
+    ADD_ALL_TESTS(check_named_curve_lookup_test, (int)crv_len);
+    ADD_ALL_TESTS(check_ec_key_field_public_range_test, (int)crv_len);
+    ADD_ALL_TESTS(check_named_curve_from_ecparameters, (int)crv_len);
+    ADD_ALL_TESTS(ec_point_hex2point_test, (int)crv_len);
+    ADD_ALL_TESTS(custom_generator_test, (int)crv_len);
+    ADD_ALL_TESTS(custom_params_test, (int)crv_len);
     ADD_TEST(ec_d2i_publickey_test);
     return 1;
 }
index d6ee5a59b916e643f239fdc30ff861ffd20aa797..76b9348ec1a2938418b2d212cc9788b018acb0d9 100644 (file)
@@ -273,7 +273,7 @@ static int encode_EVP_PKEY_prov(const char *file, const int line,
         || !TEST_FL_true(OSSL_ENCODER_to_bio(ectx, mem_ser))
         || !TEST_FL_true(BIO_get_mem_ptr(mem_ser, &mem_buf) > 0)
         || !TEST_FL_ptr(*encoded = mem_buf->data)
-        || !TEST_FL_long_gt(*encoded_len = mem_buf->length, 0))
+        || !TEST_FL_long_gt(*encoded_len = (long)mem_buf->length, 0))
         goto end;
 
     /* Detach the encoded output */
@@ -412,11 +412,11 @@ static int encode_EVP_PKEY_legacy_PEM(const char *file, const int line,
     if (!TEST_FL_ptr(mem_ser = BIO_new(BIO_s_mem()))
         || !TEST_FL_true(PEM_write_bio_PrivateKey_traditional(mem_ser, pkey,
                                                            cipher,
-                                                           upass, passlen,
+                                                           upass, (int)passlen,
                                                            NULL, NULL))
         || !TEST_FL_true(BIO_get_mem_ptr(mem_ser, &mem_buf) > 0)
         || !TEST_FL_ptr(*encoded = mem_buf->data)
-        || !TEST_FL_long_gt(*encoded_len = mem_buf->length, 0))
+        || !TEST_FL_long_gt(*encoded_len = (long)mem_buf->length, 0))
         goto end;
 
     /* Detach the encoded output */
@@ -455,7 +455,7 @@ static int encode_EVP_PKEY_MSBLOB(const char *file, const int line,
 
     if (!TEST_FL_true(BIO_get_mem_ptr(mem_ser, &mem_buf) > 0)
         || !TEST_FL_ptr(*encoded = mem_buf->data)
-        || !TEST_FL_long_gt(*encoded_len = mem_buf->length, 0))
+        || !TEST_FL_long_gt(*encoded_len = (long)mem_buf->length, 0))
         goto end;
 
     /* Detach the encoded output */
@@ -471,7 +471,7 @@ static pem_password_cb pass_pw;
 static int pass_pw(char *buf, int size, int rwflag, void *userdata)
 {
     OPENSSL_strlcpy(buf, userdata, size);
-    return strlen(userdata);
+    return (int)strlen(userdata);
 }
 
 static int encode_EVP_PKEY_PVK(const char *file, const int line,
@@ -495,7 +495,7 @@ static int encode_EVP_PKEY_PVK(const char *file, const int line,
                                           pass_pw, (void *)pass, testctx, testpropq), 0)
         || !TEST_FL_true(BIO_get_mem_ptr(mem_ser, &mem_buf) > 0)
         || !TEST_FL_ptr(*encoded = mem_buf->data)
-        || !TEST_FL_long_gt(*encoded_len = mem_buf->length, 0))
+        || !TEST_FL_long_gt(*encoded_len = (long)mem_buf->length, 0))
         goto end;
 
     /* Detach the encoded output */
@@ -562,7 +562,7 @@ static int check_unprotected_PKCS8_DER(const char *file, const int line,
 {
     const unsigned char *datap = data;
     PKCS8_PRIV_KEY_INFO *p8inf =
-        d2i_PKCS8_PRIV_KEY_INFO(NULL, &datap, data_len);
+        d2i_PKCS8_PRIV_KEY_INFO(NULL, &datap, (long)data_len);
     int ok = 0;
 
     if (TEST_FL_ptr(p8inf)) {
@@ -647,7 +647,7 @@ static int check_params_DER(const char *file, const int line,
         itype = EVP_PKEY_EC;
 
     if (itype != NID_undef) {
-        pkey = d2i_KeyParams(itype, NULL, &datap, data_len);
+        pkey = d2i_KeyParams(itype, NULL, &datap, (long)data_len);
         ok = (pkey != NULL);
         EVP_PKEY_free(pkey);
     }
@@ -718,7 +718,7 @@ static int check_MSBLOB(const char *file, const int line,
                         const char *type, const void *data, size_t data_len)
 {
     const unsigned char *datap = data;
-    EVP_PKEY *pkey = b2i_PrivateKey(&datap, data_len);
+    EVP_PKEY *pkey = b2i_PrivateKey(&datap, (long)data_len);
     int ok = TEST_FL_ptr(pkey);
 
     EVP_PKEY_free(pkey);
@@ -743,7 +743,8 @@ static int check_PVK(const char *file, const int line,
     unsigned int saltlen = 0, keylen = 0;
     int isdss = -1;
 
-    return ossl_do_PVK_header(&in, data_len, 0, &isdss, &saltlen, &keylen);
+    return ossl_do_PVK_header(&in, (unsigned int)data_len, 0, &isdss, &saltlen,
+                              &keylen);
 }
 
 static int test_unprotected_via_PVK(const char *type, EVP_PKEY *key)
@@ -765,7 +766,7 @@ static int check_protected_PKCS8_DER(const char *file, const int line,
                                      const void *data, size_t data_len)
 {
     const unsigned char *datap = data;
-    X509_SIG *p8 = d2i_X509_SIG(NULL, &datap, data_len);
+    X509_SIG *p8 = d2i_X509_SIG(NULL, &datap, (long)data_len);
     int ok = TEST_FL_ptr(p8);
 
     X509_SIG_free(p8);
@@ -858,7 +859,8 @@ static int check_public_DER(const char *file, const int line,
                             const char *type, const void *data, size_t data_len)
 {
     const unsigned char *datap = data;
-    EVP_PKEY *pkey = d2i_PUBKEY_ex(NULL, &datap, data_len, testctx, testpropq);
+    EVP_PKEY *pkey = d2i_PUBKEY_ex(NULL, &datap, (long)data_len, testctx,
+                                   testpropq);
     int ok = (TEST_FL_ptr(pkey) && TEST_FL_true(EVP_PKEY_is_a(pkey, type)));
 
     EVP_PKEY_free(pkey);
@@ -903,7 +905,7 @@ static int check_public_MSBLOB(const char *file, const int line,
                                const void *data, size_t data_len)
 {
     const unsigned char *datap = data;
-    EVP_PKEY *pkey = b2i_PublicKey(&datap, data_len);
+    EVP_PKEY *pkey = b2i_PublicKey(&datap, (long)data_len);
     int ok = TEST_FL_ptr(pkey);
 
     EVP_PKEY_free(pkey);
index 79ffb23054858714eb3d7a8a6d25c6ea5e19ebab..0a9128d506fd04b35dafb152c37c99713f8614b0 100644 (file)
@@ -446,7 +446,7 @@ int setup_tests(void)
 #ifdef OPENSSL_NO_ENGINE
     TEST_note("No ENGINE support");
 #else
-    int n;
+    size_t n;
 
     if (!test_skip_common_options()) {
         TEST_error("Error parsing test options\n");
index 3215ff655fe422f72a807cf739e707a0f36fd572..99189a20b331cb1f0cb0a3c707862fa5c403147b 100644 (file)
@@ -1361,11 +1361,11 @@ static int test_EC_priv_pub(void)
         goto err;
 
     /* Positive and negative testcase for EVP_PKEY_get1_encoded_public_key */
-    if (!TEST_int_gt(EVP_PKEY_get1_encoded_public_key(params_and_pub, &encoded), 0))
+    if (!TEST_size_t_gt(EVP_PKEY_get1_encoded_public_key(params_and_pub, &encoded), 0))
         goto err;
     OPENSSL_free(encoded);
     encoded = NULL;
-    if (!TEST_int_eq(EVP_PKEY_get1_encoded_public_key(just_params, &encoded), 0)) {
+    if (!TEST_size_t_eq(EVP_PKEY_get1_encoded_public_key(just_params, &encoded), 0)) {
         OPENSSL_free(encoded);
         encoded = NULL;
         goto err;
@@ -1375,14 +1375,14 @@ static int test_EC_priv_pub(void)
     if (!TEST_int_eq(EVP_PKEY_get_octet_string_param(params_and_pub,
                                                      OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY,
                                                      buffer, sizeof(buffer), &len), 1)
-        || !TEST_int_eq(len, 65))
+        || !TEST_size_t_eq(len, 65))
         goto err;
 
     len = 0;
     if (!TEST_int_eq(EVP_PKEY_get_octet_string_param(params_and_pub,
                                                      OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY,
                                                      NULL, 0, &len), 1)
-        || !TEST_int_eq(len, 65))
+        || !TEST_size_t_eq(len, 65))
         goto err;
 
     /* too-short buffer len*/
@@ -2201,7 +2201,7 @@ static int test_d2i_AutoPrivateKey(int i)
     int expected_id = ak->evptype;
 
     p = input;
-    if (!TEST_ptr(pkey = d2i_AutoPrivateKey(NULL, &p, input_len))
+    if (!TEST_ptr(pkey = d2i_AutoPrivateKey(NULL, &p, (long)input_len))
             || !TEST_ptr_eq(p, input + input_len)
             || !TEST_int_eq(EVP_PKEY_get_id(pkey), expected_id))
         goto done;
@@ -2310,7 +2310,7 @@ static int test_EVP_PKCS82PKEY_v2(int i)
 
     /* Can we parse PKCS#8 v2, ignoring the public key for now? */
     p = input;
-    p8inf = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, input_len);
+    p8inf = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, (long)input_len);
     if (!TEST_ptr(p8inf)
         || !TEST_true(p == input + input_len))
         goto done;
@@ -2494,7 +2494,7 @@ static int test_EVP_SM2_verify(void)
     EVP_PKEY_CTX *pctx = NULL;
     EVP_MD *sm3 = NULL;
 
-    bio = BIO_new_mem_buf(pubkey, strlen(pubkey));
+    bio = BIO_new_mem_buf(pubkey, (int)strlen(pubkey));
     if (!TEST_true(bio != NULL))
         goto done;
 
@@ -2519,7 +2519,7 @@ static int test_EVP_SM2_verify(void)
     if (!TEST_true(EVP_DigestVerifyInit(mctx, NULL, sm3, NULL, pkey)))
         goto done;
 
-    if (!TEST_int_gt(EVP_PKEY_CTX_set1_id(pctx, id, strlen(id)), 0))
+    if (!TEST_int_gt(EVP_PKEY_CTX_set1_id(pctx, id, (int)strlen(id)), 0))
         goto done;
 
     if (!TEST_true(EVP_DigestVerifyUpdate(mctx, msg, strlen(msg))))
@@ -3127,7 +3127,7 @@ static struct keys_st {
 
 #ifndef OPENSSL_NO_ML_KEM
 static int
-ml_kem_seed_to_priv(const char *alg, const unsigned char *seed, int seedlen,
+ml_kem_seed_to_priv(const char *alg, const unsigned char *seed, size_t seedlen,
                     unsigned char **ret, size_t *retlen)
 {
     OSSL_PARAM parr[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
@@ -3571,7 +3571,7 @@ static int test_X509_PUBKEY_inplace(void)
 
     if (!TEST_ptr(xp))
         goto done;
-    if (!TEST_ptr(d2i_X509_PUBKEY(&xp, &p, input_len)))
+    if (!TEST_ptr(d2i_X509_PUBKEY(&xp, &p, (long)input_len)))
         goto done;
 
     if (!TEST_ptr(X509_PUBKEY_get0(xp)))
@@ -3580,7 +3580,7 @@ static int test_X509_PUBKEY_inplace(void)
     p = kExampleBadECPubKeyDER;
     input_len = sizeof(kExampleBadECPubKeyDER);
 
-    if (!TEST_ptr(xp = d2i_X509_PUBKEY(&xp, &p, input_len)))
+    if (!TEST_ptr(xp = d2i_X509_PUBKEY(&xp, &p, (long)input_len)))
         goto done;
 
     if (!TEST_true(X509_PUBKEY_get0(xp) == NULL))
@@ -3602,7 +3602,7 @@ static int test_X509_PUBKEY_dup(void)
 
     xp = X509_PUBKEY_new_ex(testctx, testpropq);
     if (!TEST_ptr(xp)
-            || !TEST_ptr(d2i_X509_PUBKEY(&xp, &p, input_len))
+            || !TEST_ptr(d2i_X509_PUBKEY(&xp, &p, (long)input_len))
             || !TEST_ptr(xq = X509_PUBKEY_dup(xp))
             || !TEST_ptr_ne(xp, xq))
         goto done;
@@ -3617,7 +3617,7 @@ static int test_X509_PUBKEY_dup(void)
     p = kExampleBadECPubKeyDER;
     input_len = sizeof(kExampleBadECPubKeyDER);
 
-    if (!TEST_ptr(xp = d2i_X509_PUBKEY(&xp, &p, input_len))
+    if (!TEST_ptr(xp = d2i_X509_PUBKEY(&xp, &p, (long)input_len))
             || !TEST_ptr(xq = X509_PUBKEY_dup(xp)))
         goto done;
 
@@ -4434,7 +4434,7 @@ static int test_evp_iv_aes(int idx)
         goto err;
     ivlen = EVP_CIPHER_CTX_get_iv_length(ctx);
 
-    if (!TEST_int_gt(ivlen, 0))
+    if (!TEST_size_t_gt(ivlen, 0))
         goto err;
 
     if (!TEST_mem_eq(init_iv, ivlen, oiv, ivlen)
@@ -4551,7 +4551,7 @@ static int test_evp_iv_des(int idx)
         goto err;
     ivlen = EVP_CIPHER_CTX_get_iv_length(ctx);
 
-    if (!TEST_int_gt(ivlen, 0))
+    if (!TEST_size_t_gt(ivlen, 0))
         goto err;
 
     if (!TEST_mem_eq(init_iv, ivlen, oiv, ivlen)
@@ -4873,7 +4873,8 @@ static int evp_init_seq_set_iv(EVP_CIPHER_CTX *ctx, const EVP_INIT_TEST_st *t)
     int res = 0;
 
     if (t->ivlen != 0) {
-        if (!TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, t->ivlen, NULL), 0))
+        if (!TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN,
+                                             (int)t->ivlen, NULL), 0))
             goto err;
     }
     if (!TEST_true(EVP_CipherInit_ex(ctx, NULL, NULL, NULL, t->iv, -1)))
@@ -4933,14 +4934,14 @@ static int test_evp_init_seq(int idx)
         errmsg = "FINAL_ENC_INIT";
         goto err;
     }
-    if (!TEST_true(EVP_CipherUpdate(ctx, outbuf, &outlen1, t->input, t->inlen))) {
+    if (!TEST_true(EVP_CipherUpdate(ctx, outbuf, &outlen1, t->input, (int)t->inlen))) {
         errmsg = "CIPHER_UPDATE";
         goto err;
     }
     if (t->finalenc == 0 && t->tag != NULL) {
         /* Set expected tag */
         if (!TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG,
-                                           t->taglen, (void *)t->tag), 0)) {
+                                             (int)t->taglen, (void *)t->tag), 0)) {
             errmsg = "SET_TAG";
             goto err;
         }
@@ -4954,7 +4955,8 @@ static int test_evp_init_seq(int idx)
         goto err;
     }
     if (t->finalenc != 0 && t->tag != NULL) {
-        if (!TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, taglen, tag), 0)) {
+        if (!TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG,
+                                             (int)taglen, tag), 0)) {
             errmsg = "GET_TAG";
             goto err;
         }
@@ -4991,14 +4993,16 @@ static int test_evp_reinit_seq(int idx)
             /* setup cipher context */
             || !TEST_true(EVP_CipherInit_ex2(ctx, type, t->key, t->iv, t->initenc, NULL))
             /* first iteration */
-            || !TEST_true(EVP_CipherUpdate(ctx, outbuf1, &outlen1, t->input, t->inlen))
+            || !TEST_true(EVP_CipherUpdate(ctx, outbuf1, &outlen1, t->input,
+                                           (int)t->inlen))
             || !TEST_true(EVP_CipherFinal_ex(ctx, outbuf1, &outlen_final))
             /* check test results iteration 1 */
             || !TEST_mem_eq(t->expected, t->expectedlen, outbuf1, outlen1 + outlen_final)
             /* now re-init the context (same cipher, key and iv) */
             || !TEST_true(EVP_CipherInit_ex2(ctx, NULL, NULL, NULL, -1, NULL))
             /* second iteration */
-            || !TEST_true(EVP_CipherUpdate(ctx, outbuf2, &outlen2, t->input, t->inlen))
+            || !TEST_true(EVP_CipherUpdate(ctx, outbuf2, &outlen2,
+                                           t->input, (int)t->inlen))
             || !TEST_true(EVP_CipherFinal_ex(ctx, outbuf2, &outlen_final))
             /* check test results iteration 2 */
             || !TEST_mem_eq(t->expected, t->expectedlen, outbuf2, outlen2 + outlen_final))
@@ -5059,7 +5063,8 @@ static int test_evp_reset(int idx)
         errmsg = "PADDING";
         goto err;
     }
-    if (!TEST_true(EVP_CipherUpdate(ctx, outbuf, &outlen1, t->input, t->inlen))) {
+    if (!TEST_true(EVP_CipherUpdate(ctx, outbuf, &outlen1,
+                                    t->input, (int)t->inlen))) {
         errmsg = "CIPHER_UPDATE";
         goto err;
     }
@@ -5075,7 +5080,8 @@ static int test_evp_reset(int idx)
         errmsg = "CIPHER_REINIT";
         goto err;
     }
-    if (!TEST_true(EVP_CipherUpdate(ctx, outbuf, &outlen1, t->input, t->inlen))) {
+    if (!TEST_true(EVP_CipherUpdate(ctx, outbuf, &outlen1,
+                                    t->input, (int)t->inlen))) {
         errmsg = "CIPHER_UPDATE (reinit)";
         goto err;
     }
@@ -5259,7 +5265,8 @@ static int test_gcm_reinit(int idx)
         errmsg = "ENC_INIT";
         goto err;
     }
-    if (!TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, t->ivlen1, NULL), 0)) {
+    if (!TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN,
+                                         (int)t->ivlen1, NULL), 0)) {
         errmsg = "SET_IVLEN1";
         goto err;
     }
@@ -5285,7 +5292,8 @@ static int test_gcm_reinit(int idx)
         errmsg = "WRONG_RESULT1";
         goto err;
     }
-    if (!TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, taglen, tag), 0)) {
+    if (!TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG,
+                                         (int)taglen, tag), 0)) {
         errmsg = "GET_TAG1";
         goto err;
     }
@@ -5294,7 +5302,8 @@ static int test_gcm_reinit(int idx)
         goto err;
     }
     /* Now reinit */
-    if (!TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, t->ivlen2, NULL), 0)) {
+    if (!TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN,
+                                         (int)t->ivlen2, NULL), 0)) {
         errmsg = "SET_IVLEN2";
         goto err;
     }
@@ -5319,7 +5328,8 @@ static int test_gcm_reinit(int idx)
         errmsg = "WRONG_RESULT2";
         goto err;
     }
-    if (!TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, taglen, tag), 0)) {
+    if (!TEST_int_gt(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG,
+                                         (int)taglen, tag), 0)) {
         errmsg = "GET_TAG2";
         goto err;
     }
@@ -6262,9 +6272,9 @@ static int aes_gcm_encrypt(const unsigned char *gcm_key, size_t gcm_key_s,
     if (!TEST_true(EVP_EncryptInit_ex2(ctx, cipher, gcm_key, gcm_iv, params))
             || (gcm_aad != NULL
                 && !TEST_true(EVP_EncryptUpdate(ctx, NULL, &outlen,
-                                                gcm_aad, gcm_aad_s)))
+                                                gcm_aad, (int)gcm_aad_s)))
             || !TEST_true(EVP_EncryptUpdate(ctx, outbuf, &outlen,
-                                            gcm_pt, gcm_pt_s))
+                                            gcm_pt, (int)gcm_pt_s))
             || !TEST_true(EVP_EncryptFinal_ex(ctx, outbuf, &tmplen)))
         goto err;
 
@@ -6312,9 +6322,9 @@ static int aes_gcm_decrypt(const unsigned char *gcm_key, size_t gcm_key_s,
     if (!TEST_true(EVP_DecryptInit_ex2(ctx, cipher, gcm_key, gcm_iv, params))
             || (gcm_aad != NULL
                 && !TEST_true(EVP_DecryptUpdate(ctx, NULL, &outlen,
-                                                gcm_aad, gcm_aad_s)))
+                                                gcm_aad, (int)gcm_aad_s)))
             || !TEST_true(EVP_DecryptUpdate(ctx, outbuf, &outlen,
-                                            gcm_ct, gcm_ct_s))
+                                            gcm_ct, (int)gcm_ct_s))
             || !TEST_mem_eq(outbuf, outlen, gcm_pt, gcm_pt_s))
         goto err;
 
@@ -6398,7 +6408,7 @@ static int rc4_encrypt(const unsigned char *rc4_key, size_t rc4_key_s,
 
     if (!TEST_true(EVP_EncryptInit_ex2(ctx, cipher, rc4_key, NULL, params))
             || !TEST_true(EVP_EncryptUpdate(ctx, outbuf, &outlen,
-                                            rc4_pt, rc4_pt_s))
+                                            rc4_pt, (int)rc4_pt_s))
             || !TEST_true(EVP_EncryptFinal_ex(ctx, outbuf, &tmplen)))
         goto err;
 
@@ -6437,7 +6447,7 @@ static int rc4_decrypt(const unsigned char *rc4_key, size_t rc4_key_s,
 
     if (!TEST_true(EVP_DecryptInit_ex2(ctx, cipher, rc4_key, NULL, params))
             || !TEST_true(EVP_DecryptUpdate(ctx, outbuf, &outlen,
-                                            rc4_ct, rc4_ct_s))
+                                            rc4_ct, (int)rc4_ct_s))
             || !TEST_mem_eq(outbuf, outlen, rc4_pt, rc4_pt_s))
         goto err;
 
@@ -6568,8 +6578,8 @@ static int test_evp_cipher_pipeline(void)
                     || !TEST_ptr(tag_array[i] = OPENSSL_malloc(taglen)))
                     goto err;
 
-                memset(iv_array[i], i + 33, ivlen);
-                memset(plaintext_array[i], i + 1, plaintextlen);
+                memset(iv_array[i], (unsigned char)(i + 33), ivlen);
+                memset(plaintext_array[i], (unsigned char)(i + 1), plaintextlen);
                 inlen_array[i] = plaintextlen;
                 outlen_array[i] = 0;
                 ciphertextlen_array[i] = 0;
@@ -6623,10 +6633,10 @@ static int test_evp_cipher_pipeline(void)
                 if (!TEST_true(EVP_EncryptInit(ctx, cipher, key, iv_array[i]))
                     || !TEST_true(EVP_EncryptUpdate(ctx, NULL, &outlen,
                                                     plaintext_array[i],
-                                                    plaintextlen))
+                                                    (int)plaintextlen))
                     || !TEST_true(EVP_EncryptUpdate(ctx, ciphertext, &outlen,
                                                     plaintext_array[i],
-                                                    plaintextlen)))
+                                                    (int)plaintextlen)))
                     goto err;
                 ciphertextlen = outlen;
 
@@ -6676,7 +6686,7 @@ static int test_evp_cipher_pipeline(void)
                 goto err;
 
             for (i = 0; i < numpipes; i++) {
-                memset(exp_plaintext, i + 1, plaintextlen);
+                memset(exp_plaintext, (unsigned char)(i + 1), plaintextlen);
                 if (!TEST_mem_eq(plaintext_array[i], plaintextlen,
                                  exp_plaintext, plaintextlen))
                     goto err;
index 34cceb5ebfcb0cdae4414ab7e4c83bbdc3b7d709..7dab65ab1db0fd16b3ebd4d6e4b15a79fa651d13 100644 (file)
@@ -601,8 +601,8 @@ static int test_d2i_AutoPrivateKey_ex(int i)
     BIGNUM *priv_bn = NULL;
 
     p = input;
-    if (!TEST_ptr(pkey = d2i_AutoPrivateKey_ex(NULL, &p, input_len, mainctx,
-                                               NULL))
+    if (!TEST_ptr(pkey = d2i_AutoPrivateKey_ex(NULL, &p, (long)input_len,
+                                               mainctx, NULL))
             || !TEST_ptr_eq(p, input + input_len)
             || !TEST_int_eq(EVP_PKEY_get_id(pkey), expected_id))
         goto done;
@@ -759,7 +759,7 @@ static int test_d2i_PrivateKey_ex(int testid)
 
     if (!TEST_ptr(provider = OSSL_PROVIDER_load(NULL, "default")))
         goto err;
-    if (!TEST_ptr(key_bio = BIO_new_mem_buf(keydata[id].kder, keydata[id].size)))
+    if (!TEST_ptr(key_bio = BIO_new_mem_buf(keydata[id].kder, (int)keydata[id].size)))
         goto err;
     if (!TEST_ptr_null(pkey = PEM_read_bio_PrivateKey(key_bio, NULL, NULL, NULL)))
         goto err;
@@ -786,7 +786,8 @@ static int test_PEM_read_bio_negative(int testid)
     BIO *key_bio = NULL;
     EVP_PKEY *pkey = NULL;
 
-    if (!TEST_ptr(key_bio = BIO_new_mem_buf(keydata[testid].kder, keydata[testid].size)))
+    if (!TEST_ptr(key_bio = BIO_new_mem_buf(keydata[testid].kder,
+                                            (int)keydata[testid].size)))
         goto err;
     ERR_clear_error();
     if (!TEST_ptr_null(pkey = PEM_read_bio_PrivateKey(key_bio, NULL, NULL, NULL)))
@@ -1058,7 +1059,7 @@ static int do_check_bn(OSSL_PARAM params[], const char *key,
 
     ret = TEST_ptr(p = OSSL_PARAM_locate(params, key))
           && TEST_true(OSSL_PARAM_get_BN(p, &bn))
-          && TEST_int_gt(len = BN_bn2binpad(bn, buffer, expected_len), 0)
+          && TEST_int_gt(len = BN_bn2binpad(bn, buffer, (int)expected_len), 0)
           && TEST_mem_eq(expected, expected_len, buffer, len);
     BN_free(bn);
     return ret;
@@ -1216,7 +1217,7 @@ static int test_pkey_todata_null(void)
     int ret = 0;
     const unsigned char *pdata = keydata[0].kder;
 
-    ret = TEST_ptr(pkey = d2i_AutoPrivateKey_ex(NULL, &pdata, keydata[0].size,
+    ret = TEST_ptr(pkey = d2i_AutoPrivateKey_ex(NULL, &pdata, (long)keydata[0].size,
                                                 mainctx, NULL))
           && TEST_int_eq(EVP_PKEY_todata(NULL, EVP_PKEY_KEYPAIR, &params), 0)
           && TEST_int_eq(EVP_PKEY_todata(pkey, EVP_PKEY_KEYPAIR, NULL), 0);
@@ -1239,7 +1240,7 @@ static int test_pkey_export_null(void)
     int ret = 0;
     const unsigned char *pdata = keydata[0].kder;
 
-    ret = TEST_ptr(pkey = d2i_AutoPrivateKey_ex(NULL, &pdata, keydata[0].size,
+    ret = TEST_ptr(pkey = d2i_AutoPrivateKey_ex(NULL, &pdata, (long)keydata[0].size,
                                                 mainctx, NULL))
           && TEST_int_eq(EVP_PKEY_export(NULL, EVP_PKEY_KEYPAIR,
                                          test_pkey_export_cb, NULL), 0)
@@ -1256,7 +1257,7 @@ static int test_pkey_export(void)
 #endif
     int ret = 1;
     const unsigned char *pdata = keydata[0].kder;
-    int pdata_len = keydata[0].size;
+    int pdata_len = (int)keydata[0].size;
 
     if (!TEST_ptr(pkey = d2i_AutoPrivateKey_ex(NULL, &pdata, pdata_len,
                                                mainctx, NULL))
@@ -1270,7 +1271,7 @@ static int test_pkey_export(void)
 #ifndef OPENSSL_NO_DEPRECATED_3_0
     /* Now, try with a legacy key */
     pdata = keydata[0].kder;
-    pdata_len = keydata[0].size;
+    pdata_len = (int)keydata[0].size;
     if (!TEST_ptr(pkey = EVP_PKEY_new())
         || !TEST_ptr(rsa = d2i_RSAPrivateKey(NULL, &pdata, pdata_len))
         || !TEST_true(EVP_PKEY_set1_RSA(pkey, rsa))
@@ -1304,13 +1305,13 @@ static int test_rsa_pss_sign(void)
                                                      (char *)mdname, 0);
     sig_params[2] = OSSL_PARAM_construct_end();
 
-    ret = TEST_ptr(pkey = d2i_AutoPrivateKey_ex(NULL, &pdata, keydata[0].size,
+    ret = TEST_ptr(pkey = d2i_AutoPrivateKey_ex(NULL, &pdata, (long)keydata[0].size,
                                                 mainctx, NULL))
           && TEST_ptr(pctx = EVP_PKEY_CTX_new_from_pkey(mainctx, pkey, NULL))
           && TEST_int_gt(EVP_PKEY_sign_init_ex(pctx, sig_params), 0)
           && TEST_int_gt(EVP_PKEY_sign(pctx, NULL, &sig_len, mdbuf,
                                        sizeof(mdbuf)), 0)
-          && TEST_int_gt(sig_len, 0)
+          && TEST_size_t_gt(sig_len, 0)
           && TEST_ptr(sig = OPENSSL_malloc(sig_len))
           && TEST_int_gt(EVP_PKEY_sign(pctx, sig, &sig_len, mdbuf,
                                        sizeof(mdbuf)), 0);
index 876d6ccc0a3d9c2ddf04f5ed341a101635cc842c..71b59034bf6c4a2a715bfd23ff512baa68613b61 100644 (file)
@@ -270,7 +270,7 @@ static int encrypt_decrypt(const EVP_CIPHER *cipher, const unsigned char *msg,
     memset(key, 0, sizeof(key));
     if (!TEST_ptr(ctx = EVP_CIPHER_CTX_new())
             || !TEST_true(EVP_CipherInit_ex(ctx, cipher, NULL, key, NULL, 1))
-            || !TEST_true(EVP_CipherUpdate(ctx, ct, &ctlen, msg, len))
+            || !TEST_true(EVP_CipherUpdate(ctx, ct, &ctlen, msg, (int)len))
             || !TEST_true(EVP_CipherFinal_ex(ctx, ct, &ctlen))
             || !TEST_true(EVP_CipherInit_ex(ctx, cipher, NULL, key, NULL, 0))
             || !TEST_true(EVP_CipherUpdate(ctx, pt, &ptlen, ct, ctlen))
index 706460170b98302a5581b2c5eb736de65e21d236..6a3a44e14b64a328f240a50b035de9e77d04f595 100644 (file)
@@ -561,7 +561,7 @@ static int rsa_keygen(int bits, EVP_PKEY **pub, EVP_PKEY **priv)
         || !TEST_true(OSSL_ENCODER_to_data(ectx, &pub_der, &len)))
         goto err;
     pp = pub_der;
-    if (!TEST_ptr(d2i_PublicKey(EVP_PKEY_RSA, pub, &pp, len)))
+    if (!TEST_ptr(d2i_PublicKey(EVP_PKEY_RSA, pub, &pp, (long)len)))
         goto err;
     ret = 1;
 err:
@@ -591,8 +591,8 @@ static int kem_rsa_gen_recover(void)
           && TEST_int_eq(EVP_PKEY_encapsulate(dctx, NULL, NULL, NULL, NULL), 0)
           && TEST_int_eq(EVP_PKEY_encapsulate(dctx, NULL, &ctlen, NULL,
                                               &secretlen), 1)
-          && TEST_int_eq(ctlen, secretlen)
-          && TEST_int_eq(ctlen, bits / 8)
+          && TEST_size_t_eq(ctlen, secretlen)
+          && TEST_size_t_eq(ctlen, bits / 8)
           && TEST_int_eq(EVP_PKEY_encapsulate(dctx, ct, &ctlen, secret,
                                               &secretlen), 1)
           && TEST_ptr(rctx = EVP_PKEY_CTX_new_from_pkey(libctx, priv, NULL))
@@ -721,7 +721,7 @@ static int kem_rsa_params(void)
         && TEST_int_eq(EVP_PKEY_CTX_set_kem_op(privctx, "RSASVE"), 1)
         && TEST_int_eq(EVP_PKEY_decapsulate(privctx, secret, NULL, ct, sizeof(ct)), 1)
         && TEST_int_eq(EVP_PKEY_decapsulate(privctx, NULL, &secretlen, ct, sizeof(ct)), 1)
-        && TEST_int_eq(secretlen, 256)
+        && TEST_size_t_eq(secretlen, 256)
         /* Fail if passed NULL arguments */
         && TEST_int_eq(EVP_PKEY_decapsulate(privctx, NULL, NULL, ct, sizeof(ct)), 0)
         && TEST_int_eq(EVP_PKEY_decapsulate(privctx, secret, &secretlen, NULL, 0), 0)
index 1a8f93a6208cd81c67c80a693c01520f852e1a09..fb11a0215dd96a5e3eb8c95c9288a3b91cac24f0 100644 (file)
@@ -471,7 +471,8 @@ static int test_ec_dhkem_derivekey(int tstid)
     const TEST_DERIVEKEY_DATA *t = &ec_derivekey_data[tstid];
     unsigned char pubkey[133];
     unsigned char privkey[66];
-    size_t pubkeylen = 0, privkeylen = 0;
+    size_t pubkeylen = 0;
+    int privkeylen = 0;
     BIGNUM *priv = NULL;
 
     params[0] = OSSL_PARAM_construct_utf8_string(OSSL_PKEY_PARAM_GROUP_NAME,
index df30982c23a09a1b057c40082d8dcfff5a2a07a1..a355fd5cc531913b5150a32189993e21141c1fed 100644 (file)
@@ -840,8 +840,8 @@ static int digest_test_run(EVP_TEST *t)
         if (!test_duplicate_md_ctx(t, EVP_MD_CTX_dup(mctx)))
             goto err;
 
-        got_len = expected->output_len;
-        if (!EVP_DigestFinalXOF(mctx, got, got_len)) {
+        got_len = (unsigned int)expected->output_len;
+        if (!EVP_DigestFinalXOF(mctx, got, expected->output_len)) {
             t->err = "DIGESTFINALXOF_ERROR";
             goto err;
         }
@@ -851,7 +851,7 @@ static int digest_test_run(EVP_TEST *t)
             goto err;
         }
     }
-    if (!TEST_int_eq(expected->output_len, got_len)) {
+    if (!TEST_size_t_eq(expected->output_len, got_len)) {
         t->err = "DIGEST_LENGTH_MISMATCH";
         goto err;
     }
@@ -1181,7 +1181,7 @@ static int cipher_test_enc(EVP_TEST *t, int enc, size_t out_misalign,
     if (expected->iv) {
         if (expected->aead) {
             if (EVP_CIPHER_CTX_ctrl(ctx_base, EVP_CTRL_AEAD_SET_IVLEN,
-                                     expected->iv_len, 0) <= 0) {
+                                    (int)expected->iv_len, 0) <= 0) {
                 t->err = "INVALID_IV_LENGTH";
                 goto err;
             }
@@ -1205,7 +1205,7 @@ static int cipher_test_enc(EVP_TEST *t, int enc, size_t out_misalign,
         }
         if (tag || expected->aead != EVP_CIPH_GCM_MODE) {
             if (EVP_CIPHER_CTX_ctrl(ctx_base, EVP_CTRL_AEAD_SET_TAG,
-                                     expected->tag_len, tag) <= 0)
+                                    (int)expected->tag_len, tag) <= 0)
                 goto err;
         }
     }
@@ -1219,7 +1219,7 @@ static int cipher_test_enc(EVP_TEST *t, int enc, size_t out_misalign,
         }
     }
 
-    if (!EVP_CIPHER_CTX_set_key_length(ctx_base, expected->key_len)) {
+    if (!EVP_CIPHER_CTX_set_key_length(ctx_base, (int)expected->key_len)) {
         t->err = "INVALID_KEY_LENGTH";
         goto err;
     }
@@ -1309,7 +1309,7 @@ static int cipher_test_enc(EVP_TEST *t, int enc, size_t out_misalign,
     }
 
     if (expected->aead == EVP_CIPH_CCM_MODE) {
-        if (!EVP_CipherUpdate(ctx, NULL, &tmplen, NULL, out_len)) {
+        if (!EVP_CipherUpdate(ctx, NULL, &tmplen, NULL, (int)out_len)) {
             t->err = "CCM_PLAINTEXT_LENGTH_SET_ERROR";
             goto err;
         }
@@ -1323,13 +1323,13 @@ static int cipher_test_enc(EVP_TEST *t, int enc, size_t out_misalign,
                 donelen = 0;
 
                 do {
-                    size_t current_aad_len = (size_t) data_chunk_size;
+                    size_t current_aad_len = (size_t)data_chunk_size;
 
-                    if (data_chunk_size == 0 || (size_t) data_chunk_size > aad_len)
+                    if (data_chunk_size == 0 || current_aad_len > aad_len)
                         current_aad_len = aad_len;
                     if (!EVP_CipherUpdate(ctx, NULL, &chunklen,
                                           expected->aad[i] + donelen,
-                                          current_aad_len))
+                                          (int)current_aad_len))
                         goto err;
                     donelen += current_aad_len;
                     aad_len -= current_aad_len;
@@ -1346,7 +1346,7 @@ static int cipher_test_enc(EVP_TEST *t, int enc, size_t out_misalign,
                 if (expected->aad_len[i] > 2) {
                     if (!EVP_CipherUpdate(ctx, NULL, &chunklen,
                                           expected->aad[i] + donelen,
-                                          expected->aad_len[i] - 2))
+                                          (int)(expected->aad_len[i] - 2)))
                         goto err;
                     donelen += expected->aad_len[i] - 2;
                 }
@@ -1379,13 +1379,13 @@ static int cipher_test_enc(EVP_TEST *t, int enc, size_t out_misalign,
     } else if (!enc && (expected->aead == EVP_CIPH_OCB_MODE
                         || expected->tag_late)) {
         if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG,
-                                expected->tag_len, expected->tag) <= 0) {
+                                (int)expected->tag_len, expected->tag) <= 0) {
             t->err = "TAG_SET_ERROR";
             goto err;
         }
     } else if (!enc && expected->mac_key && expected->tag) {
         if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG,
-                                expected->tag_len, expected->tag) <= 0) {
+                                (int)expected->tag_len, expected->tag) <= 0) {
             t->err = "TAG_SET_ERROR";
             goto err;
         }
@@ -1408,12 +1408,12 @@ static int cipher_test_enc(EVP_TEST *t, int enc, size_t out_misalign,
     if (!frag) {
         do {
             /* Supply the data all in one go or according to data_chunk_size */
-            size_t current_in_len = (size_t) data_chunk_size;
+            size_t current_in_len = (size_t)data_chunk_size;
 
-            if (data_chunk_size == 0 || (size_t) data_chunk_size > in_len)
+            if (data_chunk_size == 0 || current_in_len > in_len)
                 current_in_len = in_len;
             if (!EVP_CipherUpdate(ctx, tmp + out_misalign + tmplen, &chunklen,
-                                  in, current_in_len))
+                                  in, (int)current_in_len))
                 goto err;
             tmplen += chunklen;
             in += current_in_len;
@@ -1430,7 +1430,7 @@ static int cipher_test_enc(EVP_TEST *t, int enc, size_t out_misalign,
         }
         if (in_len > 1) {
             if (!EVP_CipherUpdate(ctx, tmp + out_misalign + tmplen, &chunklen,
-                                  in, in_len - 1))
+                                  in, (int)(in_len - 1)))
                 goto err;
             tmplen += chunklen;
             in += in_len - 1;
@@ -1456,7 +1456,7 @@ static int cipher_test_enc(EVP_TEST *t, int enc, size_t out_misalign,
         if (expected->tls_version >= TLS1_1_VERSION
             && (EVP_CIPHER_is_a(expected->cipher, "AES-128-CBC-HMAC-SHA1")
                 || EVP_CIPHER_is_a(expected->cipher, "AES-256-CBC-HMAC-SHA1"))) {
-            tmplen -= expected->iv_len;
+            tmplen -= (int)expected->iv_len;
             expected_out += expected->iv_len;
             out_misalign += expected->iv_len;
         }
@@ -1474,7 +1474,7 @@ static int cipher_test_enc(EVP_TEST *t, int enc, size_t out_misalign,
             goto err;
         }
         if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG,
-                                 expected->tag_len, rtag) <= 0) {
+                                (int)expected->tag_len, rtag) <= 0) {
             t->err = "TAG_RETRIEVE_ERROR";
             goto err;
         }
@@ -3362,10 +3362,10 @@ static int pbe_test_run(EVP_TEST *t)
         goto err;
     }
     if (expected->pbe_type == PBE_TYPE_PBKDF2) {
-        if (PKCS5_PBKDF2_HMAC((char *)expected->pass, expected->pass_len,
-                              expected->salt, expected->salt_len,
+        if (PKCS5_PBKDF2_HMAC((char *)expected->pass, (int)expected->pass_len,
+                              expected->salt, (int)expected->salt_len,
                               expected->iter, expected->md,
-                              expected->key_len, key) == 0) {
+                              (int)expected->key_len, key) == 0) {
             t->err = "PBKDF2_ERROR";
             goto err;
         }
@@ -3386,9 +3386,9 @@ static int pbe_test_run(EVP_TEST *t)
             t->err = "PKCS12_ERROR";
             goto err;
         }
-        if (PKCS12_key_gen_uni(expected->pass, expected->pass_len,
-                               expected->salt, expected->salt_len,
-                               expected->id, expected->iter, expected->key_len,
+        if (PKCS12_key_gen_uni(expected->pass, (int)expected->pass_len,
+                               expected->salt, (int)expected->salt_len,
+                               expected->id, expected->iter, (int)expected->key_len,
                                key, fetched_digest) == 0) {
             t->err = "PKCS12_ERROR";
             goto err;
@@ -3509,13 +3509,13 @@ static int encode_test_run(EVP_TEST *t)
         donelen = 0;
         output_len = 0;
         do {
-            size_t current_len = (size_t) data_chunk_size;
+            size_t current_len = (size_t)data_chunk_size;
 
-            if (data_chunk_size == 0 || (size_t) data_chunk_size > input_len)
+            if (data_chunk_size == 0 || current_len > input_len)
                 current_len = input_len;
             if (!TEST_true(EVP_EncodeUpdate(encode_ctx, encode_out, &chunk_len,
                                             expected->input + donelen,
-                                            current_len)))
+                                            (int)current_len)))
                 goto err;
             donelen += current_len;
             input_len -= current_len;
@@ -3551,7 +3551,7 @@ static int encode_test_run(EVP_TEST *t)
         if (data_chunk_size == 0 || (size_t) data_chunk_size > input_len)
             current_len = input_len;
         if (EVP_DecodeUpdate(decode_ctx, decode_out + output_len, &chunk_len,
-                                expected->output + donelen, current_len) < 0) {
+                                expected->output + donelen, (int)current_len) < 0) {
             t->err = "DECODE_ERROR";
             goto err;
         }
@@ -5560,7 +5560,7 @@ int setup_tests(void)
     if (n == 0)
         return 0;
 
-    ADD_ALL_TESTS(run_file_tests, n);
+    ADD_ALL_TESTS(run_file_tests, (int)n);
     return 1;
 }
 
index 42d358b638b4fec641e0ddcd782d52b8a37876dd..2e05116fad812c2a9db3fa60e93aa5070d465a69 100644 (file)
@@ -261,7 +261,7 @@ static int shake_kat_digestfinal_xoflen_test(void)
 
     if (!TEST_int_eq(EVP_MD_CTX_size(ctx), -1)
         || !TEST_int_eq(EVP_MD_CTX_set_params(ctx, params), 1)
-        || !TEST_int_eq(EVP_MD_CTX_size(ctx), sz)
+        || !TEST_int_eq(EVP_MD_CTX_size(ctx), (int)sz)
         || !TEST_int_eq(EVP_MD_get_size(md), 0)
         || !TEST_true(EVP_MD_xof(md))
         || !TEST_true(EVP_DigestUpdate(ctx, shake256_input,
index 46fc9104ef955dcaa542f00403be1655f20e2bb5..dab604419fc3fc2223b410234589c17406c844e3 100644 (file)
@@ -355,7 +355,7 @@ static int fake_rsa_sig_sign(void *ctx, unsigned char *sig,
     *siglen = 256;
     /* record that the real sign operation was called */
     if (sig != NULL) {
-        if (!TEST_int_ge(sigsize, *siglen))
+        if (!TEST_size_t_ge(sigsize, *siglen))
             return 0;
         *sigctx = 2;
         /* produce a fake signature */
@@ -468,7 +468,7 @@ static int fake_rsa_dgstsgnvfy_final(void *ctx, unsigned char *sig,
         *siglen = 256;
         /* record that the real sign operation was called */
         if (sig != NULL) {
-            if (!TEST_int_ge(sigsize, *siglen))
+            if (!TEST_size_t_ge(sigsize, *siglen))
                 return 0;
             /* produce a fake signature */
             memset(sig, 'a', *siglen);
index 30930d9ce8a59c45a862a2aaf101f710eedf8964..4304039b0a116d8a58206fa7cc95a558cd148fed 100644 (file)
@@ -69,7 +69,7 @@ static int test_fatalerr(void)
         TEST_error("Unexpected success reading data: %s\n", buf);
         goto err;
     }
-    if (!TEST_int_le(SSL_write(sssl, msg, strlen(msg)), 0))
+    if (!TEST_int_le(SSL_write(sssl, msg, (int)strlen(msg)), 0))
         goto err;
 
     ret = 1;
index dd23bb51e508d9f7b9b0d338aee20af074b92f7a..712262cc6f1bc211b24ef67904d9b0ba4ae24d5a 100644 (file)
@@ -45,7 +45,7 @@ int setup_tests(void)
 {
     char *config_file = NULL;
     OPTION_CHOICE o;
-    int n;
+    size_t n;
 
     while ((o = opt_next()) != OPT_EOF) {
         switch (o) {
@@ -67,7 +67,7 @@ int setup_tests(void)
     if (n == 0)
         return 0;
 
-    ADD_ALL_TESTS(test_fips_version, n);
+    ADD_ALL_TESTS(test_fips_version, (int)n);
     return 1;
 }
 
index 64eb6ae4410920573412c79833eda8786c62b9e5..c312042c698ceb530d649879e63a63e03adc3ba9 100644 (file)
@@ -372,14 +372,14 @@ static int parse_protos(const char *protos, unsigned char **out, size_t *outlen)
     i = prefix + 1;
     while (i <= len) {
         if ((*out)[i] == ',') {
-            if (!TEST_int_gt(i - 1, prefix))
+            if (!TEST_size_t_gt(i - 1, prefix))
                 goto err;
             (*out)[prefix] = (unsigned char)(i - 1 - prefix);
             prefix = i;
         }
         i++;
     }
-    if (!TEST_int_gt(len, prefix))
+    if (!TEST_size_t_gt(len, prefix))
         goto err;
     (*out)[prefix] = (unsigned char)(len - prefix);
     return 1;
@@ -406,7 +406,7 @@ static int client_npn_cb(SSL *s, unsigned char **out, unsigned char *outlen,
 
     ret = SSL_select_next_proto(out, outlen, in, inlen,
                                 ctx_data->npn_protocols,
-                                ctx_data->npn_protocols_len);
+                                (unsigned int)ctx_data->npn_protocols_len);
     /* Accept both OPENSSL_NPN_NEGOTIATED and OPENSSL_NPN_NO_OVERLAP. */
     return TEST_true(ret == OPENSSL_NPN_NEGOTIATED || ret == OPENSSL_NPN_NO_OVERLAP)
         ? SSL_TLSEXT_ERR_OK : SSL_TLSEXT_ERR_ALERT_FATAL;
@@ -417,7 +417,7 @@ static int server_npn_cb(SSL *s, const unsigned char **data,
 {
     CTX_DATA *ctx_data = (CTX_DATA*)(arg);
     *data = ctx_data->npn_protocols;
-    *len = ctx_data->npn_protocols_len;
+    *len = (unsigned int)ctx_data->npn_protocols_len;
     return SSL_TLSEXT_ERR_OK;
 }
 #endif
@@ -445,7 +445,7 @@ static int server_alpn_cb(SSL *s, const unsigned char **out,
      */
     ret = SSL_select_next_proto(&tmp_out, outlen,
                                 ctx_data->alpn_protocols,
-                                ctx_data->alpn_protocols_len, in, inlen);
+                                (unsigned int)ctx_data->alpn_protocols_len, in, inlen);
 
     *out = tmp_out;
     /* Unlike NPN, we don't tolerate a mismatch. */
@@ -498,7 +498,7 @@ static int configure_handshake_ctx(SSL_CTX *server_ctx, SSL_CTX *server2_ctx,
                                    CTX_DATA *client_ctx_data)
 {
     unsigned char *ticket_keys;
-    size_t ticket_key_len;
+    long ticket_key_len;
 
     if (!TEST_int_eq(SSL_CTX_set_max_send_fragment(server_ctx,
                                                    test->max_fragment_size), 1))
@@ -640,7 +640,7 @@ static int configure_handshake_ctx(SSL_CTX *server_ctx, SSL_CTX *server2_ctx,
                                     &alpn_protos, &alpn_protos_len))
                 /* Reversed return value convention... */
                 || !TEST_int_eq(SSL_CTX_set_alpn_protos(client_ctx, alpn_protos,
-                                                        alpn_protos_len), 0))
+                                                        (unsigned int)alpn_protos_len), 0))
             goto err;
         OPENSSL_free(alpn_protos);
     }
@@ -670,9 +670,9 @@ static int configure_handshake_ctx(SSL_CTX *server_ctx, SSL_CTX *server2_ctx,
      */
     ticket_key_len = SSL_CTX_set_tlsext_ticket_keys(server_ctx, NULL, 0);
     if (!TEST_ptr(ticket_keys = OPENSSL_zalloc(ticket_key_len))
-            || !TEST_int_eq(SSL_CTX_set_tlsext_ticket_keys(server_ctx,
-                                                           ticket_keys,
-                                                           ticket_key_len), 1)) {
+            || !TEST_long_eq(SSL_CTX_set_tlsext_ticket_keys(server_ctx,
+                                                            ticket_keys,
+                                                            ticket_key_len), 1)) {
         OPENSSL_free(ticket_keys);
         goto err;
     }
index e31018d9fa022a1c97714b622e66089351efa808..7b29a91dd6183296ff11207dba1e9f33324ab9ee 100644 (file)
@@ -172,7 +172,7 @@ static void generate_p12(PKCS12_BUILDER *pb, const PKCS12_ENC *mac)
         else
             md = EVP_MD_fetch(test_ctx, OBJ_nid2sn(mac->nid), test_propq);
 
-        if (!TEST_true(PKCS12_set_mac(p12, mac->pass, strlen(mac->pass),
+        if (!TEST_true(PKCS12_set_mac(p12, mac->pass, (int)strlen(mac->pass),
                                       NULL, 0, mac->iter, md))) {
             pb->success = 0;
             goto err;
@@ -262,7 +262,7 @@ err:
 static int check_p12_mac(PKCS12 *p12, const PKCS12_ENC *mac)
 {
     return TEST_true(PKCS12_mac_present(p12))
-        && TEST_true(PKCS12_verify_mac(p12, mac->pass, strlen(mac->pass)));
+        && TEST_true(PKCS12_verify_mac(p12, mac->pass, (int)strlen(mac->pass)));
 }
 
 
@@ -319,7 +319,7 @@ static STACK_OF(PKCS12_SAFEBAG) *decode_contentinfo(STACK_OF(PKCS7) *safes, int
     if (enc) {
         if (!TEST_int_eq(bagnid, NID_pkcs7_encrypted))
             goto err;
-        bags = PKCS12_unpack_p7encdata(p7, enc->pass, strlen(enc->pass));
+        bags = PKCS12_unpack_p7encdata(p7, enc->pass, (int)strlen(enc->pass));
     } else {
         if (!TEST_int_eq(bagnid, NID_pkcs7_data))
             goto err;
@@ -358,7 +358,7 @@ static int add_attributes(PKCS12_SAFEBAG *bag, const PKCS12_ATTR *attr)
                 goto err;
         } else if (attr_nid == NID_localKeyID) {
             if (!TEST_true(PKCS12_add_localkeyid(bag, (unsigned char *)p_attr->value,
-                                                 strlen(p_attr->value))))
+                                                 (int)strlen(p_attr->value))))
                 goto err;
         } else if (attr_nid == NID_oracle_jdk_trustedkeyusage) {
             attrs = (STACK_OF(X509_ATTRIBUTE)*)PKCS12_SAFEBAG_get0_attrs(bag);
@@ -370,7 +370,7 @@ static int add_attributes(PKCS12_SAFEBAG *bag, const PKCS12_ATTR *attr)
             /* Custom attribute values limited to ASCII in these tests */
             if (!TEST_true(PKCS12_add1_attr_by_txt(bag, p_attr->oid, MBSTRING_ASC,
                                                    (unsigned char *)p_attr->value,
-                                                   strlen(p_attr->value))))
+                                                   (int)strlen(p_attr->value))))
                 goto err;
         }
         p_attr++;
@@ -456,7 +456,8 @@ void add_secretbag(PKCS12_BUILDER *pb, int secret_nid, const char *secret,
 
     TEST_info("Adding secret <%s>", secret);
 
-    bag = PKCS12_add_secret(&pb->bags, secret_nid, (const unsigned char *)secret, strlen(secret));
+    bag = PKCS12_add_secret(&pb->bags, secret_nid,
+                            (const unsigned char *)secret, (int)strlen(secret));
     if (!TEST_ptr(bag)) {
         pb->success = 0;
         return;
@@ -614,9 +615,10 @@ void check_keybag(PKCS12_BUILDER *pb, const unsigned char *bytes, int len,
 
     case NID_pkcs8ShroudedKeyBag:
         if (legacy)
-            p8 = PKCS12_decrypt_skey(bag, enc->pass, strlen(enc->pass));
+            p8 = PKCS12_decrypt_skey(bag, enc->pass, (int)strlen(enc->pass));
         else
-            p8 = PKCS12_decrypt_skey_ex(bag, enc->pass, strlen(enc->pass), test_ctx, test_propq);
+            p8 = PKCS12_decrypt_skey_ex(bag, enc->pass, (int)strlen(enc->pass),
+                                        test_ctx, test_propq);
         if (!TEST_ptr(p8)) {
             pb->success = 0;
             goto err;
index 4bdadc41432b1179334b6ae549f27330f89edc43..bde12b09ca681a33d5d10762ba36a4436567ca16 100644 (file)
@@ -53,11 +53,11 @@ static EVP_PKEY *get_dh_from_pg(OSSL_LIB_CTX *libctx, const char *type,
     EVP_PKEY *dhpkey = NULL;
     BIGNUM *p = NULL, *g = NULL, *q = NULL;
 
-    p = BN_bin2bn(pdata, plen, NULL);
-    g = BN_bin2bn(gdata, glen, NULL);
+    p = BN_bin2bn(pdata, (int)plen, NULL);
+    g = BN_bin2bn(gdata, (int)glen, NULL);
     if (p == NULL || g == NULL)
         goto err;
-    if (qdata != NULL && (q = BN_bin2bn(qdata, qlen, NULL)) == NULL)
+    if (qdata != NULL && (q = BN_bin2bn(qdata, (int)qlen, NULL)) == NULL)
         goto err;
 
     dhpkey = get_dh_from_pg_bn(libctx, type, p, g, q);
index 420d3b5acd584fc46be5c3a001f0c358f32cb091..549eb5f0599ce792549893b2cd00d6f3be2cd838 100644 (file)
@@ -811,7 +811,7 @@ static int packet_plain_mutate(const QUIC_PKT_HDR *hdrin,
      * 14 long header (we assume token length is 0,
      * which is fine for server not so fine for client)
      */
-    grow_allowance = 1200 - bufsz - 16 - 14;
+    grow_allowance = 1200 - (int)bufsz - 16 - 14;
     grow_allowance -= hdrin->dst_conn_id.id_len;
     grow_allowance -= hdrin->src_conn_id.id_len;
     assert(grow_allowance >= 0);
@@ -1168,7 +1168,7 @@ static int pcipher_sendmmsg(BIO *b, BIO_MSG *msg, size_t stride,
                             size_t *num_processed)
 {
     BIO *next = BIO_next(b);
-    ossl_ssize_t ret = 0;
+    int ret = 0;
     size_t i = 0, tmpnump;
     QUIC_PKT_HDR hdr;
     PACKET pkt;
index 56d526f7525e0aca0072235b825528a84d7aca42..c5120c2dafca555a0067912e553d69ccf83663d7 100644 (file)
@@ -250,7 +250,7 @@ static int tls_dump_gets(BIO *bio, char *buf, int size)
 
 static int tls_dump_puts(BIO *bio, const char *str)
 {
-    return tls_dump_write(bio, str, strlen(str));
+    return tls_dump_write(bio, str, (int)strlen(str));
 }
 
 
@@ -620,7 +620,7 @@ int mempacket_test_inject(BIO *bio, const char *in, int inl, int pktnum,
          */
         if (duprec && i != 2) {
             memcpy(thispkt->data, in + len, inl - len);
-            thispkt->len = inl - len;
+            thispkt->len = inl - (int)len;
         } else {
             memcpy(thispkt->data, in, inl);
             thispkt->len = inl;
@@ -748,7 +748,7 @@ static int mempacket_test_gets(BIO *bio, char *buf, int size)
 
 static int mempacket_test_puts(BIO *bio, const char *str)
 {
-    return mempacket_test_write(bio, str, strlen(str));
+    return mempacket_test_write(bio, str, (int)strlen(str));
 }
 
 static int always_retry_new(BIO *bi);
@@ -1415,7 +1415,7 @@ int create_ssl_connection_ex(SSL *serverssl, SSL *clientssl, int want,
      */
     for (i = 0; i < 2; i++) {
         if (SSL_read_ex(clientssl, &buf, sizeof(buf), &readbytes) > 0) {
-            if (!TEST_ulong_eq(readbytes, 0))
+            if (!TEST_size_t_eq(readbytes, 0))
                 return 0;
         } else if (!TEST_int_eq(SSL_get_error(clientssl, 0),
                                 SSL_ERROR_WANT_READ)) {
index 050db5b223a8502db617468caaf9c217deba3a8b..66463002ac3ba55c6a1fa5fe3adba7d438601029 100644 (file)
@@ -71,7 +71,7 @@ static int mock_http_server(BIO *in, BIO *out, char version, int keep_alive,
     hdr = strchr(hdr, ' ');
     if (hdr == NULL)
         return 0;
-    len = strlen("HTTP/1.");
+    len = (int)strlen("HTTP/1.");
     if (!TEST_strn_eq(++hdr, "HTTP/1.", len))
         return 0;
     hdr += len;
@@ -81,7 +81,7 @@ static int mock_http_server(BIO *in, BIO *out, char version, int keep_alive,
     if (!TEST_char_eq(*hdr++, '\r') || !TEST_char_eq(*hdr++, '\n'))
         return 0;
 
-    count -= (hdr - req);
+    count -= (long)(hdr - req);
     if (count < 0 || out == NULL)
         return 0;
 
@@ -107,7 +107,7 @@ static int mock_http_server(BIO *in, BIO *out, char version, int keep_alive,
 
     if (is_get) { /* construct new header and body */
         if (txt != NULL)
-            len = strlen(txt);
+            len = (int)strlen(txt);
         else if ((len = ASN1_item_i2d(rsp, NULL, it)) <= 0)
             return 0;
         if (BIO_printf(out, "Content-Type: %s\r\n"
index f6d73d9d783c5589c9598d8a4b101c7e17f0cb2d..fd9985d70f038f0fd65b1aedf810ec4d4594cfd0 100644 (file)
@@ -77,7 +77,7 @@ static int test_idea_cbc(void)
 {
     IDEA_KEY_SCHEDULE key, dkey;
     unsigned char iv[IDEA_BLOCK];
-    const size_t text_len = sizeof(text);
+    const long text_len = sizeof(text);
 
     IDEA_set_encrypt_key(k, &key);
     IDEA_set_decrypt_key(&key, &dkey);
index 7a8ff6880270c61eee5b5e87df0fdacea402d379..ffcd4166acb93708a5882f8b8d6b11450c612694 100644 (file)
@@ -154,7 +154,7 @@ static int test_ige_vectors(int n)
     unsigned char iv[AES_BLOCK_SIZE * 2];
     int testresult = 1;
 
-    if (!TEST_int_le(v->length, MAX_VECTOR_SIZE))
+    if (!TEST_size_t_le(v->length, MAX_VECTOR_SIZE))
         return 0;
 
     if (v->encrypt == AES_ENCRYPT)
@@ -195,15 +195,15 @@ static int test_bi_ige_vectors(int n)
     AES_KEY key2;
     unsigned char buf[MAX_VECTOR_SIZE];
 
-        if (!TEST_int_le(v->length, MAX_VECTOR_SIZE))
+        if (!TEST_size_t_le(v->length, MAX_VECTOR_SIZE))
             return 0;
 
     if (v->encrypt == AES_ENCRYPT) {
-        AES_set_encrypt_key(v->key1, 8 * v->keysize, &key1);
-        AES_set_encrypt_key(v->key2, 8 * v->keysize, &key2);
+        AES_set_encrypt_key(v->key1, (int)(8 * v->keysize), &key1);
+        AES_set_encrypt_key(v->key2, (int)(8 * v->keysize), &key2);
     } else {
-        AES_set_decrypt_key(v->key1, 8 * v->keysize, &key1);
-        AES_set_decrypt_key(v->key2, 8 * v->keysize, &key2);
+        AES_set_decrypt_key(v->key1, (int)(8 * v->keysize), &key1);
+        AES_set_decrypt_key(v->key2, (int)(8 * v->keysize), &key2);
     }
 
     AES_bi_ige_encrypt(v->in, buf, v->length, &key1, &key2, v->iv,
index 8d5aa22dab3ec84644c4c6d15a6dcb5672defa00..77f9dffe5237f0b9ffd2862bd1467b5006b0940a 100644 (file)
@@ -246,7 +246,7 @@ static int test_pass_rsa(FIXTURE *fixture)
          */
 
         for (i = 0; i < OSSL_NELEM(expected); i++) {
-            int rv = TEST_int_eq(expected[i], keydata[i]);
+            int rv = TEST_uint64_t_eq((uint64_t)expected[i], (uint64_t)keydata[i]);
 
             if (!rv)
                 TEST_info("i = %zu", i);
index 94e9f3944ea5e680b104169a40c549c4be36bd4e..8828211332591ea85e6a912031e79e3067b9473d 100644 (file)
@@ -109,7 +109,7 @@ static int test_int_lhash(void)
         }
 
     /* num_items */
-    if (!TEST_int_eq((size_t)lh_int_num_items(h), n_int_tests))
+    if (!TEST_size_t_eq((size_t)lh_int_num_items(h), n_int_tests))
         goto end;
 
     /* retrieve */
@@ -257,7 +257,7 @@ static int test_int_hashtable(void)
     }
 
     /* num_items */
-    if (!TEST_int_eq((size_t)ossl_ht_count(ht), n_int_tests))
+    if (!TEST_size_t_eq(ossl_ht_count(ht), n_int_tests))
         goto end;
 
     /* foreach, no arg */
@@ -277,7 +277,7 @@ static int test_int_hashtable(void)
 
     /* filter */
     list = ossl_ht_filter(ht, 64, int_filter_all, NULL);
-    if (!TEST_int_eq((size_t)list->list_len, n_int_tests))
+    if (!TEST_size_t_eq(list->list_len, n_int_tests))
         goto end;
     ossl_ht_value_list_free(list);
 
@@ -448,7 +448,7 @@ static int test_hashtable_stress(int idx)
     }
 
     /* make sure we stored everything */
-    if (!TEST_int_eq((size_t)ossl_ht_count(h), n))
+    if (!TEST_size_t_eq(ossl_ht_count(h), n))
             goto end;
 
     /* delete or get in a different order */
index db288d1d08c025b4569756a22230721522eefe6f..15a73ba306b0565fa1a300e2910a7c1d1ae50611 100644 (file)
@@ -97,11 +97,11 @@ static int test_insert(void)
     INTL *c, *d;
     OSSL_LIST(int) l;
     INTL elem[20];
-    size_t i;
+    int i;
     int n = 1;
 
     ossl_list_int_init(&l);
-    for (i = 0; i < OSSL_NELEM(elem); i++) {
+    for (i = 0; i < (int)OSSL_NELEM(elem); i++) {
         ossl_list_int_init_elem(elem + i);
         elem[i].n = i;
     }
index a339ef7fa05950fd287953714f4d82030c1c28a5..ef30c7862526a5a53e75f2b0b19ae84599e143a2 100644 (file)
@@ -152,7 +152,7 @@ static int ml_dsa_siggen_test(int tst_id)
                                           td->msg, td->msg_len), 1)
             || !TEST_true(EVP_PKEY_get_size_t_param(pkey, OSSL_PKEY_PARAM_MAX_SIZE,
                                                     &sig_len2))
-            || !TEST_int_eq(sig_len2, psig_len)
+            || !TEST_size_t_eq(sig_len2, psig_len)
             || !TEST_ptr(psig = OPENSSL_zalloc(psig_len))
             || !TEST_int_eq(EVP_PKEY_sign(sctx, psig, &psig_len,
                                           td->msg, td->msg_len), 1)
@@ -239,7 +239,7 @@ static int ml_dsa_siggen_upd_test(int tst_id)
             || !TEST_int_eq(EVP_PKEY_sign_message_final(sctx, NULL, &psig_len), 1)
             || !TEST_true(EVP_PKEY_get_size_t_param(pkey, OSSL_PKEY_PARAM_MAX_SIZE,
                                                     &sig_len2))
-            || !TEST_int_eq(sig_len2, psig_len)
+            || !TEST_size_t_eq(sig_len2, psig_len)
             || !TEST_ptr(psig = OPENSSL_zalloc(psig_len))
             || !TEST_int_eq(EVP_PKEY_sign_message_final(sctx, psig, &psig_len), 1)
             || !TEST_int_eq(EVP_Q_digest(lib_ctx, "SHA256", NULL, psig, psig_len,
@@ -419,11 +419,11 @@ static int ml_dsa_keygen_drbg_test(void)
             || !TEST_int_eq(EVP_PKEY_eq(pkey, pkey2), 0)
             || !TEST_int_eq(EVP_PKEY_eq(pkey, pkey3), -1)
             || !TEST_int_eq(EVP_PKEY_get_raw_private_key(pkey, NULL, &len), 1)
-            || !TEST_int_gt(len, 0)
+            || !TEST_size_t_gt(len, 0)
             || !TEST_ptr(priv = OPENSSL_malloc(len))
             || !TEST_int_eq(EVP_PKEY_get_raw_private_key(pkey, priv, &len), 1)
             || !TEST_int_eq(EVP_PKEY_get_raw_public_key(pkey, NULL, &len), 1)
-            || !TEST_int_gt(len, 0)
+            || !TEST_size_t_gt(len, 0)
             || !TEST_ptr(pub = OPENSSL_malloc(len))
             || !TEST_int_eq(EVP_PKEY_get_raw_public_key(pkey, pub, &len), 1)
             /* Load just the public part into a PKEY */
index aa667b16d167a95c4c67e3054eeea0d240d3e572..8e80ed0a6c9fd35e1483a54f648e26a06053f100 100644 (file)
@@ -862,7 +862,7 @@ static int test_gcm128(int idx)
     if (C.size == 1)
         C.data = NULL;
 
-    AES_set_encrypt_key(K.data, K.size * 8, &key);
+    AES_set_encrypt_key(K.data, (int)(K.size * 8), &key);
 
     CRYPTO_gcm128_init(&ctx, &key, (block128_f)AES_encrypt);
     CRYPTO_gcm128_setiv(&ctx, IV.data, IV.size);
index cd3c836c7ec77df8be0d3877b1460c9d3519d1f4..a7979100fca87567d1f916221363d514c2288b22 100644 (file)
@@ -139,7 +139,7 @@ static int raw_set_params(void *vobj, const OSSL_PARAM *params)
         } else if (strcmp(params->key, "p3") == 0) {
             BN_free(obj->p3);
             if (!TEST_ptr(obj->p3 = BN_native2bn(params->data,
-                                                 params->data_size, NULL)))
+                                                 (int)params->data_size, NULL)))
                 return 0;
         } else if (strcmp(params->key, "p4") == 0) {
             OPENSSL_free(obj->p4);
@@ -183,7 +183,7 @@ static int raw_get_params(void *vobj, OSSL_PARAM *params)
             params->return_size = BN_num_bytes(obj->p3);
             if (!TEST_size_t_ge(params->data_size, params->return_size))
                 return 0;
-            BN_bn2nativepad(obj->p3, params->data, params->return_size);
+            BN_bn2nativepad(obj->p3, params->data, (int)params->return_size);
         } else if (strcmp(params->key, "p4") == 0) {
             params->return_size = strlen(obj->p4);
             if (!TEST_size_t_gt(params->data_size, params->return_size))
@@ -460,7 +460,7 @@ static int test_case_variant(OSSL_PARAM *params, const struct provider_dispatch_
         || !TEST_int_eq(app_p1, p1_init)        /* "provider" value */
         || !TEST_double_eq(app_p2, app_p2_init) /* Should remain untouched */
         || !TEST_ptr(p = OSSL_PARAM_locate(params, "p3"))
-        || !TEST_ptr(BN_native2bn(bignumbin, p->return_size, app_p3))
+        || !TEST_ptr(BN_native2bn(bignumbin, (int)p->return_size, app_p3))
         || !TEST_BN_eq(app_p3, verify_p3)       /* "provider" value */
         || !TEST_str_eq(app_p4, p4_init)        /* "provider" value */
         || !TEST_ptr(p = OSSL_PARAM_locate(params, "p5"))
@@ -511,7 +511,7 @@ static int test_case_variant(OSSL_PARAM *params, const struct provider_dispatch_
         || !TEST_int_eq(app_p1, app_p1_init)    /* app value */
         || !TEST_double_eq(app_p2, app_p2_init) /* Should remain untouched */
         || !TEST_ptr(p = OSSL_PARAM_locate(params, "p3"))
-        || !TEST_ptr(BN_native2bn(bignumbin, p->return_size, app_p3))
+        || !TEST_ptr(BN_native2bn(bignumbin, (int)p->return_size, app_p3))
         || !TEST_BN_eq(app_p3, verify_p3)       /* app value */
         || !TEST_str_eq(app_p4, app_p4_init)    /* app value */
         || !TEST_ptr(p = OSSL_PARAM_locate(params, "p5"))
index cfffc2b9323327ccca7fba49ccbf21264c93f9eb..0cfe4327a7ea452eba65b3136f26b1689f446088 100644 (file)
@@ -75,7 +75,7 @@ static int test_pkcs5_pbe(const EVP_CIPHER *cipher, const EVP_MD *md,
 
     if (!TEST_true(PKCS5_pbe_set0_algor(algor, EVP_CIPHER_nid(cipher), pbe_iter,
                                         pbe_salt, sizeof(pbe_salt)))
-        || !TEST_true(PKCS5_PBE_keyivgen(ctx, pbe_password, strlen(pbe_password),
+        || !TEST_true(PKCS5_PBE_keyivgen(ctx, pbe_password, (int)strlen(pbe_password),
                                           algor->parameter, cipher, md, 1))
         || !TEST_true(EVP_CipherUpdate(ctx, out, &i, pbe_plaintext,
                                        sizeof(pbe_plaintext))))
@@ -91,7 +91,7 @@ static int test_pkcs5_pbe(const EVP_CIPHER *cipher, const EVP_MD *md,
 
     /* Decrypt */
 
-    if (!TEST_true(PKCS5_PBE_keyivgen(ctx, pbe_password, strlen(pbe_password),
+    if (!TEST_true(PKCS5_PBE_keyivgen(ctx, pbe_password, (int)strlen(pbe_password),
                                           algor->parameter, cipher, md, 0))
         || !TEST_true(EVP_CipherUpdate(ctx, out, &i, exp, exp_len)))
         goto err;
index bf9709836544391095c71e5d2f41aedd1353fc21..801eccc11b6932c81ad2a20bf8336479548fbcf3 100644 (file)
@@ -48,7 +48,7 @@ static int test_b64(int idx)
                                       PEM_FLAG_ONLY_B64)))
         goto err;
     if (!TEST_int_eq(memcmp(pemtype, name, strlen(pemtype)), 0)
-        || !TEST_int_eq(len, strlen(raw))
+        || !TEST_long_eq(len, (long)strlen(raw))
         || !TEST_int_eq(memcmp(data, raw, strlen(raw)), 0))
         goto err;
     ret = 1;
@@ -108,7 +108,7 @@ static int test_empty_payload(void)
     long len;
     int ret = 0;
 
-    b = BIO_new_mem_buf(emptypay, strlen(emptypay));
+    b = BIO_new_mem_buf(emptypay, (int)strlen(emptypay));
     if (!TEST_ptr(b))
         return 0;
 
@@ -138,7 +138,7 @@ static int test_protected_params(void)
     EVP_PKEY *pkey = NULL;
     int ret = 0;
 
-    b = BIO_new_mem_buf(protectedpay, strlen(protectedpay));
+    b = BIO_new_mem_buf(protectedpay, (int)strlen(protectedpay));
     if (!TEST_ptr(b))
         return 0;
 
index 7c0380444407d27b4ca5f3cae9476e4f9b86c9d8..74405c9868ed930f1ffecf14bfb32007ca2564b3 100644 (file)
@@ -151,7 +151,7 @@ static int pkcs7_verify_test(void)
     for  (i = 0; i < OSSL_NELEM(sig); ++i)
         BIO_puts(bio, sig[i]);
 
-    ret = TEST_ptr(msg_bio = BIO_new_mem_buf(signed_data, strlen(signed_data)))
+    ret = TEST_ptr(msg_bio = BIO_new_mem_buf(signed_data, (int)strlen(signed_data)))
           && TEST_ptr(x509_bio = BIO_new_mem_buf(cert_der, sizeof(cert_der)))
           && TEST_ptr(cert = d2i_X509_bio(x509_bio, NULL))
           && TEST_int_eq(ERR_peek_error(), 0)
index 0f26e9d38a0e8a587dff689f8a9672ff7298db24..2ffcf5933598bdbdbef83392f3a2de65cf7f3193 100644 (file)
@@ -913,6 +913,7 @@ static int test_rx_ack_actual(int tidx, int space)
     OSSL_ACKM_TX_PKT *txs = NULL, *tx;
     OSSL_TIME ack_deadline[QUIC_PN_SPACE_NUM];
     size_t opn = 0;
+    int j;
 
     for (i = 0; i < QUIC_PN_SPACE_NUM; ++i)
         ack_deadline[i] = ossl_time_infinite();
@@ -988,13 +989,13 @@ static int test_rx_ack_actual(int tidx, int space)
                              s->expect_deadline))
                 goto err;
 
-            for (i = 0; i < QUIC_PN_SPACE_NUM; ++i) {
-                if (i != (size_t)space
-                        && !TEST_true(ossl_time_is_infinite(ossl_ackm_get_ack_deadline(h.ackm, i))))
+            for (j = 0; j < QUIC_PN_SPACE_NUM; ++j) {
+                if (j != space
+                        && !TEST_true(ossl_time_is_infinite(ossl_ackm_get_ack_deadline(h.ackm, j))))
                     goto err;
 
-                if (!TEST_int_eq(ossl_time_compare(ossl_ackm_get_ack_deadline(h.ackm, i),
-                                                   ack_deadline[i]), 0))
+                if (!TEST_int_eq(ossl_time_compare(ossl_ackm_get_ack_deadline(h.ackm, j),
+                                                   ack_deadline[j]), 0))
                     goto err;
             }
 
index ccac6e169c20655cc7b5e432e6a894ea3496af95..0849b5773a0ecc95f6b7d09f6954195340f80a55 100644 (file)
@@ -1273,7 +1273,7 @@ static int run_script_worker(struct helper *h, const struct script_op *script,
 
                 /* 0 is the success case for SSL_set_alpn_protos(). */
                 if (!TEST_false(SSL_set_alpn_protos(h->c_conn, tmp_buf,
-                                                    alpn_len + 1)))
+                                                    (unsigned int)(alpn_len + 1))))
                     goto out;
 
                 OPENSSL_free(tmp_buf);
@@ -1642,7 +1642,7 @@ static int run_script_worker(struct helper *h, const struct script_op *script,
                 if (!TEST_ptr(c_tgt))
                     goto out;
 
-                if (!TEST_true(SSL_set_default_stream_mode(c_tgt, op->arg1)))
+                if (!TEST_true(SSL_set_default_stream_mode(c_tgt, (uint32_t)op->arg1)))
                     goto out;
             }
             break;
@@ -1653,7 +1653,7 @@ static int run_script_worker(struct helper *h, const struct script_op *script,
                     goto out;
 
                 if (!TEST_true(SSL_set_incoming_stream_policy(c_tgt,
-                                                              op->arg1, 0)))
+                                                              (int)op->arg1, 0)))
                     goto out;
             }
             break;
@@ -1896,7 +1896,7 @@ static int run_script_worker(struct helper *h, const struct script_op *script,
                     h->threads[i].h            = h;
                     h->threads[i].script       = op->arg0;
                     h->threads[i].script_name  = script_name;
-                    h->threads[i].thread_idx   = i;
+                    h->threads[i].thread_idx   = (int)i;
 
                     h->threads[i].m = ossl_crypto_mutex_new();
                     if (!TEST_ptr(h->threads[i].m))
@@ -2000,7 +2000,7 @@ static int run_script_worker(struct helper *h, const struct script_op *script,
                 QUIC_CHANNEL *ch = ossl_quic_conn_get_channel(h->c_conn);
 
                 ossl_quic_engine_set_inhibit_tick(ossl_quic_channel_get0_engine(ch),
-                                                  op->arg1);
+                                                  (int)op->arg1);
             }
             break;
 
@@ -5449,7 +5449,7 @@ static int check_idle_timeout(struct helper *h, struct helper_local *hl)
 {
     uint64_t v = 0;
 
-    if (!TEST_true(SSL_get_value_uint(h->c_conn, hl->check_op->arg1,
+    if (!TEST_true(SSL_get_value_uint(h->c_conn, (uint32_t)hl->check_op->arg1,
                                       SSL_VALUE_QUIC_IDLE_TIMEOUT,
                                       &v)))
         return 0;
index 80a15e1b7ab0f66f218281dc5b3ac79b712ad75f..957e047cd926739eef340b2a794dc0dd48608267 100644 (file)
@@ -74,7 +74,7 @@ static int test_ncid_frame(int fail)
     if (!TEST_true(qtest_create_quic_connection(qtserv, cssl)))
         goto err;
 
-    if (!TEST_int_eq(SSL_write(cssl, msg, msglen), msglen))
+    if (!TEST_int_eq(SSL_write(cssl, msg, (int)msglen), (int)msglen))
         goto err;
 
     ossl_quic_tserver_tick(qtserv);
@@ -115,13 +115,13 @@ static int test_ncid_frame(int fail)
     if (!TEST_true(SSL_handle_events(cssl)))
         goto err;
 
-    if (!TEST_int_eq(SSL_read(cssl, buf, sizeof(buf)), msglen))
+    if (!TEST_int_eq(SSL_read(cssl, buf, sizeof(buf)), (int)msglen))
         goto err;
 
     if (!TEST_mem_eq(msg, msglen, buf, bytesread))
         goto err;
 
-    if (!TEST_int_eq(SSL_write(cssl, msg, msglen), msglen))
+    if (!TEST_int_eq(SSL_write(cssl, msg, (int)msglen), (int)msglen))
         goto err;
 
     ossl_quic_tserver_tick(qtserv);
index 329953a3bd75868505e3359d53895e55217795cd..7b6248cc15ec2c84964bede8b38ac05914855b93 100644 (file)
@@ -1704,7 +1704,7 @@ int setup_tests(void)
 {
     ADD_ALL_TESTS(test_script, OSSL_NELEM(scripts));
     ADD_ALL_TESTS(test_dyn_script_1,
-                  OSSL_NELEM(dyn_script_1_crypto_1a)
-                  - dyn_script_1_start_from + 1);
+                  (int)(OSSL_NELEM(dyn_script_1_crypto_1a)
+                        - dyn_script_1_start_from + 1));
     return 1;
 }
index 10630e8be39e2291dfa74c585c397ab767d8c1ec..df683c6c675a255f1def9c0043ed80b6ea2848a6 100644 (file)
@@ -39,7 +39,7 @@ static int encode_case_1_dec(PACKET *pkt, ossl_ssize_t fail)
         /* No failure modes for padding */
         return 1;
 
-    if (!TEST_int_eq(ossl_quic_wire_decode_padding(pkt), 3))
+    if (!TEST_size_t_eq(ossl_quic_wire_decode_padding(pkt), 3))
         return 0;
 
     return 1;
index b98a94055301453143b26d4bde9847308a06c2b0..2b256f02da7e56a40790c29e875736de986cb4dd 100644 (file)
@@ -147,7 +147,7 @@ static int test_quic_write_read(int idx)
             if (!TEST_true(SSL_read_ex(clientquic, buf, 1, &numbytes))
                     || !TEST_size_t_eq(numbytes, 1)
                     || !TEST_true(SSL_has_pending(clientquic))
-                    || !TEST_int_eq(SSL_pending(clientquic), msglen - 1)
+                    || !TEST_int_eq(SSL_pending(clientquic), (int)(msglen - 1))
                     || !TEST_true(SSL_read_ex(clientquic, buf + 1,
                                               sizeof(buf) - 1, &numbytes))
                     || !TEST_mem_eq(buf, numbytes + 1, msg, msglen))
@@ -298,7 +298,8 @@ static int test_ciphersuites(void)
 #endif
         TLS1_3_CK_AES_128_GCM_SHA256
     };
-    size_t i, j;
+    size_t i;
+    int j;
 
     if (!TEST_ptr(ctx))
         return 0;
@@ -701,11 +702,12 @@ static int test_new_token(void)
 
 static int ensure_valid_ciphers(const STACK_OF(SSL_CIPHER) *ciphers)
 {
-    size_t i;
+    int i;
 
     /* Ensure ciphersuite list is suitably subsetted. */
-    for (i = 0; i < (size_t)sk_SSL_CIPHER_num(ciphers); ++i) {
+    for (i = 0; i < sk_SSL_CIPHER_num(ciphers); ++i) {
         const SSL_CIPHER *cipher = sk_SSL_CIPHER_value(ciphers, i);
+
         switch (SSL_CIPHER_get_id(cipher)) {
             case TLS1_3_CK_AES_128_GCM_SHA256:
             case TLS1_3_CK_AES_256_GCM_SHA384:
index c2187e1ea42955ae30601c2ed92576a696427332..fbe36cdb6343ecf55e7829268f6c0659841f7889 100644 (file)
@@ -41,7 +41,7 @@ static int test_basic(void)
     if (!TEST_true(qtest_create_quic_connection(qtserv, cssl)))
         goto err;
 
-    if (!TEST_int_eq(SSL_write(cssl, msg, msglen), msglen))
+    if (!TEST_int_eq(SSL_write(cssl, msg, (int)msglen), (int)msglen))
         goto err;
 
     ossl_quic_tserver_tick(qtserv);
index 49b8e28ef69a7aeca13564b5ee849468a2b6035a..b63e0d4fb141e2f7275a703e86e99ae125cf2aac 100644 (file)
@@ -330,14 +330,14 @@ static void RADIX_PROCESS_report_state(RADIX_PROCESS *rp, BIO *bio,
 
 static void RADIX_PROCESS_report_thread_results(RADIX_PROCESS *rp, BIO *bio)
 {
-    size_t i;
+    int i;
     RADIX_THREAD *rt;
     char *p;
     long l;
     char pfx_buf[64];
     int rt_testresult;
 
-    for (i = 1; i < (size_t)sk_RADIX_THREAD_num(rp->threads); ++i) {
+    for (i = 1; i < sk_RADIX_THREAD_num(rp->threads); ++i) {
         rt = sk_RADIX_THREAD_value(rp->threads, i);
 
         ossl_crypto_mutex_lock(rt->m);
@@ -372,7 +372,7 @@ static int RADIX_THREAD_join(RADIX_THREAD *rt);
 static int RADIX_PROCESS_join_all_threads(RADIX_PROCESS *rp, int *testresult)
 {
     int ok = 1;
-    size_t i;
+    int i;
     RADIX_THREAD *rt;
     int composite_testresult = 1;
 
@@ -381,10 +381,10 @@ static int RADIX_PROCESS_join_all_threads(RADIX_PROCESS *rp, int *testresult)
         return 1;
     }
 
-    for (i = 1; i < (size_t)sk_RADIX_THREAD_num(rp->threads); ++i) {
+    for (i = 1; i < sk_RADIX_THREAD_num(rp->threads); ++i) {
         rt = sk_RADIX_THREAD_value(rp->threads, i);
 
-        BIO_printf(bio_err, "==> Joining thread %zu\n", i);
+        BIO_printf(bio_err, "==> Joining thread %d\n", i);
 
         if (!TEST_true(RADIX_THREAD_join(rt)))
             ok = 0;
@@ -411,11 +411,11 @@ static void RADIX_THREAD_free(RADIX_THREAD *rt);
 
 static void RADIX_PROCESS_cleanup(RADIX_PROCESS *rp)
 {
-    size_t i;
+    int i;
 
     assert(rp->done_join_all_threads);
 
-    for (i = 0; i < (size_t)sk_RADIX_THREAD_num(rp->threads); ++i)
+    for (i = 0; i < sk_RADIX_THREAD_num(rp->threads); ++i)
         RADIX_THREAD_free(sk_RADIX_THREAD_value(rp->threads, i));
 
     sk_RADIX_THREAD_free(rp->threads);
index d987cfeadec9a747d1636c0079b8559b4e5ab116..08e048eef70cc06e7d5861e7eb3d282253300819 100644 (file)
@@ -583,7 +583,7 @@ DEF_FUNC(hf_write_rand)
             buf = OPENSSL_malloc(thislen);
         if (!TEST_ptr(buf))
             goto err;
-        if (!TEST_int_eq(RAND_bytes(buf, thislen), 1))
+        if (!TEST_int_eq(RAND_bytes(buf, (int)thislen), 1))
             goto err;
         r = SSL_write_ex(ssl, buf, thislen, &bytes_written);
         if (!TEST_true(r)
index b417f8bcacbad6abaa55d7330d3a560b4f3bfaf7..eb17d2c86801e3808cef28ad9ebde8b9638b24a5 100644 (file)
@@ -78,11 +78,11 @@ static int get_sni_from_client_hello(BIO *bio, char **sni)
             goto end;
         if (type == TLSEXT_TYPE_server_name) {
             if (!TEST_true(PACKET_get_length_prefixed_2(&pkt3, &pkt4))
-                    || !TEST_uint_ne(PACKET_remaining(&pkt4), 0)
+                    || !TEST_size_t_ne(PACKET_remaining(&pkt4), 0)
                     || !TEST_true(PACKET_get_1(&pkt4, &servname_type))
                     || !TEST_uint_eq(servname_type, TLSEXT_NAMETYPE_host_name)
                     || !TEST_true(PACKET_get_length_prefixed_2(&pkt4, &pkt5))
-                    || !TEST_uint_le(PACKET_remaining(&pkt5), TLSEXT_MAXLEN_host_name)
+                    || !TEST_size_t_le(PACKET_remaining(&pkt5), TLSEXT_MAXLEN_host_name)
                     || !TEST_false(PACKET_contains_zero_byte(&pkt5))
                     || !TEST_true(PACKET_strndup(&pkt5, sni)))
                 goto end;
index 7d1c6be9e846b9515d0a9abe4103393a375df9ef..560c6dbfa11cfd196cae2a69fe620600d5947ffd 100644 (file)
@@ -185,7 +185,7 @@ static int test_siphash(int idx)
         return 0;
     }
 
-    if (!TEST_int_le(inlen, sizeof(in)))
+    if (!TEST_size_t_le(inlen, sizeof(in)))
         return 0;
 
     /* key and in data are 00 01 02 ... */
index eff9071937a26e7ae747802f267cb20e03f2183b..2eb7e797e9f4a5492f00efc31622b7dfb19da72f 100644 (file)
@@ -274,7 +274,7 @@ static int slh_dsa_sign_verify_test(int tst_id)
                                           td->msg, td->msg_len), 1)
             || !TEST_true(EVP_PKEY_get_size_t_param(pkey, OSSL_PKEY_PARAM_MAX_SIZE,
                                                     &sig_len2))
-            || !TEST_int_eq(sig_len2, psig_len)
+            || !TEST_size_t_eq(sig_len2, psig_len)
             || !TEST_ptr(psig = OPENSSL_zalloc(psig_len))
             || !TEST_int_eq(EVP_PKEY_sign(sctx, psig, &psig_len,
                                           td->msg, td->msg_len), 1))
@@ -338,10 +338,10 @@ static int slh_dsa_keygen_test(int tst_id)
                                                    pub, sizeof(pub), &pub_len)))
         goto err;
     if (!TEST_true(EVP_PKEY_get_int_param(pkey, OSSL_PKEY_PARAM_BITS, &bits))
-            || !TEST_int_eq(bits, 8 * 2 * n)
+            || !TEST_size_t_eq((size_t)bits, 8 * 2 * n)
             || !TEST_true(EVP_PKEY_get_int_param(pkey, OSSL_PKEY_PARAM_SECURITY_BITS,
                                                  &sec_bits))
-            || !TEST_int_eq(sec_bits, 8 * n)
+            || !TEST_size_t_eq((size_t)sec_bits, 8 * n)
             || !TEST_true(EVP_PKEY_get_int_param(pkey, OSSL_PKEY_PARAM_MAX_SIZE,
                                                  &sig_len))
             || !TEST_int_ge(sig_len, 7856)
index 1623098fc6ff47eee871fb23fd55c3c457a53319..abe05bcac5394d0de0d6055e1983d7b21e412d6f 100644 (file)
@@ -184,14 +184,13 @@ static int test_sm2_crypt(const EC_GROUP *group,
         goto done;
 
     if (!TEST_true(ossl_sm2_plaintext_size(ctext, ctext_len, &ptext_len))
-            || !TEST_int_eq(ptext_len, msg_len))
+            || !TEST_size_t_eq(ptext_len, msg_len))
         goto done;
 
     recovered = OPENSSL_zalloc(ptext_len);
     if (!TEST_ptr(recovered)
             || !TEST_true(ossl_sm2_decrypt(key, digest, ctext, ctext_len,
                                            recovered, &recovered_len))
-            || !TEST_int_eq(recovered_len, msg_len)
             || !TEST_mem_eq(recovered, recovered_len, message, msg_len))
         goto done;
 
index 8c26f3ed2f094db8099624a0570fbd8757c16617..0b22795b6e79fc285e78fb4bb3de904a2d5f317b 100644 (file)
@@ -299,9 +299,9 @@ static int cb_server_alpn(SSL *s, const unsigned char **out,
         abort();
     }
 
-    if (SSL_select_next_proto
-        ((unsigned char **)out, outlen, protos, protos_len, in,
-         inlen) != OPENSSL_NPN_NEGOTIATED) {
+    if (SSL_select_next_proto((unsigned char **)out, outlen, protos,
+                              (unsigned int)protos_len,
+                              in, inlen) != OPENSSL_NPN_NEGOTIATED) {
         OPENSSL_free(protos);
         return SSL_TLSEXT_ERR_NOACK;
     }
@@ -1056,7 +1056,7 @@ int main(int argc, char *argv[])
             bytes = atol(*(++argv));
             if (bytes == 0L)
                 bytes = 1L;
-            i = strlen(argv[0]);
+            i = (int)strlen(argv[0]);
             if (argv[0][i - 1] == 'k')
                 bytes *= 1024L;
             if (argv[0][i - 1] == 'm')
@@ -1735,7 +1735,7 @@ int main(int argc, char *argv[])
             goto end;
         }
         /* Returns 0 on success!! */
-        if (SSL_CTX_set_alpn_protos(c_ctx, alpn, alpn_len)) {
+        if (SSL_CTX_set_alpn_protos(c_ctx, alpn, (unsigned int)alpn_len)) {
             BIO_printf(bio_err, "Error setting ALPN\n");
             OPENSSL_free(alpn);
             goto end;
index e4e0b9c085c83af8a38f119a1be383a695422452..0031325d3903f7b49b6a5a7132574d794bedbee6 100644 (file)
@@ -150,7 +150,7 @@ static int hostname_cb(SSL *s, int *al, void *arg)
 
 static void client_keylog_callback(const SSL *ssl, const char *line)
 {
-    int line_length = strlen(line);
+    int line_length = (int)strlen(line);
 
     /* If the log doesn't fit, error out. */
     if (client_log_buffer_index + line_length > sizeof(client_log_buffer) - 1) {
@@ -166,7 +166,7 @@ static void client_keylog_callback(const SSL *ssl, const char *line)
 
 static void server_keylog_callback(const SSL *ssl, const char *line)
 {
-    int line_length = strlen(line);
+    int line_length = (int)strlen(line);
 
     /* If the log doesn't fit, error out. */
     if (server_log_buffer_index + line_length > sizeof(server_log_buffer) - 1) {
@@ -394,8 +394,8 @@ static int test_keylog(void)
             || !TEST_true(create_ssl_connection(serverssl, clientssl,
                                                 SSL_ERROR_NONE))
             || !TEST_false(error_writing_log)
-            || !TEST_int_gt(client_log_buffer_index, 0)
-            || !TEST_int_gt(server_log_buffer_index, 0))
+            || !TEST_size_t_gt(client_log_buffer_index, 0)
+            || !TEST_size_t_gt(server_log_buffer_index, 0))
         goto end;
 
     /*
@@ -917,14 +917,14 @@ static int test_ccs_change_cipher(void)
     /* Actually drive the renegotiation. */
     for (i = 0; i < 3; i++) {
         if (SSL_read_ex(clientssl, &buf, sizeof(buf), &readbytes) > 0) {
-            if (!TEST_ulong_eq(readbytes, 0))
+            if (!TEST_size_t_eq(readbytes, 0))
                 goto end;
         } else if (!TEST_int_eq(SSL_get_error(clientssl, 0),
                                 SSL_ERROR_WANT_READ)) {
             goto end;
         }
         if (SSL_read_ex(serverssl, &buf, sizeof(buf), &readbytes) > 0) {
-            if (!TEST_ulong_eq(readbytes, 0))
+            if (!TEST_size_t_eq(readbytes, 0))
                 goto end;
         } else if (!TEST_int_eq(SSL_get_error(serverssl, 0),
                                 SSL_ERROR_WANT_READ)) {
@@ -1780,7 +1780,7 @@ static int execute_cleanse_plaintext(const SSL_METHOD *smeth,
     rr = serversc->rlayer.tlsrecs;
 
     zbuf = &rr->data[rr->off];
-    if (!TEST_int_eq(rr->length, sizeof(cbuf)))
+    if (!TEST_size_t_eq(rr->length, sizeof(cbuf)))
         goto end;
 
     /*
@@ -2768,7 +2768,7 @@ static int test_extra_tickets(int idx)
             || !TEST_int_eq(idx * 2 + 2, new_called)
             || !TEST_true(SSL_read_ex(clientssl, buf, sizeof(buf), &nbytes))
             || !TEST_int_eq(idx * 2 + 4, new_called)
-            || !TEST_int_eq(sizeof(buf), nbytes)
+            || !TEST_size_t_eq(sizeof(buf), nbytes)
             || !TEST_int_eq(c, buf[0])
             || !TEST_false(SSL_read_ex(clientssl, buf, sizeof(buf), &nbytes)))
         goto end;
@@ -2845,7 +2845,7 @@ static int test_extra_tickets(int idx)
             || !TEST_int_eq(0, new_called)
             || !TEST_true(SSL_read_ex(clientssl, buf, sizeof(buf), &nbytes))
             || !TEST_int_eq(0, new_called)
-            || !TEST_int_eq(sizeof(buf), nbytes)
+            || !TEST_size_t_eq(sizeof(buf), nbytes)
             || !TEST_int_eq(c, buf[0])
             || !TEST_false(SSL_read_ex(clientssl, buf, sizeof(buf), &nbytes)))
         goto end;
@@ -2860,7 +2860,7 @@ static int test_extra_tickets(int idx)
             || !TEST_int_eq(2, new_called)
             || !TEST_true(SSL_read_ex(clientssl, buf, sizeof(buf), &nbytes))
             || !TEST_int_eq(4, new_called)
-            || !TEST_int_eq(sizeof(buf), nbytes)
+            || !TEST_size_t_eq(sizeof(buf), nbytes)
             || !TEST_int_eq(c, buf[0])
             || !TEST_false(SSL_read_ex(clientssl, buf, sizeof(buf), &nbytes)))
         goto end;
@@ -3204,7 +3204,7 @@ static int test_set_sigalgs(int idx)
         int ret;
 
         if (curr->list != NULL)
-            ret = SSL_CTX_set1_sigalgs(cctx, curr->list, curr->listlen);
+            ret = SSL_CTX_set1_sigalgs(cctx, curr->list, (long)curr->listlen);
         else
             ret = SSL_CTX_set1_sigalgs_list(cctx, curr->liststr);
 
@@ -3229,7 +3229,7 @@ static int test_set_sigalgs(int idx)
         int ret;
 
         if (curr->list != NULL)
-            ret = SSL_set1_sigalgs(clientssl, curr->list, curr->listlen);
+            ret = SSL_set1_sigalgs(clientssl, curr->list, (long)curr->listlen);
         else
             ret = SSL_set1_sigalgs_list(clientssl, curr->liststr);
         if (!ret) {
@@ -3301,7 +3301,7 @@ static unsigned int psk_client_cb(SSL *ssl, const char *hint, char *id,
                                   unsigned char *psk,
                                   unsigned int max_psk_len)
 {
-    unsigned int psklen = 0;
+    size_t psklen = 0;
 
     psk_client_cb_cnt++;
 
@@ -3321,7 +3321,7 @@ static unsigned int psk_client_cb(SSL *ssl, const char *hint, char *id,
     psklen = SSL_SESSION_get_master_key(clientpsk, psk, max_psk_len);
     strncpy(id, pskid, max_id_len);
 
-    return psklen;
+    return (unsigned int)psklen;
 }
 #endif /* OPENSSL_NO_PSK */
 
@@ -3357,7 +3357,7 @@ static int find_session_cb(SSL *ssl, const unsigned char *identity,
 static unsigned int psk_server_cb(SSL *ssl, const char *identity,
                                   unsigned char *psk, unsigned int max_psk_len)
 {
-    unsigned int psklen = 0;
+    size_t psklen = 0;
 
     psk_server_cb_cnt++;
 
@@ -3378,7 +3378,7 @@ static unsigned int psk_server_cb(SSL *ssl, const char *identity,
         return 0;
     psklen = SSL_SESSION_get_master_key(serverpsk, psk, max_psk_len);
 
-    return psklen;
+    return (unsigned int)psklen;
 }
 #endif /* OPENSSL_NO_PSK */
 
@@ -5979,7 +5979,7 @@ static int generate_stateless_cookie_callback(SSL *ssl, unsigned char *cookie,
 static int verify_stateless_cookie_callback(SSL *ssl, const unsigned char *cookie,
                                       size_t cookie_len)
 {
-    return verify_cookie_callback(ssl, cookie, cookie_len);
+    return verify_cookie_callback(ssl, cookie, (unsigned int)cookie_len);
 }
 
 static int test_stateless(void)
@@ -6861,14 +6861,14 @@ static int test_key_update(void)
         }
 
         /* Check that sending and receiving app data is ok */
-        if (!TEST_int_eq(SSL_write(clientssl, mess, strlen(mess)), strlen(mess))
+        if (!TEST_int_eq(SSL_write(clientssl, mess, (int)strlen(mess)), (int)strlen(mess))
                 || !TEST_int_eq(SSL_read(serverssl, buf, sizeof(buf)),
-                                         strlen(mess)))
+                                         (int)strlen(mess)))
             goto end;
 
-        if (!TEST_int_eq(SSL_write(serverssl, mess, strlen(mess)), strlen(mess))
+        if (!TEST_int_eq(SSL_write(serverssl, mess, (int)strlen(mess)), (int)strlen(mess))
                 || !TEST_int_eq(SSL_read(clientssl, buf, sizeof(buf)),
-                                         strlen(mess)))
+                                         (int)strlen(mess)))
             goto end;
     }
 
@@ -6929,7 +6929,7 @@ static int test_key_update_peer_in_write(int tst)
     bretry = NULL;
 
     /* Write data that we know will fail with SSL_ERROR_WANT_WRITE */
-    if (!TEST_int_eq(SSL_write(peerwrite, mess, strlen(mess)), -1)
+    if (!TEST_int_eq(SSL_write(peerwrite, mess, (int)strlen(mess)), -1)
             || !TEST_int_eq(SSL_get_error(peerwrite, 0), SSL_ERROR_WANT_WRITE)
             || !TEST_true(SSL_want_write(peerwrite))
             || !TEST_true(SSL_net_write_desired(peerwrite)))
@@ -6950,13 +6950,13 @@ static int test_key_update_peer_in_write(int tst)
      * Complete the write we started previously and read it from the other
      * endpoint
      */
-    if (!TEST_int_eq(SSL_write(peerwrite, mess, strlen(mess)), strlen(mess))
-            || !TEST_int_eq(SSL_read(peerupdate, buf, sizeof(buf)), strlen(mess)))
+    if (!TEST_int_eq(SSL_write(peerwrite, mess, (int)strlen(mess)), (int)strlen(mess))
+            || !TEST_int_eq(SSL_read(peerupdate, buf, sizeof(buf)), (int)strlen(mess)))
         goto end;
 
     /* Write more data to ensure we send the KeyUpdate message back */
-    if (!TEST_int_eq(SSL_write(peerwrite, mess, strlen(mess)), strlen(mess))
-            || !TEST_int_eq(SSL_read(peerupdate, buf, sizeof(buf)), strlen(mess)))
+    if (!TEST_int_eq(SSL_write(peerwrite, mess, (int)strlen(mess)), (int)strlen(mess))
+            || !TEST_int_eq(SSL_read(peerupdate, buf, sizeof(buf)), (int)strlen(mess)))
         goto end;
 
     if (!TEST_false(SSL_net_read_desired(peerwrite))
@@ -7034,7 +7034,7 @@ static int test_key_update_peer_in_read(int tst)
         goto end;
 
     /* Now write some data in peer - we will write the key update */
-    if (!TEST_int_eq(SSL_write(peer, mess, strlen(mess)), strlen(mess)))
+    if (!TEST_int_eq(SSL_write(peer, mess, (int)strlen(mess)), (int)strlen(mess)))
         goto end;
 
     /*
@@ -7046,8 +7046,8 @@ static int test_key_update_peer_in_read(int tst)
         goto end;
 
     /* check that sending and receiving appdata ok */
-    if (!TEST_int_eq(SSL_write(local, mess, strlen(mess)), strlen(mess))
-            || !TEST_int_eq(SSL_read(peer, prbuf, sizeof(prbuf)), strlen(mess)))
+    if (!TEST_int_eq(SSL_write(local, mess, (int)strlen(mess)), (int)strlen(mess))
+            || !TEST_int_eq(SSL_read(peer, prbuf, sizeof(prbuf)), (int)strlen(mess)))
         goto end;
 
     testresult = 1;
@@ -7103,7 +7103,7 @@ static int test_key_update_local_in_write(int tst)
     bretry = NULL;
 
     /* write data in local will fail with SSL_ERROR_WANT_WRITE */
-    if (!TEST_int_eq(SSL_write(local, mess, strlen(mess)), -1)
+    if (!TEST_int_eq(SSL_write(local, mess, (int)strlen(mess)), -1)
             || !TEST_int_eq(SSL_get_error(local, -1), SSL_ERROR_WANT_WRITE))
         goto end;
 
@@ -7118,7 +7118,7 @@ static int test_key_update_local_in_write(int tst)
 
     ERR_clear_error();
     /* write data in local previously that we will complete */
-    if (!TEST_int_eq(SSL_write(local, mess, strlen(mess)), strlen(mess)))
+    if (!TEST_int_eq(SSL_write(local, mess, (int)strlen(mess)), (int)strlen(mess)))
         goto end;
 
     /* SSL_key_update will succeed because there is no pending write data */
@@ -7130,13 +7130,13 @@ static int test_key_update_local_in_write(int tst)
      * we write some appdata in local
      * read data in peer - we will read the keyupdate msg
      */
-    if (!TEST_int_eq(SSL_write(local, mess, strlen(mess)), strlen(mess))
-        || !TEST_int_eq(SSL_read(peer, buf, sizeof(buf)), strlen(mess)))
+    if (!TEST_int_eq(SSL_write(local, mess, (int)strlen(mess)), (int)strlen(mess))
+        || !TEST_int_eq(SSL_read(peer, buf, sizeof(buf)), (int)strlen(mess)))
         goto end;
 
     /* Write more peer more data to ensure we send the keyupdate message back */
-    if (!TEST_int_eq(SSL_write(peer, mess, strlen(mess)), strlen(mess))
-            || !TEST_int_eq(SSL_read(local, buf, sizeof(buf)), strlen(mess)))
+    if (!TEST_int_eq(SSL_write(peer, mess, (int)strlen(mess)), (int)strlen(mess))
+            || !TEST_int_eq(SSL_read(local, buf, sizeof(buf)), (int)strlen(mess)))
         goto end;
 
     testresult = 1;
@@ -7215,13 +7215,13 @@ static int test_key_update_local_in_read(int tst)
      * write data in local
      * read data in peer - we will read the key update
      */
-    if (!TEST_int_eq(SSL_write(local, mess, strlen(mess)), strlen(mess))
-        || !TEST_int_eq(SSL_read(peer, prbuf, sizeof(prbuf)), strlen(mess)))
+    if (!TEST_int_eq(SSL_write(local, mess, (int)strlen(mess)), (int)strlen(mess))
+        || !TEST_int_eq(SSL_read(peer, prbuf, sizeof(prbuf)), (int)strlen(mess)))
         goto end;
 
   /* Write more peer data to ensure we send the keyupdate message back */
-    if (!TEST_int_eq(SSL_write(peer, mess, strlen(mess)), strlen(mess))
-            || !TEST_int_eq(SSL_read(local, lrbuf, sizeof(lrbuf)), strlen(mess)))
+    if (!TEST_int_eq(SSL_write(peer, mess, (int)strlen(mess)), (int)strlen(mess))
+            || !TEST_int_eq(SSL_read(local, lrbuf, sizeof(lrbuf)), (int)strlen(mess)))
         goto end;
 
     testresult = 1;
@@ -7390,7 +7390,7 @@ static int get_MFL_from_client_hello(BIO *bio, int *mfl_codemfl_code)
             goto end;
 
         if (type == TLSEXT_TYPE_max_fragment_length) {
-            if (!TEST_uint_ne(PACKET_remaining(&pkt3), 0)
+            if (!TEST_size_t_ne(PACKET_remaining(&pkt3), 0)
                     || !TEST_true(PACKET_get_1(&pkt3, &MFL_code)))
                 goto end;
 
@@ -11500,12 +11500,12 @@ static int test_pipelining(int idx)
 {
     SSL_CTX *cctx = NULL, *sctx = NULL;
     SSL *clientssl = NULL, *serverssl = NULL, *peera, *peerb;
-    int testresult = 0, numreads;
+    int testresult = 0, numreads, numpipes = 5;
     /* A 55 byte message */
     unsigned char *msg = (unsigned char *)
         "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123";
-    size_t written, readbytes, offset, msglen, fragsize = 10, numpipes = 5;
-    size_t expectedreads;
+    size_t written, readbytes, offset, msglen, fragsize = 10;
+    int expectedreads;
     unsigned char *buf = NULL;
     ENGINE *e = NULL;
 
@@ -11575,7 +11575,7 @@ static int test_pipelining(int idx)
          * Test that setting a split send fragment longer than the maximum
          * allowed fails
          */
-        if (!TEST_false(SSL_set_split_send_fragment(peera, fragsize + 1)))
+        if (!TEST_false(SSL_set_split_send_fragment(peera, (long)(fragsize + 1))))
             goto end;
     }
 
@@ -11585,7 +11585,7 @@ static int test_pipelining(int idx)
      * but sufficient for our purposes
      */
     if (!TEST_true(SSL_set_max_pipelines(peera, numpipes))
-            || !TEST_true(SSL_set_split_send_fragment(peera, fragsize)))
+            || !TEST_true(SSL_set_split_send_fragment(peera, (long)fragsize)))
         goto end;
 
     if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)))
index 8e84e1a6b6a6828224cbe97cc96ceaaa0954fbb6..0a0f464ca144b9543e085ab1d9afdcc42bc8dfa5 100644 (file)
@@ -113,7 +113,7 @@ static void test_fail_string_common(const char *prefix, const char *file,
             m2 += n2;
         l1 -= n1;
         l2 -= n2;
-        cnt += width;
+        cnt += (unsigned int)width;
     }
 fin:
     test_flush_stderr();
@@ -206,7 +206,7 @@ static void test_bignum_zero_print(const BIGNUM *bn, char sep)
 static int convert_bn_memory(const unsigned char *in, size_t bytes,
                              char *out, int *lz, const BIGNUM *bn)
 {
-    int n = bytes * 2, i;
+    int n = (int)(bytes * 2), i;
     char *p = out, *q = NULL;
     const char *r;
 
@@ -307,15 +307,15 @@ static void test_fail_bignum_common(const char *prefix, const char *file,
 
     if (bn1 != NULL) {
         m1 = bufp;
-        BN_bn2binpad(bn1, m1, len);
+        BN_bn2binpad(bn1, m1, (int)len);
     }
     if (bn2 != NULL) {
         m2 = bufp + len;
-        BN_bn2binpad(bn2, m2, len);
+        BN_bn2binpad(bn2, m2, (int)len);
     }
 
     while (len > 0) {
-        cnt = 8 * (len - bytes);
+        cnt = (unsigned int)(8 * (len - bytes));
         n1 = convert_bn_memory(m1, bytes, b1, &lz1, bn1);
         n2 = convert_bn_memory(m2, bytes, b2, &lz2, bn2);
 
@@ -504,7 +504,7 @@ static void test_fail_memory_common(const char *prefix, const char *file,
             m2 += n2;
         l1 -= n1;
         l2 -= n2;
-        cnt += bytes;
+        cnt += (unsigned int)bytes;
     }
 fin:
     test_flush_stderr();
index 69ea27ed2b98851280c997475c7cfd995b2457aa..ccbafe96c84d9333aae1683fd1f9bb0355dbecf4 100644 (file)
@@ -39,7 +39,9 @@ static size_t internal_trace_cb(const char *buf, size_t cnt,
         BIO_set_prefix(trace_data->bio, buffer);
         break;
     case OSSL_TRACE_CTRL_WRITE:
-        ret = BIO_write(trace_data->bio, buf, cnt);
+        if (cnt > INT_MAX)
+            cnt = INT_MAX;
+        ret = BIO_write(trace_data->bio, buf, (int)cnt);
         break;
     case OSSL_TRACE_CTRL_END:
         trace_data->ingroup = 0;
index e0d9cc9f09bb38a665a6e498f3bb9947fd06a468..338de88e63b31212b85bf3246ab3fe71f11d4573 100644 (file)
@@ -98,7 +98,7 @@ static int test_thread_internal(void)
     uint32_t retval[3];
     uint32_t local[3] = { 0 };
     uint32_t threads_supported;
-    size_t i;
+    uint32_t i;
     void *t[3];
     int status = 0;
     OSSL_LIB_CTX *cust_ctx = OSSL_LIB_CTX_new();
@@ -180,7 +180,7 @@ static int test_thread_internal(void)
         if (!TEST_int_eq(ossl_crypto_thread_join(t[i], &retval[0]), 1))
             goto cleanup;
 
-        if (!TEST_int_eq(retval[0], i + 1) || !TEST_int_eq(local[0], i + 2))
+        if (!TEST_uint_eq(retval[0], i + 1) || !TEST_uint_eq(local[0], i + 2))
             goto cleanup;
 
         if (!TEST_int_eq(ossl_crypto_thread_clean(t[i]), 1))
@@ -207,7 +207,7 @@ static int test_thread_internal(void)
             goto cleanup;
     }
     for (i = 0; i < OSSL_NELEM(t); ++i) {
-        if (!TEST_int_eq(retval[i], i + 1) || !TEST_int_eq(local[i], i + 2))
+        if (!TEST_uint_eq(retval[i], i + 1) || !TEST_uint_eq(local[i], i + 2))
             goto cleanup;
         if (!TEST_int_eq(ossl_crypto_thread_clean(t[i]), 1))
             goto cleanup;
@@ -229,7 +229,7 @@ static int test_thread_internal(void)
             goto cleanup;
     }
     for (i = 0; i < OSSL_NELEM(t); ++i) {
-        if (!TEST_int_eq(retval[i], i + 1) || !TEST_int_eq(local[i], i + 2))
+        if (!TEST_uint_eq(retval[i], i + 1) || !TEST_uint_eq(local[i], i + 2))
             goto cleanup;
         if (!TEST_int_eq(ossl_crypto_thread_clean(t[i]), 1))
             goto cleanup;
index 76db07f3baf6b6d1182fca981de7b2a029691306..08081c60730ed8e51c4f87264c630c895ff1d95c 100644 (file)
@@ -880,7 +880,7 @@ static void thread_general_worker(void)
         if (!TEST_true(EVP_EncryptInit_ex(cipherctx, ciph, NULL, key, iv))
                 || !TEST_true(EVP_EncryptUpdate(cipherctx, out, &ciphoutl,
                                                 (unsigned char *)message,
-                                                messlen))
+                                                (int)messlen))
                 || !TEST_true(EVP_EncryptFinal(cipherctx, out, &ciphoutl)))
             goto err;
     }
@@ -1272,7 +1272,7 @@ static void test_pem_read_one(void)
         goto err;
     }
 
-    pem = BIO_new_mem_buf(pemdata, len);
+    pem = BIO_new_mem_buf(pemdata, (int)len);
     if (pem == NULL) {
         multi_set_success(0);
         goto err;
index 7da75fe9332e95d3fc8bc7ee730e3394d722cb0c..7e8466711ad8142494526a7a6ff09905ee87e2c1 100644 (file)
@@ -72,7 +72,7 @@ static int test_offset(int idx)
     int day, sec;
 
     at.data = (unsigned char*)testdata->data;
-    at.length = strlen(testdata->data);
+    at.length = (int)strlen(testdata->data);
     at.type = testdata->type;
     at.flags = 0;
 
index 5afa5b5d7286d78476b551e6af91317f5431b1ae..f1206c99994cbd40e09a1bd905642e8a9e81139a 100644 (file)
@@ -1386,7 +1386,8 @@ static X509_SIG *p8info_to_encp8(PKCS8_PRIV_KEY_INFO *p8info,
         return NULL;
     }
     /* First argument == -1 means "standard" */
-    p8 = PKCS8_encrypt_ex(-1, ctx->cipher, kstr, klen, NULL, 0, 0, p8info, libctx, NULL);
+    p8 = PKCS8_encrypt_ex(-1, ctx->cipher, kstr, (int)klen, NULL, 0, 0, p8info,
+                          libctx, NULL);
     OPENSSL_cleanse(kstr, klen);
     return p8;
 }
index 6e1b7d978ce8f198bad9e4ff8a51f8485f2f35d6..ea36b2dfcb3a038ad315f66f81108b0b9a248061 100644 (file)
@@ -237,7 +237,7 @@ static int watchccs_gets(BIO *bio, char *buf, int size)
 
 static int watchccs_puts(BIO *bio, const char *str)
 {
-    return watchccs_write(bio, str, strlen(str));
+    return watchccs_write(bio, str, (int)strlen(str));
 }
 
 static int test_tls13ccs(int tst)
index 0effee421ab0b6818c220fc736b83eb2fae9c9c6..3d1a7e9eef5cc6f820ec51bb4e6b8855bce50e1f 100644 (file)
@@ -103,13 +103,13 @@ static int put_trace_output(void)
     int res = 1;
 
     OSSL_TRACE_BEGIN(HTTP) {
-        res = TEST_int_eq(BIO_printf(trc_out, OSSL_HELLO), strlen(OSSL_HELLO));
-        res += TEST_int_eq(trace_string(0, 0, OSSL_STR80), strlen(OSSL_STR80));
-        res += TEST_int_eq(trace_string(0, 0, OSSL_STR81), strlen(OSSL_STR80));
-        res += TEST_int_eq(trace_string(1, 1, OSSL_CTRL), strlen(OSSL_CTRL));
-        res += TEST_int_eq(trace_string(0, 1, OSSL_MASKED), strlen(OSSL_MASKED)
+        res = TEST_int_eq(BIO_printf(trc_out, OSSL_HELLO), (int)strlen(OSSL_HELLO));
+        res += TEST_int_eq(trace_string(0, 0, OSSL_STR80), (int)strlen(OSSL_STR80));
+        res += TEST_int_eq(trace_string(0, 0, OSSL_STR81), (int)strlen(OSSL_STR80));
+        res += TEST_int_eq(trace_string(1, 1, OSSL_CTRL), (int)strlen(OSSL_CTRL));
+        res += TEST_int_eq(trace_string(0, 1, OSSL_MASKED), (int)strlen(OSSL_MASKED)
                            + 1); /* newline added */
-        res += TEST_int_eq(BIO_printf(trc_out, OSSL_BYE), strlen(OSSL_BYE));
+        res += TEST_int_eq(BIO_printf(trc_out, OSSL_BYE), (int)strlen(OSSL_BYE));
         res = res == 6;
         /* not using '&&' but '+' to catch potentially multiple test failures */
     } OSSL_TRACE_END(HTTP);
index 82c8c59204f49adf7ba5c51e4dbffc905ec54a74..e8615217bd347fcd9eb96f120fe0f6618194eb1b 100644 (file)
@@ -21,7 +21,7 @@
 static int test_pem_password_cb(char *buf, int size, int rwflag, void *userdata)
 {
     OPENSSL_strlcpy(buf, (char *)userdata, (size_t)size);
-    return strlen(buf);
+    return (int)strlen(buf);
 }
 
 /*
index fdc37acee5cba35d823684d642a435333e5ed90f..5be0c0241318ae589023853c45cc43acd77cd21e 100644 (file)
@@ -376,7 +376,7 @@ static int test_ext_syntax(void)
     for (i = 0; i < OSSL_NELEM(extvalues); i++) {
         X509V3_CTX ctx;
         BIO *extbio = BIO_new_mem_buf(extvalues[i].value,
-                                      strlen(extvalues[i].value));
+                                      (int)strlen(extvalues[i].value));
         CONF *conf;
         long eline;
 
index 152da1a1ddce028262046774b13187db83c16449..438dd9fcd6b7d059a5a556562106bb43bc88e6d0 100644 (file)
@@ -675,9 +675,9 @@ static int test_GENERAL_NAME_cmp(void)
          * We create two versions of each GENERAL_NAME so that we ensure when
          * we compare them they are always different pointers.
          */
-        namesa[i] = d2i_GENERAL_NAME(NULL, &derp, gennames[i].derlen);
+        namesa[i] = d2i_GENERAL_NAME(NULL, &derp, (long)gennames[i].derlen);
         derp = gennames[i].der;
-        namesb[i] = d2i_GENERAL_NAME(NULL, &derp, gennames[i].derlen);
+        namesb[i] = d2i_GENERAL_NAME(NULL, &derp, (long)gennames[i].derlen);
         if (!TEST_ptr(namesa[i]) || !TEST_ptr(namesb[i]))
             goto end;
     }
index 154ec3b607d75c84667f7ffbfd4f267e216e1271..98384fcb38e2f8b15056c14d508079a60d68d2a6 100644 (file)
@@ -130,7 +130,7 @@ static int test_object_group_attr(int idx)
 
     p = test->data;
 
-    ias = d2i_OSSL_IETF_ATTR_SYNTAX(NULL, &p, test->len);
+    ias = d2i_OSSL_IETF_ATTR_SYNTAX(NULL, &p, (long)test->len);
 
     if ((test->valid && !TEST_ptr(ias))
             || (!test->valid && !TEST_ptr_null(ias)))
@@ -153,7 +153,7 @@ done:
 OPT_TEST_DECLARE_USAGE("[<attribute certs (PEM)>...]\n")
 int setup_tests(void)
 {
-    int cnt;
+    size_t cnt;
 
     if (!test_skip_common_options()) {
         TEST_error("Error parsing test options\n");
@@ -166,7 +166,7 @@ int setup_tests(void)
         return 0;
     }
 
-    ADD_ALL_TESTS(test_print_acert, cnt);
+    ADD_ALL_TESTS(test_print_acert, (int)cnt);
     ADD_TEST(test_acert_sign);
     ADD_ALL_TESTS(test_object_group_attr, OSSL_NELEM(ietf_syntax_tests));
 
index b09de70a8a5631222650f0daa6ee77c1bcac7d36..745a6328240d9169eb772bc750e937a66eaa1c0d 100644 (file)
@@ -43,9 +43,9 @@ int setup_tests(void)
     }
 
     n = test_get_argument_count();
-    if (!TEST_int_gt(n, 0))
+    if (!TEST_size_t_gt(n, 0))
         return 0;
 
-    ADD_ALL_TESTS(test_509_dup_cert, n);
+    ADD_ALL_TESTS(test_509_dup_cert, (int)n);
     return 1;
 }
index 1c6e569a4c44444045348fc90a16e0fe18853332..f5a3c0ce20895a1465189135c9d9dc548b436bc5 100644 (file)
@@ -181,7 +181,7 @@ OPT_TEST_DECLARE_USAGE("<pss-self-signed-cert.pem>\n")
 int setup_tests(void)
 {
     const unsigned char *p;
-    int cnt;
+    size_t cnt;
 
     cnt = test_get_argument_count();
     if (cnt != 1) {
index 262f9ed7ce9e136778220ea988b59b471a39daeb..c668beaaf706b7b7b1a4e1793d119d3c3f0e14ff 100644 (file)
@@ -261,7 +261,7 @@ static int test_x509_cmp_time(int idx)
     memset(&t, 0, sizeof(t));
     t.type = x509_cmp_tests[idx].type;
     t.data = (unsigned char*)(x509_cmp_tests[idx].data);
-    t.length = strlen(x509_cmp_tests[idx].data);
+    t.length = (int)strlen(x509_cmp_tests[idx].data);
     t.flags = 0;
 
     result = X509_cmp_time(&t, &x509_cmp_tests[idx].cmp_time);