Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.3 KiB

  1. //========= Copyright � Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Player decals signature validation code
  4. //
  5. //=============================================================================//
  6. #ifndef PLAYERDECALS_SIGNATURE_H
  7. #define PLAYERDECALS_SIGNATURE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. //
  12. // We will be using RSA 1024-bit private signing key
  13. // PKCS1 signature length is guaranteed to be 128 bytes
  14. //
  15. #define PLAYERDECALS_SIGNATURE_VERSION 1
  16. #define PLAYERDECALS_SIGNATURE_BYTELEN 128
  17. #define PLAYERDECALS_NUMCHARGES 50
  18. #define PLAYERDECALS_UNITS_SIZE 48
  19. #define PLAYERDECALS_COOLDOWN_SECONDS 45
  20. #define PLAYERDECALS_DURATION_SOLID 240
  21. #define PLAYERDECALS_DURATION_FADE1 40
  22. #define PLAYERDECALS_DURATION_FADE2 120
  23. #define PLAYERDECALS_DURATION_APPLY 1.5f
  24. #define PLAYERDECALS_LIMIT_COUNT 100
  25. //
  26. // SECURITY INFORMATION: this file is included in DLLs that are
  27. // shipping to clients and to community gameservers with the intent
  28. // for those processes to verify signatures.
  29. // NEVER include/reference private key data in this header!
  30. // Private key must be used only on GC.
  31. //
  32. inline bool BClientPlayerDecalSignatureComposeSignBuffer( PlayerDecalDigitalSignature const &data, CUtlBuffer &buf )
  33. {
  34. if ( data.endpos_size() != 3 ) return false;
  35. for ( int k = 0; k < 3; ++ k ) buf.PutFloat( data.endpos( k ) );
  36. if ( data.startpos_size() != 3 ) return false;
  37. for ( int k = 0; k < 3; ++k ) buf.PutFloat( data.startpos( k ) );
  38. if ( data.right_size() != 3 ) return false;
  39. for ( int k = 0; k < 3; ++k ) buf.PutFloat( data.right( k ) );
  40. if ( data.normal_size() != 3 ) return false;
  41. for ( int k = 0; k < 3; ++k ) buf.PutFloat( data.normal( k ) );
  42. buf.PutInt( data.tx_defidx() );
  43. buf.PutInt( data.tint_id() );
  44. buf.PutInt( data.entindex() );
  45. buf.PutInt( data.hitbox() );
  46. buf.PutFloat( data.creationtime() );
  47. buf.PutUnsignedInt( data.accountid() );
  48. buf.PutUnsignedInt( data.rtime() );
  49. buf.PutUnsignedInt( data.trace_id() );
  50. return true;
  51. }
  52. inline bool BValidateClientPlayerDecalSignature( PlayerDecalDigitalSignature const &data )
  53. {
  54. CUtlBuffer bufData;
  55. bufData.EnsureCapacity( PLAYERDECALS_SIGNATURE_BYTELEN );
  56. if ( !BClientPlayerDecalSignatureComposeSignBuffer( data, bufData ) )
  57. return false;
  58. // Removed for partner depot
  59. return true;
  60. }
  61. #endif // PLAYERDECALS_SIGNATURE_H