Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SW_HW_Platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Farnoud Farahmand
SW_HW_Platform
Commits
31db3d61
Commit
31db3d61
authored
Sep 09, 2019
by
Farnoud Farahmand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
verified hardware v2
parent
e0189a90
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
14 deletions
+7
-14
NTRUEncrypt.c
c_baremetal/NTRUEncrypt.c
+7
-14
No files found.
c_baremetal/NTRUEncrypt.c
View file @
31db3d61
...
...
@@ -438,14 +438,12 @@ encrypt_cca(
TxBuffer
[
0
]
=
0x0000000000008800
;
//memcpy(TxBuffer+1, h, 443*2);
for
(
tx_rx_c
=
1
;
tx_rx_c
<
744
;
tx_rx_c
++
)
{
// initialize RxBuffer with 0's
TxBuffer
[
tx_rx_c
]
=
complement
&
h
[
tx_rx_c
-
1
];
TxBuffer
[
tx_rx_c
]
=
complement
&
h
[
744
-
tx_rx_c
-
1
];
}
TxBuffer
[
744
]
=
0x0000000000008200
;
for
(
tx_rx_c
=
745
;
tx_rx_c
<
1239
;
tx_rx_c
++
)
{
// initialize RxBuffer with 0's
TxBuffer
[
tx_rx_c
]
=
complement
&
r_pos
[
tx_rx_c
-
745
];
}
...
...
@@ -466,9 +464,9 @@ encrypt_cca(
xil_printf
(
"
\r\n
Encrypt Mult Execution Time (ENC) = %d
\r\n
"
,
execution_time
);
#endif
for
(
tx_rx_c
=
0
;
tx_rx_c
<
744
;
tx_rx_c
++
)
{
t
[
tx_rx_c
]
=
RxBuffer
[
tx_rx_c
+
2
];
}
for
(
tx_rx_c
=
0
;
tx_rx_c
<
743
;
tx_rx_c
++
)
{
t
[
742
-
tx_rx_c
]
=
RxBuffer
[
tx_rx_c
+
2
];
}
}
else
{
#if ROTATION_ON
...
...
@@ -578,14 +576,11 @@ int decrypt_cca(
TxBuffer
[
0
]
=
0x0000000000008400
;
//memcpy(TxBuffer+1, h, 443*2);
for
(
tx_rx_c
=
1
;
tx_rx_c
<
495
;
tx_rx_c
++
)
{
// initialize RxBuffer with 0's
TxBuffer
[
tx_rx_c
]
=
complement
&
F_pos
[
tx_rx_c
-
1
];
}
TxBuffer
[
495
]
=
0x0000000000009100
;
for
(
tx_rx_c
=
496
;
tx_rx_c
<
1239
;
tx_rx_c
++
)
{
// initialize RxBuffer with 0's
TxBuffer
[
tx_rx_c
]
=
complement
&
c
[
tx_rx_c
-
496
];
TxBuffer
[
tx_rx_c
]
=
complement
&
c
[
1239
-
tx_rx_c
-
1
];
}
#if POLY_MUL_EXE
...
...
@@ -606,7 +601,7 @@ int decrypt_cca(
#endif
for
(
tx_rx_c
=
0
;
tx_rx_c
<
743
;
tx_rx_c
++
)
{
m
[
tx_rx_c
]
=
RxBuffer
[
tx_rx_c
+
2
];
m
[
742
-
tx_rx_c
]
=
RxBuffer
[
tx_rx_c
+
2
];
}
}
else
{
#if ROTATION_ON
...
...
@@ -678,7 +673,6 @@ int decrypt_cca(
TxBuffer
[
0
]
=
0x0000000000009200
;
//memcpy(TxBuffer+1, h, 443*2);
for
(
tx_rx_c
=
1
;
tx_rx_c
<
495
;
tx_rx_c
++
)
{
// initialize RxBuffer with 0's
TxBuffer
[
tx_rx_c
]
=
complement
&
r_pos
[
tx_rx_c
-
1
];
}
...
...
@@ -700,7 +694,7 @@ int decrypt_cca(
#endif
for
(
tx_rx_c
=
0
;
tx_rx_c
<
743
;
tx_rx_c
++
)
{
t_rec
[
tx_rx_c
]
=
RxBuffer
[
tx_rx_c
+
1
];
t_rec
[
742
-
tx_rx_c
]
=
RxBuffer
[
tx_rx_c
+
1
];
}
}
else
{
#if ROTATION_ON
...
...
@@ -716,7 +710,6 @@ int decrypt_cca(
#if POLY_MUL_EXE
XTmrCtr_Stop
(
&
TMRInst
,
0
);
// Read Timer value
execution_time
=
XTmrCtr_GetValue
(
&
TMRInst
,
0
);
xil_printf
(
"
\r\n
Decrypt Mult Execution Time (DEC2) = %d
\r\n
"
,
execution_time
);
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment