Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/majn/tgl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx>2015-09-29 19:24:42 +0300
committerBen Wiederhake <BenWiederhake.GitHub@gmx>2015-10-01 21:59:54 +0300
commit1faa1591ac735960b0e06824cb4b16fb5f53e46d (patch)
treed7806b354e9c0a93b6e135af5243d0f91dcf822d
parent9e2cd6bd9099a2b49729ba8f3c69c51ef739ea96 (diff)
Simplify BN interface.
-rw-r--r--crypto/bn.h2
-rw-r--r--crypto/bn_openssl.c7
2 files changed, 6 insertions, 3 deletions
diff --git a/crypto/bn.h b/crypto/bn.h
index 066b971..d375371 100644
--- a/crypto/bn.h
+++ b/crypto/bn.h
@@ -37,7 +37,7 @@ TGLC_bn * TGLC_bn_bin2bn(const unsigned char *s, int len, TGLC_bn *ret);
int TGLC_bn_set_word (TGLC_bn *a, unsigned long w);
unsigned long TGLC_bn_get_word (const TGLC_bn *a);
int TGLC_bn_num_bits (const TGLC_bn *a);
-int TGLC_bn_sub (TGLC_bn *r, const TGLC_bn *a, const TGLC_bn *b);
+void TGLC_bn_sub (TGLC_bn *r, const TGLC_bn *a, const TGLC_bn *b);
int TGLC_bn_div (TGLC_bn *dv, TGLC_bn *rem, const TGLC_bn *a, const TGLC_bn *d, TGLC_bn_ctx *ctx);
int TGLC_bn_mod_exp (TGLC_bn *r, const TGLC_bn *a, const TGLC_bn *p, const TGLC_bn *m, TGLC_bn_ctx *ctx);
diff --git a/crypto/bn_openssl.c b/crypto/bn_openssl.c
index ae61ce0..a475fd9 100644
--- a/crypto/bn_openssl.c
+++ b/crypto/bn_openssl.c
@@ -22,6 +22,8 @@
#ifndef TGL_AVOID_OPENSSL_BN
+#include <assert.h>
+
#include <openssl/bn.h>
#include "bn.h"
@@ -78,8 +80,9 @@ int TGLC_bn_num_bits (const TGLC_bn *a) {
return BN_num_bits (unwrap_bn (a));
}
-int TGLC_bn_sub (TGLC_bn *r, const TGLC_bn *a, const TGLC_bn *b) {
- return BN_sub (unwrap_bn (r), unwrap_bn (a), unwrap_bn (b));
+void TGLC_bn_sub (TGLC_bn *r, const TGLC_bn *a, const TGLC_bn *b) {
+ int res = BN_sub (unwrap_bn (r), unwrap_bn (a), unwrap_bn (b));
+ assert (res);
}
int TGLC_bn_div (TGLC_bn *dv, TGLC_bn *rem, const TGLC_bn *a, const TGLC_bn *d, TGLC_bn_ctx *ctx) {