@@ -45,7 +45,7 @@ impl State {
45
45
/// Initialize Poly1305 [`State`] with the given key
46
46
pub ( crate ) fn new ( key : & Key ) -> Self {
47
47
// Prepare addition key and polynomial key.
48
- let ( k, r1) = prepare_keys ( key) ;
48
+ let ( k, r1) = unsafe { prepare_keys ( key) } ;
49
49
50
50
// Precompute R^2.
51
51
let r2 = ( r1 * r1) . reduce ( ) ;
@@ -68,7 +68,8 @@ impl State {
68
68
}
69
69
70
70
/// Compute a Poly1305 block
71
- pub ( crate ) fn compute_block ( & mut self , block : & Block , partial : bool ) {
71
+ #[ target_feature( enable = "avx2" ) ]
72
+ pub ( crate ) unsafe fn compute_block ( & mut self , block : & Block , partial : bool ) {
72
73
// We can cache a single partial block.
73
74
if partial {
74
75
assert ! ( self . partial_block. is_none( ) ) ;
@@ -101,7 +102,8 @@ impl State {
101
102
}
102
103
103
104
/// Finalize output producing a [`Tag`]
104
- pub ( crate ) fn finalize ( & mut self ) -> Tag {
105
+ #[ target_feature( enable = "avx2" ) ]
106
+ pub ( crate ) unsafe fn finalize ( & mut self ) -> Tag {
105
107
assert ! ( self . num_cached_blocks < 4 ) ;
106
108
let mut data = & self . cached_blocks [ ..] ;
107
109
0 commit comments