/optee_os/core/lib/libtomcrypt/src/pk/asn1/der/choice/ |
A D | der_decode_choice.c | 34 LTC_ARGCHK(inlen != NULL); in der_decode_choice() 38 if (*inlen < 2) { in der_decode_choice() 57 *inlen = z; in der_decode_choice() 67 *inlen = z; in der_decode_choice() 88 *inlen = z; in der_decode_choice() 99 *inlen = z; in der_decode_choice() 118 *inlen = 2; in der_decode_choice() 180 z = *inlen; in der_decode_choice() 183 *inlen = z; in der_decode_choice() 189 z = *inlen; in der_decode_choice() [all …]
|
/optee_os/core/lib/libtomcrypt/src/headers/ |
A D | tomcrypt_pk.h | 59 int rsa_exptmod(const unsigned char *in, unsigned long inlen, 115 int rsa_import_pkcs8(const unsigned char *in, unsigned long inlen, 294 int ecc_encrypt_key(const unsigned char *in, unsigned long inlen, 449 int dsa_sign_hash(const unsigned char *in, unsigned long inlen, 461 int dsa_encrypt_key(const unsigned char *in, unsigned long inlen, 466 int dsa_decrypt_key(const unsigned char *in, unsigned long inlen, 595 #define der_encode_sequence(list, inlen, out, outlen) der_encode_sequence_ex(list, inlen, out, outl… argument 621 #define der_decode_sequence(in, inlen, list, outlen) der_decode_sequence_ex(in, inlen, list, outlen… argument 622 #define der_decode_sequence_strict(in, inlen, list, outlen) der_decode_sequence_ex(in, inlen, list,… argument 640 #define der_decode_set(in, inlen, list, outlen) der_decode_sequence_ex(in, inlen, list, outlen, LTC… argument [all …]
|
A D | tomcrypt_misc.h | 13 int base64_encode(const unsigned char *in, unsigned long inlen, 16 int base64_decode(const char *in, unsigned long inlen, 18 int base64_strict_decode(const char *in, unsigned long inlen, 20 int base64_sane_decode(const char *in, unsigned long inlen, 30 int base64url_decode(const char *in, unsigned long inlen, 32 int base64url_strict_decode(const char *in, unsigned long inlen, 34 int base64url_sane_decode(const char *in, unsigned long inlen, 46 int base32_encode(const unsigned char *in, unsigned long inlen, 49 int base32_decode(const char *in, unsigned long inlen, 75 const unsigned char *in, unsigned long inlen, [all …]
|
A D | tomcrypt_prng.h | 98 int (*add_entropy)(const unsigned char *in, unsigned long inlen, prng_state *prng); 129 int (*pimport)(const unsigned char *in, unsigned long inlen, prng_state *prng); 138 int yarrow_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng); 143 int yarrow_import(const unsigned char *in, unsigned long inlen, prng_state *prng); 150 int fortuna_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng); 156 int fortuna_import(const unsigned char *in, unsigned long inlen, prng_state *prng); 164 int rc4_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng); 169 int rc4_import(const unsigned char *in, unsigned long inlen, prng_state *prng); 188 int sprng_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng); 193 int sprng_import(const unsigned char *in, unsigned long inlen, prng_state *prng); [all …]
|
A D | tomcrypt_mac.h | 25 const unsigned char *in, unsigned long inlen, 30 const unsigned char *in, unsigned long inlen, ...); 53 const unsigned char *in, unsigned long inlen, 58 const unsigned char *in, unsigned long inlen, ...); 88 const unsigned char *in, unsigned long inlen, 94 const unsigned char *in, unsigned long inlen, ...); 166 const unsigned char *in, unsigned long inlen, 192 const unsigned char *in, unsigned long inlen, 197 const unsigned char *in, unsigned long inlen, ...); 226 const unsigned char *in, unsigned long inlen, [all …]
|
A D | tomcrypt_hash.h | 231 int (*process)(hash_state *hash, const unsigned char *in, unsigned long inlen); 245 const unsigned char *in, unsigned long inlen, 253 int chc_process(hash_state * md, const unsigned char *in, unsigned long inlen); 274 int sha3_process(hash_state * md, const unsigned char *in, unsigned long inlen); 374 int sha1_process(hash_state * md, const unsigned char *in, unsigned long inlen); 426 int md5_process(hash_state * md, const unsigned char *in, unsigned long inlen); 434 int md4_process(hash_state * md, const unsigned char *in, unsigned long inlen); 442 int md2_process(hash_state * md, const unsigned char *in, unsigned long inlen); 450 int tiger_process(hash_state * md, const unsigned char *in, unsigned long inlen); 501 const unsigned char *in, unsigned long inlen, [all …]
|
/optee_os/core/lib/libtomcrypt/src/misc/base64/ |
A D | base64_decode.c | 85 static int _base64_decode_internal(const char *in, unsigned long inlen, in _base64_decode_internal() argument 98 for (x = y = z = t = 0; x < inlen; x++) { in _base64_decode_internal() 99 if ((in[x] == 0) && (x == (inlen - 1)) && (mode != strict)) { in _base64_decode_internal() 156 int base64_decode(const char *in, unsigned long inlen, in base64_decode() argument 159 return _base64_decode_internal(in, inlen, out, outlen, map_base64, insane); in base64_decode() 170 int base64_strict_decode(const char *in, unsigned long inlen, in base64_strict_decode() argument 173 return _base64_decode_internal(in, inlen, out, outlen, map_base64, strict); in base64_strict_decode() 184 int base64_sane_decode(const char *in, unsigned long inlen, in base64_sane_decode() argument 200 int base64url_decode(const char *in, unsigned long inlen, in base64url_decode() argument 214 int base64url_strict_decode(const char *in, unsigned long inlen, in base64url_strict_decode() argument [all …]
|
A D | base64_encode.c | 31 static int _base64_encode_internal(const unsigned char *in, unsigned long inlen, in _base64_encode_internal() argument 43 len2 = 4 * ((inlen + 2) / 3); in _base64_encode_internal() 49 leven = 3*(inlen / 3); in _base64_encode_internal() 58 if (i < inlen) { in _base64_encode_internal() 60 unsigned b = (i+1 < inlen) ? in[1] : 0; in _base64_encode_internal() 65 *p++ = (i+1 < inlen) ? codes[(((b & 0xf) << 2)) & 0x3F] : '='; in _base64_encode_internal() 69 if (i+1 < inlen) *p++ = codes[(((b & 0xf) << 2)) & 0x3F]; in _base64_encode_internal() 90 int base64_encode(const unsigned char *in, unsigned long inlen, in base64_encode() argument 93 return _base64_encode_internal(in, inlen, out, outlen, codes_base64, 1); in base64_encode() 107 int base64url_encode(const unsigned char *in, unsigned long inlen, in base64url_encode() argument [all …]
|
/optee_os/core/lib/libtomcrypt/src/pk/asn1/der/custom_type/ |
A D | der_decode_custom_type.c | 64 if (inlen < 2) { in der_decode_custom_type_ex() 92 y = inlen; in der_decode_custom_type_ex() 122 blksize = inlen - x; in der_decode_custom_type_ex() 125 y = inlen - x; in der_decode_custom_type_ex() 147 inlen -= x; in der_decode_custom_type_ex() 166 z = inlen; in der_decode_custom_type_ex() 177 z = inlen; in der_decode_custom_type_ex() 188 z = inlen; in der_decode_custom_type_ex() 200 z = inlen; in der_decode_custom_type_ex() 212 z = inlen; in der_decode_custom_type_ex() [all …]
|
/optee_os/core/lib/libtomcrypt/src/misc/base32/ |
A D | base32_encode.c | 24 int base32_encode(const unsigned char *in, unsigned long inlen, in base32_encode() argument 44 x = (8 * inlen + 4) / 5 + 1; in base32_encode() 52 if (inlen == 0) { in base32_encode() 58 x = 5 * (inlen / 5); in base32_encode() 70 if (i < inlen) { in base32_encode() 72 unsigned b = (i+1 < inlen) ? in[1] : 0; in base32_encode() 73 unsigned c = (i+2 < inlen) ? in[2] : 0; in base32_encode() 74 unsigned d = (i+3 < inlen) ? in[3] : 0; in base32_encode() 77 if (i+1 < inlen) { in base32_encode() 81 if (i+2 < inlen) { in base32_encode() [all …]
|
A D | base32_decode.c | 24 int base32_decode(const char *in, unsigned long inlen, in base32_decode() argument 67 while (inlen > 0 && in[inlen-1] == '=') inlen--; in base32_decode() 70 if (inlen == 0) { in base32_decode() 76 x = (inlen * 5) / 8; in base32_decode() 84 x = inlen % 8; in base32_decode() 90 for (x = 0; x < inlen; x++) { in base32_decode()
|
/optee_os/core/lib/libtomcrypt/src/stream/salsa20/ |
A D | salsa20_crypt.c | 56 int salsa20_crypt(salsa20_state *st, const unsigned char *in, unsigned long inlen, unsigned char *o… in salsa20_crypt() argument 61 if (inlen == 0) return CRYPT_OK; /* nothing to do */ in salsa20_crypt() 69 j = MIN(st->ksleft, inlen); in salsa20_crypt() 71 inlen -= j; in salsa20_crypt() 72 if (inlen == 0) return CRYPT_OK; in salsa20_crypt() 80 if (inlen <= 64) { in salsa20_crypt() 81 for (i = 0; i < inlen; ++i) out[i] = in[i] ^ buf[i]; in salsa20_crypt() 82 st->ksleft = 64 - inlen; in salsa20_crypt() 83 for (i = inlen; i < 64; ++i) st->kstream[i] = buf[i]; in salsa20_crypt() 87 inlen -= 64; in salsa20_crypt()
|
/optee_os/core/lib/libtomcrypt/src/stream/chacha/ |
A D | chacha_crypt.c | 55 int chacha_crypt(chacha_state *st, const unsigned char *in, unsigned long inlen, unsigned char *out) in chacha_crypt() argument 60 if (inlen == 0) return CRYPT_OK; /* nothing to do */ in chacha_crypt() 68 j = MIN(st->ksleft, inlen); in chacha_crypt() 70 inlen -= j; in chacha_crypt() 71 if (inlen == 0) return CRYPT_OK; in chacha_crypt() 85 if (inlen <= 64) { in chacha_crypt() 86 for (i = 0; i < inlen; ++i) out[i] = in[i] ^ buf[i]; in chacha_crypt() 87 st->ksleft = 64 - inlen; in chacha_crypt() 88 for (i = inlen; i < 64; ++i) st->kstream[i] = buf[i]; in chacha_crypt() 92 inlen -= 64; in chacha_crypt()
|
/optee_os/core/lib/libtomcrypt/src/pk/ecc/ |
A D | ecc_ansi_x963_import.c | 25 int ecc_ansi_x963_import(const unsigned char *in, unsigned long inlen, ecc_key *key) in ecc_ansi_x963_import() argument 27 return ecc_ansi_x963_import_ex(in, inlen, key, NULL); in ecc_ansi_x963_import() 30 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 38 if ((inlen & 1) == 0) { in ecc_ansi_x963_import_ex() 45 if ((err = ecc_set_curve_by_size((inlen-1)>>1, key)) != CRYPT_OK) { return err; } in ecc_ansi_x963_import_ex() 53 if ((err = ecc_set_key((unsigned char *)in, inlen, PK_PUBLIC, key)) != CRYPT_OK) { return err; } in ecc_ansi_x963_import_ex()
|
A D | ecc_import_x509.c | 14 static int _ecc_import_x509_with_oid(const unsigned char *in, unsigned long inlen, ecc_key *key) in _ecc_import_x509_with_oid() argument 25 err = x509_decode_subject_public_key_info(in, inlen, PKA_EC, bin_xy, &len_xy, in _ecc_import_x509_with_oid() 40 static int _ecc_import_x509_with_curve(const unsigned char *in, unsigned long inlen, ecc_key *key) in _ecc_import_x509_with_curve() argument 73 …err = x509_decode_subject_public_key_info(in, inlen, PKA_EC, bin_xy, &len_xy, LTC_ASN1_SEQUENCE, s… in _ecc_import_x509_with_curve() 93 int ecc_import_subject_public_key_info(const unsigned char *in, unsigned long inlen, ecc_key *key) in ecc_import_subject_public_key_info() argument 97 if ((err = _ecc_import_x509_with_oid(in, inlen, key)) == CRYPT_OK) { in ecc_import_subject_public_key_info() 101 err = _ecc_import_x509_with_curve(in, inlen, key); in ecc_import_subject_public_key_info() 114 int ecc_import_x509(const unsigned char *in, unsigned long inlen, ecc_key *key) in ecc_import_x509() argument 116 …return x509_decode_public_key_from_certificate(in, inlen, PKA_EC, LTC_ASN1_EOL, NULL, NULL, NULL, … in ecc_import_x509()
|
/optee_os/core/lib/libtomcrypt/src/pk/asn1/der/general/ |
A D | der_decode_asn1_length.c | 25 int der_decode_asn1_length(const unsigned char *in, unsigned long *inlen, unsigned long *outlen) in der_decode_asn1_length() argument 30 LTC_ARGCHK(inlen != NULL); in der_decode_asn1_length() 32 if (*inlen < 1) { in der_decode_asn1_length() 49 if (real_len > (*inlen - 1)) { in der_decode_asn1_length() 60 if (decoded_len > (*inlen - offset)) return CRYPT_OVERFLOW; in der_decode_asn1_length() 61 *inlen = offset; in der_decode_asn1_length()
|
/optee_os/core/lib/libtomcrypt/src/pk/asn1/der/sequence/ |
A D | der_decode_sequence_flexi.c | 52 LTC_ARGCHK(inlen != NULL); in der_decode_sequence_flexi() 58 if (*inlen == 0) { in der_decode_sequence_flexi() 66 while (*inlen) { in der_decode_sequence_flexi() 72 id_len = *inlen; in der_decode_sequence_flexi() 81 len_len = *inlen - id_len; in der_decode_sequence_flexi() 91 } else if (len > (*inlen - id_len - len_len)) { in der_decode_sequence_flexi() 141 if ((err = der_decode_boolean(in, *inlen, l->data)) != CRYPT_OK) { in der_decode_sequence_flexi() 374 len = *inlen; in der_decode_sequence_flexi() 443 *inlen -= data_offset; in der_decode_sequence_flexi() 510 *inlen -= len; in der_decode_sequence_flexi() [all …]
|
A D | der_decode_sequence_multi.c | 30 static int _der_decode_sequence_va(const unsigned char *in, unsigned long inlen, va_list a1, va_lis… in _der_decode_sequence_va() argument 132 err = der_decode_sequence_ex(in, inlen, list, x, flags); in _der_decode_sequence_va() 144 int der_decode_sequence_multi(const unsigned char *in, unsigned long inlen, ...) in der_decode_sequence_multi() argument 151 va_start(a1, inlen); in der_decode_sequence_multi() 152 va_start(a2, inlen); in der_decode_sequence_multi() 154 err = _der_decode_sequence_va(in, inlen, a1, a2, LTC_DER_SEQ_SEQUENCE | LTC_DER_SEQ_RELAXED); in der_decode_sequence_multi() 170 int der_decode_sequence_multi_ex(const unsigned char *in, unsigned long inlen, unsigned int flags, … in der_decode_sequence_multi_ex() argument 180 err = _der_decode_sequence_va(in, inlen, a1, a2, flags); in der_decode_sequence_multi_ex()
|
/optee_os/core/lib/libtomcrypt/src/pk/asn1/der/bit/ |
A D | der_encode_bit_string.c | 28 int der_encode_bit_string(const unsigned char *in, unsigned long inlen, in der_encode_bit_string() argument 40 if ((err = der_length_bit_string(inlen, &len)) != CRYPT_OK) { in der_encode_bit_string() 51 y = ((inlen + 7) >> 3) + 1; in der_encode_bit_string() 61 out[x++] = (unsigned char)((8 - inlen) & 7); in der_encode_bit_string() 64 for (y = buf = 0; y < inlen; y++) { in der_encode_bit_string() 72 if (inlen & 7) { in der_encode_bit_string()
|
A D | der_encode_raw_bit_string.c | 30 int der_encode_raw_bit_string(const unsigned char *in, unsigned long inlen, in der_encode_raw_bit_string() argument 42 if ((err = der_length_bit_string(inlen, &len)) != CRYPT_OK) { in der_encode_raw_bit_string() 53 y = ((inlen + 7) >> 3) + 1; in der_encode_raw_bit_string() 63 out[x++] = (unsigned char)((8 - inlen) & 7); in der_encode_raw_bit_string() 66 for (y = buf = 0; y < inlen; y++) { in der_encode_raw_bit_string() 74 if (inlen & 7) { in der_encode_raw_bit_string()
|
/optee_os/core/lib/libtomcrypt/src/mac/omac/ |
A D | omac_process.c | 27 int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen) in omac_process() argument 47 if (omac->buflen == 0 && inlen > blklen) { in omac_process() 49 for (x = 0; x < (inlen - blklen); x += blklen) { in omac_process() 58 inlen -= x; in omac_process() 63 while (inlen != 0) { in omac_process() 76 n = MIN(inlen, (unsigned long)(omac->blklen - omac->buflen)); in omac_process() 79 inlen -= n; in omac_process()
|
/optee_os/core/lib/libtomcrypt/src/misc/hkdf/ |
A D | hkdf.c | 21 const unsigned char *in, unsigned long inlen, in hkdf_extract() argument 33 return hmac_memory(hash_idx, (const unsigned char *)"", 1, in, inlen, out, outlen); in hkdf_extract() 35 return hmac_memory(hash_idx, salt, saltlen, in, inlen, out, outlen); in hkdf_extract() 39 const unsigned char *in, unsigned long inlen, in hkdf_expand() argument 58 if (inlen < hashsize || outlen > hashsize * 255) { in hkdf_expand() 84 if ((err = hmac_memory(hash_idx, in, inlen, dat, datlen, in hkdf_expand() 111 const unsigned char *in, unsigned long inlen, in hkdf() argument 129 if ((err = hkdf_extract(hash_idx, salt, saltlen, in, inlen, extracted, &hashsize)) != 0) { in hkdf()
|
/optee_os/core/lib/libtomcrypt/src/pk/asn1/der/utf8/ |
A D | der_decode_utf8_string.c | 28 int der_decode_utf8_string(const unsigned char *in, unsigned long inlen, in der_decode_utf8_string() argument 40 if (inlen < 2) { in der_decode_utf8_string() 51 y = inlen - x; in der_decode_utf8_string() 57 if (len > (inlen - x)) { in der_decode_utf8_string() 62 for (y = 0; x < inlen; ) { in der_decode_utf8_string() 69 if (z == 1 || z > 4 || (x + (z - 1) > inlen)) { in der_decode_utf8_string()
|
/optee_os/core/lib/libtomcrypt/src/mac/pmac/ |
A D | pmac_process.c | 27 int pmac_process(pmac_state *pmac, const unsigned char *in, unsigned long inlen) in pmac_process() argument 45 if (pmac->buflen == 0 && inlen > 16) { in pmac_process() 47 for (x = 0; x < (inlen - 16); x += 16) { in pmac_process() 60 inlen -= x; in pmac_process() 64 while (inlen != 0) { in pmac_process() 81 n = MIN(inlen, (unsigned long)(pmac->block_len - pmac->buflen)); in pmac_process() 84 inlen -= n; in pmac_process()
|
/optee_os/core/lib/libtomcrypt/src/pk/asn1/der/integer/ |
A D | der_decode_integer.c | 27 int der_decode_integer(const unsigned char *in, unsigned long inlen, void *num) in der_decode_integer() argument 36 if (inlen < (1 + 1 + 1)) { in der_decode_integer() 47 inlen -= x; in der_decode_integer() 48 if ((err = der_decode_asn1_length(in + x, &inlen, &y)) != CRYPT_OK) { in der_decode_integer() 51 x += inlen; in der_decode_integer()
|