12345678910111213141516171819202122232425262728293031323334353637383940 |
- /*===========================================================================
- Combined Charging System (CCS): SECC
- NidNmk.h
- initiated by Vern, Joseph
- (since 2019/07/19)
- =============================================================================*/
- #include <stdint.h>
- #include <unistd.h>
- #include <stdlib.h>
- #include <string.h>
- typedef struct sha256
- {
- uint32_t count [2];
- uint32_t state [8];
- uint8_t block [64];
- uint8_t extra [64];
- } SHA256;
- #define SHA256_DIGEST_LENGTH 256 / 8
- #define HPAVKEY_NMK_LEN 16
- #define HPAVKEY_NID_LEN 7
- #define SHR(word, bits) ((word & 0xFFFFFFFF) >> bits)
- #define ROTR(word, bits) (SHR(word, bits) | (word << (32 - bits)))
- #define DEFAULT_LEVEL 0
- //--------------------------------------------------------------------------
- /* Functions -----------------------------------------------------------*/
- //--------------------------------------------------------------------------
- void HPAVKeyNMK(uint8_t NMK [], const char *string);
- void HPAVKeyNID(uint8_t NID [], const uint8_t NMK [], uint8_t level);
- void SHA256Reset(struct sha256 *sha256);
- void SHA256Block(struct sha256 *sha256, void const *memory);
- void SHA256Write(struct sha256 *sha256, void const *memory, uint16_t extent);
- void SHAEncode(uint8_t memory [], uint32_t number);
- void SHA256Fetch(struct sha256 *sha256, uint8_t digest []);
|