1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 # This code is taken from CRYPTOGAMs[1] and is included here using the option
4 # in the license to distribute the code under the GPL. Therefore this program
5 # is free software; you can redistribute it and/or modify it under the terms of
6 # the GNU General Public License version 2 as published by the Free Software
9 # [1] https://github.com/dot-asm/cryptogams/
11 # Copyright (c) 2006-2017, CRYPTOGAMS by <appro@openssl.org>
12 # All rights reserved.
14 # Redistribution and use in source and binary forms, with or without
15 # modification, are permitted provided that the following conditions
18 # * Redistributions of source code must retain copyright notices,
19 # this list of conditions and the following disclaimer.
21 # * Redistributions in binary form must reproduce the above
22 # copyright notice, this list of conditions and the following
23 # disclaimer in the documentation and/or other materials
24 # provided with the distribution.
26 # * Neither the name of the CRYPTOGAMS nor the names of its
27 # copyright holder and contributors may be used to endorse or
28 # promote products derived from this software without specific
29 # prior written permission.
31 # ALTERNATIVELY, provided that this notice is retained in full, this
32 # product may be distributed under the terms of the GNU General Public
33 # License (GPL), in which case the provisions of the GPL apply INSTEAD OF
36 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS
37 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
38 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
39 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
40 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
43 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
44 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
45 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
46 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48 # ====================================================================
49 # Written by Andy Polyakov <appro@openssl.org> for the OpenSSL
50 # project. The module is, however, dual licensed under OpenSSL and
51 # CRYPTOGAMS licenses depending on where you obtain it. For further
52 # details see https://www.openssl.org/~appro/cryptogams/.
53 # ====================================================================
56 # ====================================================================
57 # Written and Modified by Danny Tsen <dtsen@us.ibm.com>
58 # - Added x25519_fe51_sqr_times, x25519_fe51_frombytes, x25519_fe51_tobytes
61 # Copyright 2024- IBM Corp.
63 # X25519 lower-level primitives for PPC64.
66 #include <linux/linkage.h>
71 SYM_FUNC_START(x25519_fe51_mul)
271 SYM_FUNC_END(x25519_fe51_mul)
274 SYM_FUNC_START(x25519_fe51_sqr)
357 SYM_FUNC_END(x25519_fe51_sqr)
360 SYM_FUNC_START(x25519_fe51_mul121666)
395 SYM_FUNC_END(x25519_fe51_mul121666)
398 SYM_FUNC_START(x25519_fe51_sqr_times)
523 bdnz .Lsqr_times_loop
544 SYM_FUNC_END(x25519_fe51_sqr_times)
547 SYM_FUNC_START(x25519_fe51_frombytes)
550 srdi 12, 12, 13 # 0x7ffffffffffff
584 SYM_FUNC_END(x25519_fe51_frombytes)
587 SYM_FUNC_START(x25519_fe51_tobytes)
596 srdi 12, 12, 13 # 0x7ffffffffffff
648 SYM_FUNC_END(x25519_fe51_tobytes)
651 SYM_FUNC_START(x25519_cswap)
671 SYM_FUNC_END(x25519_cswap)