Source release 19.3.0
This commit is contained in:
@@ -7,18 +7,22 @@
|
||||
#ifndef WVOEC_UTIL_CMAC_H_
|
||||
#define WVOEC_UTIL_CMAC_H_
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <openssl/cmac.h>
|
||||
|
||||
#include "wv_class_utils.h"
|
||||
|
||||
namespace wvoec {
|
||||
namespace util {
|
||||
class Cmac {
|
||||
public:
|
||||
WVCDM_DISALLOW_COPY_AND_MOVE(Cmac);
|
||||
|
||||
// Creates an AES-128-CMAC or an AES-256-CMAC depending on |key_size|.
|
||||
// Returns an empty pointer if the key size is not valid.
|
||||
static std::unique_ptr<Cmac> Create(const uint8_t* key, size_t key_size);
|
||||
@@ -48,14 +52,14 @@ class Cmac {
|
||||
~Cmac();
|
||||
|
||||
private:
|
||||
Cmac() {}
|
||||
Cmac() = default;
|
||||
|
||||
// Assumes |key_size| is a valid AES-128 or AES-256 key.
|
||||
bool Init(const uint8_t* key, size_t key_size);
|
||||
|
||||
CMAC_CTX* ctx_ = nullptr;
|
||||
bool ready_ = false;
|
||||
};
|
||||
}; // class Cmac
|
||||
} // namespace util
|
||||
} // namespace wvoec
|
||||
#endif // WVOEC_UTIL_CMAC_H_
|
||||
|
||||
Reference in New Issue
Block a user