Fixed compilation error

This commit is contained in:
Yuriy Glukhov 2018-03-30 16:57:21 +03:00
parent c3e78c28c3
commit 647660af02
1 changed files with 14 additions and 14 deletions

View File

@ -26,22 +26,22 @@ type
IncorrectKey, ## Recovered public key is invalid IncorrectKey, ## Recovered public key is invalid
IncorrectTag ## ECIES tag verification failed IncorrectTag ## ECIES tag verification failed
when false: # when false:
# REVIEW(zah): # # REVIEW(zah):
# Why do we work with arrays and known fixed offsets (such sa eciesIvPos) # # Why do we work with arrays and known fixed offsets (such sa eciesIvPos)
# instead of defining object types with named fields: # # instead of defining object types with named fields:
type # type
EciesPrefix = object # EciesPrefix = object
leadingByte: byte # leadingByte: byte
pubKey: PublicKey # pubKey: PublicKey
iv: array[aes128.sizeBlock] # iv: array[aes128.sizeBlock]
# You can then write to these fields by doing: # # You can then write to these fields by doing:
var eciesPrefix = cast[ptr EciesPrefix](addr array[0]) # var eciesPrefix = cast[ptr EciesPrefix](addr array[0])
eciesPrefix.pubKey = ... # eciesPrefix.pubKey = ...
eciesPrefix.iv = ... # eciesPrefix.iv = ...
# This will make the code slightly easier to read and review for correctness # # This will make the code slightly easier to read and review for correctness
template eciesOverheadLength*(): int = template eciesOverheadLength*(): int =
## Return data overhead size for ECIES encrypted message ## Return data overhead size for ECIES encrypted message