@@ -256,6 +256,7 @@ int wp_ecc_up_ref(wp_Ecc* ecc)
256256 return ok ;
257257#else
258258 ecc -> refCnt ++ ;
259+ WOLFPROV_LEAVE (WP_LOG_PK , __FILE__ ":" WOLFPROV_STRINGIZE (__LINE__ ), 1 );
259260 return 1 ;
260261#endif
261262}
@@ -800,6 +801,14 @@ static int wp_ecc_get_params(wp_Ecc* ecc, OSSL_PARAM params[])
800801 }
801802 }
802803
804+ if (ok ) {
805+ /* Always assume not decoded from explicit params for now */
806+ p = OSSL_PARAM_locate (params , OSSL_PKEY_PARAM_EC_DECODED_FROM_EXPLICIT_PARAMS );
807+ if ((p != NULL ) && !OSSL_PARAM_set_int (p , 0 )) {
808+ ok = 0 ;
809+ }
810+ }
811+
803812 WOLFPROV_LEAVE (WP_LOG_PK , __FILE__ ":" WOLFPROV_STRINGIZE (__LINE__ ), ok );
804813 return ok ;
805814}
@@ -1869,11 +1878,13 @@ static int wp_ecc_decode_params(wp_Ecc* ecc, unsigned char* data, word32 len)
18691878 ok = 0 ;
18701879 }
18711880 if (ok && (data [0 ] != 0x06 )) {
1881+ WOLFPROV_MSG (WP_LOG_PK , "Invalid data" );
18721882 ok = 0 ;
18731883 }
18741884 if (ok ) {
18751885 oidLen = data [1 ];
18761886 if ((oidLen >= 0x80 ) || (oidLen + 2 > len )) {
1887+ WOLFPROV_MSG (WP_LOG_PK , "OID out of bounds" );
18771888 ok = 0 ;
18781889 }
18791890 }
@@ -1884,17 +1895,20 @@ static int wp_ecc_decode_params(wp_Ecc* ecc, unsigned char* data, word32 len)
18841895 ecc -> curveId = wp_ecc_get_curve_id_from_oid (data + 2 , oidLen );
18851896 #endif
18861897 if (ecc -> curveId == ECC_CURVE_INVALID ) {
1898+ WOLFPROV_MSG (WP_LOG_PK , "Invalid curve" );
18871899 ok = 0 ;
18881900 }
18891901 }
18901902
18911903 if (ok ) {
18921904 rc = wc_ecc_set_curve (& ecc -> key , 0 , ecc -> curveId );
18931905 if (rc != 0 ) {
1906+ WOLFPROV_MSG (WP_LOG_PK , "Can't set curve: %d" ,rc );
18941907 ok = 0 ;
18951908 }
18961909 }
18971910 if (ok && (!wp_ecc_set_bits (ecc ))) {
1911+ WOLFPROV_MSG (WP_LOG_PK , "Can't set bits" );
18981912 ok = 0 ;
18991913 }
19001914
@@ -2108,6 +2122,7 @@ static int wp_ecc_encode_params_size(const wp_Ecc *ecc, size_t* keyLen)
21082122 /* ASN.1 type, len and data. */
21092123 * keyLen = ecc -> key .dp -> oidSz + 2 ;
21102124
2125+ WOLFPROV_LEAVE (WP_LOG_PK , __FILE__ ":" WOLFPROV_STRINGIZE (__LINE__ ), 1 );
21112126 return 1 ;
21122127}
21132128
@@ -2130,6 +2145,7 @@ static int wp_ecc_encode_params(const wp_Ecc *ecc, unsigned char* keyData,
21302145
21312146 * keyLen = ecc -> key .dp -> oidSz + 2 ;
21322147
2148+ WOLFPROV_LEAVE (WP_LOG_PK , __FILE__ ":" WOLFPROV_STRINGIZE (__LINE__ ), 1 );
21332149 return 1 ;
21342150}
21352151
0 commit comments