security/manager/boot/src/nsEntropyCollector.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/manager/boot/src/nsEntropyCollector.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,36 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +#ifndef nsEntropyCollector_h___
     1.9 +#define nsEntropyCollector_h___
    1.10 +
    1.11 +#include "nsIEntropyCollector.h"
    1.12 +#include "nsIBufEntropyCollector.h"
    1.13 +#include "nsCOMPtr.h"
    1.14 +
    1.15 +#define NS_ENTROPYCOLLECTOR_CID \
    1.16 + { /* 34587f4a-be18-43c0-9112-b782b08c0add */       \
    1.17 +  0x34587f4a, 0xbe18, 0x43c0,                       \
    1.18 + {0x91, 0x12, 0xb7, 0x82, 0xb0, 0x8c, 0x0a, 0xdd} }
    1.19 +
    1.20 +class nsEntropyCollector : public nsIBufEntropyCollector
    1.21 +{
    1.22 +  public:
    1.23 +    nsEntropyCollector();
    1.24 +    virtual ~nsEntropyCollector();
    1.25 +
    1.26 +    NS_DECL_THREADSAFE_ISUPPORTS
    1.27 +    NS_DECL_NSIENTROPYCOLLECTOR
    1.28 +    NS_DECL_NSIBUFENTROPYCOLLECTOR
    1.29 +
    1.30 +    enum { entropy_buffer_size = 1024 };
    1.31 +
    1.32 +  protected:
    1.33 +    unsigned char mEntropyCache[entropy_buffer_size];
    1.34 +    int32_t mBytesCollected;
    1.35 +    unsigned char *mWritePointer;
    1.36 +    nsCOMPtr<nsIEntropyCollector> mForwardTarget;
    1.37 +};
    1.38 +
    1.39 +#endif /* !defined nsEntropyCollector_h__ */

mercurial