Skip to content

Commit d750e55

Browse files
jh6186andrewc-arm
authored andcommitted
tidy up PR comments ARMmbed#1
Signed-off-by: PARKJIHOON <[email protected]>
1 parent 0d27423 commit d750e55

File tree

6 files changed

+111
-41
lines changed

6 files changed

+111
-41
lines changed
Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2015-2016 Nuvoton
2+
* Copyright (c) 2006-2019 ARM Limited
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,27 +13,28 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
/****************************************************************************
17+
*
18+
* Copyright 2019 Samsung Electronics All Rights Reserved.
19+
* SPDX-License-Identifier: Apache-2.0
20+
*
21+
* Licensed under the Apache License, Version 2.0 (the "License");
22+
* you may not use this file except in compliance with the License.
23+
* You may obtain a copy of the License at
24+
*
25+
* http://www.apache.org/licenses/LICENSE-2.0
26+
*
27+
* Unless required by applicable law or agreed to in writing,
28+
* software distributed under the License is distributed on an
29+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
30+
* either express or implied. See the License for the specific
31+
* language governing permissions and limitations under the License.
32+
*
33+
****************************************************************************/
1634
#ifndef MBEDTLS_DEVICE_H
1735
#define MBEDTLS_DEVICE_H
1836

19-
//#define MBEDTLS_DES_ALT
20-
21-
//#define MBEDTLS_SHA1_ALT
2237
#define MBEDTLS_SHA256_ALT
2338
#define MBEDTLS_SHA512_ALT
2439

25-
//#define MBEDTLS_AES_ALT
26-
27-
//#define MBEDTLS_ECP_INTERNAL_ALT
28-
/* Support for Weierstrass curves with Jacobi representation */
29-
//#define MBEDTLS_ECP_RANDOMIZE_JAC_ALT
30-
//#define MBEDTLS_ECP_ADD_MIXED_ALT
31-
//#define MBEDTLS_ECP_DOUBLE_JAC_ALT
32-
//#define MBEDTLS_ECP_NORMALIZE_JAC_ALT
33-
//#define MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT
34-
/* Support for curves with Montgomery arithmetic */
35-
//#define MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT
36-
//#define MBEDTLS_ECP_RANDOMIZE_MXZ_ALT
37-
//#define MBEDTLS_ECP_NORMALIZE_MXZ_ALT
38-
3940
#endif /* MBEDTLS_DEVICE_H */

features/mbedtls/targets/TARGET_Samsung/sha/sha256_alt.c

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2015-2016 Nuvoton
2+
* Copyright (c) 2006-2019 ARM Limited
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,6 +13,25 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
/****************************************************************************
17+
*
18+
* Copyright 2019 Samsung Electronics All Rights Reserved.
19+
* SPDX-License-Identifier: Apache-2.0
20+
*
21+
* Licensed under the Apache License, Version 2.0 (the "License");
22+
* you may not use this file except in compliance with the License.
23+
* You may obtain a copy of the License at
24+
*
25+
* http://www.apache.org/licenses/LICENSE-2.0
26+
*
27+
* Unless required by applicable law or agreed to in writing,
28+
* software distributed under the License is distributed on an
29+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
30+
* either express or implied. See the License for the specific
31+
* language governing permissions and limitations under the License.
32+
*
33+
****************************************************************************/
34+
1635

1736
#include "mbedtls/sha256.h"
1837
#include "mbedtls/platform_util.h"
@@ -76,8 +95,8 @@ void mbedtls_sha256_clone(mbedtls_sha256_context *dst,
7695
return;
7796
}
7897

79-
//SHA256_VALIDATE( dst != NULL );
80-
//SHA256_VALIDATE( src != NULL );
98+
SHA256_VALIDATE( dst != NULL );
99+
SHA256_VALIDATE( src != NULL );
81100

82101
memcpy(dst, src, sizeof(mbedtls_sha256_context));
83102
}
@@ -94,9 +113,8 @@ int mbedtls_sha256_starts_ret(mbedtls_sha256_context *ctx, int is224)
94113
ctx->total[1] = 0;
95114

96115
if( is224 == 0 )
97-
{ //SHA-256 by SSS H/W
116+
{
98117
ctx->is224 = 0;
99-
/// memset( ctx->sbuf, 0, sizeof( ctx->sbuf ) );
100118
memset( ctx, 0, sizeof( mbedtls_sha256_context ) );
101119
}
102120
else
@@ -106,14 +124,15 @@ int mbedtls_sha256_starts_ret(mbedtls_sha256_context *ctx, int is224)
106124
ctx->state[1] = 0x367CD507;
107125
ctx->state[2] = 0x3070DD17;
108126
ctx->state[3] = 0xF70E5939;
109-
ctx->state[4] = 0xFFC00B31;
110-
ctx->state[5] = 0x68581511;
111-
ctx->state[6] = 0x64F98FA7;
112-
ctx->state[7] = 0xBEFA4FA4;
127+
ctx->state[4] = 0xFFC00B31;
128+
ctx->state[5] = 0x68581511;
129+
ctx->state[6] = 0x64F98FA7;
130+
ctx->state[7] = 0xBEFA4FA4;
113131
ctx->is224 = is224;
114132
}
115133

116-
return( 0 );
134+
// No any of H/W access, always return OK
135+
return 0;
117136
}
118137

119138
/*
@@ -128,7 +147,6 @@ int mbedtls_sha256_update_ret(mbedtls_sha256_context *ctx, const unsigned char *
128147
if(ilen > MAX_MB_HASH_BLOCK_BLEN || ctx->totals > MAX_MB_HASH_BLOCK_BLEN) {
129148
// H/W SHA has limitation to seperated API with oversized message.
130149
// fall back to S/W SHA-256
131-
//memset( ctx, 0, sizeof( mbedtls_sha256_context ) );
132150
if(ctx->totals == 0) {
133151
ctx->total[0] = 0;
134152
ctx->total[1] = 0;
@@ -150,6 +168,8 @@ int mbedtls_sha256_update_ret(mbedtls_sha256_context *ctx, const unsigned char *
150168
ctx->pstMessage.u32DataByteLen += ilen;
151169
}
152170
}
171+
172+
// No any of H/W access, always return OK
153173
return 0;
154174
}
155175

@@ -177,7 +197,7 @@ int mbedtls_sha256_finish_ret(mbedtls_sha256_context *ctx, unsigned char output[
177197

178198
//! assign hash_byte_len to compare returned result from sss_fw after hash operation
179199
object_id = OID_SHA2_256;
180-
block_byte_len = 64; /* meaningless*/
200+
block_byte_len = 64; /* dummy */
181201

182202
//! step 1 : set message length parameter to SSS
183203
ret = mb_hash_init(&ctx->pstMessage, object_id);

features/mbedtls/targets/TARGET_Samsung/sha/sha256_alt.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2015-2016 Nuvoton
2+
* Copyright (c) 2006-2019 ARM Limited
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,6 +13,25 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
/****************************************************************************
17+
*
18+
* Copyright 2019 Samsung Electronics All Rights Reserved.
19+
* SPDX-License-Identifier: Apache-2.0
20+
*
21+
* Licensed under the Apache License, Version 2.0 (the "License");
22+
* you may not use this file except in compliance with the License.
23+
* You may obtain a copy of the License at
24+
*
25+
* http://www.apache.org/licenses/LICENSE-2.0
26+
*
27+
* Unless required by applicable law or agreed to in writing,
28+
* software distributed under the License is distributed on an
29+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
30+
* either express or implied. See the License for the specific
31+
* language governing permissions and limitations under the License.
32+
*
33+
****************************************************************************/
34+
1635
#ifndef MBEDTLS_SHA256_ALT_H
1736
#define MBEDTLS_SHA256_ALT_H
1837

features/mbedtls/targets/TARGET_Samsung/sha/sha512_alt.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2015-2016 Nuvoton
2+
* Copyright (c) 2006-2019 ARM Limited
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,6 +13,25 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
/****************************************************************************
17+
*
18+
* Copyright 2019 Samsung Electronics All Rights Reserved.
19+
* SPDX-License-Identifier: Apache-2.0
20+
*
21+
* Licensed under the Apache License, Version 2.0 (the "License");
22+
* you may not use this file except in compliance with the License.
23+
* You may obtain a copy of the License at
24+
*
25+
* http://www.apache.org/licenses/LICENSE-2.0
26+
*
27+
* Unless required by applicable law or agreed to in writing,
28+
* software distributed under the License is distributed on an
29+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
30+
* either express or implied. See the License for the specific
31+
* language governing permissions and limitations under the License.
32+
*
33+
****************************************************************************/
34+
1635

1736
#include "mbedtls/sha512.h"
1837
#include "mbedtls/platform_util.h"

features/mbedtls/targets/TARGET_Samsung/sha/sha512_alt.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2015-2016 Nuvoton
2+
* Copyright (c) 2006-2019 ARM Limited
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,6 +13,24 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
/****************************************************************************
17+
*
18+
* Copyright 2019 Samsung Electronics All Rights Reserved.
19+
* SPDX-License-Identifier: Apache-2.0
20+
*
21+
* Licensed under the Apache License, Version 2.0 (the "License");
22+
* you may not use this file except in compliance with the License.
23+
* You may obtain a copy of the License at
24+
*
25+
* http://www.apache.org/licenses/LICENSE-2.0
26+
*
27+
* Unless required by applicable law or agreed to in writing,
28+
* software distributed under the License is distributed on an
29+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
30+
* either express or implied. See the License for the specific
31+
* language governing permissions and limitations under the License.
32+
*
33+
****************************************************************************/
1634
#ifndef MBEDTLS_SHA512_ALT_H
1735
#define MBEDTLS_SHA512_ALT_H
1836

targets/TARGET_Samsung/TARGET_SIDK_S5JS100/PeripheralNames.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2006-2018 ARM Limited
2+
* Copyright (c) 2006-2019 ARM Limited
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -107,13 +107,6 @@ typedef enum {
107107
#define STDIO_UART _UART_NAME(UART_, UART_STDIO_PORT)
108108
#endif
109109

110-
111-
/* what are these ports for? */
112-
//#define MBED_UART0 UART_TX0, UART_RX0
113-
//#define MBED_UART1 UART_TX1, UART_RX1
114-
//#define MBED_UARTUSB UART_TX1, UART_RX1
115-
116-
//USB UART - what for ???
117110
#define USBTX UART_TX0
118111
#define USBRX UART_RX0
119112

0 commit comments

Comments
 (0)