Skip to content

Commit 66e2a65

Browse files
committed
Promote some stuff from crypto.h to crypto_constants.h
Getting synced up with Steam main branch.
1 parent 97079a4 commit 66e2a65

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

src/common/crypto.h

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,12 @@
33
#ifndef CRYPTO_H
44
#define CRYPTO_H
55

6-
#include <tier0/dbg.h> // for Assert & AssertMsg
7-
//#include "tier1/passwordhash.h"
8-
#include "keypair.h"
9-
#include "steam/steamtypes.h" // Salt_t
6+
#include <tier0/platform.h>
107
#include "crypto_constants.h"
8+
//#include <tier1/passwordhash.h>
9+
#include "keypair.h"
1110

12-
const unsigned int k_cubMD5Hash = 16;
13-
typedef unsigned char MD5Digest_t[k_cubMD5Hash];
14-
15-
const unsigned int k_cubSHA256Hash = 32;
16-
typedef unsigned char SHA256Digest_t[ k_cubSHA256Hash ];
17-
18-
const unsigned int k_cubSHA1Hash = 20;
19-
typedef uint8 SHADigest_t[ k_cubSHA1Hash ];
11+
class CUtlBuffer;
2012

2113
// Base class for symmetric encryption and decryption context.
2214
// A context is used when you want to use the same encryption

src/common/crypto_25519_donna.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//========= Copyright Valve LLC, All rights reserved. ========================
22
#include "crypto.h"
3+
#include <tier0/dbg.h>
34

45
#ifdef VALVE_CRYPTO_25519_DONNA
56

src/common/crypto_25519_openssl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//========= Copyright Valve LLC, All rights reserved. ========================
22
#include "crypto.h"
3+
#include <tier0/dbg.h>
34

45
#ifdef STEAMNETWORKINGSOCKETS_CRYPTO_25519_OPENSSL
56

src/common/crypto_constants.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#define CRYPTO_CONSTANTS_H
55
#pragma once
66

7+
#include <steam/steamtypes.h>
8+
79
const int k_nSymmetricBlockSize = 16; // AES block size (128 bits)
810
const int k_nSymmetricIVSize = 12; // length of the IV (must be 12 for BCryptEncrypt/BCryptDecrypt, but OpenSSL is more flexible)
911
const int k_nSymmetricGCMTagSize = 16; // length in GCM tag (must be 16 for BCryptEncrypt/BCryptDecrypt, but OpenSSL is more flexible)
@@ -18,11 +20,19 @@ const int k_cubRSAEncryptedBlockSize = 128;
1820
const int k_cubRSAPlaintextBlockSize = 86 + 1; // assume plaintext is text, so add a byte for the trailing \0
1921
const uint32 k_cubRSASignature = k_cubRSAEncryptedBlockSize;
2022

23+
const uint32 k_cubRSA2048Signature = 256; // Signature length when using a 2048-bit RSA key
24+
2125
const int k_nAESKeyLenMax = k_nSymmetricKeyLen;
2226
const int k_nAESKeyLenMaxEncoded = k_nAESKeyLenMax*2;
2327
const int k_nAESKeyBits = k_nSymmetricKeyLen*8; // normal size of AES keys
2428
const int k_cchMaxPassphrase = 128; // maximum size of a license passphrase
2529

2630
const int k_nSHAHashStringLen = 40; // length of SHA1 hash when stored as a hex string
2731

32+
const unsigned int k_cubMD5Hash = 16;
33+
typedef unsigned char MD5Digest_t[k_cubMD5Hash];
34+
35+
const unsigned int k_cubSHA256Hash = 32;
36+
typedef unsigned char SHA256Digest_t[ k_cubSHA256Hash ];
37+
2838
#endif // CRYPTO_CONSTANTS_H

0 commit comments

Comments
 (0)