mirror of
https://github.com/libretro/dolphin
synced 2024-12-22 13:16:32 +00:00
b9dd94b9b2
The loops relied on unsigned integer overflow, which is not immediately obvious. Replace them with less clever variants that are clearer. Also implement bn_compare using std::memcmp.
17 lines
558 B
C
17 lines
558 B
C
// Copyright 2014 Dolphin Emulator Project
|
|
// Licensed under GPLv2+
|
|
// Refer to the license.txt file included.
|
|
|
|
#pragma once
|
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
// bignum arithmetic
|
|
|
|
int bn_compare(const u8* a, const u8* b, int n);
|
|
void bn_sub_modulus(u8* a, const u8* N, int n);
|
|
void bn_add(u8* d, const u8* a, const u8* b, const u8* N, int n);
|
|
void bn_mul(u8* d, const u8* a, const u8* b, const u8* N, int n);
|
|
void bn_inv(u8* d, const u8* a, const u8* N, int n); // only for prime N
|
|
void bn_exp(u8* d, const u8* a, const u8* N, int n, const u8* e, int en);
|