pike.git
/
src
/
post_modules
/
Nettle
/
hogweed.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/post_modules/Nettle/hogweed.cmod:546:
/*! @decl int size() *! *! @returns *! Returns the size in bits for a single coordinate on the curve. */ PIKEFUN int size() { #ifdef HAVE_NETTLE_ECC_BIT_SIZE push_int(ecc_bit_size(THIS->curve)); #else
+
do {
+
#ifdef HAVE_CURVE_NETTLE_SECP_192R1
if (THIS->curve == &nettle_secp_192r1) { push_int(192);
-
}
else
if (THIS->curve == &nettle_secp_224r1) {
+
break;
+
}
+
#endif
/*
HAVE_CURVE_NETTLE_SECP_192R1 */
+
#ifdef HAVE_CURVE_NETTLE_SECP_224R1
+
if (THIS->curve == &nettle_secp_224r1) {
push_int(224);
-
}
else
if (THIS->curve == &nettle_secp_256r1) {
+
break;
+
}
+
#endif
/*
HAVE_CURVE_NETTLE_SECP_224R1 */
+
#ifdef HAVE_CURVE_NETTLE_SECP_256R1
+
if (THIS->curve == &nettle_secp_256r1) {
push_int(256);
-
}
else
if (THIS->curve == &nettle_secp_384r1) {
+
break;
+
}
+
#endif
/*
HAVE_CURVE_NETTLE_SECP_256R1 */
+
#ifdef HAVE_CURVE_NETTLE_SECP_384R1
+
if (THIS->curve == &nettle_secp_384r1) {
push_int(384);
-
}
else
if (THIS->curve == &nettle_secp_521r1) {
+
break;
+
}
+
#endif
/*
HAVE_CURVE_NETTLE_SECP_384R1 */
+
#ifdef HAVE_CURVE_NETTLE_SECP_521R1
+
if (THIS->curve == &nettle_secp_521r1) {
push_int(521);
-
}
else
{
+
break;
+
}
+
#endif
/*
HAVE_CURVE_NETTLE_SECP_521R1 */
push_int(0);
-
+
} while(0);
+
#endif /* HAVE_NETTLE_ECC_BIT_SIZE */
}
-
#endif
-
}
+
/*! @decl Gmp.mpz new_scalar(function(int(0..):string(8bit)) rnd) *! *! @param rnd *! Randomness function to use as source. *! *! @returns *! Returns a random scalar suitable to use as an @[ECDSA] private key *! or as an ECDH secret factor. */