summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-03-25 19:44:26 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-03-25 19:44:26 +0200
commitf1d5eb1da9900ab1435d8bd2f4fdb2353717809b (patch)
treea7019d7f6abbb6d0bf028e1a983ef06d56575278
parent89d237f36b932dcacda031921bb961c24c3aa596 (diff)
downloadlibuecc-f1d5eb1da9900ab1435d8bd2f4fdb2353717809b.tar
libuecc-f1d5eb1da9900ab1435d8bd2f4fdb2353717809b.zip
Add ecc_25519_secret_sanitize stub implementation
-rw-r--r--include/libuecc/ecc.h1
-rw-r--r--src/ec25519_secret.c9
2 files changed, 10 insertions, 0 deletions
diff --git a/include/libuecc/ecc.h b/include/libuecc/ecc.h
index e2fc545..cf584cf 100644
--- a/include/libuecc/ecc.h
+++ b/include/libuecc/ecc.h
@@ -57,5 +57,6 @@ void ecc_25519_secret_add(ecc_secret_key_256 *out, const ecc_secret_key_256 *in1
void ecc_25519_secret_sub(ecc_secret_key_256 *out, const ecc_secret_key_256 *in1, const ecc_secret_key_256 *in2);
void ecc_25519_secret_reduce(ecc_secret_key_256 *out, const ecc_secret_key_256 *in);
void ecc_25519_secret_mult(ecc_secret_key_256 *out, const ecc_secret_key_256 *in1, const ecc_secret_key_256 *in2);
+void ecc_25519_secret_sanitize(ecc_secret_key_256 *out, const ecc_secret_key_256 *in);
#endif /* _LIBUECC_ECC_H_ */
diff --git a/src/ec25519_secret.c b/src/ec25519_secret.c
index 5819a6c..9108613 100644
--- a/src/ec25519_secret.c
+++ b/src/ec25519_secret.c
@@ -176,3 +176,12 @@ void ecc_25519_secret_mult(ecc_secret_key_256 *out, const ecc_secret_key_256 *in
montgomery(out->s, R, C);
}
+/* TODO implement properly, rule out zero etc. */
+void ecc_25519_secret_sanitize(ecc_secret_key_256 *out, const ecc_secret_key_256 *in) {
+ int i;
+
+ for (i = 0; i < 32; i++)
+ out->s[i] = in->s[i];
+
+ out->s[31] |= 0x80;
+}