| /optee_os/core/lib/libtomcrypt/src/encauth/gcm/ |
| H A D | gcm_add_aad.c | 33 if (gcm->buflen > 16 || gcm->buflen < 0) { in gcm_add_aad() 44 if (gcm->buflen == 0 && gcm->totlen == 0) return CRYPT_ERROR; in gcm_add_aad() 46 if (gcm->ivmode || gcm->buflen != 12) { in gcm_add_aad() 47 for (x = 0; x < (unsigned long)gcm->buflen; x++) { in gcm_add_aad() 50 if (gcm->buflen) { in gcm_add_aad() 51 gcm->totlen += gcm->buflen * CONST64(8); in gcm_add_aad() 75 gcm->buflen = 0; in gcm_add_aad() 80 if (gcm->mode != LTC_GCM_MODE_AAD || gcm->buflen >= 16) { in gcm_add_aad() 86 if (gcm->buflen == 0 && adatalen > 15) { in gcm_add_aad() 101 gcm->X[gcm->buflen++] ^= *adata++; in gcm_add_aad() [all …]
|
| H A D | gcm_add_iv.c | 35 if (gcm->buflen >= 16 || gcm->buflen < 0) { in gcm_add_iv() 45 if (IVlen + gcm->buflen > 12) { in gcm_add_iv() 51 if (gcm->buflen == 0) { in gcm_add_iv() 65 gcm->buf[gcm->buflen++] = *IV++; in gcm_add_iv() 67 if (gcm->buflen == 16) { in gcm_add_iv() 73 gcm->buflen = 0; in gcm_add_iv()
|
| H A D | gcm_process.c | 36 if (gcm->buflen > 16 || gcm->buflen < 0) { in gcm_process() 45 if (gcm->pttotlen / 8 + (ulong64)gcm->buflen + (ulong64)ptlen >= CONST64(0xFFFFFFFE0)) { in gcm_process() 57 if (gcm->buflen) { in gcm_process() 58 gcm->totlen += gcm->buflen * CONST64(8); in gcm_process() 71 gcm->buflen = 0; in gcm_process() 81 if (gcm->buflen == 0) { in gcm_process() 124 if (gcm->buflen == 16) { in gcm_process() 135 gcm->buflen = 0; in gcm_process() 139 b = ct[x] = pt[x] ^ gcm->buf[gcm->buflen]; in gcm_process() 142 pt[x] = ct[x] ^ gcm->buf[gcm->buflen]; in gcm_process() [all …]
|
| H A D | gcm_done.c | 29 if (gcm->buflen > 16 || gcm->buflen < 0) { in gcm_done() 52 if (gcm->buflen) { in gcm_done() 53 gcm->pttotlen += gcm->buflen * CONST64(8); in gcm_done()
|
| H A D | gcm_memory.c | 95 unsigned long buflen = sizeof(buf); in gcm_memory() local 96 if ((err = gcm_done(gcm, buf, &buflen)) != CRYPT_OK) { in gcm_memory() 99 if (buflen != *taglen || XMEM_NEQ(buf, tag, buflen) != 0) { in gcm_memory()
|
| /optee_os/core/lib/libtomcrypt/src/pk/ecc/ |
| H A D | ecc_ssh_ecdsa_encode_name.c | 20 int ecc_ssh_ecdsa_encode_name(char *buffer, unsigned long *buflen, const ecc_key *key) in ecc_ssh_ecdsa_encode_name() argument 27 LTC_ARGCHK(buflen != NULL); in ecc_ssh_ecdsa_encode_name() 36 size = snprintf(buffer, *buflen, "ecdsa-sha2-nistp256"); in ecc_ssh_ecdsa_encode_name() 40 size = snprintf(buffer, *buflen, "ecdsa-sha2-nistp384"); in ecc_ssh_ecdsa_encode_name() 44 size = snprintf(buffer, *buflen, "ecdsa-sha2-nistp521"); in ecc_ssh_ecdsa_encode_name() 47 size = snprintf(buffer, *buflen, "ecdsa-sha2-%s", oidstr); in ecc_ssh_ecdsa_encode_name() 54 } else if ((unsigned)size >= *buflen) { in ecc_ssh_ecdsa_encode_name() 59 *buflen = size + 1; /* the string length + NUL byte */ in ecc_ssh_ecdsa_encode_name()
|
| /optee_os/core/lib/libtomcrypt/src/mac/omac/ |
| H A D | omac_process.c | 31 if ((omac->buflen > (int)sizeof(omac->block)) || (omac->buflen < 0) || in omac_process() 32 (omac->blklen > (int)sizeof(omac->block)) || (omac->buflen > omac->blklen)) { in omac_process() 40 if (omac->buflen == 0 && inlen > blklen) { in omac_process() 58 if (omac->buflen == omac->blklen) { in omac_process() 65 omac->buflen = 0; in omac_process() 69 n = MIN(inlen, (unsigned long)(omac->blklen - omac->buflen)); in omac_process() 70 XMEMCPY(omac->block + omac->buflen, in, n); in omac_process() 71 omac->buflen += n; in omac_process()
|
| H A D | omac_done.c | 31 if ((omac->buflen > (int)sizeof(omac->block)) || (omac->buflen < 0) || in omac_done() 32 (omac->blklen > (int)sizeof(omac->block)) || (omac->buflen > omac->blklen)) { in omac_done() 37 if (omac->buflen != omac->blklen) { in omac_done() 39 omac->block[omac->buflen++] = 0x80; in omac_done() 42 while (omac->buflen < omac->blklen) { in omac_done() 43 omac->block[omac->buflen++] = 0x00; in omac_done()
|
| /optee_os/lib/libmbedtls/mbedtls/library/ |
| H A D | x509write.c | 49 size_t buflen = 0; in mbedtls_x509_write_set_san_common() local 63 CHECK_OVERFLOW_ADD(buflen, cur->node.san.unstructured_name.len); in mbedtls_x509_write_set_san_common() 64 CHECK_OVERFLOW_ADD(buflen, 4 + 1); in mbedtls_x509_write_set_san_common() 73 CHECK_OVERFLOW_ADD(buflen, 4 + 1 + 4 + 1); in mbedtls_x509_write_set_san_common() 74 CHECK_OVERFLOW_ADD(buflen, chunk->oid.len); in mbedtls_x509_write_set_san_common() 75 CHECK_OVERFLOW_ADD(buflen, chunk->val.len); in mbedtls_x509_write_set_san_common() 78 CHECK_OVERFLOW_ADD(buflen, 4 + 1); in mbedtls_x509_write_set_san_common() 88 CHECK_OVERFLOW_ADD(buflen, 4 + 1); in mbedtls_x509_write_set_san_common() 91 buf = mbedtls_calloc(1, buflen); in mbedtls_x509_write_set_san_common() 95 p = buf + buflen; in mbedtls_x509_write_set_san_common() [all …]
|
| H A D | entropy_poll.c | 85 static int getrandom_wrapper(void *buf, size_t buflen, unsigned int flags) in getrandom_wrapper() argument 90 memset(buf, 0, buflen); in getrandom_wrapper() 93 return (int) syscall(SYS_getrandom, buf, buflen, flags); in getrandom_wrapper() 105 static int getrandom_wrapper(void *buf, size_t buflen, unsigned int flags) in getrandom_wrapper() argument 107 return (int) getrandom(buf, buflen, flags); in getrandom_wrapper() 127 static int sysctl_arnd_wrapper(unsigned char *buf, size_t buflen) in sysctl_arnd_wrapper() argument 135 while (buflen > 0) { in sysctl_arnd_wrapper() 136 len = buflen > 256 ? 256 : buflen; in sysctl_arnd_wrapper() 140 buflen -= len; in sysctl_arnd_wrapper()
|
| H A D | error.c | 792 void mbedtls_strerror(int ret, char *buf, size_t buflen) in mbedtls_strerror() argument 799 if (buflen == 0) { in mbedtls_strerror() 803 memset(buf, 0x00, buflen); in mbedtls_strerror() 816 mbedtls_snprintf(buf, buflen, "UNKNOWN ERROR CODE (%04X)", (unsigned int) use_ret); in mbedtls_strerror() 818 mbedtls_snprintf(buf, buflen, "%s", high_level_error_description); in mbedtls_strerror() 842 if (buflen - len < 5) { in mbedtls_strerror() 846 mbedtls_snprintf(buf + len, buflen - len, " : "); in mbedtls_strerror() 849 buflen -= len + 3; in mbedtls_strerror() 856 mbedtls_snprintf(buf, buflen, "UNKNOWN ERROR CODE (%04X)", (unsigned int) use_ret); in mbedtls_strerror() 858 mbedtls_snprintf(buf, buflen, "%s", low_level_error_description); in mbedtls_strerror() [all …]
|
| H A D | x509_csr.c | 266 const unsigned char *buf, size_t buflen, in mbedtls_x509_csr_parse_der_internal() argument 280 if (csr == NULL || buf == NULL || buflen == 0) { in mbedtls_x509_csr_parse_der_internal() 289 p = mbedtls_calloc(1, len = buflen); in mbedtls_x509_csr_parse_der_internal() 295 memcpy(p, buf, buflen); in mbedtls_x509_csr_parse_der_internal() 435 const unsigned char *buf, size_t buflen) in mbedtls_x509_csr_parse_der() argument 437 return mbedtls_x509_csr_parse_der_internal(csr, buf, buflen, NULL, NULL); in mbedtls_x509_csr_parse_der() 444 const unsigned char *buf, size_t buflen, in mbedtls_x509_csr_parse_der_with_ext_cb() argument 448 return mbedtls_x509_csr_parse_der_internal(csr, buf, buflen, cb, p_ctx); in mbedtls_x509_csr_parse_der_with_ext_cb() 454 int mbedtls_x509_csr_parse(mbedtls_x509_csr *csr, const unsigned char *buf, size_t buflen) in mbedtls_x509_csr_parse() argument 465 if (csr == NULL || buf == NULL || buflen == 0) { in mbedtls_x509_csr_parse() [all …]
|
| H A D | x509_crl.c | 284 const unsigned char *buf, size_t buflen) in mbedtls_x509_crl_parse_der() argument 325 if (buflen == 0) { in mbedtls_x509_crl_parse_der() 329 p = mbedtls_calloc(1, buflen); in mbedtls_x509_crl_parse_der() 334 memcpy(p, buf, buflen); in mbedtls_x509_crl_parse_der() 337 crl->raw.len = buflen; in mbedtls_x509_crl_parse_der() 339 end = p + buflen; in mbedtls_x509_crl_parse_der() 505 int mbedtls_x509_crl_parse(mbedtls_x509_crl *chain, const unsigned char *buf, size_t buflen) in mbedtls_x509_crl_parse() argument 522 if (buflen == 0 || buf[buflen - 1] != '\0') { in mbedtls_x509_crl_parse() 537 buflen -= use_len; in mbedtls_x509_crl_parse() 541 pem.buf, pem.buflen)) != 0) { in mbedtls_x509_crl_parse() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/mac/pelican/ |
| H A D | pelican.c | 43 pelmac->buflen = 0; in pelican_init() 100 if (pelmac->buflen < 0 || pelmac->buflen > 15) { in pelican_process() 105 if (pelmac->buflen == 0) { in pelican_process() 119 pelmac->state[pelmac->buflen++] ^= *in++; in pelican_process() 120 if (pelmac->buflen == 16) { in pelican_process() 122 pelmac->buflen = 0; in pelican_process() 140 if (pelmac->buflen < 0 || pelmac->buflen > 16) { in pelican_done() 144 if (pelmac->buflen == 16) { in pelican_done() 146 pelmac->buflen = 0; in pelican_done() 148 pelmac->state[pelmac->buflen++] ^= 0x80; in pelican_done()
|
| /optee_os/core/lib/libtomcrypt/src/mac/pmac/ |
| H A D | pmac_process.c | 32 if ((pmac->buflen > (int)sizeof(pmac->block)) || (pmac->buflen < 0) || in pmac_process() 33 (pmac->block_len > (int)sizeof(pmac->block)) || (pmac->buflen > pmac->block_len)) { in pmac_process() 38 if (pmac->buflen == 0 && inlen > 16) { in pmac_process() 59 if (pmac->buflen == pmac->block_len) { in pmac_process() 70 pmac->buflen = 0; in pmac_process() 74 n = MIN(inlen, (unsigned long)(pmac->block_len - pmac->buflen)); in pmac_process() 75 XMEMCPY(pmac->block + pmac->buflen, in, n); in pmac_process() 76 pmac->buflen += n; in pmac_process()
|
| H A D | pmac_done.c | 22 if ((pmac->buflen > (int)sizeof(pmac->block)) || (pmac->buflen < 0) || in pmac_done() 23 (pmac->block_len > (int)sizeof(pmac->block)) || (pmac->buflen > pmac->block_len)) { in pmac_done() 30 if (pmac->buflen == pmac->block_len) { in pmac_done() 37 for (x = 0; x < pmac->buflen; x++) { in pmac_done()
|
| /optee_os/core/lib/libtomcrypt/src/mac/xcbc/ |
| H A D | xcbc_process.c | 34 (xcbc->buflen > xcbc->blocksize) || (xcbc->buflen < 0)) { in xcbc_process() 39 if (xcbc->buflen == 0) { in xcbc_process() 52 if (xcbc->buflen == xcbc->blocksize) { in xcbc_process() 54 xcbc->buflen = 0; in xcbc_process() 56 xcbc->IV[xcbc->buflen++] ^= *in++; in xcbc_process()
|
| H A D | xcbc_done.c | 30 (xcbc->buflen > xcbc->blocksize) || (xcbc->buflen < 0)) { in xcbc_done() 35 if (xcbc->buflen == xcbc->blocksize) { in xcbc_done() 41 xcbc->IV[xcbc->buflen] ^= 0x80; in xcbc_done()
|
| /optee_os/core/lib/libtomcrypt/src/mac/f9/ |
| H A D | f9_process.c | 31 (f9->buflen > f9->blocksize) || (f9->buflen < 0)) { in f9_process() 36 if (f9->buflen == 0) { in f9_process() 52 if (f9->buflen == f9->blocksize) { in f9_process() 57 f9->buflen = 0; in f9_process() 59 f9->IV[f9->buflen++] ^= *in++; in f9_process()
|
| H A D | f9_done.c | 30 (f9->buflen > f9->blocksize) || (f9->buflen < 0)) { in f9_done() 34 if (f9->buflen != 0) { in f9_done() 37 f9->buflen = 0; in f9_done()
|
| /optee_os/lib/libmbedtls/mbedtls/include/mbedtls/ |
| H A D | pem.h | 54 size_t MBEDTLS_PRIVATE(buflen); /*!< length of the buffer */ 109 static inline const unsigned char *mbedtls_pem_get_buffer(mbedtls_pem_context *ctx, size_t *buflen) in mbedtls_pem_get_buffer() argument 111 *buflen = ctx->MBEDTLS_PRIVATE(buflen); in mbedtls_pem_get_buffer()
|
| H A D | x509_csr.h | 93 const unsigned char *buf, size_t buflen); 152 const unsigned char *buf, size_t buflen, 172 int mbedtls_x509_csr_parse(mbedtls_x509_csr *csr, const unsigned char *buf, size_t buflen);
|
| /optee_os/core/lib/libtomcrypt/src/encauth/eax/ |
| H A D | eax_decrypt_verify_memory.c | 41 unsigned long buflen; in eax_decrypt_verify_memory() local 76 buflen = taglen; in eax_decrypt_verify_memory() 77 if ((err = eax_done(eax, buf, &buflen)) != CRYPT_OK) { in eax_decrypt_verify_memory() 82 if (buflen >= taglen && XMEM_NEQ(buf, tag, taglen) == 0) { in eax_decrypt_verify_memory()
|
| /optee_os/core/lib/libtomcrypt/src/encauth/ocb3/ |
| H A D | ocb3_decrypt_verify_memory.c | 41 unsigned long buflen; in ocb3_decrypt_verify_memory() local 78 buflen = taglen; in ocb3_decrypt_verify_memory() 79 if ((err = ocb3_done(ocb, buf, &buflen)) != CRYPT_OK) { in ocb3_decrypt_verify_memory() 84 if (buflen >= taglen && XMEM_NEQ(buf, tag, taglen) == 0) { in ocb3_decrypt_verify_memory()
|
| /optee_os/core/lib/libtomcrypt/src/encauth/chachapoly/ |
| H A D | chacha20poly1305_memory.c | 53 unsigned long buflen = sizeof(buf); in chacha20poly1305_memory() local 55 if ((err = chacha20poly1305_done(&st, buf, &buflen)) != CRYPT_OK) { goto LBL_ERR; } in chacha20poly1305_memory() 56 if (buflen != *taglen || XMEM_NEQ(buf, tag, buflen) != 0) { in chacha20poly1305_memory()
|