10957b409SSimon J. Gerraty /*
20957b409SSimon J. Gerraty * Copyright (c) 2018 Thomas Pornin <pornin@bolet.org>
30957b409SSimon J. Gerraty *
40957b409SSimon J. Gerraty * Permission is hereby granted, free of charge, to any person obtaining
50957b409SSimon J. Gerraty * a copy of this software and associated documentation files (the
60957b409SSimon J. Gerraty * "Software"), to deal in the Software without restriction, including
70957b409SSimon J. Gerraty * without limitation the rights to use, copy, modify, merge, publish,
80957b409SSimon J. Gerraty * distribute, sublicense, and/or sell copies of the Software, and to
90957b409SSimon J. Gerraty * permit persons to whom the Software is furnished to do so, subject to
100957b409SSimon J. Gerraty * the following conditions:
110957b409SSimon J. Gerraty *
120957b409SSimon J. Gerraty * The above copyright notice and this permission notice shall be
130957b409SSimon J. Gerraty * included in all copies or substantial portions of the Software.
140957b409SSimon J. Gerraty *
150957b409SSimon J. Gerraty * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
160957b409SSimon J. Gerraty * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
170957b409SSimon J. Gerraty * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
180957b409SSimon J. Gerraty * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
190957b409SSimon J. Gerraty * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
200957b409SSimon J. Gerraty * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
210957b409SSimon J. Gerraty * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
220957b409SSimon J. Gerraty * SOFTWARE.
230957b409SSimon J. Gerraty */
240957b409SSimon J. Gerraty
250957b409SSimon J. Gerraty #include "inner.h"
260957b409SSimon J. Gerraty
270957b409SSimon J. Gerraty #if BR_INT128 || BR_UMUL128
280957b409SSimon J. Gerraty
290957b409SSimon J. Gerraty /* see bearssl_rsa.h */
300957b409SSimon J. Gerraty uint32_t
br_rsa_i62_keygen(const br_prng_class ** rng,br_rsa_private_key * sk,void * kbuf_priv,br_rsa_public_key * pk,void * kbuf_pub,unsigned size,uint32_t pubexp)310957b409SSimon J. Gerraty br_rsa_i62_keygen(const br_prng_class **rng,
320957b409SSimon J. Gerraty br_rsa_private_key *sk, void *kbuf_priv,
330957b409SSimon J. Gerraty br_rsa_public_key *pk, void *kbuf_pub,
340957b409SSimon J. Gerraty unsigned size, uint32_t pubexp)
350957b409SSimon J. Gerraty {
360957b409SSimon J. Gerraty return br_rsa_i31_keygen_inner(rng,
370957b409SSimon J. Gerraty sk, kbuf_priv, pk, kbuf_pub, size, pubexp,
380957b409SSimon J. Gerraty &br_i62_modpow_opt_as_i31);
390957b409SSimon J. Gerraty }
400957b409SSimon J. Gerraty
410957b409SSimon J. Gerraty /* see bearssl_rsa.h */
420957b409SSimon J. Gerraty br_rsa_keygen
br_rsa_i62_keygen_get(void)43*9c474dc5SSimon J. Gerraty br_rsa_i62_keygen_get(void)
440957b409SSimon J. Gerraty {
450957b409SSimon J. Gerraty return &br_rsa_i62_keygen;
460957b409SSimon J. Gerraty }
470957b409SSimon J. Gerraty
480957b409SSimon J. Gerraty #else
490957b409SSimon J. Gerraty
500957b409SSimon J. Gerraty /* see bearssl_rsa.h */
510957b409SSimon J. Gerraty br_rsa_keygen
br_rsa_i62_keygen_get(void)52*9c474dc5SSimon J. Gerraty br_rsa_i62_keygen_get(void)
530957b409SSimon J. Gerraty {
540957b409SSimon J. Gerraty return 0;
550957b409SSimon J. Gerraty }
560957b409SSimon J. Gerraty
570957b409SSimon J. Gerraty #endif
58