1010
1111#ifdef LTC_OMAC
1212
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+
1338/**
1439 OMAC multiple blocks of memory
1540 @param cipher The index of the desired cipher
@@ -30,8 +55,6 @@ int omac_memory_multi(int cipher,
3055 int err ;
3156 omac_state * omac ;
3257 va_list args ;
33- const unsigned char * curptr ;
34- unsigned long curlen ;
3558
3659 LTC_ARGCHK (key != NULL );
3760 LTC_ARGCHK (in != NULL );
@@ -49,23 +72,10 @@ int omac_memory_multi(int cipher,
4972 goto LBL_ERR ;
5073 }
5174 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 ) {
6776 goto LBL_ERR ;
6877 }
78+ err = omac_done (omac , out , outlen );
6979LBL_ERR :
7080#ifdef LTC_CLEAN_STACK
7181 zeromem (omac , sizeof (omac_state ));
0 commit comments