| 1 | /************************************************************************* |
| 2 | * Copyright (C) 2013 Intel Corporation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | *************************************************************************/ |
| 16 | |
| 17 | /* |
| 18 | // Intel(R) Cryptography Primitives Library |
| 19 | // |
| 20 | // Context: |
| 21 | // ippsAES_CCMMessageLen() |
| 22 | // |
| 23 | */ |
| 24 | |
| 25 | #include "owndefs.h" |
| 26 | #include "owncp.h" |
| 27 | #include "pcpaesauthccm.h" |
| 28 | #include "pcptool.h" |
| 29 | |
| 30 | #if (_ALG_AES_SAFE_ == _ALG_AES_SAFE_COMPACT_SBOX_) |
| 31 | #include "pcprijtables.h" |
| 32 | #endif |
| 33 | |
| 34 | /*F* |
| 35 | // Name: ippsAES_CCMMessageLen |
| 36 | // |
| 37 | // Purpose: Setup expected length of payload (in bytes). |
| 38 | // |
| 39 | // Returns: Reason: |
| 40 | // ippStsNullPtrErr pState == NULL |
| 41 | // ippStsContextMatchErr !VALID_AESCCM_ID() |
| 42 | // ippStsNoErr no errors |
| 43 | // |
| 44 | // Parameters: |
| 45 | // msgLen length in bytes of the message expected to be processed |
| 46 | // pState pointer to the AES-CCM state |
| 47 | // |
| 48 | *F*/ |
| 49 | IPPFUN(IppStatus, ippsAES_CCMMessageLen, (Ipp64u msgLen, IppsAES_CCMState* pState)) |
| 50 | { |
| 51 | /* test context */ |
| 52 | IPP_BAD_PTR1_RET(pState); |
| 53 | IPP_BADARG_RET(!VALID_AESCCM_ID(pState), ippStsContextMatchErr); |
| 54 | |
| 55 | /* init for new message */ |
| 56 | AESCCM_MSGLEN(pState) = msgLen; |
| 57 | |
| 58 | return ippStsNoErr; |
| 59 | } |