Reference implementations of PQC
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

55 lines
1.3 KiB

  1. #ifndef AES_H
  2. #define AES_H
  3. #include <stdint.h>
  4. #include <stdlib.h>
  5. #define AES128_KEYBYTES 16
  6. #define AES192_KEYBYTES 24
  7. #define AES256_KEYBYTES 32
  8. #define AESCTR_NONCEBYTES 12
  9. #define AES_BLOCKBYTES 16
  10. typedef struct {
  11. uint64_t sk_exp[88];
  12. } aes128ctx;
  13. typedef struct {
  14. uint64_t sk_exp[104];
  15. } aes192ctx;
  16. typedef struct {
  17. uint64_t sk_exp[120];
  18. } aes256ctx;
  19. void aes128_keyexp(aes128ctx *r, const unsigned char *key);
  20. void aes128_ecb(unsigned char *out, const unsigned char *in, size_t nblocks, const aes128ctx *ctx);
  21. void aes128_ctr(unsigned char *out, size_t outlen, const unsigned char *iv, const aes128ctx *ctx);
  22. void aes128_ctx_release(aes128ctx *r);
  23. void aes192_keyexp(aes192ctx *r, const unsigned char *key);
  24. void aes192_ecb(unsigned char *out, const unsigned char *in, size_t nblocks, const aes192ctx *ctx);
  25. void aes192_ctr(unsigned char *out, size_t outlen, const unsigned char *iv, const aes192ctx *ctx);
  26. void aes192_ctx_release(aes192ctx *r);
  27. void aes256_keyexp(aes256ctx *r, const unsigned char *key);
  28. void aes256_ecb(unsigned char *out, const unsigned char *in, size_t nblocks, const aes256ctx *ctx);
  29. void aes256_ctr(unsigned char *out, size_t outlen, const unsigned char *iv, const aes256ctx *ctx);
  30. void aes256_ctx_release(aes256ctx *r);
  31. #endif