src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11gcm2.h
changeset 58489 2faeaa5933a6
equal deleted inserted replaced
58488:165b193b30dd 58489:2faeaa5933a6
       
     1 /*
       
     2  * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    20  * or visit www.oracle.com if you need additional information or have any
       
    21  * questions.
       
    22  */
       
    23 
       
    24 /* There is a known incompatibility for CK_GCM_PARAMS structure.
       
    25  * PKCS#11 v2.40 standard mechanisms specification specifies
       
    26  * CK_GCM_PARAMS as
       
    27  *     typedef struct CK_GCM_PARAMS {
       
    28  *         CK_BYTE_PTR       pIv;
       
    29  *         CK_ULONG          ulIvLen;
       
    30  *         CK_BYTE_PTR       pAAD;
       
    31  *         CK_ULONG          ulAADLen;
       
    32  *         CK_ULONG          ulTagBits;
       
    33  *     } CK_GCM_PARAMS;
       
    34  * However, the official header file of PKCS#11 v2.40 defines the
       
    35  * CK_GCM_PARAMS with an extra "ulIvBits" field (type CK_ULONG).
       
    36  * NSS uses the spec version while Solaris and SoftHSM2 use the header
       
    37  * version. In order to work with both sides, SunPKCS11 provider defines
       
    38  * the spec version of CK_GCM_PARAMS as CK_GCM_PARAMS_NO_IVBITS (as in this
       
    39  * file) and uses it first before failing over to the header version.
       
    40  */
       
    41 #ifndef _PKCS11GCM2_H_
       
    42 #define _PKCS11GCM2_H_ 1
       
    43 
       
    44 /* include the platform dependent part of the header */
       
    45 typedef struct CK_GCM_PARAMS_NO_IVBITS {
       
    46     CK_BYTE_PTR       pIv;
       
    47     CK_ULONG          ulIvLen;
       
    48     CK_BYTE_PTR       pAAD;
       
    49     CK_ULONG          ulAADLen;
       
    50     CK_ULONG          ulTagBits;
       
    51 } CK_GCM_PARAMS_NO_IVBITS;
       
    52 
       
    53 typedef CK_GCM_PARAMS_NO_IVBITS CK_PTR CK_GCM_PARAMS_NO_IVBITS_PTR;
       
    54 
       
    55 #endif /* _PKCS11GCM2_H_ */