Home
last modified time | relevance | path

Searched refs:xcbc (Results 1 – 7 of 7) sorted by relevance

/optee_os/core/lib/libtomcrypt/src/mac/xcbc/
H A Dxcbc_process.c18 int xcbc_process(xcbc_state *xcbc, const unsigned char *in, unsigned long inlen) in xcbc_process() argument
25 LTC_ARGCHK(xcbc != NULL); in xcbc_process()
29 if ((err = cipher_is_valid(xcbc->cipher)) != CRYPT_OK) { in xcbc_process()
33 if ((xcbc->blocksize > cipher_descriptor[xcbc->cipher]->block_length) || (xcbc->blocksize < 0) || in xcbc_process()
34 (xcbc->buflen > xcbc->blocksize) || (xcbc->buflen < 0)) { in xcbc_process()
39 if (xcbc->buflen == 0) { in xcbc_process()
40 while (inlen > (unsigned long)xcbc->blocksize) { in xcbc_process()
41 for (x = 0; x < xcbc->blocksize; x += sizeof(LTC_FAST_TYPE)) { in xcbc_process()
42 *(LTC_FAST_TYPE_PTR_CAST(&(xcbc->IV[x]))) ^= *(LTC_FAST_TYPE_PTR_CAST(&(in[x]))); in xcbc_process()
44 cipher_descriptor[xcbc->cipher]->ecb_encrypt(xcbc->IV, xcbc->IV, &xcbc->key); in xcbc_process()
[all …]
H A Dxcbc_done.c18 int xcbc_done(xcbc_state *xcbc, unsigned char *out, unsigned long *outlen) in xcbc_done() argument
21 LTC_ARGCHK(xcbc != NULL); in xcbc_done()
25 if ((err = cipher_is_valid(xcbc->cipher)) != CRYPT_OK) { in xcbc_done()
29 if ((xcbc->blocksize > cipher_descriptor[xcbc->cipher]->block_length) || (xcbc->blocksize < 0) || in xcbc_done()
30 (xcbc->buflen > xcbc->blocksize) || (xcbc->buflen < 0)) { in xcbc_done()
35 if (xcbc->buflen == xcbc->blocksize) { in xcbc_done()
37 for (x = 0; x < xcbc->blocksize; x++) { in xcbc_done()
38 xcbc->IV[x] ^= xcbc->K[1][x]; in xcbc_done()
41 xcbc->IV[xcbc->buflen] ^= 0x80; in xcbc_done()
43 for (x = 0; x < xcbc->blocksize; x++) { in xcbc_done()
[all …]
H A Dxcbc_init.c19 int xcbc_init(xcbc_state *xcbc, int cipher, const unsigned char *key, unsigned long keylen) in xcbc_init() argument
25 LTC_ARGCHK(xcbc != NULL); in xcbc_init()
50 XMEMCPY(xcbc->K[0], key, k1); in xcbc_init()
51 XMEMCPY(xcbc->K[1], key+k1, cipher_descriptor[cipher]->block_length); in xcbc_init()
52 …XMEMCPY(xcbc->K[2], key+k1 + cipher_descriptor[cipher]->block_length, cipher_descriptor[cipher]->b… in xcbc_init()
70 xcbc->K[y][x] = y + 1; in xcbc_init()
72 cipher_descriptor[cipher]->ecb_encrypt(xcbc->K[y], xcbc->K[y], skey); in xcbc_init()
77 err = cipher_descriptor[cipher]->setup(xcbc->K[0], k1, 0, &xcbc->key); in xcbc_init()
80 zeromem(xcbc->IV, cipher_descriptor[cipher]->block_length); in xcbc_init()
81 xcbc->blocksize = cipher_descriptor[cipher]->block_length; in xcbc_init()
[all …]
H A Dxcbc_memory.c27 xcbc_state *xcbc; in xcbc_memory() local
40 xcbc = XCALLOC(1, sizeof(*xcbc)); in xcbc_memory()
41 if (xcbc == NULL) { in xcbc_memory()
45 if ((err = xcbc_init(xcbc, cipher, key, keylen)) != CRYPT_OK) { in xcbc_memory()
49 if ((err = xcbc_process(xcbc, in, inlen)) != CRYPT_OK) { in xcbc_memory()
53 err = xcbc_done(xcbc, out, outlen); in xcbc_memory()
55 XFREE(xcbc); in xcbc_memory()
H A Dxcbc_memory_multi.c31 xcbc_state *xcbc; in xcbc_memory_multi() local
42 xcbc = XMALLOC(sizeof(xcbc_state)); in xcbc_memory_multi()
43 if (xcbc == NULL) { in xcbc_memory_multi()
48 if ((err = xcbc_init(xcbc, cipher, key, keylen)) != CRYPT_OK) { in xcbc_memory_multi()
56 if ((err = xcbc_process(xcbc, curptr, curlen)) != CRYPT_OK) { in xcbc_memory_multi()
66 if ((err = xcbc_done(xcbc, out, outlen)) != CRYPT_OK) { in xcbc_memory_multi()
71 zeromem(xcbc, sizeof(xcbc_state)); in xcbc_memory_multi()
73 XFREE(xcbc); in xcbc_memory_multi()
H A Dxcbc_file.c38 xcbc_state xcbc; in xcbc_file()
51 if ((err = xcbc_init(&xcbc, cipher, key, keylen)) != CRYPT_OK) { in xcbc_file()
63 if ((err = xcbc_process(&xcbc, buf, (unsigned long)x)) != CRYPT_OK) { in xcbc_file()
74 err = xcbc_done(&xcbc, out, outlen); in xcbc_file()
80 zeromem(&xcbc, sizeof(xcbc_state)); in xcbc_file()
/optee_os/core/lib/libtomcrypt/src/headers/
H A Dtomcrypt_mac.h191 int xcbc_init(xcbc_state *xcbc, int cipher, const unsigned char *key, unsigned long keylen);
192 int xcbc_process(xcbc_state *xcbc, const unsigned char *in, unsigned long inlen);
193 int xcbc_done(xcbc_state *xcbc, unsigned char *out, unsigned long *outlen);