30
30
static uintptr_t ngx_http_lua_ngx_escape_sql_str (u_char * dst , u_char * src ,
31
31
size_t size );
32
32
static int ngx_http_lua_ngx_quote_sql_str (lua_State * L );
33
- static int ngx_http_lua_ngx_crc32_short (lua_State * L );
34
- static int ngx_http_lua_ngx_crc32_long (lua_State * L );
35
33
static int ngx_http_lua_ngx_encode_args (lua_State * L );
36
34
static int ngx_http_lua_ngx_decode_args (lua_State * L );
37
35
#if (NGX_OPENSSL )
@@ -51,12 +49,6 @@ ngx_http_lua_inject_string_api(lua_State *L)
51
49
lua_pushcfunction (L , ngx_http_lua_ngx_quote_sql_str );
52
50
lua_setfield (L , -2 , "quote_sql_str" );
53
51
54
- lua_pushcfunction (L , ngx_http_lua_ngx_crc32_short );
55
- lua_setfield (L , -2 , "crc32_short" );
56
-
57
- lua_pushcfunction (L , ngx_http_lua_ngx_crc32_long );
58
- lua_setfield (L , -2 , "crc32_long" );
59
-
60
52
#if (NGX_OPENSSL )
61
53
lua_pushcfunction (L , ngx_http_lua_ngx_hmac_sha1 );
62
54
lua_setfield (L , -2 , "hmac_sha1" );
@@ -256,42 +248,6 @@ ngx_http_lua_encode_base64(ngx_str_t *dst, ngx_str_t *src, int no_padding)
256
248
}
257
249
258
250
259
- static int
260
- ngx_http_lua_ngx_crc32_short (lua_State * L )
261
- {
262
- u_char * p ;
263
- size_t len ;
264
-
265
- if (lua_gettop (L ) != 1 ) {
266
- return luaL_error (L , "expecting one argument, but got %d" ,
267
- lua_gettop (L ));
268
- }
269
-
270
- p = (u_char * ) luaL_checklstring (L , 1 , & len );
271
-
272
- lua_pushnumber (L , (lua_Number ) ngx_crc32_short (p , len ));
273
- return 1 ;
274
- }
275
-
276
-
277
- static int
278
- ngx_http_lua_ngx_crc32_long (lua_State * L )
279
- {
280
- u_char * p ;
281
- size_t len ;
282
-
283
- if (lua_gettop (L ) != 1 ) {
284
- return luaL_error (L , "expecting one argument, but got %d" ,
285
- lua_gettop (L ));
286
- }
287
-
288
- p = (u_char * ) luaL_checklstring (L , 1 , & len );
289
-
290
- lua_pushnumber (L , (lua_Number ) ngx_crc32_long (p , len ));
291
- return 1 ;
292
- }
293
-
294
-
295
251
static int
296
252
ngx_http_lua_ngx_encode_args (lua_State * L )
297
253
{
@@ -414,6 +370,20 @@ ngx_http_lua_ffi_sha1_bin(const u_char *src, size_t len, u_char *dst)
414
370
}
415
371
416
372
373
+ unsigned int
374
+ ngx_http_lua_ffi_crc32_short (const u_char * src , size_t len )
375
+ {
376
+ return ngx_crc32_short ((u_char * ) src , len );
377
+ }
378
+
379
+
380
+ unsigned int
381
+ ngx_http_lua_ffi_crc32_long (const u_char * src , size_t len )
382
+ {
383
+ return ngx_crc32_long ((u_char * ) src , len );
384
+ }
385
+
386
+
417
387
size_t
418
388
ngx_http_lua_ffi_encode_base64 (const u_char * src , size_t slen , u_char * dst ,
419
389
int no_padding )
0 commit comments