125 for (
int i : {40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 60, 61, 62, 63, 63, 64, 65, 66, 10, 11, 12, 13, 14, 15, 16, 17, 18})
127 get_example(i, key, nonce, auth_data, plain, cipher);
129 tag = cipher.substr(plain.size());
130 cipher.resize(plain.size());
131 LOG(
INFO,
"\nExample %d keylen=%d nlen=%d alen=%d taglen=%d datalen=%d", i, (
int)key.size(), (
int)nonce.size(), (
int)auth_data.size(), (
int)tag.size(), (
int)plain.size());
135 o_tag.resize(tag.size());
136 HASSERT(cipher.size() == plain.size());
138 key, nonce, auth_data, cipher, &o_plain, &o_tag);
139 printcomp(tag, o_tag,
"tag");
140 printcomp(plain, o_plain,
"plain");
147 key, nonce, auth_data, plain, tag.size(), &o_cipher, &o_tag);
148 printcomp(tag, o_tag,
"tag");
149 printcomp(cipher, o_cipher,
"cipher");
152 for (
int i = 0; i <= 67; i++)
155 get_sha_example(i, key, digest, plain);
156 LOG(
INFO,
"SHA256 Example %d datalen=%d", i, (
int)plain.size());
158 printcomp(digest, o_digest,
"hash");
161 return !have_failure;
static void decrypt(const std::string &aes_key, const std::string &nonce, const std::string &auth_data, const std::string &cipher, std::string *plain, std::string *tag)
Performs authenticated decryption using CCM in one call.
static void encrypt(const std::string &aes_key, const std::string &nonce, const std::string &auth_data, const std::string &plain, unsigned tag_len, std::string *cipher, std::string *tag)
Performs authenticated encryption using CCM in one call.