MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / xcbc_memory

Function xcbc_memory

extern/libtomcrypt/src/mac/xcbc/xcbc_memory.c:28–63  ·  view source on GitHub ↗

XCBC-MAC a block of memory @param cipher Index of cipher to use @param key [in] Secret key @param keylen Length of key in octets @param in [in] Message to MAC @param inlen Length of input in octets @param out [out] Destination for the MAC tag @param outlen [in/out] Output size and final tag size Return CRYPT_OK on success. */

Source from the content-addressed store, hash-verified

26 Return CRYPT_OK on success.
27*/
28int xcbc_memory(int cipher,
29 const unsigned char *key, unsigned long keylen,
30 const unsigned char *in, unsigned long inlen,
31 unsigned char *out, unsigned long *outlen)
32{
33 xcbc_state *xcbc;
34 int err;
35
36 /* is the cipher valid? */
37 if ((err = cipher_is_valid(cipher)) != CRYPT_OK) {
38 return err;
39 }
40
41 /* Use accelerator if found */
42 if (cipher_descriptor[cipher].xcbc_memory != NULL) {
43 return cipher_descriptor[cipher].xcbc_memory(key, keylen, in, inlen, out, outlen);
44 }
45
46 xcbc = XCALLOC(1, sizeof(*xcbc));
47 if (xcbc == NULL) {
48 return CRYPT_MEM;
49 }
50
51 if ((err = xcbc_init(xcbc, cipher, key, keylen)) != CRYPT_OK) {
52 goto done;
53 }
54
55 if ((err = xcbc_process(xcbc, in, inlen)) != CRYPT_OK) {
56 goto done;
57 }
58
59 err = xcbc_done(xcbc, out, outlen);
60done:
61 XFREE(xcbc);
62 return err;
63}
64
65#endif
66

Callers 3

xcbc_testFunction · 0.85
multi_testFunction · 0.85
time_macs_Function · 0.85

Calls 4

cipher_is_validFunction · 0.85
xcbc_initFunction · 0.85
xcbc_processFunction · 0.85
xcbc_doneFunction · 0.85

Tested by 2

xcbc_testFunction · 0.68
multi_testFunction · 0.68