Home
last modified time | relevance | path

Searched refs:inlen (Results 1 – 25 of 140) sorted by relevance

123456

/optee_os/core/lib/libtomcrypt/src/pk/asn1/der/choice/
H A Dder_decode_choice.c20 int der_decode_choice(const unsigned char *in, unsigned long *inlen, in der_decode_choice() argument
27 LTC_ARGCHK(inlen != NULL); in der_decode_choice()
31 if (*inlen < 2) { in der_decode_choice()
47 if (der_decode_boolean(in, *inlen, data) == CRYPT_OK) { in der_decode_choice()
50 *inlen = z; in der_decode_choice()
57 if (der_decode_integer(in, *inlen, data) == CRYPT_OK) { in der_decode_choice()
60 *inlen = z; in der_decode_choice()
67 if (der_decode_short_integer(in, *inlen, data) == CRYPT_OK) { in der_decode_choice()
70 *inlen = z; 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/headers/
H A Dtomcrypt_pk.h52 int rsa_exptmod(const unsigned char *in, unsigned long inlen,
59 #define rsa_encrypt_key(in, inlen, out, outlen, lparam, lparamlen, prng, prng_idx, hash_idx, key) \ argument
60 …rsa_encrypt_key_ex(in, inlen, out, outlen, lparam, lparamlen, prng, prng_idx, hash_idx, -1, LTC_PK…
62 #define rsa_decrypt_key(in, inlen, out, outlen, lparam, lparamlen, hash_idx, stat, key) \ argument
63 …rsa_decrypt_key_ex(in, inlen, out, outlen, lparam, lparamlen, hash_idx, -1, LTC_PKCS_1_OAEP, stat,…
65 #define rsa_sign_hash(in, inlen, out, outlen, prng, prng_idx, hash_idx, saltlen, key) \ argument
66 rsa_sign_hash_ex(in, inlen, out, outlen, LTC_PKCS_1_PSS, prng, prng_idx, hash_idx, saltlen, key)
75 int rsa_encrypt_key_ex(const unsigned char *in, unsigned long inlen,
83 int rsa_decrypt_key_ex(const unsigned char *in, unsigned long inlen,
90 int rsa_sign_hash_ex(const unsigned char *in, unsigned long inlen,
[all …]
H A Dtomcrypt_misc.h6 int base64_encode(const unsigned char *in, unsigned long inlen,
9 int base64_decode(const char *in, unsigned long inlen,
11 int base64_strict_decode(const char *in, unsigned long inlen,
13 int base64_sane_decode(const char *in, unsigned long inlen,
18 int base64url_encode(const unsigned char *in, unsigned long inlen,
20 int base64url_strict_encode(const unsigned char *in, unsigned long inlen,
23 int base64url_decode(const char *in, unsigned long inlen,
25 int base64url_strict_decode(const char *in, unsigned long inlen,
27 int base64url_sane_decode(const char *in, unsigned long inlen,
39 int base32_encode(const unsigned char *in, unsigned long inlen,
[all …]
H A Dtomcrypt_prng.h91 int (*add_entropy)(const unsigned char *in, unsigned long inlen, prng_state *prng);
122 int (*pimport)(const unsigned char *in, unsigned long inlen, prng_state *prng);
131 int yarrow_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng);
136 int yarrow_import(const unsigned char *in, unsigned long inlen, prng_state *prng);
143 int fortuna_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng);
144 …d long source, unsigned long pool, const unsigned char *in, unsigned long inlen, prng_state *prng);
149 int fortuna_import(const unsigned char *in, unsigned long inlen, prng_state *prng);
150 int fortuna_update_seed(const unsigned char *in, unsigned long inlen, prng_state *prng);
157 int rc4_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng);
162 int rc4_import(const unsigned char *in, unsigned long inlen, prng_state *prng);
[all …]
H A Dtomcrypt_mac.h12 int hmac_process(hmac_state *hmac, const unsigned char *in, unsigned long inlen);
17 const unsigned char *in, unsigned long inlen,
22 const unsigned char *in, unsigned long inlen, ...)
42 int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen);
46 const unsigned char *in, unsigned long inlen,
51 const unsigned char *in, unsigned long inlen, ...)
77 int pmac_process(pmac_state *pmac, const unsigned char *in, unsigned long inlen);
82 const unsigned char *in, unsigned long inlen,
88 const unsigned char *in, unsigned long inlen, ...)
115 int poly1305_process(poly1305_state *st, const unsigned char *in, unsigned long inlen);
[all …]
/optee_os/core/lib/libtomcrypt/src/misc/base64/
H A Dbase64_decode.c78 static int s_base64_decode_internal(const char *in, unsigned long inlen, in s_base64_decode_internal() argument
91 for (x = y = z = t = 0; x < inlen; x++) { in s_base64_decode_internal()
92 if ((in[x] == 0) && (x == (inlen - 1)) && (mode != strict)) { in s_base64_decode_internal()
149 int base64_decode(const char *in, unsigned long inlen, in base64_decode() argument
152 return s_base64_decode_internal(in, inlen, out, outlen, map_base64, insane); in base64_decode()
163 int base64_strict_decode(const char *in, unsigned long inlen, in base64_strict_decode() argument
166 return s_base64_decode_internal(in, inlen, out, outlen, map_base64, strict); in base64_strict_decode()
177 int base64_sane_decode(const char *in, unsigned long inlen, in base64_sane_decode() argument
180 return s_base64_decode_internal(in, inlen, out, outlen, map_base64, relaxed); in base64_sane_decode()
193 int base64url_decode(const char *in, unsigned long inlen, in base64url_decode() argument
[all …]
H A Dbase64_encode.c33 static int s_base64_encode_internal(const unsigned char *in, unsigned long inlen, in s_base64_encode_internal() argument
45 len2 = 4 * ((inlen + 2) / 3); in s_base64_encode_internal()
64 leven = 3*(inlen / 3); in s_base64_encode_internal()
77 if (i < inlen) { in s_base64_encode_internal()
79 unsigned b = (i+1 < inlen) ? in[1] : 0; in s_base64_encode_internal()
84 *p++ = (i+1 < inlen) ? codes[(((b & 0xf) << 2)) & 0x3F] : '='; in s_base64_encode_internal()
88 if (i+1 < inlen) *p++ = codes[(((b & 0xf) << 2)) & 0x3F]; in s_base64_encode_internal()
109 int base64_encode(const unsigned char *in, unsigned long inlen, in base64_encode() argument
112 return s_base64_encode_internal(in, inlen, out, outlen, codes_base64, pad); in base64_encode()
125 int base64_encode_pem(const unsigned char *in, unsigned long inlen, in base64_encode_pem() argument
[all …]
/optee_os/core/lib/libtomcrypt/src/misc/base32/
H A Dbase32_encode.c17 int base32_encode(const unsigned char *in, unsigned long inlen, in base32_encode() argument
37 x = (8 * inlen + 4) / 5 + 1; in base32_encode()
45 if (inlen == 0) { in base32_encode()
51 x = 5 * (inlen / 5); in base32_encode()
63 if (i < inlen) { in base32_encode()
65 unsigned b = (i+1 < inlen) ? in[1] : 0; in base32_encode()
66 unsigned c = (i+2 < inlen) ? in[2] : 0; in base32_encode()
67 unsigned d = (i+3 < inlen) ? in[3] : 0; in base32_encode()
70 if (i+1 < inlen) { in base32_encode()
74 if (i+2 < inlen) { in base32_encode()
[all …]
H A Dbase32_decode.c17 int base32_decode(const char *in, unsigned long inlen, in base32_decode() argument
60 while (inlen > 0 && in[inlen-1] == '=') inlen--; in base32_decode()
63 if (inlen == 0) { in base32_decode()
69 x = (inlen * 5) / 8; in base32_decode()
77 x = inlen % 8; in base32_decode()
83 for (x = 0; x < inlen; x++) { in base32_decode()
/optee_os/core/lib/libtomcrypt/src/pk/asn1/der/custom_type/
H A Dder_decode_custom_type.c20 int der_decode_custom_type(const unsigned char *in, unsigned long inlen, in der_decode_custom_type() argument
24 …return der_decode_custom_type_ex(in, inlen, root, NULL, 0, LTC_DER_SEQ_ORDERED | LTC_DER_SEQ_RELAX… in der_decode_custom_type()
42 int der_decode_custom_type_ex(const unsigned char *in, unsigned long inlen, in der_decode_custom_type_ex() argument
57 if (inlen < 2) { in der_decode_custom_type_ex()
77 in_new = XMALLOC(inlen); in der_decode_custom_type_ex()
81 XMEMCPY(in_new, in, inlen); in der_decode_custom_type_ex()
85 y = inlen; in der_decode_custom_type_ex()
115 blksize = inlen - x; in der_decode_custom_type_ex()
118 y = inlen - x; in der_decode_custom_type_ex()
126 if (blksize > (inlen - x)) { in der_decode_custom_type_ex()
[all …]
/optee_os/core/lib/libtomcrypt/src/stream/salsa20/
H A Dsalsa20_crypt.c49 int salsa20_crypt(salsa20_state *st, const unsigned char *in, unsigned long inlen, unsigned char *o… in salsa20_crypt() argument
54 if (inlen == 0) return CRYPT_OK; /* nothing to do */ in salsa20_crypt()
62 j = MIN(st->ksleft, inlen); in salsa20_crypt()
64 inlen -= j; in salsa20_crypt()
65 if (inlen == 0) return CRYPT_OK; in salsa20_crypt()
73 if (inlen <= 64) { in salsa20_crypt()
74 for (i = 0; i < inlen; ++i) out[i] = in[i] ^ buf[i]; in salsa20_crypt()
75 st->ksleft = 64 - inlen; in salsa20_crypt()
76 for (i = inlen; i < 64; ++i) st->kstream[i] = buf[i]; in salsa20_crypt()
80 inlen -= 64; in salsa20_crypt()
/optee_os/core/lib/libtomcrypt/src/pk/ecc/
H A Decc_ansi_x963_import.c18 int ecc_ansi_x963_import(const unsigned char *in, unsigned long inlen, ecc_key *key) in ecc_ansi_x963_import() argument
20 return ecc_ansi_x963_import_ex(in, inlen, key, NULL); in ecc_ansi_x963_import()
23 int ecc_ansi_x963_import_ex(const unsigned char *in, unsigned long inlen, ecc_key *key, const ltc_e… in ecc_ansi_x963_import_ex() argument
31 if ((inlen & 1) == 0) { in ecc_ansi_x963_import_ex()
38 if ((err = ecc_set_curve_by_size((inlen-1)>>1, key)) != CRYPT_OK) { return err; } in ecc_ansi_x963_import_ex()
46 if ((err = ecc_set_key((unsigned char *)in, inlen, PK_PUBLIC, key)) != CRYPT_OK) { return err; } in ecc_ansi_x963_import_ex()
/optee_os/core/lib/libtomcrypt/src/pk/asn1/der/general/
H A Dder_decode_asn1_length.c18 int der_decode_asn1_length(const unsigned char *in, unsigned long *inlen, unsigned long *outlen) in der_decode_asn1_length() argument
23 LTC_ARGCHK(inlen != NULL); in der_decode_asn1_length()
25 if (*inlen < 1) { in der_decode_asn1_length()
42 if (real_len > (*inlen - 1)) { in der_decode_asn1_length()
53 if (decoded_len > (*inlen - offset)) return CRYPT_OVERFLOW; in der_decode_asn1_length()
54 *inlen = offset; in der_decode_asn1_length()
/optee_os/core/lib/libtomcrypt/src/stream/chacha/
H A Dchacha_crypt.c48 int chacha_crypt(chacha_state *st, const unsigned char *in, unsigned long inlen, unsigned char *out) in chacha_crypt() argument
53 if (inlen == 0) return CRYPT_OK; /* nothing to do */ in chacha_crypt()
61 j = MIN(st->ksleft, inlen); in chacha_crypt()
63 inlen -= j; in chacha_crypt()
64 if (inlen == 0) return CRYPT_OK; in chacha_crypt()
78 if (inlen <= 64) { in chacha_crypt()
79 for (i = 0; i < inlen; ++i) out[i] = in[i] ^ buf[i]; in chacha_crypt()
80 st->ksleft = 64 - inlen; in chacha_crypt()
81 for (i = inlen; i < 64; ++i) st->kstream[i] = buf[i]; in chacha_crypt()
85 inlen -= 64; in chacha_crypt()
/optee_os/core/lib/libtomcrypt/src/pk/asn1/der/bit/
H A Dder_encode_bit_string.c21 int der_encode_bit_string(const unsigned char *in, unsigned long inlen, in der_encode_bit_string() argument
33 if ((err = der_length_bit_string(inlen, &len)) != CRYPT_OK) { in der_encode_bit_string()
44 y = ((inlen + 7) >> 3) + 1; in der_encode_bit_string()
54 out[x++] = (unsigned char)((8 - inlen) & 7); in der_encode_bit_string()
57 for (y = buf = 0; y < inlen; y++) { in der_encode_bit_string()
65 if (inlen & 7) { in der_encode_bit_string()
H A Dder_encode_raw_bit_string.c23 int der_encode_raw_bit_string(const unsigned char *in, unsigned long inlen, in der_encode_raw_bit_string() argument
35 if ((err = der_length_bit_string(inlen, &len)) != CRYPT_OK) { in der_encode_raw_bit_string()
46 y = ((inlen + 7) >> 3) + 1; in der_encode_raw_bit_string()
56 out[x++] = (unsigned char)((8 - inlen) & 7); in der_encode_raw_bit_string()
59 for (y = buf = 0; y < inlen; y++) { in der_encode_raw_bit_string()
67 if (inlen & 7) { in der_encode_raw_bit_string()
/optee_os/core/lib/libtomcrypt/src/pk/asn1/der/sequence/
H A Dder_decode_sequence_flexi.c39 static int s_der_decode_sequence_flexi(const unsigned char *in, unsigned long *inlen, ltc_asn1_list… in s_der_decode_sequence_flexi() argument
46 LTC_ARGCHK(inlen != NULL); in s_der_decode_sequence_flexi()
52 if (*inlen == 0) { in s_der_decode_sequence_flexi()
60 while (*inlen) { in s_der_decode_sequence_flexi()
66 id_len = *inlen; in s_der_decode_sequence_flexi()
75 len_len = *inlen - id_len; in s_der_decode_sequence_flexi()
85 } else if (len > (*inlen - id_len - len_len)) { in s_der_decode_sequence_flexi()
135 if ((err = der_decode_boolean(in, *inlen, l->data)) != CRYPT_OK) { in s_der_decode_sequence_flexi()
157 if ((err = der_decode_integer(in, *inlen, l->data)) != CRYPT_OK) { in s_der_decode_sequence_flexi()
181 if ((err = der_decode_bit_string(in, *inlen, l->data, &l->size)) != CRYPT_OK) { in s_der_decode_sequence_flexi()
[all …]
H A Dder_decode_sequence_multi.c23 static int s_der_decode_sequence_va(const unsigned char *in, unsigned long inlen, va_list a1, va_li… in s_der_decode_sequence_va() argument
126 err = der_decode_sequence_ex(in, inlen, list, x, flags); in s_der_decode_sequence_va()
138 int der_decode_sequence_multi(const unsigned char *in, unsigned long inlen, ...) in der_decode_sequence_multi() argument
145 va_start(a1, inlen); in der_decode_sequence_multi()
146 va_start(a2, inlen); in der_decode_sequence_multi()
148 err = s_der_decode_sequence_va(in, inlen, a1, a2, LTC_DER_SEQ_SEQUENCE | LTC_DER_SEQ_RELAXED); in der_decode_sequence_multi()
164 int der_decode_sequence_multi_ex(const unsigned char *in, unsigned long inlen, unsigned int flags, … in der_decode_sequence_multi_ex() argument
174 err = s_der_decode_sequence_va(in, inlen, a1, a2, flags); in der_decode_sequence_multi_ex()
/optee_os/core/lib/libtomcrypt/src/mac/omac/
H A Domac_process.c20 int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen) in omac_process() argument
40 if (omac->buflen == 0 && inlen > blklen) { in omac_process()
42 for (x = 0; x < (inlen - blklen); x += blklen) { in omac_process()
51 inlen -= x; in omac_process()
56 while (inlen != 0) { in omac_process()
69 n = MIN(inlen, (unsigned long)(omac->blklen - omac->buflen)); in omac_process()
72 inlen -= n; in omac_process()
/optee_os/core/lib/libtomcrypt/src/pk/rsa/
H A Drsa_import.c24 int rsa_import_pkcs1(const unsigned char *in, unsigned long inlen, rsa_key *key) in rsa_import_pkcs1() argument
29 err = der_decode_sequence_multi(in, inlen, LTC_ASN1_SHORT_INTEGER, 1UL, &version, in rsa_import_pkcs1()
36 if ((err = der_decode_sequence_multi(in, inlen, in rsa_import_pkcs1()
50 if ((err = der_decode_sequence_multi(in, inlen, in rsa_import_pkcs1()
85 int rsa_import(const unsigned char *in, unsigned long inlen, rsa_key *key) in rsa_import() argument
101 tmpbuf_len = inlen; in rsa_import()
109 err = x509_decode_subject_public_key_info(in, inlen, in rsa_import()
128 if ((err = rsa_import_pkcs1(in, inlen, key)) == CRYPT_OK) { in rsa_import()
/optee_os/core/lib/libtomcrypt/src/pk/asn1/der/integer/
H A Dder_decode_integer.c20 int der_decode_integer(const unsigned char *in, unsigned long inlen, void *num) in der_decode_integer() argument
29 if (inlen < (1 + 1 + 1)) { in der_decode_integer()
40 inlen -= x; in der_decode_integer()
41 if ((err = der_decode_asn1_length(in + x, &inlen, &y)) != CRYPT_OK) { in der_decode_integer()
44 x += inlen; in der_decode_integer()
/optee_os/core/lib/libtomcrypt/src/encauth/chachapoly/
H A Dchacha20poly1305_add_aad.c15 … chacha20poly1305_add_aad(chacha20poly1305_state *st, const unsigned char *in, unsigned long inlen) in chacha20poly1305_add_aad() argument
19 if (inlen == 0) return CRYPT_OK; /* nothing to do */ in chacha20poly1305_add_aad()
23 if ((err = poly1305_process(&st->poly, in, inlen)) != CRYPT_OK) return err; in chacha20poly1305_add_aad()
24 st->aadlen += (ulong64)inlen; in chacha20poly1305_add_aad()
/optee_os/core/lib/libtomcrypt/src/misc/hkdf/
H A Dhkdf.c14 const unsigned char *in, unsigned long inlen, in hkdf_extract() argument
26 return hmac_memory(hash_idx, (const unsigned char *)"", 1, in, inlen, out, outlen); in hkdf_extract()
28 return hmac_memory(hash_idx, salt, saltlen, in, inlen, out, outlen); in hkdf_extract()
32 const unsigned char *in, unsigned long inlen, in hkdf_expand() argument
51 if (inlen < hashsize || outlen > hashsize * 255) { in hkdf_expand()
77 if ((err = hmac_memory(hash_idx, in, inlen, dat, datlen, in hkdf_expand()
104 const unsigned char *in, unsigned long inlen, in hkdf() argument
122 if ((err = hkdf_extract(hash_idx, salt, saltlen, in, inlen, extracted, &hashsize)) != 0) { in hkdf()
/optee_os/core/lib/libtomcrypt/src/pk/asn1/der/set/
H A Dder_encode_set.c42 int der_encode_set(const ltc_asn1_list *list, unsigned long inlen, in der_encode_set() argument
50 copy = XCALLOC(inlen, sizeof(*copy)); in der_encode_set()
56 for (x = 0; x < inlen; x++) { in der_encode_set()
62 XQSORT(copy, inlen, sizeof(*copy), &s_qsort_helper); in der_encode_set()
65 err = der_encode_sequence_ex(copy, inlen, out, outlen, LTC_ASN1_SET); in der_encode_set()
/optee_os/core/lib/libtomcrypt/src/mac/pmac/
H A Dpmac_process.c20 int pmac_process(pmac_state *pmac, const unsigned char *in, unsigned long inlen) in pmac_process() argument
38 if (pmac->buflen == 0 && inlen > 16) { in pmac_process()
40 for (x = 0; x < (inlen - 16); x += 16) { in pmac_process()
53 inlen -= x; in pmac_process()
57 while (inlen != 0) { in pmac_process()
74 n = MIN(inlen, (unsigned long)(pmac->block_len - pmac->buflen)); in pmac_process()
77 inlen -= n; in pmac_process()

123456