Skip to content

Commit

Permalink
Update comments in btok/sm
Browse files Browse the repository at this point in the history
  • Loading branch information
agievich committed Jan 8, 2025
1 parent 89a22e5 commit 5212211
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions include/bee2/crypto/btok.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
\brief STB 34.101.79 (btok): cryptographic tokens
\project bee2 [cryptographic library]
\created 2022.07.04
\version 2023.06.17
\version 2025.01.08
\copyright The Bee2 authors
\license Licensed under the Apache License, Version 2.0 (see LICENSE.txt).
*******************************************************************************
Expand Down Expand Up @@ -515,15 +515,15 @@ err_t btokCVCMatch(
Защита организована по схеме encrypt-then-mac: сначала тело команды/ответа
зашифровывается, а затем к шифртексту присоединяется имитовставка, которая
покрывает шифртекст и открытые данные команды/ответа.
покрывает счетчик, шифртекст и открытые данные команды/ответа.
Счетчик используется в качестве синхропосылки при шифровании. Перед установкой
защиты или ее снятием счетчик инкрементируется. Первоначально счетчик равняется
нулю.
Контролируется следующая логика:
- установка/снятие защиты команды выполняется с нечетными значениями счетчика;
- установка/снятие защиты команды выполняется с четными значениями счетчика.
- установка/снятие защиты ответа выполняется с четными значениями счетчика.
\expect Состояние функций SM не изменяется вне этих функций.
Expand Down
6 changes: 3 additions & 3 deletions src/crypto/btok/btok_sm.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
\brief STB 34.101.79 (btok): Secure Messaging
\project bee2 [cryptographic library]
\created 2022.10.31
\version 2023.06.19
\version 2025.01.08
\copyright The Bee2 authors
\license Licensed under the Apache License, Version 2.0 (see LICENSE.txt).
*******************************************************************************
Expand Down Expand Up @@ -116,8 +116,8 @@ static size_t apduCmdRDFLenLen(const apdu_cmd_t* cmd)
T = belt-mac(ctr CLA* INS P1 P2 [der(0x87, 0x02 Y)] [der(0x97, Le)], key1)
Правила формирования Le* и Lc*:
Le* всегда устанавливается в 0x00, а Lc* определяется обычным образом:
len(Lc*) = 1, если len(CDF*) < 256, и len(Lc*) = 3 в противном случае.
Le* = 0x00, Lc* определяется обычным образом:
len(Lc*) = 1, если len(CDF*) < 256, и len(Lc*) = 3 в противном случае.
\remark Минимальная длина защищенной команды:
4 (hdr) + 1 (cdf_len_len) + 10 (mac) + 1 (Le*) = 16.
Expand Down
2 changes: 1 addition & 1 deletion test/crypto/btok_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
\brief Tests for STB 34.101.79 (btok)
\project bee2/test
\created 2022.07.07
\version 2023.12.19
\version 2025.01.08
\copyright The Bee2 authors
\license Licensed under the Apache License, Version 2.0 (see LICENSE.txt).
*******************************************************************************
Expand Down

0 comments on commit 5212211

Please sign in to comment.