forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit87688dd
committed
The large one adds support for RSA keys and reorganizes
the pubkey functions a bit. The actual RSA-specific codethere is tiny, most of the patch consists of reorg of thepubkey code, as lots of it was written as elgamal-only.---------------------------------------------------------------------------The SHLIB section was copy-pasted from somewhere and containsseveral unnecessary libs. This cleans it up a bit. -lcrypt we don't use system crypt() -lssl, -lssleay32 no SSL here -lz in win32 section already added on previous line -ldes The chance anybody has it is pretty low. And the chance pgcrypto works with it is even lower.Also trim the win32 section.---------------------------------------------------------------------------It is already disabled in Makefile, remove code too.---------------------------------------------------------------------------I was bit hasty making the random exponent 'k' a prime. Further researhshows that Elgamal encryption has no specific needs in respect to k,any random number is fine.It is bit different for signing, there it needs to be 'relatively prime'to p - 1, that means GCD(k, p-1) == 1, which is also a lot lighter thanfull primality. As we don't do signing, this can be ignored.This brings major speedup to Elgamal encryption.---------------------------------------------------------------------------o pgp_mpi_free: Accept NULLso pgp_mpi_cksum: result should be 16bito Remove function name from error messages - to be similar to other SQL functions, and it does not match anyway the called functiono remove couple junk lines---------------------------------------------------------------------------o Support for RSA encryptiono Big reorg to better separate generic and algorithm-specific code.o Regression tests for RSA.---------------------------------------------------------------------------o Tom stuck a CVS id into file. I doubt the usefulness of it, but if it needs to be in the file then rather at the end. Also tag it as comment for asciidoc.o Mention bytea vs. text differenceo Couple clarifications---------------------------------------------------------------------------There is a choice whether to update it with pgp functions orremove it. I decided to remove it, updating is pointless.I've tried to keep the core of pgcrypto relatively independentfrom main PostgreSQL, to make it easy to use externally if needed,and that is good. Eg. that made development of PGP functions muchnicer.But I have no plans to release it as generic library, so keeping suchdocup-to-date is waste of time. If anyone is interested in using it inother products, he can probably bother to read the source too.Commented source is another thing - I'll try to make another passover code to see if there is anything non-obvious that would needmore comments.---------------------------------------------------------------------------Marko Kreen1 parentabecf1a commit87688dd
File tree
23 files changed
+808
-278
lines changed- contrib/pgcrypto
- expected
- sql
23 files changed
+808
-278
lines changedLines changed: 4 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 |
| - | |
| 2 | + | |
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
| |||
56 | 56 |
| |
57 | 57 |
| |
58 | 58 |
| |
59 |
| - | |
| 59 | + | |
60 | 60 |
| |
61 |
| - | |
62 |
| - | |
63 |
| - | |
64 |
| - | |
65 |
| - | |
| 61 | + | |
| 62 | + | |
66 | 63 |
| |
67 | 64 |
| |
68 | 65 |
| |
69 |
| - | |
70 | 66 |
| |
71 | 67 |
| |
72 | 68 |
| |
|
Lines changed: 30 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 |
| - | |
2 | 1 |
| |
3 | 2 |
| |
4 | 3 |
| |
| |||
278 | 277 |
| |
279 | 278 |
| |
280 | 279 |
| |
281 |
| - | |
| 280 | + | |
282 | 281 |
| |
283 | 282 |
| |
284 | 283 |
| |
| |||
334 | 333 |
| |
335 | 334 |
| |
336 | 335 |
| |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
337 | 340 |
| |
338 | 341 |
| |
339 | 342 |
| |
| |||
362 | 365 |
| |
363 | 366 |
| |
364 | 367 |
| |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
365 | 372 |
| |
366 | 373 |
| |
367 | 374 |
| |
| |||
422 | 429 |
| |
423 | 430 |
| |
424 | 431 |
| |
425 |
| - | |
426 | 432 |
| |
427 | 433 |
| |
428 | 434 |
| |
| |||
492 | 498 |
| |
493 | 499 |
| |
494 | 500 |
| |
495 |
| - | |
| 501 | + | |
496 | 502 |
| |
497 | 503 |
| |
498 | 504 |
| |
| |||
513 | 519 |
| |
514 | 520 |
| |
515 | 521 |
| |
516 |
| - | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
517 | 526 |
| |
518 | 527 |
| |
519 | 528 |
| |
| |||
531 | 540 |
| |
532 | 541 |
| |
533 | 542 |
| |
| 543 | + | |
| 544 | + | |
| 545 | + | |
534 | 546 |
| |
535 | 547 |
| |
536 | 548 |
| |
537 | 549 |
| |
538 | 550 |
| |
539 | 551 |
| |
540 | 552 |
| |
541 |
| - | |
| 553 | + | |
| 554 | + | |
542 | 555 |
| |
543 |
| - | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
544 | 560 |
| |
545 | 561 |
| |
546 | 562 |
| |
| |||
631 | 647 |
| |
632 | 648 |
| |
633 | 649 |
| |
| 650 | + | |
| 651 | + | |
| 652 | + | |
634 | 653 |
| |
635 | 654 |
| |
636 | 655 |
| |
| |||
673 | 692 |
| |
674 | 693 |
| |
675 | 694 |
| |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + |
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
99 | 99 |
| |
100 | 100 |
| |
101 | 101 |
| |
102 |
| - | |
| 102 | + |
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
43 | 43 |
| |
44 | 44 |
| |
45 | 45 |
| |
46 |
| - | |
| 46 | + | |
47 | 47 |
| |
48 | 48 |
| |
49 | 49 |
| |
|
Lines changed: 16 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
21 | 21 |
| |
22 | 22 |
| |
23 | 23 |
| |
24 |
| - | |
| 24 | + | |
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
28 | 28 |
| |
29 | 29 |
| |
30 | 30 |
| |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
31 | 37 |
| |
32 | 38 |
| |
33 | 39 |
| |
| |||
47 | 53 |
| |
48 | 54 |
| |
49 | 55 |
| |
50 |
| - | |
| 56 | + | |
51 | 57 |
| |
52 | 58 |
| |
53 | 59 |
| |
54 | 60 |
| |
55 | 61 |
| |
56 | 62 |
| |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
57 | 69 |
| |
58 | 70 |
| |
59 | 71 |
| |
60 | 72 |
| |
61 | 73 |
| |
62 | 74 |
| |
63 | 75 |
| |
64 |
| - | |
| 76 | + | |
| 77 | + | |
65 | 78 |
|
Lines changed: 118 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
326 | 326 |
| |
327 | 327 |
| |
328 | 328 |
| |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
329 | 420 |
| |
330 | 421 |
| |
331 | 422 |
| |
| |||
393 | 484 |
| |
394 | 485 |
| |
395 | 486 |
| |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
396 | 503 |
| |
397 | 504 |
| |
398 | 505 |
| |
| |||
415 | 522 |
| |
416 | 523 |
| |
417 | 524 |
| |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
418 | 532 |
| |
419 | 533 |
| |
420 | 534 |
| |
421 |
| - | |
| 535 | + | |
422 | 536 |
| |
423 | 537 |
| |
424 | 538 |
| |
425 |
| - | |
| 539 | + | |
426 | 540 |
| |
427 | 541 |
| |
428 | 542 |
| |
429 |
| - | |
| 543 | + | |
430 | 544 |
| |
431 | 545 |
| |
432 | 546 |
| |
433 |
| - | |
| 547 | + | |
434 | 548 |
| |
435 | 549 |
| |
436 | 550 |
| |
|
Lines changed: 12 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
32 | 41 |
| |
33 | 42 |
| |
34 | 43 |
| |
35 | 44 |
| |
36 | 45 |
| |
37 |
| - | |
| 46 | + | |
38 | 47 |
| |
39 | 48 |
| |
40 | 49 |
| |
41 | 50 |
| |
42 | 51 |
| |
43 |
| - | |
| 52 | + | |
44 | 53 |
| |
45 | 54 |
| |
46 | 55 |
| |
| |||
56 | 65 |
| |
57 | 66 |
| |
58 | 67 |
| |
59 |
| - | |
| 68 | + |
0 commit comments
Comments
(0)