class HMAC

Defined at line 23 of file ../../src/security/lib/fcrypto/hmac.h

Public Methods

void HMAC ()

Defined at line 39 of file ../../src/security/lib/fcrypto/hmac.cc

void ~HMAC ()

Defined at line 40 of file ../../src/security/lib/fcrypto/hmac.cc

zx_status_t Create (digest::Algorithm digest, const Secret & key, const void * in, size_t in_len, Bytes * out, uint16_t flags)

Convenience method that calls |Init|, |Update|, and |Final| in one shot to create a keyed

digest that it saves in |out|. Callers must omit |flags| unless the security implications

are clearly understood.

Defined at line 42 of file ../../src/security/lib/fcrypto/hmac.cc

zx_status_t Verify (digest::Algorithm digest, const Secret & key, const void * in, size_t in_len, const Bytes & hmac, uint16_t flags)

Convenience method that checks if the given |digest| matches the one that |Create| would

generate using |digest|, |key|, |in|, and |in_len|. On failure, it returns

|ZX_ERR_IO_DATA_INTEGRITY|. Callers must omit |flags| unless the security implications are

clearly understood.

Defined at line 55 of file ../../src/security/lib/fcrypto/hmac.cc

zx_status_t Init (digest::Algorithm digest, const Secret & key, uint16_t flags)

Initializes the HMAC algorithm indicated by |digest| with the given |key|. A call to |Init|

must precede any calls to |Update| or |Final|. Callers must omit |flags| unless the security

implications are clearly understood.

Defined at line 86 of file ../../src/security/lib/fcrypto/hmac.cc

zx_status_t Update (const void * in, size_t in_len)

Updates the HMAC with |in_len| bytes of additional data from |in|. This can only be called

between calls to |Init| and |Final|.

Defined at line 124 of file ../../src/security/lib/fcrypto/hmac.cc

zx_status_t Final (Bytes * out)

Returns the keyed digest in |out|. |Init| must be called again before calling |Update|

again.

Defined at line 148 of file ../../src/security/lib/fcrypto/hmac.cc

Enumerations

enum Flags
Name Value
ALLOW_WEAK_KEY 0x0001
ALLOW_TRUNCATION 0x0002

Defined at line 25 of file ../../src/security/lib/fcrypto/hmac.h