hmac_drbg.h 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. #ifndef OSSL_PROV_HMAC_DRBG_H
  10. # define OSSL_PROV_HMAC_DRBG_H
  11. # pragma once
  12. #include <openssl/evp.h>
  13. #include "prov/provider_util.h"
  14. typedef struct drbg_hmac_st {
  15. EVP_MAC_CTX *ctx; /* H(x) = HMAC_hash OR H(x) = KMAC */
  16. PROV_DIGEST digest; /* H(x) = hash(x) */
  17. size_t blocklen;
  18. unsigned char K[EVP_MAX_MD_SIZE];
  19. unsigned char V[EVP_MAX_MD_SIZE];
  20. } PROV_DRBG_HMAC;
  21. int ossl_drbg_hmac_init(PROV_DRBG_HMAC *drbg,
  22. const unsigned char *ent, size_t ent_len,
  23. const unsigned char *nonce, size_t nonce_len,
  24. const unsigned char *pstr, size_t pstr_len);
  25. int ossl_drbg_hmac_generate(PROV_DRBG_HMAC *hmac,
  26. unsigned char *out, size_t outlen,
  27. const unsigned char *adin, size_t adin_len);
  28. #endif /* OSSL_PROV_HMAC_DRBG_H */