They are only to be used internally by the DWC UWB modules.
Functions | |
int | dwc_dh_sha256 (uint8_t *message, uint32_t len, uint8_t *out) |
int | dwc_dh_hmac_sha256 (uint8_t *message, uint32_t messagelen, uint8_t *key, uint32_t keylen, uint8_t *out) |
int | dwc_dh_modpow (void *num, uint32_t num_len, void *exp, uint32_t exp_len, void *mod, uint32_t mod_len, void *out) |
int | dwc_dh_pk (uint8_t nd, uint8_t *exp, uint8_t *pkd, uint8_t *hash) |
Computes PKD or PKH, and SHA-256(PKd || Nd). | |
int | dwc_dh_derive_keys (uint8_t nd, uint8_t *pkh, uint8_t *pkd, uint8_t *exp, int is_host, char *dd, uint8_t *ck, uint8_t *kdk) |
Computes the DHKEY, and VD. |
int dwc_dh_pk | ( | uint8_t | nd, | |
uint8_t * | exp, | |||
uint8_t * | pkd, | |||
uint8_t * | hash | |||
) |
Computes PKD or PKH, and SHA-256(PKd || Nd).
PK = g^exp mod p.
Input: Nd = Number of digits on the device.
Output: exp = A 32-byte buffer to be filled with a randomly generated number. used as either A or B. pk = A 384-byte buffer to be filled with the PKH or PKD. hash = A 32-byte buffer to be filled with SHA-256(PK || ND).
int dwc_dh_derive_keys | ( | uint8_t | nd, | |
uint8_t * | pkh, | |||
uint8_t * | pkd, | |||
uint8_t * | exp, | |||
int | is_host, | |||
char * | dd, | |||
uint8_t * | ck, | |||
uint8_t * | kdk | |||
) |
Computes the DHKEY, and VD.
If called from host, then it will comput DHKEY=PKD^exp % p. If called from device, then it will comput DHKEY=PKH^exp % p.
Input: pkd = The PKD value. pkh = The PKH value. exp = The A value (if device) or B value (if host) generated in dwc_wudev_dh_pk. is_host = Set to non zero if a WUSB host is calling this function.
Output:
dd = A pointer to an buffer to be set to the displayed digits string to be shown to the user. This buffer should be at 5 bytes long to hold 4 digits plus a null termination character. This buffer can be used directly for display. ck = A 16-byte buffer to be filled with the CK. kdk = A 32-byte buffer to be filled with the KDK.