Hi Max,
The changes look fine. I did notice in the files that there is a header
block comment that has a last modified date from the original code.
Should those be updated to 2018?
--Jamil
On 11/23/2018 6:31 AM, Weijun Wang wrote:
I was curious in some SunEC internals and turned EC_DEBUG on, and
found out the library cannot be built. It looks like back when we
switched to warnings-as-errors some codes are not updated. Here is the
patch:
*diff --git a/src/jdk.crypto.ec/share/native/libsunec/impl/ec.c
b/src/jdk.crypto.ec/share/native/libsunec/impl/ec.c*
*--- a/src/jdk.crypto.ec/share/native/libsunec/impl/ec.c*
*+++ b/src/jdk.crypto.ec/share/native/libsunec/impl/ec.c*
@@ -109,16 +109,16 @@
printf("\n");
if (k1 != NULL) {
- mp_tohex(k1, mpstr);
+ mp_tohex((mp_int*)k1, mpstr);
printf("ec_points_mul: scalar k1: %s\n", mpstr);
- mp_todecimal(k1, mpstr);
+ mp_todecimal((mp_int*)k1, mpstr);
printf("ec_points_mul: scalar k1: %s (dec)\n", mpstr);
}
if (k2 != NULL) {
- mp_tohex(k2, mpstr);
+ mp_tohex((mp_int*)k2, mpstr);
printf("ec_points_mul: scalar k2: %s\n", mpstr);
- mp_todecimal(k2, mpstr);
+ mp_todecimal((mp_int*)k2, mpstr);
printf("ec_points_mul: scalar k2: %s (dec)\n", mpstr);
}
*diff --git a/src/jdk.crypto.ec/share/native/libsunec/impl/ecdecode.c
b/src/jdk.crypto.ec/share/native/libsunec/impl/ecdecode.c*
*--- a/src/jdk.crypto.ec/share/native/libsunec/impl/ecdecode.c*
*+++ b/src/jdk.crypto.ec/share/native/libsunec/impl/ecdecode.c*
@@ -55,6 +55,9 @@
#include "ecl-curve.h"
#include "ecc_impl.h"
+#if EC_DEBUG
+#include <stdio.h>
+#endif
#define MAX_ECKEY_LEN 72
#define SEC_ASN1_OBJECT_ID 0x06
In the first file, k1 and k2 are defined as const mp_int * but
mp_tohex accepts a mp_int* as its 1st argument.
In the second file, there is a printf call in a EC_DEBUG block.
Noreg-cleanup.
Thanks
Max