Skip to main content

Parallel Programming in Cyber-Physical Systems

  • Chapter
Cyber-Physical Systems Security

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 129.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Hardcover Book
USD 169.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    Simultaneous multi-threading.

  2. 2.

    M0 = 1 for every non-zero M, and M1 = M.

References

  1. G.R. Blakley, A computer algorithm for the product AB modulo M. IEEE Trans. Comput. 32(5), 497–500 (1983)

    Article  Google Scholar 

  2. B. Dally, Efficiency and parallelism: the challenges of future computing. Tech. rep., Nvidia Research, Stanford University, 2014

    Google Scholar 

  3. 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

    Google Scholar 

  4. J.L. Hennessy, D.A. Patterson, Computer Architecture, Fifth Edition: A Quantitative Approach, 5th edn. (Morgan Kaufmann Publishers Inc., San Francisco, 2011)

    Google Scholar 

  5. ISO, ISO/IEC 14882:2011 – Information technology – Programming languages – C++ (Standard, International Organization for Standardization, Geneva, 2011)

    Google Scholar 

  6. 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

    Google Scholar 

  7. D.E. Knuth, The Art of Computer Programming: Seminumerical Algorithms, vol. 2, 3rd edn. (Addison-Wesley Longman Publishing Co., Inc., Boston, 1997)

    Google Scholar 

  8. Ç.K. Koç, High-speed RSA implementation. Tech. rep., RSA Laboratories, 1994

    Google Scholar 

  9. 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

    MATH  Google Scholar 

  10. 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)

    Article  MathSciNet  Google Scholar 

  11. G. Loukas, Cyber-Physical Attacks: A Growing Invisible Threat, 1st edn. (Butterworth-Heinemann, Newton, 2015)

    Google Scholar 

  12. 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

    Google Scholar 

  13. P.L. Montgomery, Modular multiplication without trial division. Math. Comput. 44(170), 519–521 (1985)

    Article  MathSciNet  Google Scholar 

  14. D. Page, Theoretical use of cache memory as a cryptanalytic side-channel, 2002

    Google Scholar 

  15. R.L. Rivest, A. Shamir, L. Adleman, A method for obtaining digital signatures and public-key cryptosystems. Commun. ACM 21(2), 120–126 (1978)

    Article  MathSciNet  Google Scholar 

  16. H. Sutter, The free lunch is over: a fundamental turn toward concurrency in software. Dr Dobb’s J. 30(3), 202–210 (2005)

    Google Scholar 

  17. 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

  18. 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

    Google Scholar 

  19. M. Wolf, D. Serpanos, Safety and security in cyber-physical systems and internet-of-things systems. Proc. IEEE 106(1), 9–20 (2018)

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Sandro Bartolini .

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.

Fig. 11
figure 11figure 11

Basic sequential code implementing the Karatsuba step used as a reference for the discussed parallelized versions. We use multi-precision numbers from the GMPXX (GMP for C++) library (mpz_class), and the three multiplications on k∕2-bit numbers are performed by the main thread using GMP standard multiplication. The code for splitting the numbers into most and least significant part is omitted

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).

Fig. 12
figure 12figure 12

Parallel code implementing the Karatsuba step through C++ std::async concurrency construct. Each of the three multiplications on k∕2-bit numbers is performed by a different thread: the first two by additional threads, each operating inside the std::async, and the third directly performed in the main thread. The main thread then waits the completion of the other ones (e.g., retLL.get( )) before calculating the final result

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

Reprints 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)

Publish with us

Policies and ethics