10
10
11
11
#ifdef LTC_OMAC
12
12
13
+ static LTC_INLINE int s_omac_vprocess (omac_state * omac , const unsigned char * in , unsigned long inlen , va_list args )
14
+ {
15
+ const unsigned char * curptr = in ;
16
+ unsigned long curlen = inlen ;
17
+ int err ;
18
+ for (;;) {
19
+ /* process buf */
20
+ if ((err = omac_process (omac , curptr , curlen )) != CRYPT_OK ) {
21
+ return err ;
22
+ }
23
+ /* step to next */
24
+ curptr = va_arg (args , const unsigned char * );
25
+ if (curptr == NULL ) {
26
+ break ;
27
+ }
28
+ curlen = va_arg (args , unsigned long );
29
+ }
30
+ return CRYPT_OK ;
31
+ }
32
+
33
+ int omac_vprocess (omac_state * omac , const unsigned char * in , unsigned long inlen , va_list args )
34
+ {
35
+ return s_omac_vprocess (omac , in , inlen , args );
36
+ }
37
+
13
38
/**
14
39
OMAC multiple blocks of memory
15
40
@param cipher The index of the desired cipher
@@ -30,8 +55,6 @@ int omac_memory_multi(int cipher,
30
55
int err ;
31
56
omac_state * omac ;
32
57
va_list args ;
33
- const unsigned char * curptr ;
34
- unsigned long curlen ;
35
58
36
59
LTC_ARGCHK (key != NULL );
37
60
LTC_ARGCHK (in != NULL );
@@ -49,23 +72,10 @@ int omac_memory_multi(int cipher,
49
72
goto LBL_ERR ;
50
73
}
51
74
va_start (args , inlen );
52
- curptr = in ;
53
- curlen = inlen ;
54
- for (;;) {
55
- /* process buf */
56
- if ((err = omac_process (omac , curptr , curlen )) != CRYPT_OK ) {
57
- goto LBL_ERR ;
58
- }
59
- /* step to next */
60
- curptr = va_arg (args , const unsigned char * );
61
- if (curptr == NULL ) {
62
- break ;
63
- }
64
- curlen = va_arg (args , unsigned long );
65
- }
66
- if ((err = omac_done (omac , out , outlen )) != CRYPT_OK ) {
75
+ if ((err = s_omac_vprocess (omac , in , inlen , args )) != CRYPT_OK ) {
67
76
goto LBL_ERR ;
68
77
}
78
+ err = omac_done (omac , out , outlen );
69
79
LBL_ERR :
70
80
#ifdef LTC_CLEAN_STACK
71
81
zeromem (omac , sizeof (omac_state ));
0 commit comments