/freebsd/contrib/wpa/wpa_supplicant/ |
H A D | eap_register.c | 26 int ret = 0; in eap_register_methods() local 29 if (ret == 0) in eap_register_methods() 30 ret = eap_peer_md5_register(); in eap_register_methods() 34 if (ret == 0) in eap_register_methods() 35 ret = eap_peer_tls_register(); in eap_register_methods() 39 if (ret == 0) in eap_register_methods() 40 ret = eap_peer_unauth_tls_register(); in eap_register_methods() 45 if (ret == 0) in eap_register_methods() 46 ret = eap_peer_wfa_unauth_tls_register(); in eap_register_methods() 51 if (ret == 0) in eap_register_methods() [all …]
|
/freebsd/crypto/libecc/src/curves/ |
H A D | prj_pt.c | 34 int ret; in prj_pt_check_initialized() local 36 MUST_HAVE(((in != NULL) && (in->magic == PRJ_PT_MAGIC)), ret, err); in prj_pt_check_initialized() 37 ret = ec_shortw_crv_check_initialized(in->crv); in prj_pt_check_initialized() 40 return ret; in prj_pt_check_initialized() 49 int ret; in prj_pt_init() local 51 ret = ec_shortw_crv_check_initialized(curve); EG(ret, err); in prj_pt_init() 53 MUST_HAVE((in != NULL), ret, err); in prj_pt_init() 55 ret = fp_init(&(in->X), curve->a.ctx); EG(ret, err); in prj_pt_init() 56 ret = fp_init(&(in->Y), curve->a.ctx); EG(ret, err); in prj_pt_init() 57 ret = fp_init(&(in->Z), curve->a.ctx); EG(ret, err); in prj_pt_init() [all …]
|
H A D | aff_pt_edwards.c | 25 int ret; in aff_pt_edwards_check_initialized() local 27 MUST_HAVE(((in != NULL) && (in->magic == AFF_PT_EDWARDS_MAGIC)), ret, err); in aff_pt_edwards_check_initialized() 28 ret = ec_edwards_crv_check_initialized(in->crv); in aff_pt_edwards_check_initialized() 31 return ret; in aff_pt_edwards_check_initialized() 42 int ret; in aff_pt_edwards_init() local 44 MUST_HAVE((in != NULL), ret, err); in aff_pt_edwards_init() 45 ret = ec_edwards_crv_check_initialized(curve); EG(ret, err); in aff_pt_edwards_init() 47 ret = fp_init(&(in->x), curve->a.ctx); EG(ret, err); in aff_pt_edwards_init() 48 ret = fp_init(&(in->y), curve->a.ctx); EG(ret, err); in aff_pt_edwards_init() 54 return ret; in aff_pt_edwards_init() [all …]
|
H A D | aff_pt_montgomery.c | 21 int ret; in aff_pt_montgomery_check_initialized() local 23 MUST_HAVE(((in != NULL) && (in->magic == AFF_PT_MONTGOMERY_MAGIC)), ret, err); in aff_pt_montgomery_check_initialized() 24 ret = ec_montgomery_crv_check_initialized(in->crv); in aff_pt_montgomery_check_initialized() 27 return ret; in aff_pt_montgomery_check_initialized() 38 int ret; in aff_pt_montgomery_init() local 40 MUST_HAVE((in != NULL), ret, err); in aff_pt_montgomery_init() 41 ret = ec_montgomery_crv_check_initialized(curve); EG(ret, err); in aff_pt_montgomery_init() 43 ret = fp_init(&(in->u), curve->A.ctx); EG(ret, err); in aff_pt_montgomery_init() 44 ret = fp_init(&(in->v), curve->A.ctx); EG(ret, err); in aff_pt_montgomery_init() 50 return ret; in aff_pt_montgomery_init() [all …]
|
H A D | aff_pt.c | 26 int ret; in aff_pt_check_initialized() local 28 MUST_HAVE(((in != NULL) && (in->magic == AFF_PT_MAGIC)), ret, err); in aff_pt_check_initialized() 29 ret = ec_shortw_crv_check_initialized(in->crv); in aff_pt_check_initialized() 32 return ret; in aff_pt_check_initialized() 41 int ret; in aff_pt_init() local 43 MUST_HAVE((in != NULL), ret, err); in aff_pt_init() 44 MUST_HAVE((curve != NULL), ret, err); in aff_pt_init() 46 ret = ec_shortw_crv_check_initialized(curve); EG(ret, err); in aff_pt_init() 47 ret = fp_init(&(in->x), curve->a.ctx); EG(ret, err); in aff_pt_init() 48 ret = fp_init(&(in->y), curve->a.ctx); EG(ret, err); in aff_pt_init() [all …]
|
/freebsd/crypto/libecc/src/fp/ |
H A D | fp_sqrt.c | 28 int ret, iszero, cmp; in legendre() local 36 ret = fp_check_initialized(a); EG(ret, err); in legendre() 37 ret = fp_init(&pow, a->ctx); EG(ret, err); in legendre() 38 ret = fp_init(&one, a->ctx); EG(ret, err); in legendre() 39 ret = nn_init(&exp, 0); EG(ret, err); in legendre() 44 ret = fp_init(&pow, a->ctx); EG(ret, err); in legendre() 45 ret = fp_init(&one, a->ctx); EG(ret, err); in legendre() 46 ret = nn_init(&exp, 0); EG(ret, err); in legendre() 49 ret = fp_one(&one); EG(ret, err); in legendre() 55 ret = nn_dec(&exp, &(a->ctx->p)); EG(ret, err); in legendre() [all …]
|
H A D | fp.c | 33 int ret = 0; in fp_ctx_check_initialized() local 35 MUST_HAVE(((ctx != NULL) && (ctx->magic == FP_CTX_MAGIC)), ret, err); in fp_ctx_check_initialized() 38 return ret; in fp_ctx_check_initialized() 59 int ret; in fp_ctx_init() local 61 MUST_HAVE((ctx != NULL), ret, err); in fp_ctx_init() 62 ret = nn_check_initialized(p); EG(ret, err); in fp_ctx_init() 63 ret = nn_check_initialized(r); EG(ret, err); in fp_ctx_init() 64 ret = nn_check_initialized(r_square); EG(ret, err); in fp_ctx_init() 65 ret = nn_check_initialized(p_normalized); EG(ret, err); in fp_ctx_init() 67 ret = nn_copy(&(ctx->p), p); EG(ret, err); in fp_ctx_init() [all …]
|
/freebsd/crypto/libecc/src/nn/ |
H A D | nn_modinv.c | 51 int isodd, swap, smaller, ret, cmp, iszero, tmp_isodd; in _nn_modinv_odd() local 57 ret = nn_init(out, 0); EG(ret, err); in _nn_modinv_odd() 58 ret = nn_init(&a, (u16)(m->wlen * WORD_BYTES)); EG(ret, err); in _nn_modinv_odd() 59 ret = nn_init(&b, (u16)(m->wlen * WORD_BYTES)); EG(ret, err); in _nn_modinv_odd() 60 ret = nn_init(&u, (u16)(m->wlen * WORD_BYTES)); EG(ret, err); in _nn_modinv_odd() 61 ret = nn_init(&mp1d2, (u16)(m->wlen * WORD_BYTES)); EG(ret, err); in _nn_modinv_odd() 65 ret = nn_init(&tmp, (u16)(m->wlen * WORD_BYTES)); EG(ret, err); in _nn_modinv_odd() 67 MUST_HAVE((!nn_isodd(m, &isodd)) && isodd, ret, err); in _nn_modinv_odd() 68 MUST_HAVE((!nn_cmp(x, m, &cmp)) && (cmp < 0), ret, err); in _nn_modinv_odd() 69 MUST_HAVE((!nn_iszero(x, &iszero)) && (!iszero), ret, err); in _nn_modinv_odd() [all …]
|
H A D | nn_div.c | 45 int ret, mask, tmp; in _nn_cmp_shift() local 48 MUST_HAVE((in1->wlen >= (in2->wlen + shift)), ret, err); in _nn_cmp_shift() 49 MUST_HAVE((cmp != NULL), ret, err); in _nn_cmp_shift() 58 ret = 0; in _nn_cmp_shift() 61 return ret; in _nn_cmp_shift() 80 int ret; in _nn_cnd_sub_shift() local 83 MUST_HAVE((out->wlen >= (in->wlen + shift)), ret, err); in _nn_cnd_sub_shift() 84 MUST_HAVE((borrow != NULL), ret, err); in _nn_cnd_sub_shift() 100 ret = 0; in _nn_cnd_sub_shift() 103 return ret; in _nn_cnd_sub_shift() [all …]
|
/freebsd/crypto/libecc/src/sig/ |
H A D | bign_common.c | 77 int ret; in _reverse_endianness() local 79 MUST_HAVE((buf != NULL), ret, err); in _reverse_endianness() 89 ret = 0; in _reverse_endianness() 91 return ret; in _reverse_endianness() 99 int ret; in bign_get_oid_from_adata() local 102 MUST_HAVE((adata != NULL) && (oid_ptr != NULL) && (oid_len != NULL), ret, err); in bign_get_oid_from_adata() 103 MUST_HAVE((adata_len >= 4), ret, err); in bign_get_oid_from_adata() 108 MUST_HAVE(((*oid_len) + t_len) >= (t_len), ret, err); in bign_get_oid_from_adata() 109 MUST_HAVE(((*oid_len) + t_len) <= (adata_len - 4), ret, err); in bign_get_oid_from_adata() 112 ret = 0; in bign_get_oid_from_adata() [all …]
|
H A D | eddsa.c | 63 int ret; in dom() local 65 MUST_HAVE((h != NULL) && (h_ctx != NULL), ret, err); in dom() 67 MUST_HAVE((x <= 255) && (olen_y <= 255), ret, err); in dom() 70 ret = h->hfunc_update(h_ctx, (const u8*)"SigEd25519 no Ed25519 collisions", 32); EG(ret, err); in dom() 73 ret = h->hfunc_update(h_ctx, (const u8*)"SigEd448", 8); EG(ret, err); in dom() 76 ret = -1; in dom() 81 ret = h->hfunc_update(h_ctx, tmp, 2); EG(ret, err); in dom() 83 ret = h->hfunc_update(h_ctx, y, olen_y); EG(ret, err); in dom() 87 return ret; in dom() 162 int ret; in eddsa_key_type_check_curve() local [all …]
|
H A D | ecdsa_common.c | 52 int ret, cmp; in __ecdsa_rfc6979_nonce() local 64 MUST_HAVE((k != NULL), ret, err); in __ecdsa_rfc6979_nonce() 65 MUST_HAVE((hash != NULL), ret, err); in __ecdsa_rfc6979_nonce() 66 ret = nn_check_initialized(q); EG(ret, err); in __ecdsa_rfc6979_nonce() 67 ret = nn_check_initialized(x); EG(ret, err); in __ecdsa_rfc6979_nonce() 71 MUST_HAVE((q_len <= EC_PRIV_KEY_MAX_SIZE) && (hsize <= MAX_BLOCK_SIZE), ret, err); in __ecdsa_rfc6979_nonce() 74 ret = local_memset(V, 0x01, hsize); EG(ret, err); in __ecdsa_rfc6979_nonce() 75 ret = local_memset(K, 0x00, hsize); EG(ret, err); in __ecdsa_rfc6979_nonce() 77 ret = nn_export_to_buf(priv_key_buff, q_len, x); EG(ret, err); in __ecdsa_rfc6979_nonce() 81 ret = hmac_init(&hmac_ctx, K, hsize, hash_type); EG(ret, err); in __ecdsa_rfc6979_nonce() [all …]
|
H A D | bip0340.c | 49 int ret; in _bip0340_hash() local 52 MUST_HAVE((h_ctx != NULL), ret, err); in _bip0340_hash() 54 ret = hash_mapping_callbacks_sanity_check(hm); EG(ret, err); in _bip0340_hash() 56 ret = hm->hfunc_init(h_ctx); EG(ret, err); in _bip0340_hash() 57 ret = hm->hfunc_update(h_ctx, tag, tag_len); EG(ret, err); in _bip0340_hash() 58 ret = hm->hfunc_finalize(h_ctx, hash); EG(ret, err); in _bip0340_hash() 61 ret = hm->hfunc_init(h_ctx); EG(ret, err); in _bip0340_hash() 62 ret = hm->hfunc_update(h_ctx, hash, hm->digest_size); EG(ret, err); in _bip0340_hash() 63 ret = hm->hfunc_update(h_ctx, hash, hm->digest_size); EG(ret, err); in _bip0340_hash() 64 ret = hm->hfunc_update(h_ctx, m, m_len); EG(ret, err); in _bip0340_hash() [all …]
|
H A D | sm2.c | 39 int ret; in sm2_gen_priv_key() local 43 ret = priv_key_check_initialized_and_type(priv_key, SM2); EG(ret, err); in sm2_gen_priv_key() 46 ret = nn_init(&tmp, 0); EG(ret, err); in sm2_gen_priv_key() 47 ret = nn_dec(&tmp, &(priv_key->params->ec_gen_order)); EG(ret, err); in sm2_gen_priv_key() 48 ret = nn_get_random_mod(&(priv_key->x), &tmp); in sm2_gen_priv_key() 53 return ret; in sm2_gen_priv_key() 59 int ret, cmp; in sm2_init_pub_key() local 63 MUST_HAVE((out_pub != NULL), ret, err); in sm2_init_pub_key() 65 ret = priv_key_check_initialized_and_type(in_priv, SM2); EG(ret, err); in sm2_init_pub_key() 72 ret = nn_init(&tmp, 0); EG(ret, err); in sm2_init_pub_key() [all …]
|
H A D | ecfsdsa.c | 33 int ret, cmp; in ecfsdsa_init_pub_key() local 37 MUST_HAVE((out_pub != NULL), ret, err); in ecfsdsa_init_pub_key() 40 ret = local_memset(out_pub, 0, sizeof(ec_pub_key)); EG(ret, err); in ecfsdsa_init_pub_key() 42 ret = priv_key_check_initialized_and_type(in_priv, ECFSDSA); EG(ret, err); in ecfsdsa_init_pub_key() 46 MUST_HAVE(!nn_cmp(&(in_priv->x), q, &cmp) && (cmp < 0), ret, err); in ecfsdsa_init_pub_key() 51 ret = prj_pt_mul_blind(&(out_pub->y), &(in_priv->x), G); EG(ret, err); in ecfsdsa_init_pub_key() 58 return ret; in ecfsdsa_init_pub_key() 63 int ret; in ecfsdsa_siglen() local 65 MUST_HAVE((siglen != NULL), ret, err); in ecfsdsa_siglen() 68 (hsize <= MAX_DIGEST_SIZE) && (blocksize <= MAX_BLOCK_SIZE), ret, err); in ecfsdsa_siglen() [all …]
|
/freebsd/crypto/heimdal/lib/krb5/ |
H A D | store.c | 295 krb5_error_code ret; in krb5_storage_to_data() local 301 ret = size_too_large(sp, size); in krb5_storage_to_data() 302 if (ret) in krb5_storage_to_data() 303 return ret; in krb5_storage_to_data() 304 ret = krb5_data_alloc(data, size); in krb5_storage_to_data() 305 if (ret) { in krb5_storage_to_data() 307 return ret; in krb5_storage_to_data() 322 int ret; in krb5_store_int() local 328 ret = sp->store(sp, v, len); in krb5_store_int() 329 if (ret < 0) in krb5_store_int() [all …]
|
H A D | kcm.c | 73 krb5_error_code ret = 0; in kcm_send_request() local 78 ret = heim_ipc_init_context(kcm_ipc_name, &kcm_ipc); in kcm_send_request() 80 if (ret) in kcm_send_request() 83 ret = krb5_storage_to_data(request, &request_data); in kcm_send_request() 84 if (ret) { in kcm_send_request() 89 ret = heim_ipc_call(kcm_ipc, &request_data, response_data, NULL); in kcm_send_request() 92 if (ret) { in kcm_send_request() 94 ret = KRB5_CC_NOSUPP; in kcm_send_request() 97 return ret; in kcm_send_request() 106 krb5_error_code ret; in krb5_kcm_storage_request() local [all …]
|
/freebsd/crypto/libecc/src/examples/basic/ |
H A D | nn_miller_rabin.c | 47 int ret, iszero, cmp, isodd, cmp1, cmp2; in miller_rabin() local 55 ret = nn_check_initialized(n); EG(ret, err); in miller_rabin() 56 MUST_HAVE((res != NULL), ret, err); in miller_rabin() 60 ret = nn_init(&s, 0); EG(ret, err); in miller_rabin() 61 ret = nn_init(&q, 0); EG(ret, err); in miller_rabin() 62 ret = nn_init(&r, 0); EG(ret, err); in miller_rabin() 63 ret = nn_init(&d, 0); EG(ret, err); in miller_rabin() 64 ret = nn_init(&a, 0); EG(ret, err); in miller_rabin() 65 ret = nn_init(&y, 0); EG(ret, err); in miller_rabin() 66 ret = nn_init(&j, 0); EG(ret, err); in miller_rabin() [all …]
|
H A D | curve_basic_examples.c | 40 int ret, is_oncurve; in get_random_point_on_curve() local 49 MUST_HAVE((curve_params != NULL), ret, err); in get_random_point_on_curve() 57 ret = fp_init(&x, ctx); EG(ret, err); in get_random_point_on_curve() 58 ret = fp_init(&y, ctx); EG(ret, err); in get_random_point_on_curve() 59 ret = fp_init(&fp_tmp1, ctx); EG(ret, err); in get_random_point_on_curve() 60 ret = fp_init(&fp_tmp2, ctx); EG(ret, err); in get_random_point_on_curve() 62 ret = nn_init(&nn_tmp, 0); EG(ret, err); in get_random_point_on_curve() 63 ret = nn_set_word_value(&nn_tmp, WORD(3)); EG(ret, err); in get_random_point_on_curve() 66 ret = fp_get_random(&x, ctx); EG(ret, err); in get_random_point_on_curve() 67 ret = fp_copy(&fp_tmp1, &x); EG(ret, err); in get_random_point_on_curve() [all …]
|
H A D | nn_pollard_rho.c | 60 int ret, cmp, cmp1, cmp2; in pollard_rho() local 66 ret = nn_init(&a, 0); EG(ret, err); in pollard_rho() 67 ret = nn_init(&b, 0); EG(ret, err); in pollard_rho() 68 ret = nn_init(&tmp, 0); EG(ret, err); in pollard_rho() 69 ret = nn_init(&one, 0); EG(ret, err); in pollard_rho() 70 ret = nn_init(&c_bignum, 0); EG(ret, err); in pollard_rho() 71 ret = nn_init(d, 0); EG(ret, err); in pollard_rho() 73 MUST_HAVE((c > 0), ret, err); in pollard_rho() 76 ret = nn_zero(d); EG(ret, err); in pollard_rho() 77 ret = nn_one(&one); EG(ret, err); in pollard_rho() [all …]
|
/freebsd/crypto/libecc/src/examples/sig/dsa/ |
H A D | dsa.c | 58 int ret, cmp; in dsa_import_priv_key() local 61 MUST_HAVE((priv != NULL), ret, err); in dsa_import_priv_key() 62 MUST_HAVE((p != NULL) && (q != NULL) && (g != NULL) && (x != NULL), ret, err); in dsa_import_priv_key() 65 ret = _os2ip(&(priv->p), p, plen); EG(ret, err); in dsa_import_priv_key() 66 ret = _os2ip(&(priv->q), q, qlen); EG(ret, err); in dsa_import_priv_key() 67 ret = _os2ip(&(priv->g), g, glen); EG(ret, err); in dsa_import_priv_key() 68 ret = _os2ip(&(priv->x), x, xlen); EG(ret, err); in dsa_import_priv_key() 71 ret = nn_cmp(&(priv->q), &(priv->p), &cmp); EG(ret, err); in dsa_import_priv_key() 72 MUST_HAVE((cmp < 0), ret, err); in dsa_import_priv_key() 74 ret = nn_cmp(&(priv->g), &(priv->p), &cmp); EG(ret, err); in dsa_import_priv_key() [all …]
|
/freebsd/crypto/libecc/src/wycheproof_tests/ |
H A D | libecc_wycheproof.c | 43 #define OPENMP_EG(ret, err) do { \ argument 44 if(ret){ \ 49 #define OPENMP_MUST_HAVE(cnd, ret, err) do { \ argument 50 ret = !!(cnd); \ 51 ret = -((~ret) & 1); \ 52 OPENMP_EG(ret, err); \ 60 #define OPENMP_EG(ret, err) do { \ argument 61 EG(ret, err); \ 63 #define OPENMP_MUST_HAVE(cnd, ret, err) do { \ argument 64 MUST_HAVE(cnd, ret, err); \ [all …]
|
/freebsd/crypto/libecc/src/examples/sig/gostr34_10_94/ |
H A D | gostr34_10_94.c | 90 int ret, iszero; in gostr34_10_94_sign() local 110 MUST_HAVE((priv != NULL) && (msg != NULL) && (sig != NULL), ret, err); in gostr34_10_94_sign() 112 ret = local_memset(hash, 0, sizeof(hash)); EG(ret, err); in gostr34_10_94_sign() 121 ret = nn_check_initialized(p); EG(ret, err); in gostr34_10_94_sign() 122 ret = nn_check_initialized(q); EG(ret, err); in gostr34_10_94_sign() 123 ret = nn_check_initialized(g); EG(ret, err); in gostr34_10_94_sign() 124 ret = nn_check_initialized(x); EG(ret, err); in gostr34_10_94_sign() 130 ret = nn_bitlen(q, &N); EG(ret, err); in gostr34_10_94_sign() 131 ret = gen_hash_get_hash_sizes(gostr34_10_94_hash, &hlen, &block_size); EG(ret, err); in gostr34_10_94_sign() 132 MUST_HAVE((hlen <= MAX_DIGEST_SIZE), ret, err); in gostr34_10_94_sign() [all …]
|
/freebsd/contrib/wpa/hostapd/ |
H A D | eap_register.c | 25 int ret = 0; in eap_server_register_methods() local 28 if (ret == 0) in eap_server_register_methods() 29 ret = eap_server_identity_register(); in eap_server_register_methods() 33 if (ret == 0) in eap_server_register_methods() 34 ret = eap_server_md5_register(); in eap_server_register_methods() 38 if (ret == 0) in eap_server_register_methods() 39 ret = eap_server_tls_register(); in eap_server_register_methods() 43 if (ret == 0) in eap_server_register_methods() 44 ret = eap_server_unauth_tls_register(); in eap_server_register_methods() 49 if (ret == 0) in eap_server_register_methods() [all …]
|
/freebsd/crypto/libecc/src/tests/ |
H A D | ec_utils.c | 60 int ret; in export_private_key() local 63 MUST_HAVE(file != NULL, ret, err); in export_private_key() 65 ret = priv_key_check_initialized(priv_key); in export_private_key() 66 if (ret) { in export_private_key() 68 ret = -1; in export_private_key() 74 ret = ec_structured_priv_key_export_to_buf(priv_key, priv_key_buf, in export_private_key() 76 if (ret) { in export_private_key() 78 ret = -1; in export_private_key() 85 MUST_HAVE(name != NULL, ret, err); in export_private_key() 92 ret = 0; in export_private_key() [all …]
|