Re-implementation based on OSSL4R