drbg_cavs_data.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the OpenSSL license (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. /*
  10. * Known answer tests (KAT) for NIST SP800-90A DRBGs.
  11. */
  12. #include <stddef.h>
  13. #ifndef DRBG_CAVS_DATA_H
  14. # define DRBG_CAVS_DATA_H
  15. enum drbg_kat_type {
  16. NO_RESEED,
  17. PR_FALSE,
  18. PR_TRUE
  19. };
  20. enum drbg_flags {
  21. NA = 0,
  22. USE_DF = 1<<0,
  23. NO_DF = 1<<1,
  24. USE_HMAC = 1<<2
  25. };
  26. struct drbg_kat_no_reseed {
  27. size_t count;
  28. const unsigned char *entropyin;
  29. const unsigned char *nonce;
  30. const unsigned char *persstr;
  31. const unsigned char *addin1;
  32. const unsigned char *addin2;
  33. const unsigned char *retbytes;
  34. };
  35. struct drbg_kat_pr_false {
  36. size_t count;
  37. const unsigned char *entropyin;
  38. const unsigned char *nonce;
  39. const unsigned char *persstr;
  40. const unsigned char *entropyinreseed;
  41. const unsigned char *addinreseed;
  42. const unsigned char *addin1;
  43. const unsigned char *addin2;
  44. const unsigned char *retbytes;
  45. };
  46. struct drbg_kat_pr_true {
  47. size_t count;
  48. const unsigned char *entropyin;
  49. const unsigned char *nonce;
  50. const unsigned char *persstr;
  51. const unsigned char *entropyinpr1;
  52. const unsigned char *addin1;
  53. const unsigned char *entropyinpr2;
  54. const unsigned char *addin2;
  55. const unsigned char *retbytes;
  56. };
  57. struct drbg_kat {
  58. enum drbg_kat_type type;
  59. enum drbg_flags flags;
  60. int nid;
  61. size_t entropyinlen;
  62. size_t noncelen;
  63. size_t persstrlen;
  64. size_t addinlen;
  65. size_t retbyteslen;
  66. const void *t;
  67. };
  68. extern const struct drbg_kat *drbg_ctr_test[];
  69. extern const struct drbg_kat *drbg_hmac_test[];
  70. extern const struct drbg_kat *drbg_hash_test[];
  71. extern const size_t drbg_ctr_nelem;
  72. extern const size_t drbg_hmac_nelem;
  73. extern const size_t drbg_hash_nelem;
  74. #endif