prf_tls12.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* prf_tls12.h */
  2. /*
  3. This file is part of the AVR-Crypto-Lib.
  4. Copyright (C) 2011 Daniel Otte (daniel.otte@rub.de)
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef PRF_TLS12_H_
  17. #define PRF_TLS12_H_
  18. #include <stdint.h>
  19. #include <crypto/hashfunction_descriptor.h>
  20. #include <crypto/hfal-basic.h>
  21. #include <crypto/hfal-hmac.h>
  22. typedef struct{
  23. hfhmacgen_ctx_t mainctx;
  24. uint16_t blocklength_b;
  25. uint16_t bufferlength_b;
  26. uint8_t* seed_buffer;
  27. } prf_tls12_ctx_t;
  28. uint8_t prf_tls12_init(prf_tls12_ctx_t* ctx, const hfdesc_t* hash,
  29. const void* key, uint16_t keylength_b,
  30. const void* seed, uint16_t seedlength_b);
  31. uint8_t prf_tls12_init_w_label(prf_tls12_ctx_t* ctx, const hfdesc_t* hash,
  32. const void* key, uint16_t keylength_b,
  33. const void* label, uint16_t labellength_B,
  34. const void* seed, uint16_t seedlength_b);
  35. void prf_tls12_free(prf_tls12_ctx_t* ctx);
  36. uint8_t prf_tls12_next(void* dest, prf_tls12_ctx_t* ctx);
  37. uint8_t prf_tls12_fill(void* dest, uint16_t length_B, prf_tls12_ctx_t* ctx);
  38. #endif /* PRF_TLS12_H_ */