Home
last modified time | relevance | path

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

/optee_os/core/lib/libtomcrypt/src/modes/cfb/
A Dcfb_encrypt.c27 int cfb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CFB *cfb) in cfb_encrypt() argument
33 LTC_ARGCHK(cfb != NULL); in cfb_encrypt()
35 if ((err = cipher_is_valid(cfb->cipher)) != CRYPT_OK) { in cfb_encrypt()
40 if (cfb->blocklen < 0 || cfb->blocklen > (int)sizeof(cfb->IV) || in cfb_encrypt()
41 cfb->padlen < 0 || cfb->padlen > (int)sizeof(cfb->pad)) { in cfb_encrypt()
46 if (cfb->padlen == cfb->blocklen) { in cfb_encrypt()
47 …if ((err = cipher_descriptor[cfb->cipher]->ecb_encrypt(cfb->pad, cfb->IV, &cfb->key)) != CRYPT_OK)… in cfb_encrypt()
50 cfb->padlen = 0; in cfb_encrypt()
52 cfb->pad[cfb->padlen] = (*ct = *pt ^ cfb->IV[cfb->padlen]); in cfb_encrypt()
55 ++(cfb->padlen); in cfb_encrypt()
A Dcfb_decrypt.c27 int cfb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CFB *cfb) in cfb_decrypt() argument
33 LTC_ARGCHK(cfb != NULL); in cfb_decrypt()
35 if ((err = cipher_is_valid(cfb->cipher)) != CRYPT_OK) { in cfb_decrypt()
40 if (cfb->blocklen < 0 || cfb->blocklen > (int)sizeof(cfb->IV) || in cfb_decrypt()
41 cfb->padlen < 0 || cfb->padlen > (int)sizeof(cfb->pad)) { in cfb_decrypt()
46 if (cfb->padlen == cfb->blocklen) { in cfb_decrypt()
47 …if ((err = cipher_descriptor[cfb->cipher]->ecb_encrypt(cfb->pad, cfb->IV, &cfb->key)) != CRYPT_OK)… in cfb_decrypt()
50 cfb->padlen = 0; in cfb_decrypt()
52 cfb->pad[cfb->padlen] = *ct; in cfb_decrypt()
53 *pt = *ct ^ cfb->IV[cfb->padlen]; in cfb_decrypt()
[all …]
A Dcfb_start.c31 int keylen, int num_rounds, symmetric_CFB *cfb) in cfb_start() argument
37 LTC_ARGCHK(cfb != NULL); in cfb_start()
45 cfb->cipher = cipher; in cfb_start()
46 cfb->blocklen = cipher_descriptor[cipher]->block_length; in cfb_start()
47 for (x = 0; x < cfb->blocklen; x++) { in cfb_start()
48 cfb->IV[x] = IV[x]; in cfb_start()
52 if ((err = cipher_descriptor[cipher]->setup(key, keylen, num_rounds, &cfb->key)) != CRYPT_OK) { in cfb_start()
57 cfb->padlen = 0; in cfb_start()
58 return cipher_descriptor[cfb->cipher]->ecb_encrypt(cfb->IV, cfb->IV, &cfb->key); in cfb_start()
A Dcfb_setiv.c26 int cfb_setiv(const unsigned char *IV, unsigned long len, symmetric_CFB *cfb) in cfb_setiv() argument
31 LTC_ARGCHK(cfb != NULL); in cfb_setiv()
33 if ((err = cipher_is_valid(cfb->cipher)) != CRYPT_OK) { in cfb_setiv()
37 if (len != (unsigned long)cfb->blocklen) { in cfb_setiv()
42 cfb->padlen = 0; in cfb_setiv()
43 return cipher_descriptor[cfb->cipher]->ecb_encrypt(IV, cfb->IV, &cfb->key); in cfb_setiv()
A Dcfb_getiv.c26 int cfb_getiv(unsigned char *IV, unsigned long *len, const symmetric_CFB *cfb) in cfb_getiv() argument
30 LTC_ARGCHK(cfb != NULL); in cfb_getiv()
31 if ((unsigned long)cfb->blocklen > *len) { in cfb_getiv()
32 *len = cfb->blocklen; in cfb_getiv()
35 XMEMCPY(IV, cfb->IV, cfb->blocklen); in cfb_getiv()
36 *len = cfb->blocklen; in cfb_getiv()
A Dcfb_done.c23 int cfb_done(symmetric_CFB *cfb) in cfb_done() argument
26 LTC_ARGCHK(cfb != NULL); in cfb_done()
28 if ((err = cipher_is_valid(cfb->cipher)) != CRYPT_OK) { in cfb_done()
31 cipher_descriptor[cfb->cipher]->done(&cfb->key); in cfb_done()
/optee_os/core/lib/libtomcrypt/src/headers/
A Dtomcrypt_cipher.h873 int keylen, int num_rounds, symmetric_CFB *cfb);
874 int cfb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CFB *cfb);
875 int cfb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CFB *cfb);
876 int cfb_getiv(unsigned char *IV, unsigned long *len, const symmetric_CFB *cfb);
877 int cfb_setiv(const unsigned char *IV, unsigned long len, symmetric_CFB *cfb);
878 int cfb_done(symmetric_CFB *cfb);

Completed in 10 milliseconds