99 getCurves : _getCurves ,
1010 getHashes : _getHashes ,
1111 setEngine : _setEngine ,
12- timingSafeEqual : _timingSafeEqual
1312} = internalBinding ( 'crypto' ) ;
1413
1514const {
@@ -20,7 +19,6 @@ const {
2019 hideStackFrames,
2120 codes : {
2221 ERR_CRYPTO_ENGINE_UNKNOWN ,
23- ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH ,
2422 ERR_INVALID_ARG_TYPE ,
2523 }
2624} = require ( 'internal/errors' ) ;
@@ -76,21 +74,6 @@ function setEngine(id, flags) {
7674 throw new ERR_CRYPTO_ENGINE_UNKNOWN ( id ) ;
7775}
7876
79- function timingSafeEqual ( buf1 , buf2 ) {
80- if ( ! isArrayBufferView ( buf1 ) ) {
81- throw new ERR_INVALID_ARG_TYPE ( 'buf1' ,
82- [ 'Buffer' , 'TypedArray' , 'DataView' ] , buf1 ) ;
83- }
84- if ( ! isArrayBufferView ( buf2 ) ) {
85- throw new ERR_INVALID_ARG_TYPE ( 'buf2' ,
86- [ 'Buffer' , 'TypedArray' , 'DataView' ] , buf2 ) ;
87- }
88- if ( buf1 . byteLength !== buf2 . byteLength ) {
89- throw new ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH ( ) ;
90- }
91- return _timingSafeEqual ( buf1 , buf2 ) ;
92- }
93-
9477const getArrayBufferView = hideStackFrames ( ( buffer , name , encoding ) => {
9578 if ( typeof buffer === 'string' ) {
9679 if ( encoding === 'buffer' )
@@ -116,6 +99,5 @@ module.exports = {
11699 kHandle,
117100 setDefaultEncoding,
118101 setEngine,
119- timingSafeEqual,
120102 toBuf
121103} ;
0 commit comments