示例#1
0
/*
* Set the EAX key
*/
void EAX_Base::set_key(const SymmetricKey& key)
   {
   /*
   * These could share the key schedule, which is one nice part of EAX,
   * but it's much easier to ignore that here...
   */
   ctr->set_key(key);
   cmac->set_key(key);

   header_mac = eax_prf(1, BLOCK_SIZE, cmac, 0, 0);
   }
示例#2
0
文件: eax.cpp 项目: Kampbell/botan
/*
* Set the EAX key
*/
void EAX_Mode::key_schedule(const byte key[], size_t length)
{
    /*
    * These could share the key schedule, which is one nice part of EAX,
    * but it's much easier to ignore that here...
    */
    m_ctr->set_key(key, length);
    m_cmac->set_key(key, length);

    m_ad_mac = eax_prf(1, block_size(), *m_cmac, nullptr, 0);
}
示例#3
0
文件: eax.cpp 项目: Kampbell/botan
secure_vector<byte> EAX_Mode::start_raw(const byte nonce[], size_t nonce_len)
{
    if(!valid_nonce_length(nonce_len))
        throw Invalid_IV_Length(name(), nonce_len);

    m_nonce_mac = eax_prf(0, block_size(), *m_cmac, nonce, nonce_len);

    m_ctr->set_iv(m_nonce_mac.data(), m_nonce_mac.size());

    for(size_t i = 0; i != block_size() - 1; ++i)
        m_cmac->update(0);
    m_cmac->update(2);

    return secure_vector<byte>();
}
示例#4
0
/*
* Set the EAX header
*/
void EAX_Base::set_header(const byte header[], size_t length)
   {
   header_mac = eax_prf(1, BLOCK_SIZE, cmac, header, length);
   }
示例#5
0
/*
* Set the EAX nonce
*/
void EAX_Base::set_iv(const InitializationVector& iv)
   {
   nonce_mac = eax_prf(0, BLOCK_SIZE, cmac, iv.begin(), iv.length());
   ctr->set_iv(&nonce_mac[0], nonce_mac.size());
   }
示例#6
0
文件: eax.cpp 项目: Kampbell/botan
/*
* Set the EAX associated data
*/
void EAX_Mode::set_associated_data(const byte ad[], size_t length)
{
    m_ad_mac = eax_prf(1, block_size(), *m_cmac, ad, length);
}