| /optee_os/core/lib/libtomcrypt/src/pk/ecc/ |
| H A D | ltc_ecc_projective_add_point.c | 34 if ((err = mp_init_multi(&t1, &t2, &x, &y, &z, LTC_NULL)) != CRYPT_OK) { 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() 45 if ((err = ltc_ecc_is_point_at_infinity(Q, modulus, &inf)) != CRYPT_OK) return err; 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() 66 if ((err = mp_copy(P->x, x)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_add_point() 67 if ((err = mp_copy(P->y, y)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_add_point() 68 if ((err = mp_copy(P->z, z)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_add_point() 73 if ((err = mp_sqr(Q->z, t1)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_add_point() 74 if ((err = mp_montgomery_reduce(t1, modulus, mp)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_add_point() 76 if ((err = mp_mul(t1, x, x)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_add_point() [all …]
|
| H A D | ltc_ecc_projective_dbl_point.c | 50 if ((err = mp_init_multi(&t1, &t2, LTC_NULL)) != CRYPT_OK) { 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() 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() 70 if ((err = mp_montgomery_reduce(R->z, modulus, mp)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_dbl_point() 72 if ((err = mp_add(R->z, R->z, R->z)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_dbl_point() 74 if ((err = mp_sub(R->z, modulus, R->z)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_dbl_point() 79 if ((err = mp_sub(R->x, t1, t2)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_dbl_point() [all …]
|
| H A D | ecc_recover_key.c | 49 …multi(&r, &s, &v, &w, &t1, &t2, &u1, &u2, &v1, &v2, &e, &x, &y, &a_plus3, LTC_NULL)) != CRYPT_OK) { in ecc_recover_key() 57 if ((err = mp_add_d(a, 3, a_plus3)) != CRYPT_OK) { in ecc_recover_key() 75 … LTC_ASN1_EOL, 0UL, LTC_NULL)) != CRYPT_OK) { goto error; } in ecc_recover_key() 84 …if ((err = mp_read_unsigned_bin(r, (unsigned char *)sig, i)) != CRYPT_OK) … in ecc_recover_key() 85 …if ((err = mp_read_unsigned_bin(s, (unsigned char *)sig+i, i)) != CRYPT_OK) … in ecc_recover_key() 89 if (pk_oid_cmp_with_ulong("1.3.132.0.10", key->dp.oid, key->dp.oidlen) != CRYPT_OK) { in ecc_recover_key() 105 …if ((err = mp_read_unsigned_bin(r, (unsigned char *)sig, 32)) != CRYPT_OK) … in ecc_recover_key() 106 …if ((err = mp_read_unsigned_bin(s, (unsigned char *)sig+32, 32)) != CRYPT_OK) … in ecc_recover_key() 119 … LTC_SSHDATA_EOL, NULL)) != CRYPT_OK) { goto error; } in ecc_recover_key() 123 …if ((err = ecc_ssh_ecdsa_encode_name(name2, &name2len, key)) != CRYPT_OK) … in ecc_recover_key() [all …]
|
| H A D | ltc_ecc_map.c | 33 if ((err = mp_init_multi(&t1, &t2, LTC_NULL)) != CRYPT_OK) { 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() 50 if ((err = mp_mul(P->x, t2, P->x)) != CRYPT_OK) { goto done; } in ltc_ecc_map() 51 if ((err = mp_montgomery_reduce(P->x, modulus, mp)) != CRYPT_OK) { goto done; } in ltc_ecc_map() 52 if ((err = mp_mul(P->y, t1, P->y)) != CRYPT_OK) { goto done; } in ltc_ecc_map() [all …]
|
| H A D | ltc_ecc_mulmod_timing.c | 38 if ((err = ltc_ecc_is_point_at_infinity(G, modulus, &inf)) != CRYPT_OK) return err; in ltc_ecc_mulmod() 45 if ((err = mp_montgomery_setup(modulus, &mp)) != CRYPT_OK) { goto error; } in ltc_ecc_mulmod() 46 if ((err = mp_init(&mu)) != CRYPT_OK) { goto error; } in ltc_ecc_mulmod() 47 if ((err = mp_montgomery_normalization(mu, modulus)) != CRYPT_OK) { goto error; } in ltc_ecc_mulmod() 50 if ((err = mp_init(&a_plus3)) != CRYPT_OK) { goto error; } in ltc_ecc_mulmod() 51 if ((err = mp_add_d(a, 3, a_plus3)) != CRYPT_OK) { goto error; } in ltc_ecc_mulmod() 53 if ((err = mp_init(&ma)) != CRYPT_OK) { goto error; } in ltc_ecc_mulmod() 54 if ((err = mp_mulmod(a, mu, modulus, ma)) != CRYPT_OK) { goto error; } in ltc_ecc_mulmod() 75 if ((err = mp_mulmod(G->x, mu, modulus, tG->x)) != CRYPT_OK) { goto done; } in ltc_ecc_mulmod() 76 if ((err = mp_mulmod(G->y, mu, modulus, tG->y)) != CRYPT_OK) { goto done; } in ltc_ecc_mulmod() [all …]
|
| H A D | ecc_verify_hash.c | 45 if ((err = mp_init_multi(&r, &s, &v, &w, &u1, &u2, &e, &a_plus3, LTC_NULL)) != CRYPT_OK) { in ecc_verify_hash_ex() 52 if ((err = mp_add_d(a, 3, a_plus3)) != CRYPT_OK) { in ecc_verify_hash_ex() 69 … LTC_ASN1_EOL, 0UL, LTC_NULL)) != CRYPT_OK) { goto error; } in ecc_verify_hash_ex() 78 …if ((err = mp_read_unsigned_bin(r, (unsigned char *)sig, i)) != CRYPT_OK) … in ecc_verify_hash_ex() 79 …if ((err = mp_read_unsigned_bin(s, (unsigned char *)sig+i, i)) != CRYPT_OK) … in ecc_verify_hash_ex() 83 if (pk_oid_cmp_with_ulong("1.3.132.0.10", key->dp.oid, key->dp.oidlen) != CRYPT_OK) { in ecc_verify_hash_ex() 91 …if ((err = mp_read_unsigned_bin(r, (unsigned char *)sig, 32)) != CRYPT_OK) … in ecc_verify_hash_ex() 92 …if ((err = mp_read_unsigned_bin(s, (unsigned char *)sig+32, 32)) != CRYPT_OK) … in ecc_verify_hash_ex() 105 … LTC_SSHDATA_EOL, NULL)) != CRYPT_OK) { goto error; } in ecc_verify_hash_ex() 109 …if ((err = ecc_ssh_ecdsa_encode_name(name2, &name2len, key)) != CRYPT_OK) … in ecc_verify_hash_ex() [all …]
|
| H A D | ltc_ecc_import_point.c | 15 if (mp_init_multi(&t1, &t2, LTC_NULL) != CRYPT_OK) { in ltc_ecc_import_point() 24 …if ((err = mp_read_unsigned_bin(x, (unsigned char *)in+1, size)) != CRYPT_OK) { goto cleanup;… in ltc_ecc_import_point() 26 …if ((err = mp_read_unsigned_bin(y, (unsigned char *)in+1+size, size)) != CRYPT_OK) { goto cleanup;… in ltc_ecc_import_point() 31 …if ((err = mp_read_unsigned_bin(x, (unsigned char *)in+1, size)) != CRYPT_OK) { goto cleanup;… in ltc_ecc_import_point() 33 …if ((err = mp_sqr(x, t1)) != CRYPT_OK) { goto cleanup;… in ltc_ecc_import_point() 34 …if ((err = mp_mulmod(t1, x, prime, t1)) != CRYPT_OK) { goto cleanup;… in ltc_ecc_import_point() 36 …if ((err = mp_mulmod(a, x, prime, t2)) != CRYPT_OK) { goto cleanup;… in ltc_ecc_import_point() 37 …if ((err = mp_add(t1, t2, t1)) != CRYPT_OK) { goto cleanup;… in ltc_ecc_import_point() 39 …if ((err = mp_add(t1, b, t1)) != CRYPT_OK) { goto cleanup;… in ltc_ecc_import_point() 41 …if ((err = mp_sqrtmod_prime(t1, prime, t2)) != CRYPT_OK) { goto cleanup;… in ltc_ecc_import_point() [all …]
|
| H A D | ecc_sign_hash.c | 49 if ((err = mp_init_multi(&r, &s, &e, &b, LTC_NULL)) != CRYPT_OK) { in ecc_sign_hash_ex() 58 … if ((err = mp_read_unsigned_bin(e, (unsigned char *)in, inlen)) != CRYPT_OK) { goto errnokey; } in ecc_sign_hash_ex() 61 … if ((err = mp_read_unsigned_bin(e, (unsigned char *)in, pbytes)) != CRYPT_OK) { goto errnokey; } in ecc_sign_hash_ex() 70 … if ((err = mp_read_unsigned_bin(e, (unsigned char *)buf, pbytes)) != CRYPT_OK) { goto errnokey; } in ecc_sign_hash_ex() 75 if ((err = ecc_copy_curve(key, &pubkey)) != CRYPT_OK) { goto errnokey; } in ecc_sign_hash_ex() 76 if ((err = ecc_generate_key(prng, wprng, &pubkey)) != CRYPT_OK) { goto errnokey; } in ecc_sign_hash_ex() 79 if ((err = mp_mod(pubkey.pubkey.x, p, r)) != CRYPT_OK) { goto error; } in ecc_sign_hash_ex() 84 if (mp_copy(pubkey.pubkey.x, s) != CRYPT_OK) { goto error; } in ecc_sign_hash_ex() 88 if ((err = mp_sub(s, p, s)) != CRYPT_OK) { goto error; } in ecc_sign_hash_ex() 96 …if ((err = rand_bn_upto(b, p, prng, wprng)) != CRYPT_OK) { goto error; } /* b = blinding … in ecc_sign_hash_ex() [all …]
|
| H A D | ltc_ecc_is_point.c | 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() 39 if ((err = mp_mulmod(t2, x, prime, t2)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point() 40 if ((err = mp_addmod(t1, t2, prime, t1)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point() 44 if ((err = mp_add(t1, prime, t1)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point() [all …]
|
| H A D | ltc_ecc_mulmod.c | 39 if ((err = ltc_ecc_is_point_at_infinity(G, modulus, &inf)) != CRYPT_OK) return err; in ltc_ecc_mulmod() 46 if ((err = mp_montgomery_setup(modulus, &mp)) != CRYPT_OK) { goto error; } in ltc_ecc_mulmod() 47 if ((err = mp_init(&mu)) != CRYPT_OK) { goto error; } in ltc_ecc_mulmod() 48 if ((err = mp_montgomery_normalization(mu, modulus)) != CRYPT_OK) { goto error; } in ltc_ecc_mulmod() 51 if ((err = mp_init(&a_plus3)) != CRYPT_OK) { goto error; } in ltc_ecc_mulmod() 52 if ((err = mp_add_d(a, 3, a_plus3)) != CRYPT_OK) { goto error; } in ltc_ecc_mulmod() 54 if ((err = mp_init(&ma)) != CRYPT_OK) { goto error; } in ltc_ecc_mulmod() 55 if ((err = mp_mulmod(a, mu, modulus, ma)) != CRYPT_OK) { goto error; } in ltc_ecc_mulmod() 76 if ((err = ltc_ecc_copy_point(G, tG)) != CRYPT_OK) { goto done; } in ltc_ecc_mulmod() 78 if ((err = mp_mulmod(G->x, mu, modulus, tG->x)) != CRYPT_OK) { goto done; } in ltc_ecc_mulmod() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/choice/ |
| H A D | der_decode_choice.c | 47 if (der_decode_boolean(in, *inlen, data) == CRYPT_OK) { in der_decode_choice() 48 if (der_length_boolean(&z) == CRYPT_OK) { in der_decode_choice() 51 return CRYPT_OK; in der_decode_choice() 57 if (der_decode_integer(in, *inlen, data) == CRYPT_OK) { in der_decode_choice() 58 if (der_length_integer(data, &z) == CRYPT_OK) { in der_decode_choice() 61 return CRYPT_OK; in der_decode_choice() 67 if (der_decode_short_integer(in, *inlen, data) == CRYPT_OK) { in der_decode_choice() 68 if (der_length_short_integer(*(unsigned long*)data, &z) == CRYPT_OK) { in der_decode_choice() 71 return CRYPT_OK; in der_decode_choice() 77 if (der_decode_bit_string(in, *inlen, data, &size) == CRYPT_OK) { in der_decode_choice() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/encauth/chachapoly/ |
| H A D | chacha20poly1305_test.c | 37 if ((err = chacha20poly1305_init(&st1, k, sizeof(k))) != CRYPT_OK) return err; in chacha20poly1305_test() 38 if ((err = chacha20poly1305_setiv(&st1, i12, sizeof(i12))) != CRYPT_OK) return err; in chacha20poly1305_test() 39 if ((err = chacha20poly1305_add_aad(&st1, aad, sizeof(aad))) != CRYPT_OK) return err; in chacha20poly1305_test() 41 …if ((err = chacha20poly1305_encrypt(&st1, (unsigned char *)m, 25, ct)) != CRYPT_OK) re… in chacha20poly1305_test() 42 …acha20poly1305_encrypt(&st1, (unsigned char *)m + 25, 10, ct + 25)) != CRYPT_OK) return err; in chacha20poly1305_test() 43 …acha20poly1305_encrypt(&st1, (unsigned char *)m + 35, 35, ct + 35)) != CRYPT_OK) return err; in chacha20poly1305_test() 44 …acha20poly1305_encrypt(&st1, (unsigned char *)m + 70, 5, ct + 70)) != CRYPT_OK) return err; in chacha20poly1305_test() 45 …acha20poly1305_encrypt(&st1, (unsigned char *)m + 75, 5, ct + 75)) != CRYPT_OK) return err; in chacha20poly1305_test() 46 …acha20poly1305_encrypt(&st1, (unsigned char *)m + 80, mlen - 80, ct + 80)) != CRYPT_OK) return err; in chacha20poly1305_test() 48 if ((err = chacha20poly1305_done(&st1, emac, &len)) != CRYPT_OK) return err; in chacha20poly1305_test() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/dsa/ |
| H A D | dsa_verify_key.c | 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() 57 return CRYPT_OK; in dsa_int_validate_pqg() 62 return CRYPT_OK; in dsa_int_validate_pqg() 65 if ((err = mp_init_multi(&tmp1, &tmp2, LTC_NULL)) != CRYPT_OK) { return err; } in dsa_int_validate_pqg() 68 if ((err = mp_sub_d(key->p, 1, tmp1)) != CRYPT_OK) { goto error; } in dsa_int_validate_pqg() 69 if ((err = mp_div(tmp1, key->q, tmp1, tmp2)) != CRYPT_OK) { goto error; } in dsa_int_validate_pqg() 71 err = CRYPT_OK; in dsa_int_validate_pqg() 78 if ((err = mp_exptmod(key->g, key->q, key->p, tmp1)) != CRYPT_OK) { goto error; } in dsa_int_validate_pqg() 80 err = CRYPT_OK; in dsa_int_validate_pqg() [all …]
|
| H A D | dsa_generate_pqg.c | 103 if ((err = hash_is_valid(hash)) != CRYPT_OK) { return err; } in s_dsa_make_params() 112 if (err != CRYPT_OK) { goto cleanup1; } in s_dsa_make_params() 114 if ((err = mp_2expt(t2L1, L-1)) != CRYPT_OK) { goto cleanup; } in s_dsa_make_params() 116 if ((err = mp_2expt(t2N1, N-1)) != CRYPT_OK) { goto cleanup; } in s_dsa_make_params() 118 if ((err = mp_2expt(t2seedlen, seedbytes*8)) != CRYPT_OK) { goto cleanup; } in s_dsa_make_params() 126 if ((err = hash_memory(hash, sbuf, seedbytes, digest, &i)) != CRYPT_OK) { goto cleanup; } in s_dsa_make_params() 127 if ((err = mp_read_unsigned_bin(U, digest, outbytes)) != CRYPT_OK) { goto cleanup; } in s_dsa_make_params() 128 if ((err = mp_mod(U, t2N1, U)) != CRYPT_OK) { goto cleanup; } in s_dsa_make_params() 129 if ((err = mp_add(t2N1, U, q)) != CRYPT_OK) { goto cleanup; } in s_dsa_make_params() 131 if ((err = mp_prime_is_prime(q, mr_tests_q, &res)) != CRYPT_OK) { goto cleanup; } in s_dsa_make_params() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/rsa/ |
| H A D | rsa_make_key.c | 21 if ((err = prng_is_valid(wprng)) != CRYPT_OK) { in s_rsa_make_key() 25 if ((err = mp_init_multi(&p, &q, &tmp1, &tmp2, LTC_NULL)) != CRYPT_OK) { in s_rsa_make_key() 33 if ((err = rand_prime( p, size/2, prng, wprng)) != CRYPT_OK) { goto cleanup; } in s_rsa_make_key() 34 … if ((err = mp_sub_d( p, 1, tmp1)) != CRYPT_OK) { goto cleanup; } /* tmp1 = p-1 */ in s_rsa_make_key() 35 …if ((err = mp_gcd( tmp1, e, tmp2)) != CRYPT_OK) { goto cleanup; } /* tmp2 = gcd(p-1… in s_rsa_make_key() 40 if ((err = rand_prime( q, size/2, prng, wprng)) != CRYPT_OK) { goto cleanup; } in s_rsa_make_key() 41 … if ((err = mp_sub_d( q, 1, tmp1)) != CRYPT_OK) { goto cleanup; } /* tmp1 = q-1 */ in s_rsa_make_key() 42 …if ((err = mp_gcd( tmp1, e, tmp2)) != CRYPT_OK) { goto cleanup; } /* tmp2 = gcd(q-1, e)… in s_rsa_make_key() 46 …if ((err = mp_sub_d( p, 1, tmp2)) != CRYPT_OK) { goto cleanup; } /* tmp2 = p-1 … in s_rsa_make_key() 48 …if ((err = mp_lcm( tmp1, tmp2, tmp1)) != CRYPT_OK) { goto cleanup; } /* tmp1 = lcm(… in s_rsa_make_key() [all …]
|
| H A D | rsa_exptmod.c | 54 NULL)) != CRYPT_OK) in rsa_exptmod() 56 if ((err = mp_read_unsigned_bin(tmp, (unsigned char *)in, (int)inlen)) != CRYPT_OK) 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() 105 …if ((err = mp_exptmod(tmp, key->d, key->N, tmp)) != CRYPT_OK) { goto … in rsa_exptmod() 108 …if ((err = mp_exptmod(tmp, key->dP, key->p, tmpa)) != CRYPT_OK) { goto … in rsa_exptmod() 111 …if ((err = mp_exptmod(tmp, key->dQ, key->q, tmpb)) != CRYPT_OK) { goto … in rsa_exptmod() 114 …if ((err = mp_sub(tmpa, tmpb, tmp)) != CRYPT_OK) { goto … in rsa_exptmod() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/stream/chacha/ |
| H A D | chacha_test.c | 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() 51 …if ((err = chacha_crypt(&st, (unsigned char*)pt, len, out)) != CRYPT_OK) return err; in chacha_test() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/stream/sosemanuk/ |
| H A D | sosemanuk_test.c | 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() 30 …if ((err = sosemanuk_crypt(&st, (unsigned char*)pt + 5, 25, out + 5)) != CRYPT_OK) return … in sosemanuk_test() 31 …if ((err = sosemanuk_crypt(&st, (unsigned char*)pt + 30, 10, out + 30)) != CRYPT_OK) return … in sosemanuk_test() 32 …if ((err = sosemanuk_crypt(&st, (unsigned char*)pt + 40, len - 40, out + 40)) != 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() 43 (unsigned char*)pt, len, out)) != CRYPT_OK) return err; in sosemanuk_test() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/mac/poly1305/ |
| H A D | poly1305_test.c | 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() 39 if ((err = poly1305_process(&st, (unsigned char*)m, mlen)) != CRYPT_OK) return err; in poly1305_test() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/stream/salsa20/ |
| H A D | salsa20_test.c | 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() 43 …if ((err = salsa20_crypt(&st, (unsigned char*)pt + 5, 25, out + 5)) != CRYPT_OK) return er… in salsa20_test() 44 …if ((err = salsa20_crypt(&st, (unsigned char*)pt + 30, 10, out + 30)) != CRYPT_OK) return er… in salsa20_test() 45 …if ((err = salsa20_crypt(&st, (unsigned char*)pt + 40, len - 40, out + 40)) != 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() 58 (unsigned char*)pt, len, out)) != CRYPT_OK) return err; in salsa20_test() [all …]
|
| H A D | xsalsa20_test.c | 21 return CRYPT_OK; in s_sha256() 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() 57 …y, sizeof(key), 20, nonce, sizeof(nonce), msg, msglen, ciphertext)) != CRYPT_OK) r… in xsalsa20_test() 58 …y, sizeof(key), 20, nonce, sizeof(nonce), ciphertext, msglen, msg2)) != CRYPT_OK) r… in xsalsa20_test() 77 if ((err = xsalsa20_setup(&st, key, 32, nonce, 24, rounds)) != CRYPT_OK) return err; in xsalsa20_test() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/custom_type/ |
| H A D | der_decode_custom_type.c | 86 if ((err = der_decode_asn1_identifier(in, &y, &ident)) != CRYPT_OK) { in der_decode_custom_type_ex() 119 if ((err = der_decode_asn1_length(&in[x], &y, &blksize)) != CRYPT_OK) { in der_decode_custom_type_ex() 138 seq_err = CRYPT_OK; in der_decode_custom_type_ex() 176 if ((err = der_decode_boolean(in + x, z, ((int *)data))) != CRYPT_OK) { in der_decode_custom_type_ex() 180 if ((err = der_length_boolean(&z)) != CRYPT_OK) { in der_decode_custom_type_ex() 187 if ((err = der_decode_integer(in + x, z, data)) != CRYPT_OK) { in der_decode_custom_type_ex() 191 if ((err = der_length_integer(data, &z)) != CRYPT_OK) { in der_decode_custom_type_ex() 198 if ((err = der_decode_short_integer(in + x, z, data)) != CRYPT_OK) { in der_decode_custom_type_ex() 202 if ((err = der_length_short_integer(((unsigned long*)data)[0], &z)) != CRYPT_OK) { in der_decode_custom_type_ex() 210 if ((err = der_decode_bit_string(in + x, z, data, &size)) != CRYPT_OK) { in der_decode_custom_type_ex() [all …]
|
| H A D | der_encode_custom_type.c | 39 if (der_length_custom_type(root, &y, &z) != CRYPT_OK) return CRYPT_INVALID_ARG; in der_encode_custom_type() 49 if (der_length_asn1_identifier(root, &id_len) != CRYPT_OK) return CRYPT_INVALID_ARG; in der_encode_custom_type() 66 if ((err = der_encode_asn1_length(z, &out[x], &y)) != CRYPT_OK) { in der_encode_custom_type() 90 if ((err = der_encode_boolean(*((int *)data), out + x, &z)) != CRYPT_OK) { in der_encode_custom_type() 97 if ((err = der_encode_integer(data, out + x, &z)) != CRYPT_OK) { in der_encode_custom_type() 104 … if ((err = der_encode_short_integer(*((unsigned long*)data), out + x, &z)) != CRYPT_OK) { in der_encode_custom_type() 111 if ((err = der_encode_bit_string(data, size, out + x, &z)) != CRYPT_OK) { in der_encode_custom_type() 118 if ((err = der_encode_raw_bit_string(data, size, out + x, &z)) != CRYPT_OK) { in der_encode_custom_type() 125 if ((err = der_encode_octet_string(data, size, out + x, &z)) != CRYPT_OK) { in der_encode_custom_type() 138 if ((err = der_encode_object_identifier(data, size, out + x, &z)) != CRYPT_OK) { in der_encode_custom_type() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/prngs/ |
| H A D | chacha20.c | 38 return CRYPT_OK; in chacha20_prng_start() 61 … if ((err = chacha_keystream(&prng->u.chacha.s, buf, sizeof(buf))) != CRYPT_OK) goto LBL_UNLOCK; in chacha20_prng_add_entropy() 64 if ((err = chacha_setup(&prng->u.chacha.s, buf, 32, 20)) != CRYPT_OK) goto LBL_UNLOCK; in chacha20_prng_add_entropy() 66 if ((err = chacha_ivctr64(&prng->u.chacha.s, buf + 32, 8, 0)) != CRYPT_OK) goto LBL_UNLOCK; in chacha20_prng_add_entropy() 74 err = CRYPT_OK; in chacha20_prng_add_entropy() 92 …if (prng->ready) { err = CRYPT_OK; goto LBL_UNL… in chacha20_prng_ready() 94 …if ((err = chacha_setup(&prng->u.chacha.s, prng->u.chacha.ent, 32, 20)) != CRYPT_OK) goto LBL… in chacha20_prng_ready() 96 …if ((err = chacha_ivctr64(&prng->u.chacha.s, prng->u.chacha.ent + 32, 8, 0)) != CRYPT_OK) goto LBL… in chacha20_prng_ready() 117 if (chacha_keystream(&prng->u.chacha.s, out, outlen) != CRYPT_OK) outlen = 0; in chacha20_prng_read() 164 if ((err = chacha20_prng_start(prng)) != CRYPT_OK) return err; in LTC_PRNG_EXPORT() [all …]
|
| H A D | sober128.c | 40 return CRYPT_OK; in sober128_start() 63 …if ((err = sober128_stream_keystream(&prng->u.sober128.s, buf, sizeof(buf))) != CRYPT_OK) goto LBL… in sober128_add_entropy() 66 … if ((err = sober128_stream_setup(&prng->u.sober128.s, buf, 32)) != CRYPT_OK) goto LBL_UNLOCK; in sober128_add_entropy() 68 … if ((err = sober128_stream_setiv(&prng->u.sober128.s, buf + 32, 8)) != CRYPT_OK) goto LBL_UNLOCK; in sober128_add_entropy() 76 err = CRYPT_OK; in sober128_add_entropy() 94 …if (prng->ready) { err = CRYPT_OK; goto… in sober128_ready() 96 …if ((err = sober128_stream_setup(&prng->u.sober128.s, prng->u.sober128.ent, 32)) != CRYPT_OK) … in sober128_ready() 98 …if ((err = sober128_stream_setiv(&prng->u.sober128.s, prng->u.sober128.ent + 32, 8)) != CRYPT_OK) … in sober128_ready() 119 if (sober128_stream_keystream(&prng->u.sober128.s, out, outlen) != CRYPT_OK) outlen = 0; in sober128_read() 166 if ((err = sober128_start(prng)) != CRYPT_OK) return err; in LTC_PRNG_EXPORT() [all …]
|