Explorar el Código

Add notes on using encryption functions from non-main threads.

ambrop7 hace 15 años
padre
commit
e39dbd4fda

+ 2 - 0
client/DatagramPeerIO.h

@@ -127,6 +127,8 @@ typedef struct {
  * Initializes the object.
  * The interface is initialized in default mode.
  * {@link BLog_Init} must have been done.
+ * {@link BSecurity_GlobalInitThreadSafe} must have been done if
+ * {@link BThreadWorkDispatcher_UsingThreads}(twd) = 1.
  *
  * @param o the object
  * @param reactor {@link BReactor} we live in

+ 2 - 0
flow/SPProtoDecoder.h

@@ -75,6 +75,8 @@ typedef struct {
 
 /**
  * Initializes the object.
+ * {@link BSecurity_GlobalInitThreadSafe} must have been done if
+ * {@link BThreadWorkDispatcher_UsingThreads}(twd) = 1.
  *
  * @param o the object
  * @param output output interface. Its MTU must not be too large, i.e. this must hold:

+ 2 - 0
flow/SPProtoEncoder.h

@@ -85,6 +85,8 @@ typedef struct {
 /**
  * Initializes the object.
  * The object is initialized in blocked state.
+ * {@link BSecurity_GlobalInitThreadSafe} must have been done if
+ * {@link BThreadWorkDispatcher_UsingThreads}(twd) = 1.
  *
  * @param o the object
  * @param input input interface. Its MTU must not be too large, i.e. this must hold:

+ 2 - 0
security/BEncryption.h

@@ -116,6 +116,8 @@ int BEncryption_cipher_key_size (int cipher);
 
 /**
  * Initializes the object.
+ * {@link BSecurity_GlobalInitThreadSafe} must have been done if this object
+ * will be used from a non-main thread.
  * 
  * @param enc the object
  * @param mode whether encryption or decryption is to be done, or both.

+ 2 - 0
security/BHash.h

@@ -58,6 +58,8 @@ int BHash_size (int type);
 
 /**
  * Calculates a hash.
+ * {@link BSecurity_GlobalInitThreadSafe} must have been done if this is
+ * being called from a non-main thread.
  * 
  * @param type hash type number. Must be valid.
  * @param data data to calculate the hash of

+ 2 - 0
security/BRandom.h

@@ -31,6 +31,8 @@
 
 /**
  * Generates random data.
+ * {@link BSecurity_GlobalInitThreadSafe} must have been done if this is
+ * being called from a non-main thread.
  * 
  * @param buf buffer to write data into
  * @param len number of bytes to generate. Must be >=0.

+ 2 - 0
security/OTPCalculator.h

@@ -55,6 +55,8 @@ typedef struct {
 
 /**
  * Initializes the calculator.
+ * {@link BSecurity_GlobalInitThreadSafe} must have been done if this object
+ * will be used from a non-main thread.
  *
  * @param calc the object
  * @param num_otps number of OTPs to generate from a seed. Must be >=0.

+ 2 - 0
security/OTPChecker.h

@@ -76,6 +76,8 @@ typedef struct {
 
 /**
  * Initializes the checker.
+ * {@link BSecurity_GlobalInitThreadSafe} must have been done if
+ * {@link BThreadWorkDispatcher_UsingThreads}(twd) = 1.
  *
  * @param mc the object
  * @param num_otps number of OTPs to generate from a seed. Must be >0.

+ 2 - 0
security/OTPGenerator.h

@@ -63,6 +63,8 @@ typedef struct {
 /**
  * Initializes the generator.
  * The object is initialized with number of used OTPs = num_otps.
+ * {@link BSecurity_GlobalInitThreadSafe} must have been done if
+ * {@link BThreadWorkDispatcher_UsingThreads}(twd) = 1.
  *
  * @param g the object
  * @param num_otps number of OTPs to generate from a seed. Must be >=0.