Abstract
The growing diffusion of heterogeneous Cyber-Physical Systems (CPSs) poses a problem of security. The employment of cryptographic strategies and techniques is a fundamental part in the attempt of finding a solution to it. Cryptographic algorithms, however, need to increase their security level due to the growing computational power in the hands of potential attackers. To avoid a consequent performance worsening and keep CPSs functioning and secure, these cryptographic techniques must be implemented so to exploit the aggregate computational power that modern parallel architectures provide. In this chapter we investigate the possibility to parallelize two very common basic operations in cryptography: modular exponentiation and Karatsuba multiplication. For the former, we propose two different techniques (m-ary and exponent slicing) that reduce calculation time of 30/40%. For the latter, we show various implementations of a three-thread parallelization scheme that provides up to 60% better performance with respect to a sequential implementation.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
Simultaneous multi-threading.
- 2.
M0 = 1 for every non-zero M, and M1 = M.
References
G.R. Blakley, A computer algorithm for the product AB modulo M. IEEE Trans. Comput. 32(5), 497–500 (1983)
B. Dally, Efficiency and parallelism: the challenges of future computing. Tech. rep., Nvidia Research, Stanford University, 2014
Q.D. Elaine Barker, Recommendation for key management, part 3: application-specific key management guidance. Tech. rep., National Institute of Standards and Technology (NIST), 2015
J.L. Hennessy, D.A. Patterson, Computer Architecture, Fifth Edition: A Quantitative Approach, 5th edn. (Morgan Kaufmann Publishers Inc., San Francisco, 2011)
ISO, ISO/IEC 14882:2011 – Information technology – Programming languages – C++ (Standard, International Organization for Standardization, Geneva, 2011)
J. Kelsey, B. Schneier, D. Wagner, C. Hall, Side channel cryptanalysis of product ciphers, in Proceedings of the 5th European Symposium on Research in Computer Security, ESORICS ’98 (Springer, London, 1998), pp 97–110. http://dl.acm.org/citation.cfm?id=646647.699203
D.E. Knuth, The Art of Computer Programming: Seminumerical Algorithms, vol. 2, 3rd edn. (Addison-Wesley Longman Publishing Co., Inc., Boston, 1997)
Ç.K. Koç, High-speed RSA implementation. Tech. rep., RSA Laboratories, 1994
P.C. Kocher, Timing attacks on implementations of Diffie-Hellman, RSA, DSS, and other systems, in Proceedings of the 16th Annual International Cryptology Conference on Advances in Cryptology, CRYPTO ’96 (Springer, London, 1996), pp. 104–113. http://dl.acm.org/citation.cfm?id=646761.706156
P. Lara, F. Borges, R. Portugal, N. Nedjah, Parallel modular exponentiation using load balancing without precomputation. J. Comput. Syst. Sci. 78(2), 575–582 (2012)
G. Loukas, Cyber-Physical Attacks: A Growing Invisible Threat, 1st edn. (Butterworth-Heinemann, Newton, 2015)
M.M. Michael, M.L. Scott, Simple, fast, and practical non-blocking and blocking concurrent queue algorithms, in Proceedings of the Fifteenth Annual ACM Symposium on Principles of Distributed Computing, PODC ’96 (ACM, New York, 1996), pp. 267–275
P.L. Montgomery, Modular multiplication without trial division. Math. Comput. 44(170), 519–521 (1985)
D. Page, Theoretical use of cache memory as a cryptanalytic side-channel, 2002
R.L. Rivest, A. Shamir, L. Adleman, A method for obtaining digital signatures and public-key cryptosystems. Commun. ACM 21(2), 120–126 (1978)
H. Sutter, The free lunch is over: a fundamental turn toward concurrency in software. Dr Dobb’s J. 30(3), 202–210 (2005)
G. Torbjörn, GNU MP - the GNU multiple precision arithmetic library (2016). https://gmplib.org/gmp-man-6.1.2.pdf. Accessed 28 Feb 2018
D.M. Tullsen, S.J. Eggers, H.M. Levy, Simultaneous multithreading: maximizing on-chip parallelism, in Proceedings of the 22nd Annual International Symposium on Computer Architecture, ISCA ’95 (ACM, New York, 1995), pp. 392–403
M. Wolf, D. Serpanos, Safety and security in cyber-physical systems and internet-of-things systems. Proc. IEEE 106(1), 9–20 (2018)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Appendix: Sequential and Basic Parallel Code for Karatsuba
Appendix: Sequential and Basic Parallel Code for Karatsuba
In the following we show the base sequential Karatsuba code (Kara_seq) and the parallel version based on C++11 std::async asynchronous thread invocation that we used in our experiments. The purpose is to highlight the changes that need to be done for enabling a multi-threaded computation.
In Fig. 11 we show the base code that implements a Karatsuba step on the multi-precision numbers and then delegates the multiplication of the k∕2 split numbers to the native GMP multiplication algorithm, here accessed through overloaded * operator. The two operands are split, and the three multiplications are performed in sequence by the same main thread, which eventually calculates the final result from the three partial ones. splitBigNum_limb procedure, not shown, splits a multi-precision number into its most and least significant parts using the limb, i.e., processor word, granularity.
Then, Fig. 12 shows the version (Kara_thrAs) in which two additional threads are spawned through the std::async C++ construct to calculate the first two multiplication concurrently and, in parallel with the third one, computed in the main thread. Then the main thread retrieves the partial results calculated by the helper ones or blocks until they are ready (e.g., retLL.get( ) call).
Threads are spawned in the points indicated by the green arrows and are joined to the main execution in the points indicated by the red arrows.
Kara_thr version is very similar to the Kara_thrAs with only two differences. Firstly, std::thread is used in place of std::async, and the retrieval of partial results requires to preliminarily join the threads via thread::join( ) method, i.e., possibly waiting for their completion.
The other more advanced versions, kara_infThr and kara_infThrLF, are not shown as the detailed analysis of their code would require too many advanced concepts of parallel programming for the scope of this chapter. However, their main features and operational principles are summarized without approximations in the overall discussion of Sect. 2.3.
Rights and permissions
Copyright information
© 2018 Springer Nature Switzerland AG
About this chapter
Cite this chapter
Bartolini, S., Peccerillo, B. (2018). Parallel Programming in Cyber-Physical Systems. In: Koç, Ç.K. (eds) Cyber-Physical Systems Security. Springer, Cham. https://doi.org/10.1007/978-3-319-98935-8_6
Download citation
DOI: https://doi.org/10.1007/978-3-319-98935-8_6
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-98934-1
Online ISBN: 978-3-319-98935-8
eBook Packages: Computer ScienceComputer Science (R0)