Skip to content

Commit 74b7c3b

Browse files
committed
Merge #1476: include: make docs more consistent
da7bc1b include: in doc, remove article in front of "pointer" (Jonas Nick) aa3dd52 include: make doc about ctx more consistent (Jonas Nick) e3f6900 include: remove obvious "cannot be NULL" doc (Jonas Nick) Pull request description: ACKs for top commit: sipa: ACK da7bc1b real-or-random: ACK da7bc1b Tree-SHA512: 809f312fa0cd1e9502ac79b8a1c502b87e6dfc2db8ad6bbd96d7ddbdaadad0c3b6110fa704b770c353cd34d5bf5547541cbb5f2779425d7419b584e721c854c2
2 parents d373bf6 + da7bc1b commit 74b7c3b

8 files changed

+62
-62
lines changed

contrib/lax_der_parsing.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ extern "C" {
6767
*
6868
* Returns: 1 when the signature could be parsed, 0 otherwise.
6969
* Args: ctx: a secp256k1 context object
70-
* Out: sig: a pointer to a signature object
71-
* In: input: a pointer to the signature to be parsed
70+
* Out: sig: pointer to a signature object
71+
* In: input: pointer to the signature to be parsed
7272
* inputlen: the length of the array pointed to be input
7373
*
7474
* This function will accept any valid DER encoded signature, even if the

include/secp256k1.h

+33-33
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ SECP256K1_API void secp256k1_selftest(void);
265265
* memory allocation entirely, see secp256k1_context_static and the functions in
266266
* secp256k1_preallocated.h.
267267
*
268-
* Returns: a newly created context object.
268+
* Returns: pointer to a newly created context object.
269269
* In: flags: Always set to SECP256K1_CONTEXT_NONE (see below).
270270
*
271271
* The only valid non-deprecated flag in recent library versions is
@@ -296,8 +296,8 @@ SECP256K1_API secp256k1_context *secp256k1_context_create(
296296
* Cloning secp256k1_context_static is not possible, and should not be emulated by
297297
* the caller (e.g., using memcpy). Create a new context instead.
298298
*
299-
* Returns: a newly created context object.
300-
* Args: ctx: an existing context to copy (not secp256k1_context_static)
299+
* Returns: pointer to a newly created context object.
300+
* Args: ctx: pointer to a context to copy (not secp256k1_context_static).
301301
*/
302302
SECP256K1_API secp256k1_context *secp256k1_context_clone(
303303
const secp256k1_context *ctx
@@ -313,7 +313,7 @@ SECP256K1_API secp256k1_context *secp256k1_context_clone(
313313
* behaviour is undefined. In that case, secp256k1_context_preallocated_destroy must
314314
* be used instead.
315315
*
316-
* Args: ctx: an existing context to destroy, constructed using
316+
* Args: ctx: pointer to a context to destroy, constructed using
317317
* secp256k1_context_create or secp256k1_context_clone
318318
* (i.e., not secp256k1_context_static).
319319
*/
@@ -350,8 +350,8 @@ SECP256K1_API void secp256k1_context_destroy(
350350
* fails. In this case, the corresponding default handler will be called with
351351
* the data pointer argument set to NULL.
352352
*
353-
* Args: ctx: an existing context object.
354-
* In: fun: a pointer to a function to call when an illegal argument is
353+
* Args: ctx: pointer to a context object.
354+
* In: fun: pointer to a function to call when an illegal argument is
355355
* passed to the API, taking a message and an opaque pointer.
356356
* (NULL restores the default handler.)
357357
* data: the opaque pointer to pass to fun above, must be NULL for the default handler.
@@ -377,8 +377,8 @@ SECP256K1_API void secp256k1_context_set_illegal_callback(
377377
* for that). After this callback returns, anything may happen, including
378378
* crashing.
379379
*
380-
* Args: ctx: an existing context object.
381-
* In: fun: a pointer to a function to call when an internal error occurs,
380+
* Args: ctx: pointer to a context object.
381+
* In: fun: pointer to a function to call when an internal error occurs,
382382
* taking a message and an opaque pointer (NULL restores the
383383
* default handler, see secp256k1_context_set_illegal_callback
384384
* for details).
@@ -395,7 +395,7 @@ SECP256K1_API void secp256k1_context_set_error_callback(
395395
/** Create a secp256k1 scratch space object.
396396
*
397397
* Returns: a newly created scratch space.
398-
* Args: ctx: an existing context object.
398+
* Args: ctx: pointer to a context object.
399399
* In: size: amount of memory to be available as scratch space. Some extra
400400
* (<100 bytes) will be allocated for extra accounting.
401401
*/
@@ -407,7 +407,7 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT secp256k1_scratch_space *secp256k1_sc
407407
/** Destroy a secp256k1 scratch space.
408408
*
409409
* The pointer may not be used afterwards.
410-
* Args: ctx: a secp256k1 context object.
410+
* Args: ctx: pointer to a context object.
411411
* scratch: space to destroy
412412
*/
413413
SECP256K1_API void secp256k1_scratch_space_destroy(
@@ -419,7 +419,7 @@ SECP256K1_API void secp256k1_scratch_space_destroy(
419419
*
420420
* Returns: 1 if the public key was fully valid.
421421
* 0 if the public key could not be parsed or is invalid.
422-
* Args: ctx: a secp256k1 context object.
422+
* Args: ctx: pointer to a context object.
423423
* Out: pubkey: pointer to a pubkey object. If 1 is returned, it is set to a
424424
* parsed version of input. If not, its value is undefined.
425425
* In: input: pointer to a serialized public key
@@ -439,14 +439,14 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_parse(
439439
/** Serialize a pubkey object into a serialized byte sequence.
440440
*
441441
* Returns: 1 always.
442-
* Args: ctx: a secp256k1 context object.
443-
* Out: output: a pointer to a 65-byte (if compressed==0) or 33-byte (if
442+
* Args: ctx: pointer to a context object.
443+
* Out: output: pointer to a 65-byte (if compressed==0) or 33-byte (if
444444
* compressed==1) byte array to place the serialized key
445445
* in.
446-
* In/Out: outputlen: a pointer to an integer which is initially set to the
446+
* In/Out: outputlen: pointer to an integer which is initially set to the
447447
* size of output, and is overwritten with the written
448448
* size.
449-
* In: pubkey: a pointer to a secp256k1_pubkey containing an
449+
* In: pubkey: pointer to a secp256k1_pubkey containing an
450450
* initialized public key.
451451
* flags: SECP256K1_EC_COMPRESSED if serialization should be in
452452
* compressed format, otherwise SECP256K1_EC_UNCOMPRESSED.
@@ -464,7 +464,7 @@ SECP256K1_API int secp256k1_ec_pubkey_serialize(
464464
* Returns: <0 if the first public key is less than the second
465465
* >0 if the first public key is greater than the second
466466
* 0 if the two public keys are equal
467-
* Args: ctx: a secp256k1 context object.
467+
* Args: ctx: pointer to a context object
468468
* In: pubkey1: first public key to compare
469469
* pubkey2: second public key to compare
470470
*/
@@ -477,9 +477,9 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_cmp(
477477
/** Parse an ECDSA signature in compact (64 bytes) format.
478478
*
479479
* Returns: 1 when the signature could be parsed, 0 otherwise.
480-
* Args: ctx: a secp256k1 context object
481-
* Out: sig: a pointer to a signature object
482-
* In: input64: a pointer to the 64-byte array to parse
480+
* Args: ctx: pointer to a context object
481+
* Out: sig: pointer to a signature object
482+
* In: input64: pointer to the 64-byte array to parse
483483
*
484484
* The signature must consist of a 32-byte big endian R value, followed by a
485485
* 32-byte big endian S value. If R or S fall outside of [0..order-1], the
@@ -498,9 +498,9 @@ SECP256K1_API int secp256k1_ecdsa_signature_parse_compact(
498498
/** Parse a DER ECDSA signature.
499499
*
500500
* Returns: 1 when the signature could be parsed, 0 otherwise.
501-
* Args: ctx: a secp256k1 context object
502-
* Out: sig: a pointer to a signature object
503-
* In: input: a pointer to the signature to be parsed
501+
* Args: ctx: pointer to a context object
502+
* Out: sig: pointer to a signature object
503+
* In: input: pointer to the signature to be parsed
504504
* inputlen: the length of the array pointed to be input
505505
*
506506
* This function will accept any valid DER encoded signature, even if the
@@ -520,13 +520,13 @@ SECP256K1_API int secp256k1_ecdsa_signature_parse_der(
520520
/** Serialize an ECDSA signature in DER format.
521521
*
522522
* Returns: 1 if enough space was available to serialize, 0 otherwise
523-
* Args: ctx: a secp256k1 context object
524-
* Out: output: a pointer to an array to store the DER serialization
525-
* In/Out: outputlen: a pointer to a length integer. Initially, this integer
523+
* Args: ctx: pointer to a context object
524+
* Out: output: pointer to an array to store the DER serialization
525+
* In/Out: outputlen: pointer to a length integer. Initially, this integer
526526
* should be set to the length of output. After the call
527527
* it will be set to the length of the serialization (even
528528
* if 0 was returned).
529-
* In: sig: a pointer to an initialized signature object
529+
* In: sig: pointer to an initialized signature object
530530
*/
531531
SECP256K1_API int secp256k1_ecdsa_signature_serialize_der(
532532
const secp256k1_context *ctx,
@@ -538,9 +538,9 @@ SECP256K1_API int secp256k1_ecdsa_signature_serialize_der(
538538
/** Serialize an ECDSA signature in compact (64 byte) format.
539539
*
540540
* Returns: 1
541-
* Args: ctx: a secp256k1 context object
542-
* Out: output64: a pointer to a 64-byte array to store the compact serialization
543-
* In: sig: a pointer to an initialized signature object
541+
* Args: ctx: pointer to a context object
542+
* Out: output64: pointer to a 64-byte array to store the compact serialization
543+
* In: sig: pointer to an initialized signature object
544544
*
545545
* See secp256k1_ecdsa_signature_parse_compact for details about the encoding.
546546
*/
@@ -554,7 +554,7 @@ SECP256K1_API int secp256k1_ecdsa_signature_serialize_compact(
554554
*
555555
* Returns: 1: correct signature
556556
* 0: incorrect or unparseable signature
557-
* Args: ctx: a secp256k1 context object.
557+
* Args: ctx: pointer to a context object
558558
* In: sig: the signature being verified.
559559
* msghash32: the 32-byte message hash being verified.
560560
* The verifier must make sure to apply a cryptographic
@@ -585,12 +585,12 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdsa_verify(
585585
/** Convert a signature to a normalized lower-S form.
586586
*
587587
* Returns: 1 if sigin was not normalized, 0 if it already was.
588-
* Args: ctx: a secp256k1 context object
589-
* Out: sigout: a pointer to a signature to fill with the normalized form,
588+
* Args: ctx: pointer to a context object
589+
* Out: sigout: pointer to a signature to fill with the normalized form,
590590
* or copy if the input was already normalized. (can be NULL if
591591
* you're only interested in whether the input was already
592592
* normalized).
593-
* In: sigin: a pointer to a signature to check/normalize (can be identical to sigout)
593+
* In: sigin: pointer to a signature to check/normalize (can be identical to sigout)
594594
*
595595
* With ECDSA a third-party can forge a second distinct signature of the same
596596
* message, given a single initial signature, but without knowing the key. This

include/secp256k1_ecdh.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ SECP256K1_API const secp256k1_ecdh_hash_function secp256k1_ecdh_hash_function_de
3939
* 0: scalar was invalid (zero or overflow) or hashfp returned 0
4040
* Args: ctx: pointer to a context object.
4141
* Out: output: pointer to an array to be filled by hashfp.
42-
* In: pubkey: a pointer to a secp256k1_pubkey containing an initialized public key.
42+
* In: pubkey: pointer to a secp256k1_pubkey containing an initialized public key.
4343
* seckey: a 32-byte scalar with which to multiply the point.
4444
* hashfp: pointer to a hash function. If NULL,
4545
* secp256k1_ecdh_hash_function_sha256 is used

include/secp256k1_ellswift.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ SECP256K1_API const secp256k1_ellswift_xdh_hash_function secp256k1_ellswift_xdh_
8787
* Returns: 1 always.
8888
* Args: ctx: pointer to a context object
8989
* Out: ell64: pointer to a 64-byte array to be filled
90-
* In: pubkey: a pointer to a secp256k1_pubkey containing an
90+
* In: pubkey: pointer to a secp256k1_pubkey containing an
9191
* initialized public key
9292
* rnd32: pointer to 32 bytes of randomness
9393
*
@@ -169,7 +169,7 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ellswift_create(
169169
* (will not be NULL)
170170
* ell_b64: pointer to the 64-byte encoded public key of party B
171171
* (will not be NULL)
172-
* seckey32: a pointer to our 32-byte secret key
172+
* seckey32: pointer to our 32-byte secret key
173173
* party: boolean indicating which party we are: zero if we are
174174
* party A, non-zero if we are party B. seckey32 must be
175175
* the private key corresponding to that party's ell_?64.

include/secp256k1_extrakeys.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ typedef struct {
3939
* Returns: 1 if the public key was fully valid.
4040
* 0 if the public key could not be parsed or is invalid.
4141
*
42-
* Args: ctx: a secp256k1 context object.
42+
* Args: ctx: pointer to a context object.
4343
* Out: pubkey: pointer to a pubkey object. If 1 is returned, it is set to a
4444
* parsed version of input. If not, it's set to an invalid value.
4545
* In: input32: pointer to a serialized xonly_pubkey.
@@ -54,9 +54,9 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_xonly_pubkey_parse(
5454
*
5555
* Returns: 1 always.
5656
*
57-
* Args: ctx: a secp256k1 context object.
58-
* Out: output32: a pointer to a 32-byte array to place the serialized key in.
59-
* In: pubkey: a pointer to a secp256k1_xonly_pubkey containing an initialized public key.
57+
* Args: ctx: pointer to a context object.
58+
* Out: output32: pointer to a 32-byte array to place the serialized key in.
59+
* In: pubkey: pointer to a secp256k1_xonly_pubkey containing an initialized public key.
6060
*/
6161
SECP256K1_API int secp256k1_xonly_pubkey_serialize(
6262
const secp256k1_context *ctx,
@@ -69,7 +69,7 @@ SECP256K1_API int secp256k1_xonly_pubkey_serialize(
6969
* Returns: <0 if the first public key is less than the second
7070
* >0 if the first public key is greater than the second
7171
* 0 if the two public keys are equal
72-
* Args: ctx: a secp256k1 context object.
72+
* Args: ctx: pointer to a context object.
7373
* In: pubkey1: first public key to compare
7474
* pubkey2: second public key to compare
7575
*/

include/secp256k1_preallocated.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ SECP256K1_API size_t secp256k1_context_preallocated_size(
5252
* in the memory. In simpler words, the prealloc pointer (or any pointer derived
5353
* from it) should not be used during the lifetime of the context object.
5454
*
55-
* Returns: a newly created context object.
56-
* In: prealloc: a pointer to a rewritable contiguous block of memory of
55+
* Returns: pointer to newly created context object.
56+
* In: prealloc: pointer to a rewritable contiguous block of memory of
5757
* size at least secp256k1_context_preallocated_size(flags)
5858
* bytes, as detailed above.
5959
* flags: which parts of the context to initialize.
@@ -72,7 +72,7 @@ SECP256K1_API secp256k1_context *secp256k1_context_preallocated_create(
7272
* caller-provided memory.
7373
*
7474
* Returns: the required size of the caller-provided memory block.
75-
* In: ctx: an existing context to copy.
75+
* In: ctx: pointer to a context to copy.
7676
*/
7777
SECP256K1_API size_t secp256k1_context_preallocated_clone_size(
7878
const secp256k1_context *ctx
@@ -91,9 +91,9 @@ SECP256K1_API size_t secp256k1_context_preallocated_clone_size(
9191
* Cloning secp256k1_context_static is not possible, and should not be emulated by
9292
* the caller (e.g., using memcpy). Create a new context instead.
9393
*
94-
* Returns: a newly created context object.
95-
* Args: ctx: an existing context to copy (not secp256k1_context_static).
96-
* In: prealloc: a pointer to a rewritable contiguous block of memory of
94+
* Returns: pointer to a newly created context object.
95+
* Args: ctx: pointer to a context to copy (not secp256k1_context_static).
96+
* In: prealloc: pointer to a rewritable contiguous block of memory of
9797
* size at least secp256k1_context_preallocated_size(flags)
9898
* bytes, as detailed above.
9999
*/
@@ -118,7 +118,7 @@ SECP256K1_API secp256k1_context *secp256k1_context_preallocated_clone(
118118
* preallocated pointer given to secp256k1_context_preallocated_create or
119119
* secp256k1_context_preallocated_clone.
120120
*
121-
* Args: ctx: an existing context to destroy, constructed using
121+
* Args: ctx: pointer to a context to destroy, constructed using
122122
* secp256k1_context_preallocated_create or
123123
* secp256k1_context_preallocated_clone
124124
* (i.e., not secp256k1_context_static).

include/secp256k1_recovery.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ typedef struct {
2828
/** Parse a compact ECDSA signature (64 bytes + recovery id).
2929
*
3030
* Returns: 1 when the signature could be parsed, 0 otherwise
31-
* Args: ctx: a secp256k1 context object
32-
* Out: sig: a pointer to a signature object
33-
* In: input64: a pointer to a 64-byte compact signature
31+
* Args: ctx: pointer to a context object
32+
* Out: sig: pointer to a signature object
33+
* In: input64: pointer to a 64-byte compact signature
3434
* recid: the recovery id (0, 1, 2 or 3)
3535
*/
3636
SECP256K1_API int secp256k1_ecdsa_recoverable_signature_parse_compact(
@@ -43,9 +43,9 @@ SECP256K1_API int secp256k1_ecdsa_recoverable_signature_parse_compact(
4343
/** Convert a recoverable signature into a normal signature.
4444
*
4545
* Returns: 1
46-
* Args: ctx: a secp256k1 context object.
47-
* Out: sig: a pointer to a normal signature.
48-
* In: sigin: a pointer to a recoverable signature.
46+
* Args: ctx: pointer to a context object.
47+
* Out: sig: pointer to a normal signature.
48+
* In: sigin: pointer to a recoverable signature.
4949
*/
5050
SECP256K1_API int secp256k1_ecdsa_recoverable_signature_convert(
5151
const secp256k1_context *ctx,
@@ -56,10 +56,10 @@ SECP256K1_API int secp256k1_ecdsa_recoverable_signature_convert(
5656
/** Serialize an ECDSA signature in compact format (64 bytes + recovery id).
5757
*
5858
* Returns: 1
59-
* Args: ctx: a secp256k1 context object.
60-
* Out: output64: a pointer to a 64-byte array of the compact signature.
61-
* recid: a pointer to an integer to hold the recovery id.
62-
* In: sig: a pointer to an initialized signature object.
59+
* Args: ctx: pointer to a context object.
60+
* Out: output64: pointer to a 64-byte array of the compact signature.
61+
* recid: pointer to an integer to hold the recovery id.
62+
* In: sig: pointer to an initialized signature object.
6363
*/
6464
SECP256K1_API int secp256k1_ecdsa_recoverable_signature_serialize_compact(
6565
const secp256k1_context *ctx,

include/secp256k1_schnorrsig.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,11 @@ SECP256K1_API int secp256k1_schnorrsig_sign_custom(
169169
*
170170
* Returns: 1: correct signature
171171
* 0: incorrect signature
172-
* Args: ctx: a secp256k1 context object.
172+
* Args: ctx: pointer to a context object.
173173
* In: sig64: pointer to the 64-byte signature to verify.
174174
* msg: the message being verified. Can only be NULL if msglen is 0.
175175
* msglen: length of the message
176-
* pubkey: pointer to an x-only public key to verify with (cannot be NULL)
176+
* pubkey: pointer to an x-only public key to verify with
177177
*/
178178
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_schnorrsig_verify(
179179
const secp256k1_context *ctx,

0 commit comments

Comments
 (0)