/optee_os-3.20.0/core/lib/libtomcrypt/src/encauth/chachapoly/ |
A D | chacha20poly1305_test.c | 34 int err; in chacha20poly1305_test() 37 if ((err = chacha20poly1305_init(&st1, k, sizeof(k))) != CRYPT_OK) return err; in chacha20poly1305_test() 48 if ((err = chacha20poly1305_done(&st1, emac, &len)) != CRYPT_OK) return err; in chacha20poly1305_test() 54 if ((err = chacha20poly1305_init(&st2, k, sizeof(k))) != CRYPT_OK) return err; in chacha20poly1305_test() 60 if ((err = chacha20poly1305_done(&st2, dmac, &len)) != CRYPT_OK) return err; in chacha20poly1305_test() 80 if ((err = chacha20poly1305_init(&st1, k, sizeof(k))) != CRYPT_OK) return err; in chacha20poly1305_test() 85 if ((err = chacha20poly1305_done(&st1, emac, &len)) != CRYPT_OK) return err; in chacha20poly1305_test() 91 if ((err = chacha20poly1305_init(&st1, k, sizeof(k))) != CRYPT_OK) return err; in chacha20poly1305_test() 96 if ((err = chacha20poly1305_done(&st1, dmac, &len)) != CRYPT_OK) return err; in chacha20poly1305_test() 107 if ((err = chacha20poly1305_done(&st1, emac, &len)) != CRYPT_OK) return err; in chacha20poly1305_test() [all …]
|
A D | chacha20poly1305_setiv.c | 18 int i, err; in chacha20poly1305_setiv() local 28 if ((err = chacha_ivctr32(&st->chacha, iv, ivlen, 1)) != CRYPT_OK) return err; in chacha20poly1305_setiv() 32 if ((err = chacha_ivctr64(&st->chacha, iv, ivlen, 1)) != CRYPT_OK) return err; in chacha20poly1305_setiv() 41 if ((err = chacha_ivctr32(&tmp_st, iv, ivlen, 0)) != CRYPT_OK) return err; in chacha20poly1305_setiv() 45 if ((err = chacha_ivctr64(&tmp_st, iv, ivlen, 0)) != CRYPT_OK) return err; in chacha20poly1305_setiv() 48 if ((err = chacha_keystream(&tmp_st, polykey, 32)) != CRYPT_OK) return err; in chacha20poly1305_setiv() 50 if ((err = poly1305_init(&st->poly, polykey, 32)) != CRYPT_OK) return err; in chacha20poly1305_setiv()
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/stream/chacha/ |
A D | chacha_test.c | 34 int err; in chacha_test() 39 …if ((err = chacha_setup(&st, k, sizeof(k), 20)) != CRYPT_OK) return err; in chacha_test() 40 …if ((err = chacha_ivctr32(&st, n, sizeof(n), 1)) != CRYPT_OK) return err; in chacha_test() 41 …if ((err = chacha_crypt(&st, (unsigned char*)pt, 35, out )) != CRYPT_OK) return err; in chacha_test() 42 …if ((err = chacha_crypt(&st, (unsigned char*)pt + 35, 35, out + 35)) != CRYPT_OK) return err; in chacha_test() 43 …if ((err = chacha_crypt(&st, (unsigned char*)pt + 70, 5, out + 70)) != CRYPT_OK) return err; in chacha_test() 44 …if ((err = chacha_crypt(&st, (unsigned char*)pt + 75, 5, out + 75)) != CRYPT_OK) return err; in chacha_test() 45 …if ((err = chacha_crypt(&st, (unsigned char*)pt + 80, len - 80, out + 80)) != CRYPT_OK) return err; in chacha_test() 49 …if ((err = chacha_setup(&st, k, sizeof(k), 20)) != CRYPT_OK) return err; in chacha_test() 50 …if ((err = chacha_ivctr32(&st, n, sizeof(n), 1)) != CRYPT_OK) return err; in chacha_test() [all …]
|
/optee_os-3.20.0/core/lib/libfdt/ |
A D | fdt_empty_tree.c | 15 int err; in fdt_create_empty_tree() local 18 if (err) in fdt_create_empty_tree() 19 return err; in fdt_create_empty_tree() 22 if (err) in fdt_create_empty_tree() 23 return err; in fdt_create_empty_tree() 26 if (err) in fdt_create_empty_tree() 27 return err; in fdt_create_empty_tree() 30 if (err) in fdt_create_empty_tree() 31 return err; in fdt_create_empty_tree() 34 if (err) in fdt_create_empty_tree() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/stream/sosemanuk/ |
A D | sosemanuk_test.c | 13 int err; in sosemanuk_test() 27 …if ((err = sosemanuk_setup(&st, k, sizeof(k))) != CRYPT_OK) return … in sosemanuk_test() 28 …if ((err = sosemanuk_setiv(&st, n, sizeof(n))) != CRYPT_OK) return … in sosemanuk_test() 29 …if ((err = sosemanuk_crypt(&st, (unsigned char*)pt, 5, out)) != CRYPT_OK) return … in sosemanuk_test() 36 if ((err = sosemanuk_setup(&st, k, sizeof(k))) != CRYPT_OK) return err; in sosemanuk_test() 37 if ((err = sosemanuk_setiv(&st, n, sizeof(n))) != CRYPT_OK) return err; in sosemanuk_test() 38 if ((err = sosemanuk_crypt(&st, (unsigned char*)pt, len, out)) != CRYPT_OK) return err; in sosemanuk_test() 68 if ((err = sosemanuk_setup(&st, k3, sizeof(k3))) != CRYPT_OK) return err; in sosemanuk_test() 69 if ((err = sosemanuk_setiv(&st, n3, sizeof(n3))) != CRYPT_OK) return err; in sosemanuk_test() 70 if ((err = sosemanuk_keystream(&st, out, 64)) != CRYPT_OK) return err; in sosemanuk_test() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/mac/poly1305/ |
A D | poly1305_test.c | 25 int err; in poly1305_test() 28 if ((err = poly1305_init(&st, k, 32)) != CRYPT_OK) return err; in poly1305_test() 29 if ((err = poly1305_process(&st, (unsigned char*)m, 5)) != CRYPT_OK) return err; in poly1305_test() 30 if ((err = poly1305_process(&st, (unsigned char*)m + 5, 4)) != CRYPT_OK) return err; in poly1305_test() 31 if ((err = poly1305_process(&st, (unsigned char*)m + 9, 3)) != CRYPT_OK) return err; in poly1305_test() 32 if ((err = poly1305_process(&st, (unsigned char*)m + 12, 2)) != CRYPT_OK) return err; in poly1305_test() 33 if ((err = poly1305_process(&st, (unsigned char*)m + 14, 1)) != CRYPT_OK) return err; in poly1305_test() 34 if ((err = poly1305_process(&st, (unsigned char*)m + 15, mlen - 15)) != CRYPT_OK) return err; in poly1305_test() 35 if ((err = poly1305_done(&st, out, &len)) != CRYPT_OK) return err; in poly1305_test() 38 if ((err = poly1305_init(&st, k, 32)) != CRYPT_OK) return err; in poly1305_test() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/stream/salsa20/ |
A D | salsa20_test.c | 34 int err; in salsa20_test() 40 …if ((err = salsa20_setup(&st, k, sizeof(k), rounds)) != CRYPT_OK) return er… in salsa20_test() 41 …if ((err = salsa20_ivctr64(&st, n, sizeof(n), counter)) != CRYPT_OK) return er… in salsa20_test() 42 …if ((err = salsa20_crypt(&st, (unsigned char*)pt, 5, out)) != CRYPT_OK) return er… in salsa20_test() 51 if ((err = salsa20_setup(&st, k, sizeof(k), rounds)) != CRYPT_OK) return err; in salsa20_test() 52 if ((err = salsa20_ivctr64(&st, n, sizeof(n), counter)) != CRYPT_OK) return err; in salsa20_test() 53 if ((err = salsa20_crypt(&st, (unsigned char*)pt, len, out)) != CRYPT_OK) return err; in salsa20_test() 75 if ((err = salsa20_setup(&st, k3, sizeof(k3), rounds3)) != CRYPT_OK) return err; in salsa20_test() 76 if ((err = salsa20_ivctr64(&st, n3, sizeof(n3), counter3)) != CRYPT_OK) return err; in salsa20_test() 77 if ((err = salsa20_keystream(&st, out, 64)) != CRYPT_OK) return err; in salsa20_test() [all …]
|
A D | xsalsa20_test.c | 43 int err; in xsalsa20_test() 45 if ((err = xsalsa20_setup(&st, key, 32, nonce, 24, rounds)) != CRYPT_OK) return err; in xsalsa20_test() 46 if ((err = salsa20_crypt(&st, msg, msglen, ciphertext)) != CRYPT_OK) return err; in xsalsa20_test() 47 if ((err = salsa20_done(&st)) != CRYPT_OK) return err; in xsalsa20_test() 49 if ((err = xsalsa20_setup(&st, key, 32, nonce, 24, rounds)) != CRYPT_OK) return err; in xsalsa20_test() 50 if ((err = salsa20_crypt(&st, ciphertext, msglen, msg2)) != CRYPT_OK) return err; in xsalsa20_test() 51 if ((err = salsa20_done(&st)) != CRYPT_OK) return err; in xsalsa20_test() 75 int err; in xsalsa20_test() 77 if ((err = xsalsa20_setup(&st, key, 32, nonce, 24, rounds)) != CRYPT_OK) return err; in xsalsa20_test() 78 if ((err = salsa20_keystream(&st, keystream, keystreamlen)) != CRYPT_OK) return err; in xsalsa20_test() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/ecc/ |
A D | ltc_ecc_projective_add_point.c | 26 int err, inf; in ltc_ecc_projective_add_point() local 34 if ((err = mp_init_multi(&t1, &t2, &x, &y, &z, LTC_NULL)) != CRYPT_OK) { in ltc_ecc_projective_add_point() 35 return err; in ltc_ecc_projective_add_point() 38 if ((err = ltc_ecc_is_point_at_infinity(P, modulus, &inf)) != CRYPT_OK) return err; in ltc_ecc_projective_add_point() 41 err = ltc_ecc_copy_point(Q, R); in ltc_ecc_projective_add_point() 45 if ((err = ltc_ecc_is_point_at_infinity(Q, modulus, &inf)) != CRYPT_OK) return err; in ltc_ecc_projective_add_point() 48 err = ltc_ecc_copy_point(P, R); in ltc_ecc_projective_add_point() 58 if ((err = mp_sub(modulus, Q->y, t1)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_add_point() 61 err = ltc_ecc_set_point_xyz(1, 1, 0, R); in ltc_ecc_projective_add_point() 191 err = CRYPT_OK; in ltc_ecc_projective_add_point() [all …]
|
A D | ltc_ecc_projective_dbl_point.c | 43 int err, inf; in ltc_ecc_projective_dbl_point() local 50 if ((err = mp_init_multi(&t1, &t2, LTC_NULL)) != CRYPT_OK) { in ltc_ecc_projective_dbl_point() 51 return err; in ltc_ecc_projective_dbl_point() 55 if ((err = ltc_ecc_copy_point(P, R)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_dbl_point() 58 if ((err = ltc_ecc_is_point_at_infinity(P, modulus, &inf)) != CRYPT_OK) return err; in ltc_ecc_projective_dbl_point() 61 err = ltc_ecc_set_point_xyz(1, 1, 0, R); in ltc_ecc_projective_dbl_point() 66 if ((err = mp_sqr(R->z, t1)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_dbl_point() 67 if ((err = mp_montgomery_reduce(t1, modulus, mp)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_dbl_point() 69 if ((err = mp_mul(R->z, R->y, R->z)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_dbl_point() 177 err = CRYPT_OK; in ltc_ecc_projective_dbl_point() [all …]
|
A D | ecc_recover_key.c | 35 int err; in ecc_recover_key() local 50 return err; in ecc_recover_key() 66 err = CRYPT_MEM; in ecc_recover_key() 81 err = CRYPT_INVALID_PACKET; in ecc_recover_key() 125 err = CRYPT_INVALID_ARG; in ecc_recover_key() 132 err = CRYPT_ERROR; in ecc_recover_key() 138 err = CRYPT_INVALID_ARG; in ecc_recover_key() 145 err = CRYPT_INVALID_PACKET; in ecc_recover_key() 241 err = CRYPT_OK; in ecc_recover_key() 245 err = CRYPT_INVALID_ARG; in ecc_recover_key() [all …]
|
A D | ecc_set_curve.c | 10 int err; in ecc_set_curve() local 19 return err; in ecc_set_curve() 41 return err; in ecc_set_curve() 47 int err = CRYPT_ERROR; in ecc_set_curve_by_size() local 51 err = ecc_find_curve("SECP112R1", &cu); in ecc_set_curve_by_size() 54 err = ecc_find_curve("SECP128R1", &cu); in ecc_set_curve_by_size() 57 err = ecc_find_curve("SECP160R1", &cu); in ecc_set_curve_by_size() 60 err = ecc_find_curve("SECP192R1", &cu); in ecc_set_curve_by_size() 63 err = ecc_find_curve("SECP224R1", &cu); in ecc_set_curve_by_size() 66 err = ecc_find_curve("SECP256R1", &cu); in ecc_set_curve_by_size() [all …]
|
A D | ecc_make_key.c | 23 int err; in ecc_make_key() local 25 if ((err = ecc_set_curve_by_size(keysize, key)) != CRYPT_OK) { return err; } in ecc_make_key() 26 if ((err = ecc_generate_key(prng, wprng, key)) != CRYPT_OK) { return err; } in ecc_make_key() 32 int err; in ecc_make_key_ex() local 33 if ((err = ecc_set_curve(cu, key)) != CRYPT_OK) { return err; } in ecc_make_key_ex() 34 if ((err = ecc_generate_key(prng, wprng, key)) != CRYPT_OK) { return err; } in ecc_make_key_ex() 40 int err; in ecc_generate_key() local 53 if ((err = rand_bn_upto(key->k, key->dp.order, prng, wprng)) != CRYPT_OK) { in ecc_generate_key() 58 …if ((err = ltc_mp.ecc_ptmul(key->k, &key->dp.base, &key->pubkey, key->dp.A, key->dp.prime, 1)) != … in ecc_generate_key() 64 err = CRYPT_OK; in ecc_generate_key() [all …]
|
A D | ltc_ecc_is_point.c | 18 int err; in ltc_ecc_is_point() local 24 if ((err = mp_init_multi(&t1, &t2, LTC_NULL)) != CRYPT_OK) return err; in ltc_ecc_is_point() 27 if ((err = mp_sqr(y, t1)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point() 30 if ((err = mp_sqr(x, t2)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point() 31 if ((err = mp_mod(t2, prime, t2)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point() 32 if ((err = mp_mul(x, t2, t2)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point() 35 if ((err = mp_sub(t1, t2, t1)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point() 38 if ((err = mp_submod(prime, a, prime, t2)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point() 52 err = CRYPT_INVALID_PACKET; in ltc_ecc_is_point() 54 err = CRYPT_OK; in ltc_ecc_is_point() [all …]
|
A D | ltc_ecc_map.c | 23 int err; in ltc_ecc_map() local 33 if ((err = mp_init_multi(&t1, &t2, LTC_NULL)) != CRYPT_OK) { in ltc_ecc_map() 34 return err; in ltc_ecc_map() 38 if ((err = mp_montgomery_reduce(P->z, modulus, mp)) != CRYPT_OK) { goto done; } in ltc_ecc_map() 41 if ((err = mp_invmod(P->z, modulus, t1)) != CRYPT_OK) { goto done; } in ltc_ecc_map() 44 if ((err = mp_sqr(t1, t2)) != CRYPT_OK) { goto done; } in ltc_ecc_map() 45 if ((err = mp_mod(t2, modulus, t2)) != CRYPT_OK) { goto done; } in ltc_ecc_map() 46 if ((err = mp_mul(t1, t2, t1)) != CRYPT_OK) { goto done; } in ltc_ecc_map() 47 if ((err = mp_mod(t1, modulus, t1)) != CRYPT_OK) { goto done; } in ltc_ecc_map() 56 err = CRYPT_OK; in ltc_ecc_map() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/rsa/ |
A D | rsa_make_key.c | 15 int err; in s_rsa_make_key() local 22 return err; in s_rsa_make_key() 26 return err; in s_rsa_make_key() 80 return err; in s_rsa_make_key() 95 int err; in rsa_make_key() local 102 return err; in rsa_make_key() 110 return err; in rsa_make_key() 126 int err; in rsa_make_key_ubin_e() local 138 return err; in rsa_make_key_ubin_e() 152 int err; in rsa_make_key_bn_e() local [all …]
|
A D | rsa_exptmod.c | 55 { return err; } in rsa_exptmod() 62 err = CRYPT_PK_INVALID_SIZE; in rsa_exptmod() 71 if (err != CRYPT_OK) { in rsa_exptmod() 77 if (err != CRYPT_OK) { in rsa_exptmod() 83 if (err != CRYPT_OK) { in rsa_exptmod() 89 if (err != CRYPT_OK) { in rsa_exptmod() 125 if (err != CRYPT_OK) { in rsa_exptmod() 146 err = CRYPT_BUFFER_OVERFLOW; in rsa_exptmod() 152 err = CRYPT_ERROR; in rsa_exptmod() 162 err = CRYPT_OK; in rsa_exptmod() [all …]
|
A D | rsa_import.c | 26 int err; in rsa_import_pkcs1() local 32 if (err == CRYPT_OVERFLOW) { in rsa_import_pkcs1() 43 } else if (err != CRYPT_INPUT_TOO_LONG) { in rsa_import_pkcs1() 66 err = CRYPT_PK_INVALID_TYPE; in rsa_import_pkcs1() 69 err = CRYPT_OK; in rsa_import_pkcs1() 71 return err; in rsa_import_pkcs1() 87 int err; in rsa_import() local 97 return err; in rsa_import() 104 err = CRYPT_MEM; in rsa_import() 123 err = CRYPT_OK; in rsa_import() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/dsa/ |
A D | dsa_verify_key.c | 25 int err; in dsa_verify_key() local 28 if (err != CRYPT_OK || *stat == 0) return err; in dsa_verify_key() 31 if (err != CRYPT_OK || *stat == 0) return err; in dsa_verify_key() 47 int err; in dsa_int_validate_pqg() local 88 return err; in dsa_int_validate_pqg() 100 int err, res; in dsa_int_validate_primes() local 108 return err; in dsa_int_validate_primes() 116 return err; in dsa_int_validate_primes() 136 int err; in dsa_int_validate_xy() local 144 return err; in dsa_int_validate_xy() [all …]
|
A D | dsa_generate_pqg.c | 26 int err, res, mr_tests_q, mr_tests_p, found_p, found_q, hash; in s_dsa_make_params() local 103 if ((err = hash_is_valid(hash)) != CRYPT_OK) { return err; } in s_dsa_make_params() 111 err = mp_init_multi(&t2L1, &t2N1, &t2q, &t2seedlen, &U, &W, &X, &c, &h, &e, &seedinc, LTC_NULL); in s_dsa_make_params() 147 err = hash_memory(hash, sbuf, seedbytes, wbuf+(n-j)*outbytes, &i); in s_dsa_make_params() 188 err = CRYPT_OK; in s_dsa_make_params() 196 return err; in s_dsa_make_params() 210 int err; in dsa_generate_pqg() local 217 return err; in dsa_generate_pqg() 220 err = s_dsa_make_params(prng, wprng, group_size, modulus_size, key->p, key->q, key->g); in dsa_generate_pqg() 221 if (err != CRYPT_OK) { in dsa_generate_pqg() [all …]
|
A D | dsa_verify_hash.c | 28 int err; in dsa_verify_hash_raw() local 40 return err; in dsa_verify_hash_raw() 45 err = CRYPT_INVALID_PACKET; in dsa_verify_hash_raw() 73 err = CRYPT_OK; in dsa_verify_hash_raw() 76 return err; in dsa_verify_hash_raw() 93 int err; in dsa_verify_hash() local 102 return err; in dsa_verify_hash() 109 if (err != CRYPT_OK) { in dsa_verify_hash() 113 err = der_length_sequence(sig_seq, 2, &reallen); in dsa_verify_hash() 114 if (err != CRYPT_OK || reallen != siglen) { in dsa_verify_hash() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/prngs/ |
A D | chacha20.c | 52 int err; in chacha20_prng_add_entropy() local 74 err = CRYPT_OK; in chacha20_prng_add_entropy() 77 return err; in chacha20_prng_add_entropy() 87 int err; in chacha20_prng_ready() local 102 return err; in chacha20_prng_ready() 130 int err; in chacha20_prng_done() local 137 return err; in chacha20_prng_done() 158 int err; in LTC_PRNG_EXPORT() local 164 if ((err = chacha20_prng_start(prng)) != CRYPT_OK) return err; in LTC_PRNG_EXPORT() 165 if ((err = chacha20_prng_add_entropy(in, inlen, prng)) != CRYPT_OK) return err; in LTC_PRNG_EXPORT() [all …]
|
A D | sober128.c | 54 int err; in sober128_add_entropy() local 76 err = CRYPT_OK; in sober128_add_entropy() 79 return err; in sober128_add_entropy() 89 int err; in sober128_ready() local 104 return err; in sober128_ready() 132 int err; in sober128_done() local 139 return err; in sober128_done() 160 int err; in LTC_PRNG_EXPORT() local 166 if ((err = sober128_start(prng)) != CRYPT_OK) return err; in LTC_PRNG_EXPORT() 167 if ((err = sober128_add_entropy(in, inlen, prng)) != CRYPT_OK) return err; in LTC_PRNG_EXPORT() [all …]
|
A D | rc4.c | 54 int err; in rc4_add_entropy() local 75 err = CRYPT_OK; in rc4_add_entropy() 78 return err; in rc4_add_entropy() 90 int err, i; in rc4_ready() local 105 return err; in rc4_ready() 133 int err; in rc4_done() local 140 return err; in rc4_done() 161 int err; in LTC_PRNG_EXPORT() local 167 if ((err = rc4_start(prng)) != CRYPT_OK) return err; in LTC_PRNG_EXPORT() 168 if ((err = rc4_add_entropy(in, inlen, prng)) != CRYPT_OK) return err; in LTC_PRNG_EXPORT() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/asn1/der/sequence/ |
A D | der_decode_sequence_flexi.c | 177 err = CRYPT_MEM; in s_der_decode_sequence_flexi() 200 err = CRYPT_MEM; in s_der_decode_sequence_flexi() 242 err = CRYPT_MEM; in s_der_decode_sequence_flexi() 272 err = CRYPT_MEM; in s_der_decode_sequence_flexi() 295 err = CRYPT_MEM; in s_der_decode_sequence_flexi() 318 err = CRYPT_MEM; in s_der_decode_sequence_flexi() 341 err = CRYPT_MEM; in s_der_decode_sequence_flexi() 364 err = CRYPT_MEM; in s_der_decode_sequence_flexi() 388 err = CRYPT_MEM; in s_der_decode_sequence_flexi() 433 err = CRYPT_MEM; in s_der_decode_sequence_flexi() [all …]
|