physics-mv
FORGE: request-bound machine realization, providers and verification for AienOS. Host, simulated and GB10 hardware paths have separate evidence.
Brought by drakestapleton
physics-mv / third_party / nvidia-open-580.173.02 / src / common / sdk / nvidia / inc / cc_drv.h
| 1 | /* |
| 2 | * SPDX-FileCopyrightText: Copyright (c) 2021-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
| 3 | * SPDX-License-Identifier: MIT |
| 4 | * |
| 5 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 6 | * copy of this software and associated documentation files (the "Software"), |
| 7 | * to deal in the Software without restriction, including without limitation |
| 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 9 | * and/or sell copies of the Software, and to permit persons to whom the |
| 10 | * Software is furnished to do so, subject to the following conditions: |
| 11 | * |
| 12 | * The above copyright notice and this permission notice shall be included in |
| 13 | * all copies or substantial portions of the Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 21 | * DEALINGS IN THE SOFTWARE. |
| 22 | */ |
| 23 | |
| 24 | #pragma once |
| 25 | |
| 26 | #include <nvtypes.h> |
| 27 | |
| 28 | // |
| 29 | // This file was generated with FINN, an NVIDIA coding tool. |
| 30 | // Source file: cc_drv.finn |
| 31 | // |
| 32 | |
| 33 | |
| 34 | |
| 35 | #include "nvtypes.h" |
| 36 | #include "nvcfg_sdk.h" |
| 37 | |
| 38 | // CLASS NV_CONF_COMPUTE |
| 39 | #define CC_AES_256_GCM_IV_SIZE_BYTES (0xcU) /* finn: Evaluated from "(96 / 8)" */ |
| 40 | #define CC_AES_256_GCM_IV_SIZE_DWORD (0x3U) /* finn: Evaluated from "(CC_AES_256_GCM_IV_SIZE_BYTES / 4)" */ |
| 41 | #define CC_AES_256_GCM_KEY_SIZE_BYTES (0x20U) /* finn: Evaluated from "(256 / 8)" */ |
| 42 | #define CC_AES_256_GCM_KEY_SIZE_DWORD (0x8U) /* finn: Evaluated from "(CC_AES_256_GCM_KEY_SIZE_BYTES / 4)" */ |
| 43 | |
| 44 | #define CC_HMAC_NONCE_SIZE_BYTES (0x20U) /* finn: Evaluated from "(256 / 8)" */ |
| 45 | #define CC_HMAC_NONCE_SIZE_DWORD (0x8U) /* finn: Evaluated from "(CC_HMAC_NONCE_SIZE_BYTES / 4)" */ |
| 46 | #define CC_HMAC_KEY_SIZE_BYTES (0x20U) /* finn: Evaluated from "(256 / 8)" */ |
| 47 | #define CC_HMAC_KEY_SIZE_DWORD (0x8U) /* finn: Evaluated from "(CC_HMAC_KEY_SIZE_BYTES / 4)" */ |
| 48 | |
| 49 | |
| 50 | // Type is shared between CC control calls and RMKeyStore |
| 51 | typedef enum ROTATE_IV_TYPE { |
| 52 | ROTATE_IV_ENCRYPT = 0, // Rotate the IV for encryptBundle |
| 53 | ROTATE_IV_DECRYPT = 1, // Rotate the IV for decryptBundle |
| 54 | ROTATE_IV_HMAC = 2, // Rotate the IV for hmacBundle |
| 55 | ROTATE_IV_ALL_VALID = 3, // Rotate the IV for all valid bundles in the KMB |
| 56 | } ROTATE_IV_TYPE; |
| 57 | |
| 58 | // Status value written into NvNotification.Info16 |
| 59 | typedef enum KEY_ROTATION_STATUS { |
| 60 | KEY_ROTATION_STATUS_IDLE = 0, // Key rotation complete/not in progress |
| 61 | KEY_ROTATION_STATUS_PENDING = 1, // RM is waiting for clients to report their channels are idle for key rotation |
| 62 | KEY_ROTATION_STATUS_IN_PROGRESS = 2, // Key rotation is in progress |
| 63 | KEY_ROTATION_STATUS_FAILED_TIMEOUT = 3, // Key rotation timeout failure, RM will RC non-idle channels |
| 64 | KEY_ROTATION_STATUS_FAILED_THRESHOLD = 4, // Key rotation failed because upper threshold was crossed, RM will RC non-idle channels |
| 65 | KEY_ROTATION_STATUS_FAILED_ROTATION = 5, // Internal RM failure while rotating keys for a certain channel, RM will RC the channel |
| 66 | KEY_ROTATION_STATUS_PENDING_TIMER_SUSPENDED = 6, // Key rotation timer suspended waiting for kernel key rotation to complete |
| 67 | KEY_ROTATION_STATUS_MAX_COUNT = 7, |
| 68 | } KEY_ROTATION_STATUS; |
| 69 | |
| 70 | typedef struct CC_AES_CRYPTOBUNDLE { |
| 71 | NvU32 iv[CC_AES_256_GCM_IV_SIZE_DWORD]; |
| 72 | NvU32 key[CC_AES_256_GCM_KEY_SIZE_DWORD]; |
| 73 | NvU32 ivMask[CC_AES_256_GCM_IV_SIZE_DWORD]; |
| 74 | } CC_AES_CRYPTOBUNDLE; |
| 75 | typedef struct CC_AES_CRYPTOBUNDLE *PCC_AES_CRYPTOBUNDLE; |
| 76 | |
| 77 | typedef struct CC_HMAC_CRYPTOBUNDLE { |
| 78 | NvU32 nonce[CC_HMAC_NONCE_SIZE_DWORD]; |
| 79 | NvU32 key[CC_HMAC_KEY_SIZE_DWORD]; |
| 80 | } CC_HMAC_CRYPTOBUNDLE; |
| 81 | typedef struct CC_HMAC_CRYPTOBUNDLE *PCC_HMAC_CRYPTOBUNDLE; |
| 82 | |
| 83 | typedef struct CC_KMB { |
| 84 | CC_AES_CRYPTOBUNDLE encryptBundle; // Bundle of encyption material |
| 85 | |
| 86 | union { |
| 87 | CC_HMAC_CRYPTOBUNDLE hmacBundle; // HMAC bundle used for method stream authenticity |
| 88 | CC_AES_CRYPTOBUNDLE decryptBundle; // Bundle of decryption material |
| 89 | }; |
| 90 | NvBool bIsWorkLaunch; // False if decryption parameters are valid |
| 91 | } CC_KMB; |
| 92 | typedef struct CC_KMB *PCC_KMB; |
| 93 | |
| 94 | typedef struct CC_CRYPTOBUNDLE_STATS { |
| 95 | NV_DECLARE_ALIGNED(NvU64 numEncryptionsH2D, 8); |
| 96 | NV_DECLARE_ALIGNED(NvU64 numEncryptionsD2H, 8); |
| 97 | NV_DECLARE_ALIGNED(NvU64 bytesEncryptedH2D, 8); |
| 98 | NV_DECLARE_ALIGNED(NvU64 bytesEncryptedD2H, 8); |
| 99 | } CC_CRYPTOBUNDLE_STATS; |
| 100 | typedef struct CC_CRYPTOBUNDLE_STATS *PCC_CRYPTOBUNDLE_STATS; |
| 101 |