1e1051a39Sopenharmony_ci/*
2e1051a39Sopenharmony_ci * Copyright 2009-2021 The OpenSSL Project Authors. All Rights Reserved.
3e1051a39Sopenharmony_ci *
4e1051a39Sopenharmony_ci * Licensed under the Apache License 2.0 (the "License").  You may not use
5e1051a39Sopenharmony_ci * this file except in compliance with the License.  You can obtain a copy
6e1051a39Sopenharmony_ci * in the file LICENSE in the source distribution or at
7e1051a39Sopenharmony_ci * https://www.openssl.org/source/license.html
8e1051a39Sopenharmony_ci */
9e1051a39Sopenharmony_ci
10e1051a39Sopenharmony_ci#include "internal/cryptlib.h"
11e1051a39Sopenharmony_ci#include "crypto/ppc_arch.h"
12e1051a39Sopenharmony_ci#include "ec_local.h"
13e1051a39Sopenharmony_ci
14e1051a39Sopenharmony_civoid ecp_nistz256_mul_mont(unsigned long res[4], const unsigned long a[4],
15e1051a39Sopenharmony_ci                           const unsigned long b[4]);
16e1051a39Sopenharmony_ci
17e1051a39Sopenharmony_civoid ecp_nistz256_to_mont(unsigned long res[4], const unsigned long in[4]);
18e1051a39Sopenharmony_civoid ecp_nistz256_to_mont(unsigned long res[4], const unsigned long in[4])
19e1051a39Sopenharmony_ci{
20e1051a39Sopenharmony_ci    static const unsigned long RR[] = { 0x0000000000000003U,
21e1051a39Sopenharmony_ci                                        0xfffffffbffffffffU,
22e1051a39Sopenharmony_ci                                        0xfffffffffffffffeU,
23e1051a39Sopenharmony_ci                                        0x00000004fffffffdU };
24e1051a39Sopenharmony_ci
25e1051a39Sopenharmony_ci    ecp_nistz256_mul_mont(res, in, RR);
26e1051a39Sopenharmony_ci}
27e1051a39Sopenharmony_ci
28e1051a39Sopenharmony_civoid ecp_nistz256_from_mont(unsigned long res[4], const unsigned long in[4]);
29e1051a39Sopenharmony_civoid ecp_nistz256_from_mont(unsigned long res[4], const unsigned long in[4])
30e1051a39Sopenharmony_ci{
31e1051a39Sopenharmony_ci    static const unsigned long one[] = { 1, 0, 0, 0 };
32e1051a39Sopenharmony_ci
33e1051a39Sopenharmony_ci    ecp_nistz256_mul_mont(res, in, one);
34e1051a39Sopenharmony_ci}
35