@@ -505,64 +505,32 @@ impl SyscallResponse for KeccakResponse {
505505 }
506506}
507507
508- // Sha256ProcessBlock syscall.
508+ // ShaProcessBlock syscall. Used for both SHA-256 and SHA-512 .
509509#[ derive( Debug , Eq , PartialEq ) ]
510- pub struct Sha256ProcessBlockRequest {
510+ pub struct ShaProcessBlockRequest {
511511 pub state_ptr : Relocatable ,
512512 pub input_start : Relocatable ,
513513}
514514
515- impl SyscallRequest for Sha256ProcessBlockRequest {
515+ impl SyscallRequest for ShaProcessBlockRequest {
516516 fn read (
517517 vm : & VirtualMachine ,
518518 ptr : & mut Relocatable ,
519- ) -> SyscallBaseResult < Sha256ProcessBlockRequest > {
519+ ) -> SyscallBaseResult < ShaProcessBlockRequest > {
520520 let state_start = vm. get_relocatable ( * ptr) ?;
521521 * ptr = ( * ptr + 1 ) ?;
522522 let input_start = vm. get_relocatable ( * ptr) ?;
523523 * ptr = ( * ptr + 1 ) ?;
524- Ok ( Sha256ProcessBlockRequest { state_ptr : state_start, input_start } )
524+ Ok ( ShaProcessBlockRequest { state_ptr : state_start, input_start } )
525525 }
526526}
527527
528528#[ derive( Debug , Eq , PartialEq ) ]
529- pub struct Sha256ProcessBlockResponse {
529+ pub struct ShaProcessBlockResponse {
530530 pub state_ptr : Relocatable ,
531531}
532532
533- impl SyscallResponse for Sha256ProcessBlockResponse {
534- fn write ( self , vm : & mut VirtualMachine , ptr : & mut Relocatable ) -> WriteResponseResult {
535- write_maybe_relocatable ( vm, ptr, self . state_ptr ) ?;
536- Ok ( ( ) )
537- }
538- }
539-
540- // Sha512ProcessBlock syscall.
541- #[ derive( Debug , Eq , PartialEq ) ]
542- pub struct Sha512ProcessBlockRequest {
543- pub state_ptr : Relocatable ,
544- pub input_start : Relocatable ,
545- }
546-
547- impl SyscallRequest for Sha512ProcessBlockRequest {
548- fn read (
549- vm : & VirtualMachine ,
550- ptr : & mut Relocatable ,
551- ) -> SyscallBaseResult < Sha512ProcessBlockRequest > {
552- let state_start = vm. get_relocatable ( * ptr) ?;
553- * ptr = ( * ptr + 1 ) ?;
554- let input_start = vm. get_relocatable ( * ptr) ?;
555- * ptr = ( * ptr + 1 ) ?;
556- Ok ( Sha512ProcessBlockRequest { state_ptr : state_start, input_start } )
557- }
558- }
559-
560- #[ derive( Debug , Eq , PartialEq ) ]
561- pub struct Sha512ProcessBlockResponse {
562- pub state_ptr : Relocatable ,
563- }
564-
565- impl SyscallResponse for Sha512ProcessBlockResponse {
533+ impl SyscallResponse for ShaProcessBlockResponse {
566534 fn write ( self , vm : & mut VirtualMachine , ptr : & mut Relocatable ) -> WriteResponseResult {
567535 write_maybe_relocatable ( vm, ptr, self . state_ptr ) ?;
568536 Ok ( ( ) )
0 commit comments