Skip to content

Commit 2af24c1

Browse files
nirvannTonyHan11
authored andcommitted
examples/crypto_sha: fix warning and update documentation
Signed-off-by: Aubin Constans <aubin.constans@microchip.com>
1 parent 933e845 commit 2af24c1

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

examples/crypto_sha/TESTING.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ CRYPTO_SHA EXAMPLE
33

44
# Objectives
55
------------
6-
This example aims to encryption and decryption data with the he Secure Hash
6+
This example aims to encryption and decryption data with the Secure Hash
77
Algorithm (SHA) peripheral.
88

99
# Example Description
1010
---------------------
11-
This example shows how to configure SHA1/SH256/SHA384/SHA512/SHA224 mode and
11+
This example shows how to configure SHA1/SHA224/SHA256/SHA384/SHA512 mode and
1212
transfer message with one block, multi-blocks and long message with or without
1313
DMA.
1414

@@ -38,24 +38,24 @@ On the computer, open and configure a terminal application
3838
## Start the application
3939
------------------------
4040

41-
Tested with IAR and GCC (sram and ddram configuration)
41+
Tested with IAR<sup>®</sup> and GCC (sram and ddram configuration)
4242

4343
In order to test this example, the process is the following:
4444

4545
Step | Description | Expected Result | Result
4646
-----|-------------|-----------------|-------
47-
Press '0','o','m','p' | SHA1, single block, manual | PASSED | PASSED
48-
Press '1','o','m','p' | SHA256, single block, manual | PASSED | PASSED
49-
Press '2','o','m','p' | SHA384, single block, manual | PASSED | PASSED
50-
Press '3','o','m','p' | SHA512, single block, manual | PASSED | PASSED
51-
Press '4','o','m','p' | SHA224, single block, manual | PASSED | PASSED
52-
Press '0','t','a','p' | SHA1, multi block, auto | PASSED | PASSED
53-
Press '1','t','a','p' | SHA256, multi block, auto | PASSED | PASSED
54-
Press '2','t','a','p' | SHA384, multi block, auto | PASSED | PASSED
55-
Press '3','t','a','p' | SHA512, multi block, auto | PASSED | PASSED
56-
Press '4','t','a','p' | SHA224, multi block, auto | PASSED | PASSED
57-
Press '0','l','d','p' | SHA1, long-msg, dma | PASSED | PASSED
58-
Press '1','l','d','p' | SHA256, long-msg, dma | PASSED | PASSED
59-
Press '2','l','d','p' | SHA384, long-msg, dma | PASSED | PASSED
60-
Press '3','l','d','p' | SHA512, long-msg, dma | PASSED | PASSED
61-
Press '4','l','d','p' | SHA224, long-msg, dma | PASSED | PASSED
47+
Press '0','o','p','s' | SHA1, single block, polling | Digest successfully verified | PASSED
48+
Press '1','o','p','s' | SHA224, single block, polling | Digest successfully verified | PASSED
49+
Press '2','o','p','s' | SHA256, single block, polling | Digest successfully verified | PASSED
50+
Press '3','o','p','s' | SHA384, single block, polling | Digest successfully verified | PASSED
51+
Press '4','o','p','s' | SHA512, single block, polling | Digest successfully verified | PASSED
52+
Press '0','t','d','s' | SHA1, multi block, dma | Digest successfully verified | PASSED
53+
Press '1','t','d','s' | SHA224, multi block, dma | Digest successfully verified | PASSED
54+
Press '2','t','d','s' | SHA256, multi block, dma | Digest successfully verified | PASSED
55+
Press '3','t','d','s' | SHA384, multi block, dma | Digest successfully verified | PASSED
56+
Press '4','t','d','s' | SHA512, multi block, dma | Digest successfully verified | PASSED
57+
Press '0','l','d','s' | SHA1, long-msg, dma | Digest successfully verified | PASSED
58+
Press '1','l','d','s' | SHA224, long-msg, dma | Digest successfully verified | PASSED
59+
Press '2','l','d','s' | SHA256, long-msg, dma | Digest successfully verified | PASSED
60+
Press '3','l','d','s' | SHA384, long-msg, dma | Digest successfully verified | PASSED
61+
Press '4','l','d','s' | SHA512, long-msg, dma | Digest successfully verified | PASSED

examples/crypto_sha/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ static void start_sha(void)
294294
return;
295295
}
296296

297-
memset(digest, 0, ARRAY_SIZE(digest));
297+
memset(digest, 0, sizeof digest);
298298

299299
if (block_mode == SHA_ONE_BLOCK) {
300300
len = LEN_MSG_0;
@@ -388,7 +388,7 @@ static void display_menu(void)
388388
printf(" o: one-block[%c] t: multi-block[%c] l: long-message[%c] \r\n",
389389
chk_box[0], chk_box[1], chk_box[2]);
390390

391-
printf("Press [m|a|d] to set Start Mode \r\n");
391+
printf("Press [d|p] to select transfer mode\r\n");
392392
chk_box[0] = (shad.cfg.transfer_mode == SHAD_TRANS_POLLING) ? 'X' : ' ';
393393
chk_box[1] = (shad.cfg.transfer_mode == SHAD_TRANS_DMA) ? 'X' : ' ';
394394
printf(" p: POLLING[%c] d: DMA[%c]\r\n", chk_box[0], chk_box[1]);

0 commit comments

Comments
 (0)