-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move X and T0 to function parameters
- Loading branch information
Showing
10 changed files
with
31 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,31 @@ | ||
with LSC.Types; | ||
with LSC.Byte_Arrays; | ||
use all type LSC.Types.Word64; | ||
|
||
-- @summary | ||
-- Time based One-Time-Pad | ||
-- | ||
-- @description | ||
-- Calculates the Time based One-Time-Pad based on RFC 6238 | ||
-- | ||
-- @param X Time step size | ||
-- @param T0 Reference time | ||
generic | ||
X : LSC.Types.Word64 := 30; | ||
T0 : LSC.Types.Word64 := 0; | ||
|
||
package OTP.T | ||
with SPARK_Mode | ||
is | ||
|
||
-- Calculates the TOTP Token from a given key and time offset | ||
-- @param HMAC key | ||
-- @param Current time | ||
-- @param X Time step size | ||
-- @param T0 Reference time | ||
-- @return TOTP Token as 31bit word | ||
function TOTP | ||
(Key : LSC.Byte_Arrays.Byte_Array_Type; | ||
Time : LSC.Types.Word64) | ||
Time : LSC.Types.Word64; | ||
X : LSC.Types.Word64 := 30; | ||
T0 : LSC.Types.Word64 := 0) | ||
return OTP_Token | ||
with | ||
Depends => (TOTP'Result => (Key, Time)), | ||
Pre => Key'Length <= 64; | ||
Depends => (TOTP'Result => (Key, Time, X, T0)), | ||
Pre => Key'Length <= 64 and X > 0; | ||
|
||
end OTP.T; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters